Posts

Showing posts from September, 2011

python - How to use a queryset filter with M2M models in django admin-export? -

i need export data in django admin, i'm using django-import-export lib , export fine, problem gets id of attribute instead of name(of course) given models, on operation export, want book atribute book's title instead of id's tied operation class book(models.model): title = models.charfield() value = models.floatfield() class operation(models.model): book = models.manytomanyfield(book, through='bookoperation') sender = models.charfield() date = models.datefield() class bookoperation(models.model): book = models.foreignkey(book) operation = models.foreignkey(operation) quantity = models.integerfield() here operationresource in admin.py class operationresource(resources.modelresource): book = fields.field(column_name='book(s)', widget=manytomanywidget(book)) class meta(object): model = operation exclude = ('id',) def dehydrate_book(self, operation): return operat...

c# - ColorTranslator.FromHtml / ToHtml Equiv in WPF -

after googling, no solution found. upgrading old project of mine wpf (which have 0 experience in , doing learn) can't find equivalent method to: system.drawing.colortranslator.tohtml(color.white) i using store , retrieve colors xml. of know equivalent method in wpf? currently using system.windows.media.color try using system.drawing.color instead, may solve problem: system.drawing.colortranslator.tohtml(system.drawing.color.white);

ios - Size UITextView to contents in Swift -

i have seen , tried few solutions online size text view contents nothing seems working. have auto layout on, scrolling disabled, , here code in viewdidload i'm using try , resize text view dynamically. var frame = abouttext.frame frame.size.height = abouttext.contentsize.height abouttext.frame = frame i have tried abouttext.sizetoft() abouttext.layoutifneeded() edit: tried: let fixedwidth = abouttext.frame.size.width abouttext.sizethatfits(cgsize(width: fixedwidth, height: cgfloat.max)) let newsize = abouttext.sizethatfits(cgsize(width: fixedwidth, height: cgfloat.max)) var newframe = abouttext.frame newframe.size = cgsize(width: max(newsize.width, fixedwidth), height: newsize.height) abouttext.frame = newframe technically, because using auto layout, should able use constraints , compression/stretching priorities set text view size contents. text view's natural behavior. however, if should fail, here code should force size co...

How to fill custom area in mapbox? -

Image
i have following map in mapbox editor: is possible fill custom area of map ? (in example, area selected, can see attributes) how can it? you'll want filter data , polygon styles style layer. for instance, if id can rely on id_0 , then #geo_adm2[id_0 = 81] { polygon-fill:#f00; }

python - BeautifulSoup - Missing tag under tag -

so, want text "h1" tags. i'm using beutifulsoup, , works fine until there no "h1" tag in "article" tag, " 'nonetype' object has no attribute 'contents' error. here code: from bs4 import beautifulsoup page = "<article> <a href="http://something"> </a> (missing "h1") <a href="http://something"> </a> </article> <article> <a href="http://something"> </a> <a href="http://something"> <h1>something</h1> </a> </article> <article> <a href="http://something"> </a> <a href="http://something"> <h1>something</h1> </a> </article>" soup = beautifulsoup(page, "lxml") h1s = [] articles = soup.find_all("article") in range(...

perl - Is there a relationship between the -e file test and exists function? -

reading docs -e file test says: -e file exists is there something, i'm missing relationship between -e , exists function ? the word "exists" there doesn't refer exists() function; it's using word ordinary english meaning. -e operator , exists function unrelated. -e filename tests whether named file exists in file system. the exists function tests whether specified hash or array element exists (even if corresponding value undef ). apparently, thissuitisblacknot points out in comment, online documentation has automatically created links words, including exists . similarly, description of -l operator: -l file symbolic link (false if symlinks aren't supported file system ). has html links link , if , , system , none of directly relevant. given web pages perl documents have links this, might nice if pod had syntax particular word should not linked -- i'm not convinced it's worth effort. links easy enough ignore...

python - Django Link to class based views url -

i created django page can delete blog articles using class based views , want add link each article i'm struggling it. here code link class based view views.py user_delete_article = article.objects.filter(user=request.user) template.html {% article in user_delete_article %} <p><a class="readmore" href="{% url "article.views.deleteview" article.id %}">{{ article.titre }}</a></p> {% endfor %} urls.py url(r'^delete/(?p<id>\d+)/$', deleteview.as_view(), name="deleteview"), how can make work? assuming django 1.8 <a href="{% url "deleteview" id=article.id %}">

python - Getting "ValueError: invalid literal for int" when trying to make a GUI with tKinter -

i have worked on bit , try not seem fix problem. relatively inexperienced nuances of programing language. appreciate tips. from tkinter import * root = tk() lbltitle = label(root, text="adding program") lbltitle.grid(row=0, column=3) lbllabelinput = label(root, text="input first number") lbllabelinput.grid(row=1, column=0) entnum1 = entry(root, text=1) entnum1.grid(row=1, column=1) lbllabelinput2 = label(root, text="input second number") lbllabelinput2.grid(row=1, column=2) entnum2 = entry(root, text=1) entnum2.grid(row=1, column=3) def callback(): ent1 = entnum1.get() ent2 = entnum2.get() if ent1 != 0 , ent2 != 0: result = int(ent1) + int(ent2) lblresult = label(root, text=str(result)) lblresult.grid(row=3) btnadd = button(root, text="add", command=callback()) btnadd.grid(row=2) root = mainloop() here traceback traceback (most recent call last): file ...

sql - MySQL query optimization using coalesce -

can explain me why second query faster first? (first 1 takes around 40 seconds, second 1 less 0.1) select releases.feature_code, releases.platform_id, version, release_date, general_available, uri, filesize, display_name, feature_name.full_name, if ((select exists(select 1 release_exceptions releases.feature_code = release_exceptions.feature_code , releases.platform_id = release_exceptions.platform_id , releases.version = release_exceptions.version) = 1), 1, 0) release_exceptions releases left outer join platform using(platform_id) left outer join feature_name using(feature_code) order version desc; ~~~ query 2 ------------------ ~~~ select feature_code, version, release_date, general_available, platform_id, uri, filesize, display_name, feature_name.full_name, coalesce(release_exceptions, 0) release_exceptions mus.releases left outer join ( select distinct feature_code, version, platform_id, 1 release_exceptions mus.release_exceptions ) release_exceptions using ...

My Cucumber script doesn't seem to be picking up my Ruby script -

i new cucumber , ruby, please forgive me if i'm missing seems simple. i'm able run cucumber script, , gives me following result: feature: guru99 demopage login in order login in demopage have enter login details scenario: register on guru99 demopage without email # test.feature:5 given on guru homepage # test.feature:7 when enter blank details register # test.feature:9 error email shown # test.feature:11 1 scenario (1 undefined) 3 steps (3 undefined) 0m0.040s can implement step definitions undefined steps these snippets: given(/^i on guru homepage$/) pending # write code here turns phrase above concrete actions end when(/^enter blank details register$/) pending # write code here turns phrase above concrete actions end then(/^error email shown$/) pending # write code here turns phrase above concrete actions end this expected. however, when add .rb file contains: require 'watir-web...

debugging - Visual Studio debugger doesn't recognize any usings -

when i'm debugging in visual studio, can no longer evaluate static isn't qualified. hovering on field, watch window, , immediate window broken. i error the name ___ not exist in current context . i can fix if specify full namespace in watch, can't work extensions methods or if want hover on item in code. it's debugger no longer sees of usings in current context. every , work, of time have type full namespace debugger find whatever want evaluate. i hoping vs2015 fix it, doesn't. this due fody. stopped using fody , fixed issue.

javascript - Wanting to add a defining element to a class without changing the class name -

so question may sound strange needing add defining element line of code in css can target element when targeting class well. current code below. needing add class without changing class name "right-button". if wanted code in css code "this.right-button {}", question sis in line of code can insert "this"? hope makes sense.... <div id="scroll"> <a href="mensshoes.php" class="right-button"><img src="images/scrollright.png"/></a> </div> you add id , attach css onto that. <a class="right_button" id="id_name"> #id_name {css_stuff: here;} the other way may use inline tag <a class="right_button" style="{css_stuff:here}"> . edit: adding class others mentioned method too, if you're adding css 1 element, think id method way go.

css - How to change currently active window tab color in atom editor -

i'm using atom editor version 1.0 stable in ubuntu 14.04. question is, how can change background colour of selected window tab... (means current tab..) editing style.less file? i tried, .tab{ background-color:black; } to change tab color, but, code changed tab colors except current tab color. so question is, how can change color of current tab in atom editor editing style.less file? .tab-bar .tab[data-type="texteditor"]::after { background-color: rgba(20,28,30,0.8); } i found solution opening developer tools ctrl + shift + i , , finding element using magnifier tool.

ios - Are there benefits to checking for segue identifiers rather than using failed type casting? -

when implement prepareforsegue:sender: method in uiviewcontroller subclass has multiple segues, 1 idiom in objective-c assign identifier segue in storyboard, , wrap logic in prepareforsegue:sender: in if statement inspects segue identifier . example: if segue.identifier == "destinationa" // prepare destinationa stuff else if segue.identifier == "destinationb" // prepare destinationb stuff ... in swift, we're forced api use type casting when obtaining instance of destination view controller. since can fail gracefully, my question is should go ahead , rely on optional binding conditional type casting ( as? ) or should still rely on if statement? for example, possible, should favor succinctness of relying on type casting: override func prepareforsegue(segue: uistoryboardsegue, sender: anyobject?) { if let destination = segue.destinationviewcontroller as? destinationacontroller { // prepare stuff destination } else if let de...

android - How to doNothing() on void method? -

i have method call void function in it, , when use donothing() , says void method it's not allowed. how donothing() in specific line? i'm using line, when(spycolorselector.initializecolors(view, "red")).then(donothing()); use stubber syntax : donothing().when(spycolorselector).initializecolors(view, "red"); and spycolorselector has mock. edit 1: code example spy. this test works (no exception thrown initializecolors ) junit 4.12 , mockito 1.10.19: public class colorselectortest { @test public void testgetcolors() { // given string color = "red"; view view = mock(view.class); colorselector colorselector = new colorselector(); colorselector spycolorselector = spy(colorselector); donothing().when(spycolorselector).initializecolors(view, color); // when linkedlist<integer> colors = spycolorselector.getcolors(color, view); // ...

javascript - How to Hide HTML list with jQuery and rise the following inputs? -

hi guys html code : <ul id="var_language_short"> <li id="languages_more"><label class="form_present_trigger">more</label></li> </ul> <div id="language_checkbox" class="popup_fullscreen"> <div class="popup_fullscreen_close">close</div> <ul id="var_language_long"> </ul> </div> <div class="form_present_row"> <span class="form_present_title"> <label class="form_present_title_label" for="var_prixplat">prix moyen d'un plat<span class="req" title="required">*</span></label> </span> <div class="form_present_content"> <span class="form_present_update"> <input class="form_present_input var_prixplat" type="text" id="...

The difference between -pedantic-errors and -Werror=pedantic in gcc -

what difference between using -pedantic-errors , -werror=pedantic in gcc? according documentation of gcc there difference: -pedantic-errors give error whenever base standard (see -wpedantic) requires diagnostic, in cases there undefined behavior @ compile-time , in other cases not prevent compilation of programs valid according standard. not equivalent -werror=pedantic, since there errors enabled option , not enabled latter , vice versa. what errors included -pedantic-errors, not -werror=pedantic? what errors included -werror=pedantic, not -pedantic-errors? any example of both types of errors?

javascript - CKFinder 3 adds extra / in path -

Image
i've defined resource types in ckfinder 3. config.php , here end , resource type definitions: $config['backends'][] = [ 'name' => 'default', 'adapter' => 'local', 'baseurl' => '/images', 'root' => '/var/www/mysite/images', 'chmodfiles' => 0640, 'chmodfolders' => 0750, 'filesystemencoding' => 'utf-8' ]; $config['resourcetypes'][] = [ 'name' => 'images', 'maxsize' => "2m", 'url' => '/images', 'allowedextensions' => 'gif,jpeg,jpg,png,pdf', 'backend' => 'default' ]; when use 1 select image in ckeditor (using standard image2 plugin), adds trailing slash after baseurl , before rest of path. browsing , uploading works correctly, , can see internally it's not using slashes on folder or file names, ...

rest - How to get HTTP status on Invoke-WebRequest/Invoke-RestMethod when using -OutFile parameter? -

Image
i have request restful api (note, happens both invoke-webrequest , invoke-restmethod ): $resp1 = invoke-webrequest -outfile $clusterconfigzipfile -uri $apifolder -body $filecontent -method 'post' -credential $admincredentials -contenttype "application/x-www-form-urlencoded" -erroraction silentlycontinue -verbose i know works ok because: it downloads zip file correct. if use fiddler can see response headers (http 200) my problem code returning nothing in $resp1 . have read "feature" when use -outfile . is there anyway capture response or @ least response code powershell? as documented , use -passthru parameter if want response returned in addition being written file. -outfile<string> saves response body in specified output file. enter path , file name. if omit path, default current location. by default, invoke-webrequest returns results pipeline. send results file , pipeline, use passthru parameter. ...

python - What does "~" mean in gdal? -

i'm new in programming , try use gdal library python. execute gdalinfo command, don't know "~" mean in "gdalinfo somedir/somefile.tif" example. explain me? i assume looking @ obtain latitude , longitude geotiff file , line is: dalinfo ~/somedir/somefile.tif here ~ unix style shell expansion , shortcut current user's home directory. nearest equivalent on windows environment variable %homedir% . on unix style systems represented environment variable value $home . the user's home directory current directory ("folder", if must) used when first logon. on unix systems holds files containing user preferences , start-up files, using filenames beginning dot, example .profile . won't see using ls , need ls -a . home directory on windows used, many end-users not aware of it, although software products (particularly portable ones) use it. the ~ means different in programming language, , cannot used part of filename wit...

php - Deploying yii2 in a subdirectory -

i deployed yii2 on subdirectory. encountering problems on redirection. on localhost, worked project not in subdirectory, not having problems. when deployed on our live server , put project in subdirectory, having problems. my problem when visit homepage of site being redirected root of website. here's example: main site: http://example.com/ yii2 site: http://example.com/myproject/ when try go http://example.com/myproject/ , expected redirected @ http://example.com/myproject/login , instead redirected http://example.com/login . i changed .htaccess one rewriteengine on # if directory or file exists, use directly rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d # otherwise forward index.php rewriterule ^(.*) system/index.php/$1 [qsa,l] but think 1 wrong though... i have 1 on web.php $config = [ 'id' => 'basic', 'basepath' => dirname(__file__) . directory_separator . '..', 'defaultroute...

qt - Canvas image not grabbed in QQuickWindow -

i need capture image qml has canvas elements. whereas canvas es displayed fine not correctly saved in picture snapshots. i have used qquickwindow grabwindow method described in solutions of this link , images saved in ui thread called afterrendering signal (i have tried frameswapped signal too). result qml objects saved not canvas objects. both renderstrategy , rendertarget of canvas es set default values. simple canvas es shown below: canvas { id:canvas onpaint:{ var ctx = canvas.getcontext('2d'); ctx.beginpath(); ctx.moveto(20, 0); ctx.beziercurveto(-10, 90, 210, 90, 180, 0); ctx.stroke(); //... } } i have noticed afterrendering signal called multiple times. any suggestion appreciated! :)

security - Safely Sending Credentials to Users -

i need safely send credentials created admin users in secure fashion. currently, creds have been sent users via plain text email (which huge security concern). how can securely send user username , password without needing use email encryption plugin or other software? i'm struggling find solution in literature. seems seek secure access user-defined credentials through website. i appreciate responses receive lead me closer finding , implementing secure credential transfer. thank you you may better answers on information security stackexchange site . but it's typically best avoid having send users password. let them create password when register application. if need create user account them, send them password in encrypted email or on secure im. then, force them change password on first log on. don't want know user's password beside user themselves.

Selenium can't accept alert by google chrome [java] -

this question has answer here: selenium webdriver how close browser popup 9 answers selenium can't accept alert google chrome. driver.get("http://bubble-export.com/lpg2/"); driver.get("http://google.com"); alert alert = driver.switchto().alert(); alert.accept(); firefox , ie works well.buy google chrome dose not work!! how can accept alert google chrome!? (session info: chrome=44.0.2403.89) (driver info: chromedriver=2.9.248307,platform=mac os x 10.9.5 x86_64) build info: version: '2.45.0', revision: '5017cb8', time: '2015-02-27 00:00:10' os.name: 'mac os x', os.arch: 'x86_64', os.version: '10.9.5', java.version: '1.8.0_40' driver info: org.openqa.selenium.chrome.chromedriver instead of accepting alert. can hack.which remove alert appearing ...

javascript - Using Classes Instead of IDs in HTML5 -

in another post , advised not use ids, intead use classes in html forms buttons. i'm new html5 , javascript, how use button class, , assign event handler button? possible solution: <!doctype html> <html> <head> <title>html button tag</title> </head> <body> <form> <button name="button" value="ok" type="button">click me</button> </form> </body> </html> i use document.getelementbyname() , assign button handler, correct? seriously, saying that: ids considered bad practice quite time in html, preferred method classes ...are plain wrong! id's , classes have separate usage areas, in cases overlap. automated testing, , css, id's extremely useful. never afraid use them! as answer question, there several options. either find element in javascript, , assign button handler, or add onclick-function, , assign directly in button tag, this: <button...

sql - SSIS: How to check if a record DOESN'T exist in flat file but exists on the database -

Image
i working on preparing ssis job importing .cvsv file ole db destination (sql database). going these files on daily basis. .csv file contains records of doctors. each row represents doctor. below image shows how able successfully. no problems upto point. here's need with: if doctor no longer active going same .csv file without record of him/her. how check see if record not in .csv file exists in sql database? need update doctor row in sql database , update isactive field row false . naturally, psuedo-code. select doctorid drtable not exists (select doctorid csvtable csvtable.doctorid=drtable)) you update in same statement using: update drtable set isactive = 0 doctorid in ( select doctorid drtable not exists (select doctorid csvtable csvtable.doctorid=drtable)))

c# - INNER JOIN Syntax -

hows inner join syntax work? i'm new sql , dont understand how inner join works querystring = @"select * wgcdoccab serie ='1' , tipodoc ='fss' , contribuinte ='999999990' , numdoc = inner join wgcnumeradores on wgcdoccab.numdoc = wgcnumerador.numero"; can tell me whats wrong, im sure syntax, im using c# visual studio 2013 , mysql inner join used when pulling related data out of more 1 table. pointed out above, inner join comes before clause. try this: querystring = @"select * wgcdoccab inner join wgcnumeradores on wgcdoccab.numdoc = wgcnumerador.numero serie ='1' , tipodoc ='fss' , contribuinte ='999999990'"; here explanation inner join: https://technet.microsoft.com/en-us/library/ms190014(v=sql.105).aspx

java - How do I autmatically set a JAX-WS HTTP header that varies on each request -

i want set dynamically generated http header on each soap jax-ws request. if wanted set same http header on each jax-ws request use technique here , i.e. public class myapplicationclass { // inject instance of service's port-type. @webserviceref(echoservice.class) private echoporttype port; // method invoke web service operation , send transport headers on request. public void invokeservice() { // set map contain request headers. map<string, object> requestheaders = new hashmap<string, object>(); requestheaders.put(“myheader1”, “this string value”); requestheaders.put(“myheader2”, new integer(33)); requestheaders.put(“myheader3”, new boolean(true)); // set map property on requestcontext. bindingprovider bp = (bindingprovider) port; bp.getrequestcontext().put(com.ibm.websphere.webservices.constants.request_transport_properties, requestheaders); // invoke web services...

c# - SQL Server CE records gone when app is forced close or restarted device while app is open -

i have odd problem records using sql server ce in wpf application. far have been successful in storing records on database. have set of settings access when opening application. i'm using linqpad in order view database records. here's how save database records. using (var dbc = new mydbcontext()) { var settings = new usersetting(); settings.userid = appuser.user.id; settings.minimizekey = minimizekey; settings.startstopkey = startstopkey; settings.isstartatstartup = isstartatstartup ?? false; settings.isstorestate = isstorestate ?? false; dbc.usersettings.add(settings); dbc.savechanges(); } after saving, view settings table , can see records there. problem is, when restart device while application open. record seems gone. on other hand, when close application before restarting, records still there. restarting device while app still open not practice, happen once in while , want records still there. any ideas? thanks! by defau...

actionscript 3 - Flash/AS3 - Saving a File without Prompt -

i need save file in flash without prompt; program gets frames stage , saves them png files, along text file has name of object, , other properties it. code have save without problems, need not prompt me, because have lots of frames with. is there way flash program or actionscript? no, unless you're using adobe air. reason flash player , programs run through browser on internet, , if people use flash player start saving files on other people's computers, there serious security issues. air, on other hand, run on desktop, laptop, or mobile device, , its programs run directly off same , having been pre-installed. whereas website can start running script flash player without asking first, air requires have installed script/program on computer, meaning should there intentionally. security restrictions lighter, enabling use of file class in programs.

java - Getting unrecognized characters from inputStream -

Image
i reading data weigh bridge using java comm api . below code: import java.io.*; import java.util.*; import javax.comm.*; public class parrot implements runnable, serialporteventlistener { static commportidentifier portid; static enumeration portlist; inputstream inputstream; serialport serialport; thread readthread; public static void main(string[] args) { portlist = commportidentifier.getportidentifiers(); while (portlist.hasmoreelements()) { portid = (commportidentifier) portlist.nextelement(); if (portid.getporttype() == commportidentifier.port_serial) { if (portid.getname().equals("com1")) { parrot reader = new parrot(); } } } } public parrot() { try { serialport = (serialport) portid.open("simplereadapp", 2000); } catch (portinuseexception e) {system.out.println(e);} try { ...

html - How to center a navigation bar properly? -

Image
i understand, lots of people have asked question on how center navigation bar when apply css, centers aligns nav bar bit right: nav { text-align: center; } nav li { display: inline-block; } could due list items having different lengths or think different problem? your <ul> has padding-left , default. check in developer tools. nav { background: #999; text-align: center; } nav li { background: #ccc; display: inline-block; } <nav> <ul> <li>menu 1</li> <li>menu 2</li> <li>menu 3</li> </ul> </nav> just apply padding-left:0; on appropriate <ul> fix this.

java - Code for Simple Arithmetic -

i new programming, first year college of bsit , tasked code simplearithmetic ask name first , after asked enter first , second integer. after giving asked must show "hello (the name entered)" follows next sum, difference, product , mod of 2 integers , lastly show "thank you!". i tried lot of codes not run, can me? appreciate because want learn how happen. this code public class simplearithmetic{ public static void main(string[] args){ //1: declare name symbol //2: num 1, num 2, sum, difference, product, mod 0; system.out.print("enter name: "); name = in.next(); // <---- here system.out.printf("\nenter first integer: "); system.out.printf("\nenter second integer: "); system.out.printf("\nnum 1 + num 2"); system.out.printf("\nnum 1 - num 2"); system.out.printf("\nnum 1 * num 2"); system.out.printf("\nnum 1 % num 2"); system.out.pri...

Strange VB.NET Winforms combobox behavior -

vb.net solution in visual studio 2012 i have combobox databindings database table. let's call manufacturer table. table has 2 values: id, name my combobox fills correctly, displaymember set name, , valuemember set id. returns correct valuemember when selected. works expected. here's strange part... when select values in combobox, changes display values inside combobox. example: initial values: manuf a manuf b manuf c manuf d manuf e after selecting manuf c , clicking on combobox down arrow again, combobox displays: manuf c manuf b manuf c manuf d manuf e now i'll click manuf e, , combobox displays: manuf c manuf b manuf e manuf d manuf e can tell me why it's doing , can stop rearranging , overwriting display values? make sure datasource or bindingsource of combobox not related same source data trying save. have products bindingsource has foreign key manufacturers. data want save products->manufacturers. combo bo...

java - Hibernate session.get() is always returning null -

@entity @table(name = "t019_staff_profile") public class userdetails implements serializable { private static final long serialversionuid = -723583058586873479l; @id @column(name = "staff_id", columndefinition="char(8)") private string loginid; @column(name = "password", columndefinition="char(8)") private string password; @column(name = "first_nam") private string firstname; @column(name = "last_nam") private string lastname; @column(name = "bus_og_cd" , columndefinition="char(3)") private string profile; public userdetails getlogindetails(string loginid) { userdetails object =(userdetails)sessionfactory.getcurrentsession().get(userdetails.class, loginid); return object; } check database see if value exists in database. select * t0...

Windows 10 Bluetooth Advertisement API -

is possible use advertisementpublisher send major , minor id when acting beacon, , possible use advertisementwatcher send , receive id? cheers yes, send: var manufacturerdata = new bluetoothlemanufacturerdata(); manufacturerdata.companyid = 0x004c; byte[] dataarray = new byte[] { // last 2 bytes of apple's ibeacon 0x02, 0x15, // proximity uuid 0x44, 0x50, 0x3f, 0x1b, 0xc0, 0x9c, 0x4a, 0xee, 0x97, 0x2f, 0x75, 0x0e, 0x9d, 0x34, 0x67, 0x84, // major 0x00, 0x01, // minor 0x00, 0x10, // tx power 0xc5 }; // using system.runtime.interopservices.windowsruntime; manufacturerdata.data = dataarray.asbuffer(); bluetoothleadvertisementpublisher publisher = new bluetoothleadvertisementpublisher(); publisher.advertisement.manufacturerdata.add(manufacturerdata); publisher.start(); to receive, go this question .

endianness - is there such a thing as big/little endian for bits? -

we know endianness bytes, there such thing endiannes bits? i got conversation colleague @ work , said there no such thing. said not endianness, bit ordering. during college years, distinctly remember of professors referring bit ordering big/little endianness. so here question: is there such thing endiannes bits? any appreciated. here little-endian bit: 1 could please convert big-endian bit? either question doesn't make sense @ all, or has vacuous answer: big-endian version of 1 1. question of definition whether or not nonsensical or pointless. endianness isn't useful notion individual bits.

php - recaptcha integration with separate pages -

i trying add captcha website , trying thank open in different page instead of using php within same file, how go doing this? i understand section of php surrounding form don't know how change send separate thank page. edit - if add action page captcha breaks form submits , when take action out captcha works not submit <!doctype html> <?php // grab recaptcha library require_once "recaptchalib.php"; // secret key $secret = "my secret key"; // empty response $response = null; // check secret key $recaptcha = new recaptcha($secret); // if submitted check response if ($_post["g-recaptcha-response"]) { $response = $recaptcha->verifyresponse( $_server["remote_addr"], $_post["g-recaptcha-response"] ); } ?> <html lang="en"> <head> <!--js--> <script src='https://www.google.com/recaptcha/api.js'></script> <title>mata captcha test<...

asp.net mvc - In KendoUI Grid - make grid using C# viewModel -

my scenario , i've controller passing viewmodel object view . for 1 model can return json array controller . multiple objects case viewmodel , thing each list (in viewmodel object) need make seperate grid . appreciated . i have done before - in javascript, can generate kendo datasource object in viewmodel: var yourdatasource = new kendo.data.datasource({ data: @html.raw(json.encode(model.someobject)) }); yourdatasource.read(); more not though, wire service loading of data can asynchronous, etc...

ios - How to get call information in my app? -

is there possibility call information in app ? a simple scenario : i received call open app how can call information in may app (phone number, name) ? no, not possible call information. private api.

PhpStorm 8 - can't enable emmet feature -

in phpstorm, i'm trying emmet feature work. i went through google , found link: https://www.jetbrains.com/phpstorm/help/enabling-emmet-support.html here, tell me enable feature in settings , use keystrokes "tab" or "space" or "enter" i've found enabled , i've tried options, it's not working. how solved? in phpstorm preferences have emmet section. there can check enable xml/html emmet. afterwards, can type emmet syntax : div.text , press tab. : <div class="text"></div> . regards, adrian see link screenshot

windows - Close cmd without interrupting python script -

i have python script needs run cmd, should stay running once cmd window has been closed. i've tried various combinations of start , call i've hit mental blank (and google isn't helping @ all). here's have: @echo off start /b python server.py start python client-sendmessage.py exit server.py singleton, , should continue running after exit reached. client-sendmessage.py should halt script until returns.

java - AfterAll global hook cucumber-jvm -

i'm using cucumber-jvm in integration tests , need execute code after scenarios finished, once. after reading posts this , reviewed reported issue , i've accomplished doing this: public class contextsteps { private static boolean initialized = false; @cucumber.api.java.before public void setup() throws exception { if (!initialized) { // init context. run once before first scenario starts runtime.getruntime().addshutdownhook(new thread() { @override public void run() { // end context. run once after scenarios finished } }); initialized = true; } } } i think context initialization (equivalent beforeall ) done in way fine. however, although it's working, i'm not sure @ if afterall simulation using runtime.getruntime().addshutdownhook() practice. so, these questions: should avoid runtime.getruntime().addshutdownhook() implement afterall ? ar...

php - cannot get column value from a query -

i want set value of text input value of column database : <input name="clt_cin_pass" id="clt_cin_pass" type="text" maxlength="25" placeholder="cin/passeport" value="{{data.clt_cin_pass}}"/> the data variable gotten controller : <?php use phalcon\mvc\controller; class referentielclientcontroller extends controller { ... public function modifierclientaction($id){ $this->view->titre = 'modification de client'; $critere = array(); $critere["clt_id"] = $id; $enreg = client::listerclient($critere); $this->view->data = $enreg; return $this->view->pick("client/client"); } ... } ?> the model client : <?php use phalcon\mvc\model; use phalcon\mvc\model\query; class client extends model { function listerclient($critere) { // instantiate query $ssql = " s...

floating point - DecimalFormat weird behavior with pattern #####0.00 in Java -

i using below code snap display float price value 2 decimal points. numberformat format = new decimalformat("#####0.00"); float myfloatvalue =\\i able fetch value dynamically string finalprice = format.format(myfloatvalue); // using string (finalprice) export xml purpose. it seems working fine normally, have noticed examples(given below) not working , produce price more 2 decimal points. not able replicate again, can see in log files. some examples output of finalprice string : 0.10999966 , 0.1800003 , 0.45999908 . can me guess original value of myfloatvalue these outputs? me replicate scenario , fix it. the sporadic occurrence makes me wonder whether decimal_format used in several threads concurrently. no-no. 1 expect wrong values too. maybe order specify fixed locale (decimal point vs. comma, thousand separators). and float or double not suited financial software: numbers approximations. bigdecimal price = new bigdecimal("9.99");...

Start ipython cluster using ssh on windows machine -

i have problem setting ipython cluster on windows server , connecting ipcluster using ssh connection. tried following tutorial on https://ipython.org/ipython/doc/dev/parallel/parallel_process.html#ssh , have problems understand options mean , parameters use exactly... could total noob set ipcluster? (let's remote machine has ip 192.168.0.1 , local machine has 192.168.0.2 ) if scroll middle of page https://ipython.org/ipython-doc/dev/parallel/parallel_process.html#ssh find this: current limitations of ssh mode of ipcluster are: untested , unsupported on windows. require working ssh on windows. also, using shell scripts setup , execute commands on remote hosts. that means, there no easy way build ipcluster ssh connection on windows (if works @ all).

xml - How to join to predicates together to get an attribute from the parent element based on two attributes and values from child -

i need "date of birth" node value when attribute "benefit type id" equal "ben13" and attribute "dependant of benefit" equal "y". xml <component> <attributes name="flexdependants"> <attribute name="datainstance">11</attribute> <attribute name="rownumber">1</attribute> <attribute name="date of birth">nov 11 1978</attribute> <component name="allocation"> <attributes name="allocation"> <attribute name="datainstance">24</attribute> <attribute name="benefit type id">ben13</attribute> <attribute name="dependant of benefit">y</attribute> </attributes> </component> </attributes> <attributes name="flexdependants"> <attribute name="datainst...

html - Image makes fix sized div larger -

Image
i trying put image website. image in div hast got fixed size. problem image stretches whole div when use auto height in css. the image fits div setting height , width 100%: now keep image unstretched. set width 100% , height auto described here after setting image in layer under section below layers on next part of page. here html code used: <div class="section4"> <section class="half"> <div class="officepiccontainer"> <img src="officepic.jpg" alt="new office of mego" class="officepic"> </div> </section> <section class="half"> </section> </div> and css code: .half { height: 50%; position: relative; } .half:first-child { } .half:last-child { background: #950049; } .officepic { height: auto; width: 100%; } how can resi...

OpenGL cube map texture doesn't work -

Image
i have problem getting cube maps work in opengl. followed tutorials , created own class wrapping opengl cube map texture. start i'm trying load 6 images cube map sides , render them onto pot model. want create mirror-like effect i'm using normal cube map texture coordinate. problem sampler in fragment shader seems returning zeroes whole model black. my findings far: texture data should uploaded gpu - checked uploading ( glteximage2d ) , retrieving data ( glgetteximage2d ). i checked glgeterror() , returns no error, though when set gltexparameteri(gl_texture_2d, gl_texture_mag_filter, gl_linear_mipmap_linear); or gltexparameteri(gl_texture_2d, gl_texture_min_filter, gl_linear_mipmap_linear); cubemap textures, invalid operation error inside rendering loop when try render mirror (the pot) - strange. normals of pot should ok, have checked them rendering them (see images below). the ppm image i'm loading 512 x 512, works 2d textures, there shouldn't problem. ...

Excel dynamic link within Sheet -

i have 2 columns , b. column b data supposedly refer column data (column data unique ). i need create hyperlink in column b in way if clicked should highlight value in column a. i can manually (right click --> hyperlink , etc). but there efficient way create hyperlink in if click on column b data takes me data in column a? a b 1 2 2 5 3 4 4 5 5 2 .... example : click on b value 5 , highlights value 5 in column a? i recommend use standard keyboard shortcut ctrl + [. takes spot formula comes (it references first cell used in formula). see formula ends (on same page), use ctrl + ]. avoid using mouseclicks things this; moving use keyboard as possible make more efficient in long run. also - can change excel settings under excel > options > advanced , uncheck 'allow editing directly in cells'; make clicking on cell take there, instead of opening edit window (which can instead access pressing f2, or clicking formula bar).

angularjs - this reference in callback with controllerAs-Syntax -

i'm working on angularjs project , i'm trying implement close possible angularjs 2. in angularjs 2 there no more ng-controller , $scope, i'm using directives instead of ng-controller. i'm trying avoid use of $scope using controlleras-syntax. my directives this: angular.module('myapp').directive('mydirective', function() { return { controller: function() { this.data = '123'; }, controlleras: 'ctrl', template: ' <p>{{ctrl.data}}</p> ' }; }); so far works fine. problems start when i'm trying call methode or property on controller within callback-function. in case 'this' not referencing actual controller-instance more. example: angular.module('myapp').directive('mydirective', function($http) { return { controller: function() { this.data = ''; this.loaddata = function(){ ...

Parsing returned Json with native swift -

when hitting api blob of json back, example below { “item1” : 1234, “item2” : 4567, “item3” : “78910”, “item4” : “1234” } there not structure it, want know how parse through in swift, here bottom of code grabbing (skipped on url , request stuff) let jsonobject: anyobject? = nsjsonserialization.jsonobjectwithdata(data, options: nil, error: nil) if (jsonobject != nil) { // process jsonresult println("\(jsonobject)"); } else { // couldn't load json, @ error } the json prints console fine in format above, wandering how can parse on , extract each item the whole swift json thing looks bit of mess @ moment a more neat way it, this: let json = "{\"item1\" : 1234, \"item2\" : 4567, \"item3\" : 78910, \"item4\" : 1234}" // simulated string response ... let data = json.datausingencoding(nsutf8stringencoding, all...

javascript - AngularJS - Page redirecting to some other page in angular js while trying to get parameter from url -

here's controller code .when('/showprofile/:userid', { templateurl: 'resources/views/layout/showprofile.php', controller: 'showordercontroller', }) i passing parameter url. i trying access page url directly this http://192.168.1.58/myapp/#/showprofile/8 but redirecting me http://192.168.1.58/myapp/#/showprofile/:userid how can url value in view ? here app.js , here authctrl.js try in controller, return object based on url value can respected value this //it return object console.log($routeparams); //get specific url value console.log($routeparams.userid); or console.log($route.current.params.userid);

elixir - How to render raw HTML code in Phoenix Framework? -

i'm storing raw html contenteditable tag in rethinkdb database. want display content after retrieving it. html.eex <div id="contenteditabletext"> <%= %{"contenttext" => contenttext} <- @contenttext.data %> <div><%= "#{contenttext}" %></div> <% end %> </div> i can sucessfully retrieve it, it's displaying raw html itself. the phoenix_html library provides raw/1 function case. phoenix_html included default should need do: <div id="contenteditabletext"> <%= %{"contenttext" => contenttext} <- @contenttext.data %> <div><%= raw(contenttext) %></div> <% end %> </div>

html - CSS-Bug in Bootstrap-Template -

Image
on following template css bug. if u resize browser, see template has horizontal scrollbar. not nice responsive design. on iphone6 (not landscape) have same effect. can see background-image on right side. tryed lot nothing helps. has idea fix it? template here the causes of issue extended headline sectionalize. , col-* classes. use below code reduce font-size @ lower screen size. @media (max-width: 480px) { .v-center { font-size: 40px; } } remove col-* classes above .container