Posts

Showing posts from August, 2012

JavaScript returning NaN value -

i have 2 ui-slider, , have calculation on slide callback, it's returning nan value $( document ).ready(function() { $("#amount").slider({ range: "min", value: 160000, min: 10000, max: 400000, step: 1, slide: function(event, ui) { var interest = 0.0325; var amount = parseint(ui.value); var temp1 = amount * (interest / 12) / (1 - math.pow(1 + (interest / 12), -(years * 12))); $('#currentamount').val(amount); $('#monthly').text(math.round(temp1)); } }); $("#years").slider({ range: "min", value: 8, min: 1, max: 12, step: 1, slide: function(event, ui) { var interest = 0.0325; var years = parseint(ui.value); var temp1 = amount * (interest / 12) / (1 - math.pow(1 + (interest / 12), -(years * 12))); $('#yearsval').text(years); $('#monthly').text(math.rou

javascript - how do I copy and paste images in php -

how copy , paste uploaded images in php. when click on copy button copy uploaded images. when click on paste button paste copy image using javascript , php <script type="text/javascript"> function clicked(){ var src = document.getelementbyid('copy').value document.getelementbyid('paste').value = src; } </script> html: <ul id="image_list"> <li><img src="elements/1.png" id="copy" width="640px" height = "480px" /></li> </ul> <button onclick="clicked();"> copy </button> check this, should you. else asked question way. search first, please. :) <script> function copy() { if(window.clipboarddata) { window.clipboarddata.cleardata(); window.clipboarddata.setdata("text", document.getelementbyid('txtacpy').value); } } function paste() { if(window.clipboarddata) { document.getelementbyid('txtapaste

javascript - How to Filter the value pasted in TextArea -

have text area enter semicolon separated values, able process keyboard events , validating successfully.how validate same on copy paste. $(function () { var kpi = document.getelementbyid('<%=this.d.clientid%>').value; var tb = $('#<%= textbox.clientid %>'); $(tb).keypress(function (e) { var regex = new regexp("[0-9;]+$"); var str = string.fromcharcode(!e.charcode ? e.which : e.charcode); if (regex.test(str) && !($(this).val().match(/;{2,}/))) { var = $(this).val().match(/;/ig) || []; var len = as.length; if (len < kpi) { return true; } } e.preventdefault(); return false; }); $(tb).keyup(function (e) { var str = string.fromcharcode(!e.charcode ? e.which : e.charcode); if (($(this).val().match(/[;]{2,}/g))) { var shortenedstring = $(this).val().substr(0, ($(this).val().length

How to convert xml response using curl into array then store in database using php -

i invoking php curl method on server , response xml type. curl saving output (after removing tags) in scalar type variable. there way store in database it's easy parse? <response status="ok" responsetime="10"> <results> <wirelineservices> <blockfips>360775908001027</blockfips> <frn>0007556251</frn> <providername>time warner cable llc</providername> <doingbusinessas>time warner cable</doingbusinessas> <holdingcompanynumber>131352</holdingcompanynumber> <holdingcompanyname>time warner cable inc.</holdingcompanyname> <providerurl>www.timewarnercable.com</providerurl> <technologies> <technologycode>40</technologycode> <typicaldownloadspeed>0</typicaldownloadspeed> <typicaluploadspeed>0</typicaluploadspeed> <maximumadvertiseddownloadspeed>9</maximumadvertiseddownloadspeed> <maximumadvertiseduploadspeed>

ios - AFNetworking background downloading automatically stop after some time, I need to resume it -

i using afnetwork (its base on nafdownloadrequestoperation) , task in downloading multiple zip files 1 one amazon bucket. when app in foreground every thing working well, when app goes in background mode time downloading running time , automatically stop. read blog in following method called before downloading stop. [self.operationupdate setshouldexecuteasbackgroundtaskwithexpirationhandler:^{ nslog(@"downloading stop"); }]; problem in background mode downloading automatically stop what want : if downloading stop in background , when app again comes foreground need resume downloading point. i use following code in appdelegate not understand how resume previous downloading. __block uibackgroundtaskidentifier backgroundtaskidentifier = [application beginbackgroundtaskwithexpirationhandler:^(void) { [application endbackgroundtask:backgroundtaskidentifier]; nslog(@"applicationwillresignactive"); [__se

javascript - Any way to create a "state" listener instead of an "event" listener? -

i know can add click or change listener on checkbox. handler changes disabled prop of button true when checkbox unchecked. that's easy. but rather having event-driven, there way have "state" driven? if "state" of checkbox unchecked, "state" of button disabled. doesn't matter kind of event triggers state change. if checkbox in 1 state, button in corresponding state. that's it. here's example of standard event-driven code checkout button should disabled long terms , conditions checkbox unchecked. $('input[name="terms-and-conditons"]').change(function(e, tmpl){ if(e.target.checked === true){ $('#checkout-button').prop("disabled", false); } else { $('#checkout-button').prop("disabled", true); }; }); unfortunately doesn't take account initial states, since requires event happen else happen. on page load, if checkbox unchecked, button still ena

javascript - Slicknav autoclosing multilevel menus -

i'm working slicknav mobile menu. came across cool little way have parent menu close automatically if click on parent menu , have working if i'm using below (please note, not know javascript. see me hacking other code i've found online): <ul id="menu"> <li class="first"><a href="#">parent1</a> <ul> <li><a href="#" title="">child1</a></li> <li><a href="#" title="">child2</a></li> </ul> </li> <li><a href="#" title="">parent2</a> <ul> <li><a href="#" title="">child3</a></li> <li><a href="#" title="">child4</a></li> </ul> </li> <li><a href="#" title="&

unbuffered output - Perl: Print log at runtime instead of dumping all at once later -

i have perl script runs jenkins slave. script executes shell script kept on remote box a. shell script deploys war on machine itself. both machines, jenkins slave , remote box centos instances. use strict; use warnings; use cwd; use file::copy; use getopt::long; use file::basename; use net::openssh; ($conf_file, $environment, $doexec, $exec, $job, $dest_file, $user, $host, $ip, $target_server, $jenkins_job, $wrapper, $src_file, $src_path, $src_dist_path, $src_full_path, $id_file, $ssh, @array, $line); init(); sub init { $jenkins_job = $env{'job_name'}; $conf_file = "/home/ec2-user/scm/conf/deploy_build.conf"; open (fh, "<", $conf_file) or die "cannot open < $conf_file: $!"; while (<fh>) { if ( $_ =~ /\b$jenkins_job\b/ ) { push @array, $_; } else { next; } } foreach $line (@array) { ($job, $src_path, $dest_file, $user, $wrapper) = split(':'

Elegant way handling both missing key and null values from Scala Map -

i understand in scala use of null should avoided and map.get return option[b] , can use .getorelse value , fallback default value e.g. map.getorelse("key1","default") meanwhile interacting java library, values null. e.g. map("key1"->null) getorelse throw null pointer in case. i want handle both cases , result in writing this def getorelsenonull[a,b](map:map[a,b],key:a,default:b) = { map.get(key) match{ case some(x) if x != null => x case _ => default } } which quite ugly. (it map[any] , need string key) getorelsenonull(map,"key1","").asinstanceof[string]) is possible use implicit extend map, or other elegant way? if you're dealing immutable map, safest thing filter out null values front (this incurs creation of yet map instance, unless have specific reason care performance here should not issue). val withoutnulls = map.filter{case (k,v)=> v != null}

android - Cannot get the position of the tabhost from a fragment to another fragment using bundle -

i have 2 fragments. 1 tab , 1 main layout calls list view. having trouble passing "position" alarmtab class alarmactivity class. position being passed gets length of array. when click list position [0] tab, returns length of mytabhost , not clicked tab. want position of clicked , below codes of have done far. i've been working hours already. can me point out missing. thank in advance! from alarmtab class mtabhost = (fragmenttabhost) rootview.findviewbyid(android.r.id.tabhost); widget = (tabwidget) rootview.findviewbyid(android.r.id.tabs); hs = (horizontalscrollview) rootview.findviewbyid(r.id.horizontalscrollview); mtabhost.setup(getactivity(), getchildfragmentmanager(), android.r.id.tabcontent); for(int i=0; i<smashdevicedata.get_instance().devices.size(); i++) { alarmactivity alarmactivity = new alarmactivity(); bundle bundle = new bundle(); bundle.putint("position", i); alarmactivity.setarguments(bundle); mtabhost.addtab(mtabh

X-axis dates are wrong in Matlab plot -

my dates in format 'yyyymmdd'. when put these onto x-axis of plot, crazy numbers. plot interval last decade, x-axis tick labels showing 1979 , other weird numbers. can point me in right direction correct this? thanks. edit: here requested code: tradedate=tradedate+693960; % convert excel serial dates matlab serial dates tradedate=datestr(tradedate,'mmddyyyy'); % convert format yyyymmdd tradedate=str2double(cellstr(tradedate)); % convert date strings first cell arrays , double plot(tradedate,beta); xlabel('date'); ylabel('beta'); daspect([300 1 1]); set(gca,'xtick',linspace(tradedate(1),tradedate(1715),50)); ax=gca; ax.xticklabelrotation=45; what doing plotting serial date numbers on x -axis, when suspect want plot date strings themselves. as such, use serial date numbers spawn plot first, use date strings changing x -axis labels. btw, code using str2double rather pointless because if follow comment on first line of code corr

Persist property iOS -

i need way of persisting property value can 1 of 2 states on ios devices. value must accessible parts part of application invisible other applications, easy read , write , must survive 1 program run next , os restarts. option best situation on ios? since data set small,i think nsuserdefaults should option //save nsuserdefaults * userdefaults = [nsuserdefaults standarduserdefaults]; [userdefaults setbool:true forkey:@"state"]; [userdefaults synchronize]; //get bool state = [userdefaults boolforkey:@"state"];

jquery - Dynamic div displaying incorrectly -

i have dynamic legend being added leaflet map. my issue div.innerhtml +='</div>' gets called before if statements , statement have finished. i've been looking callbacks i'm stuck after hours of looking @ this, , seem going in circles /*legend control */ function maplegendcontrol() { dynamicmaplegend = l.control({ position: 'topright' }); dynamicmaplegend.onadd = function(map) { var div = l.domutil.create('div', 'legend'), legendcolors = ["#7c7c7c", "#9d2a2a", "#26a82f"], legendlabels = ["blue", "red", "green"]; div.innerhtml += '<div class="legend-inner-top">' + '<div class="legend-inner-top-m" style="padding-top: 3px color: #e3e3e3;"><strong style="color: #e3e3e3">legend</strong></div>' + '<div class="legend-inner-top-m" style="float:

python - How to: (1) making a copy of a numpy array, (2) modifing this copy, and (3) returning the modified copy -

my goal write function (1) makes copy of numpy array, (2) modifies copy, , (3) returns modified copy. however, doesn't work thought would... to show simple example, let's assume have simple function z-score normalization: def standardizing1(array, columns, ddof=0): ary_new = array.copy() if len(ary_new.shape) == 1: ary_new = ary_new[:, np.newaxis] return (ary_new[:, columns] - ary_new[:, columns].mean(axis=0)) /\ ary_new[:, columns].std(axis=0, ddof=ddof) and results expect: >>> ary = np.array([[1, 10], [2, 9], [3, 8], [4, 7], [5, 6], [6, 5]]) >>> standardizing1(ary, [0, 1]) array([[-1.46385011, 1.46385011], [-0.87831007, 0.87831007], [-0.29277002, 0.29277002], [ 0.29277002, -0.29277002], [ 0.87831007, -0.87831007], [ 1.46385011, -1.46385011]]) however, let's want return modified version of copy. wondering why doesn't work. example, def standardizing2(array, columns, ddof=0

php - yii changing removing and renameing column names -

i have return sends list of items in auction. trying clean array before export excel spread sheet. can use yii or php clean select before exporting, need know how it. know how mysql statement frowned upon in yii world. this current code: $auction = btmauctions::model()->findbypk($id); $listings = $auction->btmlistings; $filename = 'last_lot_export.csv'; $csv = new ecsvexport($listings); $csv->tocsv($filename); // returns string default yii::app()->getrequest()->sendfile( $auction->name.'_lots.csv' , file_get_contents( $filename ) ); this exports csv looks this: id| auction_id| lot| description | manufacturer | model|more_info| condition 21 10 12 fanuc circuit board fanuc a20b-9000-0180/09c 3 20 10 1 fanuc circuit board fanuc a20b-0008-0242/023a 4 22 10 18 fanuc circut board fanuc a20b-1003-0010/12b * little dirty 3 23 10 19 fanuc circuit board fanuc a20b-1003-0020/03a *very dirty!!! *plastic broken o

c++ - Transform and accumulate with C++11 -

coming python wonder if c++ nowadays has functional things there in python. currently trying figure out how produce sum of elements using indexes instead. example python would: a = [ ... ] b = [ ... ] sum(map(lambda i: a[i] * 2 - b[i + 1], range(len(a))) so here generate new array each element determined index arithmetic. in stl there transform , accumulate , take iterators arguments. ok if on each step needed change concrete element. here need use index. also transform have specify array need put results to. there way resulting array generated on fly , returned? python's map does. because in such case it's easier write simple for-loop. there's no need create intermediate array, leave std::transform out of picture. need std::accumulate sum intermediate result. but, you've noted, involves jumping through few hoops index given iterator. int a[] = {10, 20, 30, 40}; int b[] = {1, 2, 3, 4, 5}; std::accumulate(std::begin(a), std::end(a), 0,

How to get root path of rails app -

i novice rails. have been using lamp long time. looking {{url::to('/')}} laravel. i not want use link_to creates entire anchor tag defeats purpose of isolating views. want value put in href tag. <a href="<%= write here??? %>" class="btn btn-success">this link</a> rails has has root_path , root_url helpers you seem quite confused link_to not compromise "isolation" of views. helper method makes possible create dynamic html without doing lot of interpolation. <%= link_to t('home'), root_path, class: 'btn btn-success' %>

image - Matlab fast gpuArray visualization -

the task simple, processing gpuarray of descent size, 2048x2048, inside loop , want visualize generating image plot (or heat map) in real time. a=gpuarray(...); i=nframes a= ... ; imagesc(a); drawnow; end now problem low framerate (<10 fps) when using imagesc() or imshow() though processing not take long. if want set 'cdata' image handle declared since beginning, forced move array cpu memory time expensive , defeats purpose. is there specific tool useful accelerate visualization of gpuarrays? i've watched webinar on solving pdes gpu presenter has code in real time. can watch video exact idea of i'm looking for. http://www.mathworks.com/videos/gpu-computing-with-matlab-81840.html?form_seq=conf882&elqsid=1435085269409&potential_use=student&country_code=us

date - Group Maker Algorithm based on free time avaliable -

i trying come algorithm make groups based on maximum free time available group of people have in polynomial time, believe solution problem might np. the problem followed: we divided week 1 hour slots users can put down each slot whether free or busy. let's gather information 30 users. let's assume users%group_size = 0 first: is possible put these people groups of size g every member in each group of size g has 1 overlapping free time slot each other? is possible put these people groups of size g results in optimal solution, have maximum total overlapping free time slots among groups? for example, if had group of 6 people following free time: a: 1pm-3pm sunday , 1pm-3pm monday b: 2pm-3pm sunday , 1pm-3pm monday c: 1pm-3pm sunday , 7pm-9pm monday d: 6pm-7pm sunday , 7pm-9pm monday e: 5pm-7pm sunday , 7pm-9pm monday f: 6pm-7pm sunday , 1pm-3pm monday the algorithm determine a,b,f 1 group , c,d,e group because maximum of 2 hours of free time overlaps b

Rails 4: how can I DRY out my multiple form partials? -

my app has objects foo , bar, each have corresponding models, views , controllers. a form partial comes standard after generating scaffolding each object. foo form partial looks like... <div class="form-inputs row"> <div class="col-md-6"> <%= foo.donut %> <%= foo.bagel %> <%= foo.cookie %> </div> </div> <div class="form-inputs row"> <div class="col-md-6"> <%= foo.biscuit %> <%= foo.toast %> <%= foo.muffin %> </div> </div> bar form partial looks like... <div class="form-inputs row"> <div class="col-md-6"> <%= bar.cat %> </div> </div> <div class="form-inputs row"> <div class="col-md-6"> <%= bar.dog %> </div> </div> i want uniform formatting , want easy maintain, objects have different attributes , differe

How to access Active Record Object Values ? Ruby on Rails -

i relatively new ruby on rails. made relationship called friendships, has following attributes: user_id, friend_id, state inside friendship.rb model file, have created opposite method me inverse friendships: class friendship < activerecord::base def opposite user = self.user_id; friend=self.friend_id; return friendship.where(user_id:friend,friend_id:user); end end inside view file have: <h1> requests ive sent: </h1> <%@sent_friendships.each |x|%> <%=x.opposite%><br> <%=x.opposite.inspect%> <%end%> note: @sent_friendships defined in controller as: @sent_friendships=current_user.friendships.where(state:'pending'); view output: x.opposite: #<friendship::activerecord_relation:0x007fd8abcf3498> x.opposite.inspect: #<activerecord::relation [#<friendship id: 4, user_id: 3, friend_id: 1, created_at: "2015-07-01 21:42:21", updated_at: "2015-07-01 21:42:21", state:

bash - pass values from a file as a Makefile variable -

i use values file pass command in make. problem context passing set of ids fetch proteins ncbi using eutils cli . thought of using process substitution pass file location , need string. trying set local bash variable , use in make step cannot work. hints appreciated. zachcp shell := /bin/bash # efetch 1 id test1.txt: efetch -db protein -id 808080249 -format xml >$@ # efetch two, comma-separated ids test2.txt: efetch -db protein -id 808080249,806949321 -format xml > $@ # put ids in file.... data.txt: echo "808080249\n806949321" > $@ # try call ids process substitution. # doesn't expand before being called trips error... test3.txt: data.txt efetch -db protein -id <(cat $< | xargs printf "%s,") -format xml > $@ # try set , use local bash variable test4.txt: data.txt ids=`cat $< | xargs printf "%s,"` efetch -db protein -id $$ids -format xml > $@ text3.txt work if use $(...) or `...` i

android - Actionbar v7 Toggle no space to title -

my app using android v4 toggle far. now switched v7 appcompat toggle. therefore followed these steps: how replace deprecated android.support.v4.app.actionbardrawertoggle . this worked me. problem there absolutely no space between toggle icon , left screen border , title. how can add space there looks google play store? i've got application icon on every activity. tried removing using @android:color/transparent. removed icon there still no space, actionbar title aligns straight v7 toggle icon. looks http://pl.vc/4jdg3 should http://pl.vc/1oqh6

moodle api rest call in c# -

i'm doing next api rest call in c#: string token = "e2a35dbfdaee78097c7ba489xxxxxxxx"; moodleuser user = new moodleuser(); user.username = webutility.urlencode("username"); user.password = webutility.urlencode("the_password"); user.firstname = webutility.urlencode("michael"); user.lastname = webutility.urlencode("york"); user.email = webutility.urlencode("test@gmail.com"); list<moodleuser> userlist = new list<moodleuser>(); userlist.add(user); array arrusers = userlist.toarray(); string postdata = string.format(@"users[0][username]={0}&users[0][password]={1}&users[0][firstname]={2}&users[0][lastname]={3}&users[0][email]={4}&users[0][preferences][0][type]={5}&users[0][preferences][0][value]={6}", user.username, user.password, user.firstname, user.lastname, user.email, **"auth_forcepasswordchange", "1");** string createrequest = string.format

regex - How to do this rewrite rule for apache htaccess? -

i make rewrite take get.domain.com domain.com/get.php alongside parameters. example: get.domain.com?v=64 change domain.com/get.php?v=64 also, if possible, request url on webpage not change, , remain get.domain.com?v=64 user. my current attempt: rewritecond %{http_host} ^(www\.)?get\.domain\.com$ [nc] rewriterule ^ http://domain.com/get.php [ne,r=301,l] it translate get.domain.com domain.com/get.php paramters not transferred , url changing. any idea how that? you can use rule: rewritecond %{http_host} ^(?:www\.)?(get)\.domain\.com$ [nc] rewriterule ^/?$ %1.php [l]

php - Facebook: search people from apps -

i new both php , facebook graph api. trying build app search people. there no login, believe need use app access token. here code using: <?php define('facebook_sdk_v4_src_dir', __dir__ . '/facebook/src/facebook/'); /** * load facebook sdk */ require __dir__ . '/facebook/autoload.php'; use facebook\facebooksession; use facebook\facebookrequest; /** * configure facebook */ facebooksession::setdefaultapplication('113868548952926', '9b6d12596769cd590aa4e77781a8f86c'); /** * app level session */ $session = facebooksession::newappsession(); /** * make request */ $request = new facebookrequest($session, 'get', '/search?q=peole work @ ford&type=user'); /** * execute */ $response = $request->execute(); print_r($response); however facebook\facebookauthorizationexception message a user access token required request resource . mean need login function? can do? php version: 5.6.8 thank you

Getting 'Exception in thread "main" java.lang.NoClassDefFoundError: org/ini4j/Ini' error after succesfully compiling source file from the CLI -

background: trying use ini4j purpose of parsing config files in ini format. i run command: javac -classpath ini4j-0.5.4.jar driver.java , compilation goes smoothly...however when attempt run program running: java driver error: exception in thread "main" java.lang.noclassdeffounderror: org/ini4j/ini @ clock.main(clock.java:13) caused by: java.lang.classnotfoundexception: org.ini4j.ini @ java.net.urlclassloader$1.run(urlclassloader.java:366) @ java.net.urlclassloader$1.run(urlclassloader.java:355) @ java.security.accesscontroller.doprivileged(native method) @ java.net.urlclassloader.findclass(urlclassloader.java:354) @ java.lang.classloader.loadclass(classloader.java:425) @ sun.misc.launcher$appclassloader.loadclass(launcher.java:308) @ java.lang.classloader.loadclass(classloader.java:358) ... 1 more from understand error product of jvm being able find class file being referenced in error , failing. checked ini4j jar file , c

Google App Engine Launcher Start up Error -

for past couple of months have been error google app engine launcher. each time click on icon keep on getting same thing. attach link shows picture of problem, , link shows in side error. link 1: https://plus.google.com/u/1/115545843446144625696/posts/3vrc8r2vtrd?pid=6166603109008196818&oid=115545843446144625696 link 2: https://plus.google.com/u/1/115545843446144625696/posts/dht22bzcgmr?pid=6166675564005054098&oid=11554584344614462569 you should go user directory, , delete google directory

javascript - MVC DropDownList selection changed not firing Ajax -

i new mvc , have been doing lots of looking, can't figure out why isn't working. i have following view code: $(function() { $("#ddlnumberofrecords").change(function() { var numberofrecords = $("#ddlnumberofrecords").val(); $.ajax({ type: "post", url: '@url.action("numberofrecordschanged")', data: { numberofrecords: numberofrecords }, success: function(returndata) { if (!returndata.ok) { window.alert(' error : ' + returndata.message); } else { $('#grid').html(returndata); } } }); }); }); @html.dropdownlist("ddlnumberofrecords", model.numberofrecordsselectlist) can tell me wrong that? also, there way debug javascript? put breakpoints on there, never load. edit: action. there no real content yet because trying work

javascript - Wordpress Wysiwg editor not working in 4.2.2 -

i've upgraded site add media button wasn't working. now, having upgraded 4.2.2 add media works, wysiwyg editor isn't showing. the console messages i'm receiving are: uncaught referenceerror: edbuttons not defined (anonymous function) @ post-new.php:131 the new post screen appears text tab selected, instead of visual, , when try select visual tab get: uncaught typeerror: cannot read property 'canvas' of undefined a.closealltags @ quicktags.min.js?ver=4.2.2:1 window.switcheditors.go @ editor.min.js?ver=4.2.2:1 window.switcheditors.switchto @ editor.min.js?ver=4.2.2:1 onclick @ post-new.php:405 any ideas?

java.util.scanner - Why am I getting the error, "java.util.NoSuchElementException"? -

this question has answer here: scanner nosuchelementexception 2 answers my error message looks this: exception in thread "main" java.util.nosuchelementexception: no line found @ java.util.scanner.nextline(scanner.java:1540) @ gpa3.answer(gpa3.java:364) @ gpa3.main(gpa3.java:355) i have main method , rest of code working once add piece of code throws error. not allow me enter scanner. import java.util.scanner; public class gpa3 { public static void main(string[] args) { system.out.println("hello! welcome gpa calculator."); int math; double mathgpa = 0; system.out.println("math = "); scanner input = new scanner(system.in); math= input.nextint(); if (math >100){ system.out.println("you have mistyped something"); }

java - Progress bar with indeterminate mode on a button click doesn't work -

i using netbeans , button click function. want progress bar run click on button. mode indeterminate because calling class writetofile , work minutes in background , doesn't return value. private void createfilebuttonactionperformed(java.awt.event.actionevent evt) { string str = (string) selecttypecombobox.getselecteditem(); createfilebutton.setenabled(false);// prevent more button presses string filepaths = filechooserwindow.getselectedfile().getabsolutepath(); string selecttype =(string) selecttypecombobox.getselecteditem(); writetofile writeobj; writeobj = new writetofile(filepaths,start,selecttype); try { writeobj.selecttype(); } catch (sqlexception | ioexception | runtimeexception ex) { system.exit(0); } } got work: jprogressbar1.setvisible(true); jprogressbar1.setindeterminate(true); executor executor = java.util.concurrent.executors.newsinglethreadexecutor(); executor.execute(ne

c# - System.NullReferenceException in System.Data.RBTree`1.Minimum(Int32 x_id) -

i occationally getting null reference exception when running bitcoin node (written in c# .net 4.5). have been trying various apporaches, keeps coming up, after few hours, after server has been running uninterrupted days. unable provoke issue (cannot reproduce), , cannot see source of .net implementation of red-black-tree either. seems internal .net bug related clearing dataset. have exception trace here. appreciate feedback on how either correct issue or work around it, in case has had same odd experience. hresult: -2146233088, 0x80131500 exception source: exception origin: exception stack: exception type: slf.cs.slfinternalerrorexception exception message: selectdata select statement: "select * [dbo].[blockheaders] blockhash = @equaltovalue" failed. slfexception info: hresult: -2146233088, 0x80131500 exception source: slf.cs exception origin: int32 selectdata(system.data.sqlclient.sqlconnection, int32, system.data.d

unity3d - How to apply GUI Skin to UI components created from the menu in Unity? -

in unity, have buttons , labels created. elements not created using script, how apply gui skin ui components created menu not script? the buttons , labels have constructor accepts guiskin gui.button

node.js - Grunt error - cannot find module 'tough cookie' -

i getting error , don't know make of it. grunt works fine on machine, failing on server. they're both same os. , thinking package.json might have installed later version of on server broke grunt. use ^ of dependencies, should compatible. here grunt error: loading "compress.js" tasks...error >> error: cannot find module 'lodash' loading "connect.js" tasks...error >> error: cannot find module 'cookie-signature' loading "imagemin.js" tasks...error >> error: cannot find module 'js-yaml' loading "jasmine.js" tasks...error >> error: cannot find module 'lodash' loading "jshint.js" tasks...error >> error: cannot find module 'hooker' loading "less.js" tasks...error >> error: cannot find module 'lodash' /home/jeremy/421_api/node_modules/grunt-contrib-requirejs/node_modules/requirejs/bin/r.js:16208 /** ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

javascript - Adding a new node to d3 tree -

i've been having great success playing around d3 tree data structure using example start: http://bl.ocks.org/robschmuecker/7880033 however, there 1 simple task cannot seem find answer to: add node existing data tree. not trying alter original file data came from, nor want alter svg output. want able add node directly data tree after rendered external file

Java Swing UI test driver replacement for Fest -

is there replacement fest, such replacement drive java swing ui in blackbox manner (not junit) , enable bdd? fest ( https://code.google.com/p/fest/ , http://fest.easytesting.org ) has been abandoned since 2013 ( https://github.com/alexruiz/fest-swing-1.x ) given github project. java bdd tools such cucumber ( https://cucumber.io ) , jbehave ( http://jbehave.org ) allow junit whitebox style, high-level integration testing, not drive swing ui outside in blackbox manner. switching ui swing javafx not option due human resource constraints. the current related question behind times automated tests java swing guis assertj swing fork fest , seems updated. jubula eclipse , marathon other open source options. marathonite adds bells , whistles marathon, comes support , proprietary license . i aware old question, since comes when search java swing functional test automation, hope useful else.

generics - Swift - Creating a hashable tuple-like struct -

i'm trying create hashable tuple-like object can hold type of object use key in dictionary. use structure in 2 places, once hold 2 ints, , once hold double , mentioned 2 int struct. my current implementation cheats little bit. created struct suple holds 2 ints, , hashable, , struct duple holds double , suple, , hashable. works , figure there must better, cleaner way implement this. after searching , messing around generics can't seem work, advice appreciated. edit: code looks practically identical anton's except after == in declaration of equality. didn't realize needed, , after adding that, works! something this? struct duplet<a: hashable, b: hashable>: hashable { let one: let two: b var hashvalue: int { return one.hashvalue ^ two.hashvalue } init(_ one: a, _ two: b) { self.one = 1 self.two = 2 } } func ==<a, b> (lhs: duplet<a, b>, rhs: duplet<a, b>) -> bool { retu

asp.net web api2 - Registration Azure Notification Hub in WebApi backend from Android client -

we using asp.net webapi 2.2 owin middleware authentication. try integrate azure notification hub our platform. however, not find best way registrating our android client azure notification hub through our webapi backend. should call registration method after token endpoint returns access token?, what should registration id notification hub returns?, instead of generating registration id, couldn't use userid our authenticated push notifications?, and finally, there tutorial tells explicitly how can authenticated push notifications webapi android, because official tutorials not enough after gcm registrationid/token/handle, need register @ azure notification hub , azure notification hub registrationid different gcm registrationid. your app needs store anh registrationid update registration on each app start, backend doesn't need id. you can add user id tag registration identify registrations using user id, see following linked tutorial. this official tutor

functional programming - OCaml function syntax error -

the following code gives error: let alpha = hashtbl.create 26 in let print_and_add = print_char a; hashtbl.add alpha true;; let str = read_line () in string.iter (fun x -> if hashtbl.mem alpha x=false print_and_add x) str what it's supposed do:each time function called (with char argument),it should print char,and add hash table (alpha). tried using other syntax functions: let alpha = hashtbl.create 26 in let print_and_add = (fun -> print_char a; hashtbl.add alpha true) in let str = read_line () in string.iter (fun x -> if hashtbl.mem alpha x=false print_and_add x) str but still want know why first code fails. -thanks help. the ;; symbol marks end of expression @ global level. after has part of different expression. hence alpha can't defined after that. i never use ;; in source code, when typing toplevel. in opinion, that's it's for. your code has let print_and_add ... without corresponding in . valid @ global level

unit testing - Quartz Job Scheduler Not Firing Jobs (C#) -

i've run rather perplexing issue quartz (version 2.2.4) in c# project i'm working on, , in spite of best efforts haven't been able resolve issue. the project requires several different tasks scheduled independently of one-another; being case i've written class handle setting jobs on 24 hour cycle. class supposed instantiated once each task needs scheduled. below object in question: namespace projectfront.utilities { public class quartzscheduler { public const string qb_trigger = "qbtrigger"; public const string qb_job = "qbjob"; public const string qb_group = "qbgroup"; private ischeduler scheduler; private itrigger trigger; private ijobdetail job; private jobkey jobkey; public quartzscheduler(ijob controller, string triggerid, string jobid, string jobgroup, int synchour, int syncminute) { stdschedulerfactory schedulerfactory = new stdschedulerfactory(); schedulerfactory.initiali