Posts

Showing posts from January, 2011

apache spark - Does the scala ! subprocess command waits for the subprocess to finish? -

so, have following kind of code running in each map tasks on spark. @volatile var res = (someprogram + filename) ! var cmdres = ("rm " + filename) !; the filenames each map tasks unique. basic idea once first command finishes, second command deletes file. however, notice program complain file not exist. seems subprocess call not synchronous, is, not wait subprocess complete. correct. , if indeed case, how can correct that? as can see in docs , ! method blocks until exit. docs it: starts process represented builder, blocks until exits, , returns exit code. it's possible should checking exit code interpret result , deal exceptional cases. when creating process commands concatenation, better off using seq extensions (as opposed string ones) create processbuilder . docs include helper, might you: // uses ! exit code def fileexists(name: string) = seq("test", "-f", name).! == 0

ruby on rails - double nested form with devise and geocoder not showing -

i using complex nested form. have 3 models location class location < activerecord::base has_many :events has_many :profiles geocoded_by :address end profile class profile < activerecord::base belongs_to :user accepts_nested_attributes_for :user belongs_to :location accepts_nested_attributes_for :location end user (devise) class user < activerecord::base has_one :profile, dependent: :destroy accepts_nested_attributes_for :profile end in user/new view = form_for @user, validate: true, url: user_registration_path, html: { class: 'new-user form-default' } |f| = f.fields_for :profile |p| = p.fields_for :location |build| = build.text_field :address, :input_html =>{:id => 'geo-input-address', :value => current_user.city.name} my problem address field not visible, why wouldn't rendering? when creating new user, user not yet have profile or location. fields_for iterate on existing items. eithe...

winapi - Change border color of Rectangle function in c++ -

how can change border color of rectangle function in c++/masm32? you can try this, just giving example can change according requirement. bool crectangledlg::onerasebkgnd(cdc* pdc) { cbrush brushblue(rgb(0, 0, 255));// inner color blue. cbrush* poldbrush = pdc->selectobject(&brushblue); // create , select thick, black pen cpen penblack; penblack.createpen(ps_solid, 3, rgb(255, 0, 0));// red color width 3 cpen* poldpen = pdc->selectobject(&penblack); // our client rectangle crect rect; getclientrect(rect);// pass rect coordinates here // shrink our rect 20 pixels in each direction rect.deflaterect(20, 20); // draw thick black rectangle filled blue pdc->rectangle(rect); // put old objects pdc->selectobject(poldbrush); pdc->selectobject(poldpen); return true;//cdialog::onerasebkgnd(pdc); }

c++ - Why is there a memory leak when an exception is thrown from a constructor? -

i read book c++ how program 8th edition paul deitel . there statement @ p.645: when exception thrown constructor object that's created in new expression, dynamically allocated memory object released. to verify statement, wrote code follows: #include <iostream> #include <exception> #include <memory> class a{ public: a(){std::cout << "a coming." << std::endl;} ~a(){std::cout << "a leaving." << std::endl;} }; class b { public: b() { std::cout << "b coming." << std::endl; b; throw 3; } ~b(){std::cout << "b leaving." << std::endl;} }; int main(void) { try { std::shared_ptr<b> pi(new b); } catch(...) { std::cout << "exception handled!" << std::endl; } } the output is: b coming. coming. leaving. exception handled! this shows b's destructor isn't invoked, seems confl...

winforms - Form close event in visual studio c# -

i had problem application closing in c#. when hit close button display twice or more times message box. should do? private void home_formclosed(object sender, formclosedeventargs e) { dialogresult dialog = messagebox.show("are sure want exit ? ", "exit", messageboxbuttons.yesno, messageboxicon.question); if (dialog == dialogresult.yes) { system.windows.forms.application.exit(); } else if (dialog == dialogresult.no) { this.show(); } } you should use form.formclosing event instead of formclosed event. in arguments, find field e.cancel . setting false, keep form open

performance - Meteor: How can I show questions only asked by users with the field 'active' -

i building quora of sorts.. , trying clean website. if user deletes profile, question remains there , display no user. trying link users. what did added field on users db changes 'active 'inactive'(there no deletion). so question how can query mongo can show questions users have 'active' tag on users db. i have no idea how cross database query. right way , if how possible? thanks! you have couple of options, easiest mark questions inactive author becomes inactive. here's example deleteuser method: meteor.methods({ deleteuser: function() { // mark user inactive meteor.users.update(this.userid, {$set: {isinactive: true}}); // mark user's questions inactive questions.update( {author: this.userid}, {$set: {isinactive: true}}, {multi: true} ); } }); because data inactive authors has been propagated questions collection, publish function this: meteor.publish('activequestions', function...

java - What is priority of parameters passed to maven plugin? -

i see parameter can configured in pom.xml or passed in cli such -dxxxxx=... my question if same parameter both configured in file pom.xml , passed in cli, used maven plugin? there document priority? mostly believe cli override, real case shows opposite. <plugin> <groupid>de.saumya.mojo</groupid> <artifactid>rspec-maven-plugin</artifactid> <version>1.0.0-beta</version> <configuration> <launchdirectory>${project.build.directory}/test-classes</launchdirectory> <summaryreport>${project.build.directory}/test-ruby.xml</summaryreport> <specsourcedirectory>./new_test</specsourcedirectory> </configuration> <executions> <execution> <goals> <goal>test</goal> </goals> </execution> </executions> </plugin> when ran mvn test -dspecsource...

css - Align text centered at bottom of webpage -

footer { position: absolute; bottom: 8px; text-align: center; } i want footer centered @ bottom of webpage position seems override text-align. the footer element block element. block elements take entire width of container it's in. however, when block element set position: absolute or position: fixed , it'll shrink down small can get. default, it's aligned left of page. just add style footer : left: 0; right: 0;

Next element of array every iteration chat messages display php -

Image
i want display messages in chatbox code displays first row database. hope polish names of variables arent problem. greets. chatbox: phpmyadmin rows: <?php //connecting database $connect = @mysqli_connect("localhost","root","","chat") or die ('nie udalo sie polaczyc bazy danych'); //fetch messages $zapytanie = mysqli_query($connect, "select * wiadomosci"); $wynik_zapytania = mysqli_fetch_array($zapytanie); ; foreach ($zapytanie $key) { $nazwa = $wynik_zapytania['nazwa']; $tresc = $wynik_zapytania['tresc']; $godzina = $wynik_zapytania['godzina']; echo(" <li> <div class='chat-body clearfix'> <div class='header'> <small class='text-muted'><span class='glyphicon glyphicon-time'></span>".$godzina."</small> <...

loops - R - Remove columns with 0 values in df with 1 or more remaining columns -

i writing piece of r code looping through dataframe , running time series predictions subsetted dataframe. however, manner in created loop gives me number of columns 0 values. there single column non 0 values or many columns non 0 values, there minimum of 1 column non 0 values. each iteration through loop yield different number of non-zero columns. please see following discussions regarding topic. remove columns 0 values dataframe delete columns 0 matrix how following code work? provide 2 examples captures crux of issue. first example works great , need adapt work. dat <- data.frame(x = rep(0, 10), y = rnorm(10), z = rep(0, 10), = rnorm(10)) dat <- dat[, colsums(dat) > 0] the second example fails because there single column of non 0 values. dat2 <- data.frame(x = rep(0, 10), y = rep(0, 10), z = rep(0, 10), = rnorm(10)) dat2 <- dat2[, colsums(dat2) > 0] any insights appreciated. help. try either drop=false default drop=true or remove , ...

c# - Simple client server to send XML information to CRUD database -

i need develop resident app info win32_baseboard class when required app xml without create file , app must insert or update information on database. i saw few apps have create file , don't know if exists that. the code below create memory stream data instead of writing file. ///old code //xmlserializer serializer = new xmlserializer(typeof(appconfig)); //streamwriter writer = new streamwriter(filename); //serializer.serialize(writer, config); //new code string input = "your xml here"; string output = ""; xmlserializer serializer = new xmlserializer(typeof(appconfig)); memorystream mstream = new memorystream(encoding.utf8.getbytes(input)); streamwriter writer = new streamwriter(mstream); serializer.serialize(writer, config); ​

r - Error reading csv files from an URL in Markdown -

i trying download data bank of england website charts. use read.csv in script below , works fine when run in r console. require(xts) require(performanceanalytics) url <- "http://www.bankofengland.co.uk/boeapps/iadb/fromshowcolumns.asp?csv.x=yes&datefrom=01/jan/1975&dateto=now &seriescodes=xudlusg,xudlerg&csvf=tn&usingcodes=y&vpd=y&vfd=n" datamat <- read.csv(url) datamat <- na.omit(datamat) rownames(datamat) <- as.date(datamat$date,format = "%d %b %y") datamat <- datamat[,2:3] datamat <- na.omit(as.xts(datamat)) chart.timeseries(datamat,main="") however when trying generate report using markdown following error: error in file(file, "rt") : cannot open connection calls: ... withvisible -> eval -> eval -> read.csv -> read.table -> file execution halted the code use same above aside markdown ```{r getboedata } require(xts) require(performanceanalytics) url ...

django - Convert a flat model into a structured one -

basically, want able convert like { "name": "", "street_address": "", "city": "" } into this { "name": "", "address" : { "street_address": "", "city": "" } } while still retaining model this class modela(models.model): name = models.charfield() street_address = models.charfield() city = models.charfield() any ideas? override to_representation() method alter serialization. class modelaserializer(serializers.modelserializer): class meta: model = modela fields = ('name', 'street_address', 'city') def to_representation(self, instance): x = super(modelaserializer, self).to_representation(instance) desired_response = {} desired_response['name'] = x['name'] desired_response['address...

java - Simple RMI application with client-side exception -

i use java 8 , created simple rmi application have client-side exception don't understand. using eclipse structure of application is: ---rmi_project -----bin -------client ----------implementazionemyclassserver_stub.class ----------interfacciamyclassserver.class ----------mainclient.class -------server ----------implementazionemyclassserver.class ----------interfacciamyclassserver.class ----------implementazionemyclassserver_stub.class ----------implementazionemyclassserver_skel.class ----------mainserver.class -----src -------client ----------interfacciamyclassserver.java ----------mainclient.java -------server ----------implementazionemyclassserver.java ----------interfacciamyclassserver.java ----------mainserver.java here's code: interfacciamyclassserver.java package client; import java.rmi.*; // necessaria per estendere interfaccia remote public interface interfacciamyclassserver extends remote { int somma(int a, int b) throws remoteexception; //...

c# - how use data like that to send request from windows phone -

how use data send request windows phone http://rawafedtech.info/tafsir/stable-api/current/web/app_dev.php/dummy/login { "collectionid":"7cf8b655-b8e7-cf6b-94d8-3de0ff33aaef","id":"4ff2b7f2-4bfa-3407-59e9-666e3000bc2e", "name":"login","description":"", "url":" http://rawafedtech.info/tafsir/stable-api/current/web/app_dev.php/dummy/login ","method":"post","headers":"content-type: application/json\n", "data":"{\"username\" : \"m.nasser\", \"password\" : \"123456\"}" ,"datamode":"raw","timestamp":0,"version":2,"time":1433237635939 }

android - How can set TextInputLayout hintTextAppearance dynamically? -

i want create new textinputlayout dynamically must set hinttextappearance work correctly. how can set hinttextappearance dynamically? thanks hinttextappearance same set text appearance of edittext.

database - Android listview item filter issue -

i have listview work fine. have put edittext @ top of listview . want when enters letter "a", names starting "a" should appear in list . have try nothing happen please check code , tell me doing wrong. this code of data list. public class datalistactivity extends activity { listview listview; sqlitedatabase sqlitedatabase; fooddbhelper fooddbhelper; cursor cursor; listdataadapter listdataadapter; private button button1; listdataadapter dataadapter = null; button button; dataprovider dataprovider; arraylist<hashmap<string, string>> namesslist; edittext inputsearch; string search_name; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); requestwindowfeature(window.feature_no_title); setcontentview(r.layout.data_list_layout); button1 = (button) findviewbyid(r.id.button1); button1.setonclicklistener(new ...

c# - Using 32-bit library from 64-bit application with perl or neko -

i know, question, want know little bit more on subject. we have application, written in c#, compiled x64. must compiled x64, because requirment of our customer. recently, discovered have old delphi code( sighs ) helpful module, must test( double sighs ). stupid reason, must not compile module else delphi 7. i'm stuck x32 .dll of module , x64 application use it. i've discovered workaround ipc communications, i'm familiar perl , discovered neko . far know perl used glue code , neko used sharing runtime between different languages. maybe there workaround using perl, neko or else? also, if can provide example code of sharing runtime between 2 languages in neko, i'll ver grateful. thank you! neither perl nor neko going consume 32 bit library in 64 bit process. try use either perl or neko injecting more layers in between 2 modules. you need use ipc of 1 form or another. there many ways that. create 32 bit c# host process 32 bit library, , communicate b...

python - Strange behavior of psutil -

i'm using library psutil python 2.7. consider small program : import os import psutil # return memory usage in mb process = psutil.process(os.getpid()) print process.memory_info().rss / float(2 ** 20) the memory informations returned program different. can't understand how application, doing time same stuff (here, pretty nothing) cannot have same memory footprint @ each execution. example (each line different execution) : 10.37109375 10.37109375 10.359375 10.41015625 10.4140625 10.30078125 am missing here ? measuring memory occupation taking picture of in movement. ps utils not see same size of script+variables, of parts not visible. classes instantiated , destroyed. variables allocated, freed again. as documentation says, 'garbage' collector common dynamically typed languages such python, runs @ times not synchronous measuring interval, see variations. worrysome if memory footprint increasing continually - in case we'd have memo...

google app engine - IntelliJ Idea lost AppEngine integration over git -

i got repository appengine application made in intellij. when colleague clone repo work on it, project lost every reference appengine (although has on computer) , must add each library manually. is there way avoid that? this .gitignore, generated witgh gitignore.io ### appengine ### # google app engine generated folder appengine-generated/ ### intellij ### # covers jetbrains ides: intellij, rubymine, phpstorm, appcode, pycharm *.iml ## directory-based project format: .idea/ # if remove above rule, @ least ignore following: # user-specific stuff: # .idea/workspace.xml # .idea/tasks.xml # .idea/dictionaries # sensitive or high-churn files: # .idea/datasources.ids # .idea/datasources.xml # .idea/sqldatasources.xml # .idea/dynamic.xml # .idea/uidesigner.xml # gradle: # .idea/gradle.xml # .idea/libraries # mongo explorer plugin: # .idea/mongosettings.xml ## file-based project format: *.ipr *.iws ## plugin-specific files: # intellij /out/ # mpeltonen/sbt-idea plugin .id...

jquery - How to make an if statement which will run a code based on "true" conditions in javascript -

it's hard explain problem title alone, since dont know myself want. post part of code, make shorter. http://jsfiddle.net/b0ftlujj/ problem when trying display values of object properties. myobject ={ property_1: myvalue_1, property_2: myvalue_2, }; my object can have "property_x" properties 5 of them, or none @ all. trying make if statement pseudo code: for(var statname in myobject){ if(myobject has property called : 'property_1, property_2, property_3, property_4, property_5'.indexof(statname) != -1;) //then display in html: '<img src="images/' + property_x(where x property 1/2/3/4 or 5) , display available properties in current object. can make work 5x if else statements check every property, since there cannot property_1 , property_3/4/5 if "2" missing. looking better way display it. } } i hope can understand question. if not @ least jsfiddle nice :) link resources if else statements can learn how make the...

c# - Windows Phone page navigation does not work -

i'm new in creating apps windows phone. i've got problem redirecting page. i've created blank page hyperlinkbutton and in .cs file wrote this: private void but_elf_click(object sender, routedeventargs e) { this.frame.navigate(typeof(elfy)); } in xaml: <hyperlinkbutton x:name="but_elf" content="elfy" horizontalalignment="center" margin="100,125,100,255" grid.row="1" verticalalignment="center" width="200" height="70" /> when launch app , click on button - nothing happens. there no errors, no messages. i've tried put navigateuri in button's property after pressing button (in launched app) message has shown: "you need install app task. search 1 in store?" after pressing "yes" app says: "sorry, no apps found". how figure out problem? i'm creating app windows phone 8.1 in .net framework 4.5. help. you missing refere...

arrays - How to store slider values in a vector -

i'm using matlab create gui. herefore i'm using guide function of matlab. want store slider values in vector. doing in callback function: for = 1:10 x(i) = get(handles.slider1,'value'); end but results in vector stores same value 10 times. want store last 10 values of slider in vector. ideas? i suggest create 1 x 10 vector of zeros when starting gui, i.e. in openingfcn of gui: handles.x = zeros(1,10); guidata(hobject,handles); % update handles variable then in callback function of slider, shift vector 1 right , add new value in first place: x = get(handles.slider1,'value'); handles.x = [x, handles.x(1:end-1)]; guidata(hobject,handles); % update handles variable now x contains last 10 values of slider value, x(1) last value , on. before slider hasn't been moved 10 times, of values not correct, i.e. zero. if problem, grow x vector dynamically in callback.

machine learning - Matlab example code for deep belief network for classification -

i have dataset of 40 feature vectors divided 4 clases. give example code in matlab how apply deep belief network classification (and explaining parameters)? arbitrary library/tooblox can used, should in matlab. there example shogun toolbox ( http://www.shogun-toolbox.org/ ), deebnet toolbox ( http://ceit.aut.ac.ir/~keyvanrad/deebnet%20toolbox.html ) or deep learning toolbox ( http://www.mathworks.com/matlabcentral/fileexchange/38310-deep-learning-toolbox ) unfortunately of them not documented , because i'm totally new deep learning / neral nets hard me. edit: should chose following parameters or on range should search? nn.activation_function = 'tanh_opt'; % activation functions of hidden layers: 'sigm' (sigmoid) or 'tanh_opt' (optimal tanh). nn.learningrate = 2; % learning rate note: typically needs lower when using 'sigm' activation function , non-normalized inputs. nn.momentum ...

php - Start and monitor process with exec() -

i building laravel app should start external processes , monitor status using process id. the processes started this, returning pid: exec('nohup <script> & echo $!'); this works fine. have problems tracking status of newly started process, presumably because methods use require checked process child process of shell executing commands. currently try determine if process still running by: exec("ps -p $pid -o pid=") == $pid; this retruns true if process still running works child processes. should able use kill -0 <pid> here instead, not big problem. what is problem, though, determining exit code of process. current code looks this: exec("wait $pid; echo \$?"); when process finished, wait should return , write exit code $? . also works child processes of shell executed original command, exit code 127 (is not child of shell). is there other way of getting exit code of process? also, use same laravel queue both star...

Java HttpURLConnection OutputStreamWriter is empty -

i know has been answered 10,000+ times. have been reading , testing recommendations on hour without progress. in code below, request body empty. url url = new url("[removed]"); httpurlconnection conn = (httpurlconnection)url.openconnection(); conn.setrequestproperty("authorization", "bearer [removed]"); conn.setrequestmethod("post"); conn.setrequestproperty("content-type","application/json"); conn.setdooutput(true); conn.setdoinput(true); outputstreamwriter writer = new outputstreamwriter(conn.getoutputstream()); writer.write("abc"); writer.flush(); writer.close(); string line; bufferedreader reader = new bufferedreader(new inputstreamreader(conn.getinputstream())); while ((line = reader.readline()) != null) { system.out.println(line); } reader.close(); the record created on server, body null. any appreciated. the exact same code not work on localhost works on a...

java - Why size of 'BigInteger' differs when saved from what 'bitLength' reports? -

i have variable named out biginteger . when trying length of variable in bits using out.bitlength(); i receive 46 . if save in file using objectoutputstream oos = new objectoutputstream(new fileoutputstream("./testbig.dat")); oos.writeobject(out); oos.close(); i file 208 bytes . can explain me why 2 values differ? this because objectoutputstream stores objects in java's serialization format ; not store raw content of biginteger object. you can read content deserializing it, example objectinputstream .

jquery - Is there any option to remove google map(ver 3.20) infowindow close button. ? -

is there option remove google map(ver 3.20) infowindow close button. according google.maps.infowindowoptions object specification it's not supported specify visibility of close button consider following options: css: .gm-style-iw + div { display: none; } example: jsfiddle javascript: google.maps.event.addlistener(infowindow, 'domready', function(){ $(".gm-style-iw").next("div").hide(); }); example: jsfiddle has been tested against 3.21.*

javascript - Google Analytics API login error -

2 days ago wrote site school, , today decided analyze google analytics. google analytics working well, wanted embed stats site's admin panel. , problem if log google, error on console: get https://content.googleapis.com/analytics/v3/management/accountsummaries 403 (ok) you can login admin here: krudynyh.hu/admin , username: test, password: samplepassword.

php - How to GET values from Bootstrap Modal form? -

i have used bootstrap modal form , trying values using 'get' method way not working. can tell me how using ajax. if possible without ajax ,that helpfull me. <div class='modal fade' id='editbuttonmodal' role='dialog'> <div class='modal-dialog'> <div class='modal-content' > <div class='modal-header'> <button type='button' class='close' data-dismiss='modal'>&times;</button> <h4 style="color:red; text-align:center">my article</h4> </div> <div class='modal-body'> <form role='form_edit' action="addarticle.php" method="get"> <div class="form-group"> <label for="title" >title</label> <input type="text" class="form-control" id="titleid...

c# - Stealing enemies points in multiplayer game -

i have "player" gameobject spawn onserverinitialized() . it's tag "enemy" change "player" when getcomponent<networkview>().ismine . i'd make like: void ontriggerenter (collider enemy){ if (scoremanager.score > enemy.score) { scoremanager.score = scoremanager.score + enemy.score; } else if (scoremanager.score < enemy.score) { destroy (gameobject); } } but don't know how access spawned enemy player's points. my scoremanager script: public static int score; text text; void awake () { text = getcomponent <text> (); score = 0; } void update () { text.text = "score: " + score; } } it attached gui text gameobject named scoretext . 1)when you're using getcomponent check null. 2)don't use getcomponent. serialize variable (or make public) addding [system.serializable] above text text; , drag , drop in inspector, text component. 3)you...

regex - regular expression match case sensitive off -

i have regular expression finds 2 words in line. the problem is case sensitive. need edit matches both case. reqular expression ^(.*?(\bpain\b).*?(\bfever\b)[^$]*)$ you can use regexoptions.ignorecase set case insensitive matching mode. way make the entire pattern case insensitive. same effect can achieved (?i) inline option @ beginning of pattern: (?i)^(.*?(\bpain\b).*?(\bfever\b)[^$]*)$ you can use inline flag set case insensitive mode part of pattern: ^(.*?(\b(?i:pain)\b).*?(\b(?i:fever)\b)[^$]*)$ or can match "pain" or "pain" with ^(.*?(\b(?i:p)ain\b).*?(\bfever\b)[^$]*)$ another alternative using character classes [pp] , etc. note not have set capturing group round whole pattern, have access via rx.match(str).groups(0).value . ^.*?(\b[pp]ain\b).*?(\b[ff]ever\b)[^$]*$

visual studio 2013 - DirectX VSIX Installer Installation Failed -

i beginning directx programming on visual studio express 2013. searched online how begin it. found resource here i downloaded zip , when ran vsix file got following error: this extension not installable on installed products. and following install log: 13-06-2015 14:04:12 - microsoft vsix installer 13-06-2015 14:04:12 - ------------------------------------------- 13-06-2015 14:04:13 - initializing install... 13-06-2015 14:04:14 - extension details... 13-06-2015 14:04:14 - identifier : wdcgametemplates..c3488525-c3e7-49c4-9619-e082f4a95772 13-06-2015 14:04:14 - name : wdc game templates 13-06-2015 14:04:14 - author : microsoft windows sdk 13-06-2015 14:04:14 - version : 1.0 13-06-2015 14:04:14 - description : create realtime, graphics-intensive windows store games using directx , native code. includes template code graphics, sound effects, background music, , input. 13-06-2015 14:04:14 - locale : en-us 13-06-2015...

sql - PostgreSQL integer array value join to integer in other table with desc string -

i have table test column int arrays , values {1000,4000,6000} or {1000} or {1000,4000} called ekw . these values match description string in table tab: test id | name | ekw ----------------- 1 | 1 | {1000} 2 | 2 | {1000,4000} 3 | 3 | {1000,4000,6000} tab: ekwdesc id | value | desc ----------------- 1 | 1000 | max 2 | 2000 | tim 3 | 3000 | rita 5 | 4000 | sven 6 | 5000 | tom 7 | 6000 | bob is possible select these columns , print strings? something like: select name, ekw test, ekwdesc i see result: id | name | ekwdesc ----------------- 1 | 1 | max 2 | 2 | max, sven 3 | 3 | max, sven, bob i tried in , couldn't work. you had right idea use any operator join. once join complete, that's left use string_agg transform result format want: select name, string_agg(description, ', ') test join ekwdesc on ekwdesc.value = any(test.ekw) group name see attached sqlfiddle executable example. ...

multithreading - Why the threading.timer doesn't execute every 1ms in my code? -

i set threading.timer interval time 100ms. console output, time interval 1.6s. why doesn't write line in console output every 100ms? want 1ms accurate timer, can use in code simulate plc real time system. module module1 class stateobjclass ' used hold parameters calls timertask public somevalue integer public timerreference system.threading.timer public timercanceled boolean public glo_tick long end class public stateobj new stateobjclass public long_temp1 long public int16_temp1 int16 sub runtimer() stateobj.timercanceled = false stateobj.somevalue = 1 dim timerdelegate new threading.timercallback(addressof timertask) ' create timer calls procedure every 2 seconds. ' note: there no start method; timer starts running ' instance created. dim timeritem new system.threading.timer(timerdelegate, stateobj, _ 0, 1) stateobj.timerreference = timeritem ' sav...

authentication - Where does Jetty store information about authenticated user? -

i read documentation on jetty page: http://www.eclipse.org/jetty/documentation/9.2.6.v20141205/index.html but still not know jetty store information authenticated user. writing application state less despite of fact need know logged in. do need set session replication via database or maybe there smarter way session stored in cookie: http://httpd.apache.org/docs/trunk/mod/mod_session_cookie.html it depends on authentication mechanism using. if use basic, nothing stored on server , credentials sent along every request. if use digest, transient data stored on server (in digestauthenticator), not need replicated in cluster. if use form auth, credentials indeed cached in users session , if operating in cluster either need distribute session.... or if want stateless, use single sign on mechanism handle authentication failures.

jquery - CSS3 - call back after animation done by adding class name -

how make call in angular call function after completing animation adding classname ? here code : var myapp = angular.module('myapp', []); myapp.controller('count', function($scope) { $scope.animate = function () { $('h2').addclass('fade'); //adding animation 1s //opcity done how put call back? $scope.done = function () { //call after 1s..? console.log('done'); } } }); <div class="container" ng-app="myapp"> <div class="content" ng-controller="count"> <h1 ng-click="animate()">click me</h1> <h2>let me fade</h2> </div> </div> jsfiddle since tagged jquery, how using jquery $(selector).fadeout(speed,easing,callback) speed can "fast" or "slow" or define milisec easing speed increment whether constant "linear" or faster @ end ...

javascript - jQuery .post is working but triggering .fail without any information -

i've got data posting i'm not having luck getting .post response handler code work. inconsistent results in different browsers/tools i've tried. here's post code: $.post(form.attr("action"), form.serialize(), "json") .done(function (response, textstatus, jqxhr) { alert('done'); }) .fail(function (jqxhr, textstatus, errorthrown) { // log error console alert('responsetext:' + jqxhr.responsetext + ', status:' + textstatus + ', error:' + errorthrown); }) in firefox , chrome goes .fail (even though data posting) item set textstatus "error". in firefox when try view response shows error, "syntaxerror: json.parse: unexpected end of data @ line 1 column 1". in chrome, in console i'm seeing this: "xmlhttprequest cannot load http://example.net/applicationsvc/formprocessor/index.php . no 'access-control-allow-origin' header present on requested resource. o...

go - Golang https server passing certFile and kyeFile in terms of byte array -

func listenandservetls(addr string, certfile string, keyfile string, handler handler) error above function call start https server in golang. works without problem. however, have more deployments, don't want put key files everywhere. thinking let program download key file , cert file centralized place. if there similar function receiving []byte opposed string , easy me that. seems don't see such function in documentations. looking at source of listenandservetls seems there no option, calls tls.loadx509keypair . that's unfortunate; possibly worth submitting feature request. in meantime, listenandservetls method not large, , (other tcpkeepalivelistener ) not use non-exported it'd simple copy body of method own function , replace load509keypair tls.x509keypair , take []byte of pem encoded data rather filenames. (or perhaps take tls.certificate argument instead.) e.g. something https://play.golang.org/p/ui_8ds8ouu

math - Calculate Camera tilt angle -

Image
i have camera i'd mount on tripod. know fov dimensions of camera (22.5 deg v 31 deg h). i'd know @ height , tilt angle place camera able capture 2 points of interest on ground. please see figure below. i have attempted solution using basic trig not sure correct. please help! your calculations correct in view. if have include both red points, need place camera @ angle such encloses both red points. so, tan θ = d/h c => θ = tan -1 d/h c . but, need enclose both points, angle should greater θ ( suggestion --- θ+ε, 0.25 < ε < 1 ) capture 2 red dots.

C# interfaces method{get;} mean? -

i'm beginner in oop, have problem interfaces method has "get" parameters within, code below vector2 terrain {get;} what "get" mean?? method return value get?? thanks it's "shorthand" syntax "getter". google oo getter , setter are. there better explainations getters/setters can write here. for example: http://www.dotnetperls.com/property

sql - Oracle regular expression REGEXP_LIKE for multiple columns -

i want validate tax , name, telephone no . should alpha-numeric.so used method in here want know can same short method in way without using many "and" s. if regexp_like(i.tax, '^[a-za-z0-9]+$') , regexp_like(i.name, '^[a-za-z0-9]+$') , regexp_like(vartelephone , '^[a-za-z0-9]+$') insert bizzxe_v2_sch.supplier_contacts (contact_id, supplier_id, address, zip_code, country_id, city_id, telephone, fax, email, xmlcol) values(varcontactid ,varid, k.address, k.zip_code, k.country_id, k.city_id, k.telephone, k.fax, k.email, varcontactdetail); else -- start return rval messages -- rval.ex_code:=1; rval.message:='supplier tax , supplier name should apha-numeric numbers letters , symbols..!'; -- end return rval messages -- end if; since need match same regex pattern, alphanumeric, can validate on concatenation of these 3 values: if regexp_like(i.tax || i.name || vartelephone , ...

java - Compilation failure in JNativeHook -

trying compile https://github.com/kwhat/jnativehook/wiki/compiling made far step have run ant build. compile fails following in command prompt. [javac] fatal error: unable find package java.lang in classpath or bootcl asspath build failed c:\users\george\downloads\sounds\jnativehook-2.0.1\jnativehook\build.xml:394: co mpile failed; see compiler error output details. total time: 0 seconds edit: copied rt file directory i'm trying compile. got past first error i'm getting ava\org\jnativehook\mouse\nativemousewheellistener.java download-libuiohook: bootstrap-libuiohook: [echo] bootstrapping libuiohook... [autoreconf] autoreconf --verbose --force --install build failed c:\users\george\downloads\sounds\jnativehook-2.0.1\jnativehook\build.xml:351: ex ecute failed: java.io.ioexception: cannot run program "sh" (in directory "c:\use rs\george\downloads\sounds\jnativehook-2.0.1\jnativehook\src\libuiohook"): creat eprocess error=2, system ca...

Comparing objects in a conditional, Python 3 -

i have following code in program used append setting list or if in list remove it. if setting has value should sent self.commit_setting , if not self.commit_setting passed. wise removing setting except instead of committing setting undoes it. no_color = gdk.rgba(red=0.000000, green=0.000000, blue=0.000000, alpha=1.000000) if setting in self.setting_lst: self.setting_lst.remove(setting) # if setting in list remove # note: get_rgba() returns gdk.rgba object if self.get_rgba() == no_color: # if value not set pass pass else: self.undo_setting() else: self.setting_lst.append(setting) # add setting list if not in if self.get_rgba() == no_color: # if value not set pass pass else: self.commit_setting() currently code working fine me simplify using if out else, implying if condition not met else. put: if self.get_rgba() != no_color: self.commit_s...

java - Initiliazing ParseLoginUI? -

where 1 place code launch parseloginui activity? parseloginbuilder builder = new parseloginbuilder(mainactivity.this); startactivityforresult(builder.build(), 0); is in parselogindispatchactivity? not made clear @ within of official documentation: https://github.com/parseplatform/parseui-android https://www.parse.com/docs/android/guide#user-interface i'm importing parseloginui existing app. once i've installed everything, updated manifests, build.gradle , want launch login activity once app launches? do put in manifest indicate parseloginactivity should launch first? doesn't seem work activity main application required launch initial intent. i'm little lost here... thoughts? well did find 1 solution, albeit trivial one: intent loginintent = new intent(mainactivity.this, parseloginactivity.class); startactivity(loginintent); i launched above intent options menu item, button or whatever else suits needs. if you're importing parseloginui ...

php - Creating object name with dash -

i trying run mysqli query retrieve single result, requires me create object contains dash in name, won't work. $style_name = $db2->query("select modeldesc-enu tlkpmodel modelid = '$style' limit 1")->fetch_object()->modeldesc-enu; notice part fetch_object()->modeldesc-enu; - it's invalid object name. how around this? wrap property in curly braces , quotes: fetch_object()->{'modeldesc-enu'}; although suspect need wrap column name in ticks, too, dash not valid identifier characters , means subtracting enu modeldesc. $style_name = $db2->query("select `modeldesc-enu` tlkpmodel modelid = '$style' limit 1")->fetch_object()->{'modeldesc-enu'};

parse.com - Unity 5 ParseObject.GetQuery wont work -

i've problem loading scores parse. there 3 users scores in database , i'm trying hook them: var query = parseobject.getquery("gamescores").orderbydescending("scrore");//.orderby("nickname").thenbydescending("score").limit(25); query.findasync().continuewith(t => { results = t.result; debug.log(results); foreach (parseobject obj in results) { var score = obj.get<string>("score"); debug.log(score); } }); first debug returns system.collections.objectmodel.readonlycollection`1[parse.parseobject] the second not execute @ all, wrong?

typecast operator - How to dereference an address into an integer in python? -

this question has answer here: how dereference memory location python ctypes? 1 answer i have address 0x6041f0 . know there's integer sitting out there. in c, have done *(int *)0x6041f0 integer value present @ address. how achieve same in python? ps: writing python script uses gdb module. actual program being debugged in c++. such lot of low level manipulation required. something this: $ python python 2.7.9 (default, mar 19 2015, 22:32:11) [gcc 4.8.4] on linux2 type "help", "copyright", "credits" or "license" more information. >>> ctypes import * >>> c_int_p = pointer(c_int) >>> x = c_int(4) >>> cast(addressof(x), c_int_p).contents c_int(4) with artbitrary address :) >>> cast(0x6041f0, c_int_p) <__main__.lp_c_int object @ 0x7f44d06ce050> >>> c...

c++ - SFML 2.3 and CodeBlocks error compilation -

i'm trying make sfml works codeblocks. did said in video tutorial : https://www.youtube.com/watch?v=gegwo8ug2by everything works if add sfml/graphics.hpp, config isn't bad. if try add sfml/audio.hpp (i need add sounds project) , write "sf::music background_music;" error : ||=== build: debug in jeudego (compiler: gnu gcc compiler) ===| d:\info\sfml-2.3\lib\libsfml-audio-s-d.a(soundstream.cpp.obj):d:\sfml-release\_sources\sfml\src\sfml\audio\soundstream.cpp|52|undefined reference `sf::thread::~thread()'| d:\info\sfml-2.3\lib\libsfml-audio-s-d.a(soundstream.cpp.obj):d:\sfml-release\_sources\sfml\src\sfml\audio\soundstream.cpp|70|undefined reference `sf::thread::wait()'| d:\info\sfml-2.3\lib\libsfml-audio-s-d.a(soundstream.cpp.obj):d:\sfml-release\_sources\sfml\src\sfml\audio\soundstream.cpp|59|undefined reference `sf::thread::~thread()'| d:\info\sfml-2.3\lib\libsfml-audio-s-d.a(soundstream.cpp.obj):d:\sfml-release\_sources\sfml\src\sfml\audio\sou...