Posts

Showing posts from February, 2011

Is an admisible heuristic always monotone (consistent)? -

for a* search algorithm, provided heuristic h, supose h admisible. that is: h(n) ≤ h*(n) every node n, h* real cost n goal . does ensure heuristic monotone? that is: f(n) ≤ g(n') + h(n') every sucesor n' of n, f(n)= h(n) + g(n) , g(n) accumulated cost. no. assume have 3 successor states s1 , s2 , s3 , goal state g s1 -> s2 -> s3 -> g . s1 starting node. consider following values h(s) , h*(s) (i.e. true cost): h(s1) = 3 , h*(s1) = 6 h(s2) = 4 , h*(s2) = 5 h(s3) = 3 , h*(s3) = 3 h(g) = 0 , h*(g) = 0 following path goal can have that: g(s1) = 0, g(s2) = 1, g(s3) = 3, g(g) = 6 , coinciding true cost above. although heuristic function admissible ( h(s) <= h*(s) ), f(n) not monotonic. instance f(s1) = h(s1) + g(s1) = 3 while f(s2) = h(s2) + g(s2) = 5 f(s1) < f(s2) . same holds between f(s2) , f(s3) . of course means have quite uninformative heuristic.

ruby on rails - Share data between ActiveJob and Controller -

every n seconds application requesting remote json file provides live prices securities in trading system. json has block data need ( marketdata ) , block current dataversion ( version , seqnum ). right use actioncontroller::live (with eventsource on client side) push updated data browser. actions done within 1 method: opening sse connection; forming dynamic url; pulling new data remote server; comparing/reassigning seqnum value; updating database if needed. so goal separate pulling & updating database ( activejob ) pushing updated values browser ( actioncontroller::live ). accomplish need: either store somewhere on server side seqnum & version share between controller , background job; or monitor databases latest changes in updated_at fields. so have 2 questions: what more efficient between 2 options above?are there other approaches? (in case first 1 has right exist) how implement approach? considering fact might have, example, mult

javascript - Avoid same option selected multiple times using jquery -

i have 2 tables table1 , table2. each table contains <select> tag , options , values same. now want check each table, there option exists more 1 times. if yes alert option selected. my code is: $('#table1 tr').each(function() { $(this).find('select').change(function() { //alert($(this).val()) if ($('option[value=' + $(this).val() + ']:selected').length > 1) { alert('option selected'); $(this).val($(this).find("option:first").val()); } }); }); $('#table2 tr').each(function() { $(this).find('select').change(function() { //alert($(this).val()) if ($('option[value=' + $(this).val() + ']:selected').length > 1) { alert('option selected'); $(this).val($(this).find("option:first").val()); } }); }); when select same in first table , second table alert option selected. what

c# - How to make FluentValidation ignore a property -

i have following view model public class myviewmodel { public myviewmodelclasswithvalidator mandatoryproperty {get; set;} public myviewmodelclasswithvalidator optionalproperty {get; set;} public class myviewmodelvalidator : abstractvalidator<myviewmodel> { public myviewmodelvalidator() { rulefor(x=> x.mandatoryproperty) //... //no rule property 2 } } } i'm looking way make optionalproperty ignored fluentvalidation. here, validation errors of optional property still added modelstate. this answer suggests either 1. avoid reusing child model, not option in case, , 2. delete errors modelstate. before writing dirty class modelstate httpcontext, i'd know if there's other way i'm unaware of since answer old. my objective keep validation logic encapsulated in viewmodels. thank you okay i've found easy work around. i've created extension class threadstatic field holding

vaadin7 - Drag and drop between two trees using Vaadin 7 -

i have 2 trees:tree1,tree2 , want drag , drop tree1 tree2. problem when want move folder,his childrens don't take right place in tree2. added in tree2 don't true parent (the folder dragged).in fact didn't find how know new id of folder in tree2. here code : private void drag() { tree1().setdragmode(treedragmode.node); // allow nodes have children (final object itemid : tree2().getitemids()) { tree2().setchildrenallowed(itemid, true); } tree2().setdragmode(treedragmode.node); tree2().setdrophandler(new treesortdrophandler(tree2(), tree1())); } public class treesortdrophandler implements drophandler { private final tree tree2; private final tree tree1; /** * tree must use {@link hierarchicalcontainer}. * * @param tree */ public treesortdrophandler(final tree tree2, final tree tree1) { this.tree2 = tree2; this.tree1 = tree1; } @override public acceptcriterion

javascript - How to change Liferay 6.2 site-navigation collapse behavior? -

that's it, default, liferay main navigation being collapsed dockbar, wich hidden not admin users in solution. tryed hooking dockbar , deleting collapse icon, site-navigation keeps hiding on window resize. any ideas please? p.d: saw post: - move collapsed menu button dockbar where problem solved, mention there, think it's not "stylish" way of solving problem , it's give me more problems. thanks reading. on fly tell how solve toggle button in case of no dockbar presence. on custom theme based on classic 1 have customize navigation.vm , insert code have hamburger icon close navigation. (the code not tested) <nav class="$nav_css_class navbar site-navigation" id="navigation" role="navigation"> <div class="navbar-inner"> #* start toogle hamburger menu *# <a class="visible-phone brand btn" data-toggle="collapse" data-target="#navigation"&g

java - JavaFX Transition Equivalent -

i have non-gui application want asynchronously interpolate data on time. i had @ javafx transition api , looked ideal. however, transitions api work has run part of javafx application context - don't want add overhead unnecessarily for. i wondering if suggest equivalent? or i'm going have write myself? i'd use java.util.timer that. can give timertask (basically runnable ) execute every x ms (its period). runs on background thread, assume meant asynchronously? api: http://docs.oracle.com/javase/8/docs/api/java/util/timer.html

Apache / PHP / php-fpm: locale settings change themselves -

i experienced bug apache , php-fpm: locale settings change randomly. here correct locale settings: array ( [decimal_point] => . [thousands_sep] => [int_curr_symbol] => [currency_symbol] => [mon_decimal_point] => [mon_thousands_sep] => [positive_sign] => [negative_sign] => [int_frac_digits] => 127 [frac_digits] => 127 [p_cs_precedes] => 127 [p_sep_by_space] => 127 [n_cs_precedes] => 127 [n_sep_by_space] => 127 [p_sign_posn] => 127 [n_sign_posn] => 127 [grouping] => array ( ) [mon_grouping] => array ( ) ) and here changed settings: array ( [decimal_point] => , [thousands_sep] => [int_curr_symbol] => eur [currency_symbol] => € [mon_decimal_point] => , [mon_thousands_sep] => [positive_sign] => [negative_sign] => - [int_frac_digits] => 2 [frac

java - which is best between string isEmpty and StringUtils.isNotBlank() -

this question has answer here: stringutils.isblank() vs string.isempty() 8 answers i use following code check timing: public static void main(string[] args) throws exception { string foo = "foo"; long start=system.currenttimemillis(); if (stringutils.isblank(foo)); long end=system.currenttimemillis(); system.out.println("isblank="+(end-start)); start=system.currenttimemillis(); if (foo!=null && !foo.isempty()); end=system.currenttimemillis(); system.out.println("sec="+(end-start)); } the stringutils.isblank() method takes 3ms longer simple string.isempty() method. method should use? stringutils.isblank(foo)); checks if string whitespace, empty ("") or null. stringutils.isblank() foo.isempty() returns true if, , if, length() 0. isempty() so if want advanced not

ios - not getting all images when passing images data to imageview -

i parsing xml image urls imageview in detailviewcontroller passed images through shareddelegate .but when click on tableviewcell few images occure in detailviewcontroller . imageview.image = [uiimage imagewithdata:[nsdata datawithcontentsofurl:[nsurl urlwithstring:shareddelegate.imagobj]]]; the above code wrote in detailviewcontroller appdelegate *shareddelegate = (appdelegate*)[[uiapplication sharedapplication]delegate]; shareddelegate.imagobj = [imagesarray objectatindex:indexpath.row]; i wrote code in tableview didselectrow method. you can create image property in detailviewcontroller and tableview didselectrowatindexpath method. call segue [self performseguewithidentifier:@"detailsegue" sender:indexpath]; and set - (void)prepareforsegue:(uistoryboardsegue *)segue sender:(id)sender { if ([[segue identifier] isequaltostring:@"detailsegue"]) { detailviewcontroller *dc = (detailviewcontroller *)[segue destinationview

livecode - How to search hyphenated words -

how search hyphenated words eg(alexander-great) if word present in search list output should alexander-great:1 here 1 indicate how many time particular word present in main scrolling field using following code. on mouseup put fld"mytextfield"into mytext put fld "srtext" mydata split mydata cr , colon put keys of mydata mydata repeat each words myword in mytext if myword among words of mydata if mycounts[myword] empty put 1 mycounts[myword] --answer "haii" else add 1 mycounts[myword] end if end if end repeat combine mycounts cr , colon put mycounts please use code if myword contains words of mydata instead of if myword among words of mydata

business objects - Static Measures in BusinessObjects 4.1 -

is possible make measure in sap businessobjects allways contains same value, , not depend on that's been selected? measure has calculate following: total costs / number of departments if it's possible, please write guidelines on how it. thx! one way implement calculation in sql , put statement in derived table, on base measure. table have exist in separate context other tables, can't link else. it's bit clunky , not semantic layer designed for, it'll work.

ios - Cannot upgrade from Crashlytics to Fabric -

i upgrade application crashlytics fabric. instruction fabric application upgrade code in xcode. when reach step run application, application got error undefined symbols architecture i386 when run on simulator , undefined symbols architecture arm64 when run on iphone 5s. so, should fix this? i've run similar issue evening. don't need crashlytics either, fabric/twitter. i'm using latest ios downloads/sdk fabric/twitter dev site. after using fabric app install fabric/twitter sdk in xcode project got same "undefined symbols architecture arm64" error upon run/compile. i found fix installing crashlytics first (whether need or not), going through steps etc., going in fabric.app , installing fabric/twitter next project. crashlytics installed few libraries , i'm suspecting 1 of them (libc++.dylib ?) might have resolved issue? guess there's bug in automatic fabric.app installation i.e. if install fabric/twitter (v1.8) sdk alone w/o crashlytics th

javascript - Error bars on single points in dygraphs? -

i'm using dygraphs display data errors. theoretical data fine, since makes "error band" around line - great. however, experimental data based on discrete measurements, adding kind of data able display measured points respective error - not drawing error bands nearest available points. i add nan point on each side of data points make error band invisible, - name suggests - invisible, when hovering on point can't see error. is there way implement error bars single data points? when mixed errorbands enabled series? here jsfiddle showing case. line should normal line errorband, line b points per-point errors. thanks lot! you can using custom plotter : function singleerrorplotter(e) { var ctx = e.drawingcontext; var points = e.points; var g = e.dygraph; var color = e.color; ctx.save(); ctx.strokestyle = e.color; (var = 0; < points.length; i++) { var p = points[i]; var center_x = p.canvasx; if (isnan(p.y_bottom)) contin

sonos - How to enable scrubber for tracks in itemType program -

Image
my application delivers tracks programmed radio, using container itemtype program . users allowed use scrubber skip ahead within track. in sonos ui can see scrubber, cannot interact it. is there way enable behaviour? when listening program radio station features disabled. includes skip backwards function , scrubber. unfortunately, there no way override behavior , enable functionality.

r - replace() function recodes entire column -

i using r, , need recode variables in list. list follows: > list1 group.1 x 1 4000 2 3890 where in group.1 column replace instance of 1 male , , 2 female . i have tried replace() function: replace(list1,list1$group.1 == "1", "male") which returns group.1 x male 4000 male 3890 i.e., has relplaced group.1 == 2 male. have missed step? far can see use of replace function - group.1 == 1 should limit replace command values in group.1 equal 1. seems criteria not doing anything. replace operates on vectors, not data.frames. try this: > replace(df$group.1,df$group.1 == 1, "male") [1] "male" "2" and change data, can do: > df$group.1 <- replace(df$group.1,df$group.1 == 1, "male") > df group.1 x 1 male 4000 2 2 3890 what trying looks application factor column levels c("male", "female") .

c - How to print out the members of a struct, weird errors? -

i've been trying print of members of struct have created, there few declarations errors showing saying structs undeclared. have separate function printing members of struct. have no idea on how debug it... please have errors such game1- undeclared (first use in function) , expected = , ; asm or attribute before { token #include <stdio.h> #include <stdlib.h> struct video_game { char *name, *genre, *developer, *platformer, *app_purchase; int release_year, age_limit; float price; }; void print_video_game_details(struct video_game* s) { printf("\ntitle: %s\n", s->name); printf("genre: %s\n", s->genre); printf("developer: %s\n", s->developer); printf("year of release: %d\n", s->release_year); printf("lower age limit: %d\n", s->age_limit); printf("price: $%f\n", s->price); printf("in-app purchase: %s\n", s->app_purchase); } int main(

algorithm - Counting the number of moves for sorting an array if only unit shift are allowed -

so, have array containing integers. need sort it. however, operation can perform unit shift. is, can move last element of sequence beginning. `a1, a2, ..., an → an, a1, a2, ..., an - 1.` what minimum number of operations need sort sequence? the number of integers in array can upto 10^5. , each integer individual value can 10^5 too. also, if array sorted, print 0 else if array cannot sorted unit shifts, print -1. the solution thought of: check if array sorted or not. if array sorted, print 0 else set count = 0 rotate array 1 unit , increment count. check if array sorted: if yes, print count , break, else repeat steps 4-5 till count < (total integers in array). now, above solution has time complexity of o(n^2). because, checking each individual element if array sorted , checking takes o(n) time, , have n elements, makes o(n^2). can suggest me other better approach? thanks! ps: tried hard thinking of other approach. reached uptill counting inversion

import.io - XPath to select 1 element if one of two exists -

i want select 1 element if 1 out of 2 exist while using 2 pages 1st page (price discount) <div class="price"> <span class="originalretailprice">$2,990.00</span> </div> </div> <div class="price"> <span class="saleprice">$1,794.00</span> </div> or 2nd page (only 1 price) <div class="price"> $298.00 </div> i have used //span[@class="originalretailprice"] | (//div[@class="priceblock"])[1] price twice what want select first price when it's class="originalretailprice" or when it's //div[@class="price"]/text()[1] so want make selection work on both pages use // texts @ level inside <div class="price"> : //div[@class="price"][1]//text() result: text='' text='$2,990.00' text='' and filter empty texts with: text()[normalize-space()

javascript - Get multiple <p> elements with Jquery and add them to a div -

i'm trying extract multiple <p></p> elements , append them single div. can seem first paragraph. idea? i'm using code: $("#result").append($wikidom.find('p').html()); you don't need use .html() $("#result").append($wikidom.find('p')); //remove .html() when use .html() give html of first element only, not of paragraphs in jquery set. note using append on element that's in document move old location new 1 (whereas appending html of element copies it).

html - Problems with CSS while using RewriteRule on .htaccess -

i'm having trouble while using rewriterule on local , remote servers. here's situation i'm in right now: localhost/puntvallesgit/index.php?seccion=nosaltres this actual url i want renamed to: localhost/puntvallesgit/nosaltres and localhost/puntvallesgit/nosaltres/ both urls work, meaning, not give me 404 or that, but, second 1 (localhost/puntvallesgit/nosaltres/) there's no css nor js loading correctly. looking html code, can see while using rule, url path js , css gets changed to: localhost/puntvallesgit/nosaltres/css/styles.css yet code has this: <link href="./css/styles.css" rel="stylesheet"> i understand sine i'm rewritting url, /nosaltres ... html code adapts new folder structure, not expected behaviour. also, while using url without final slash (localhost/puntvallesgit/nosaltres) works great (under localhost). i use absolute paths, yet, not ideal thing do, since paths change localhost remote server he

mapreduce - Hadoop Input File Name Issue -

i facing issue below. input folder contains file named : /xyz/pqr/job_ip/output_upto_thu_apr_23_14:53:05_2015.log when starting hadoop job job not able read input if change name of file mv /xyz/pqr/job_ip/output_upto_thu_apr_23_14:53:05_2015.log /xyz/pqr/job_ip/output_upto_thu_apr_23_145305_2015.log then job runs fine... the exception getting when keeping file name output_upto_thu_apr_23_14:53:05_2015.log : caused by: java.lang.illegalargumentexception: java.net.urisyntaxexception: relative path in absolute uri: output_upto_thu_apr_23_14:53:05_2015.log @ org.apache.hadoop.fs.path.initialize(path.java:148) @ org.apache.hadoop.fs.path.<init>(path.java:126) @ org.apache.hadoop.fs.path.<init>(path.java:50) @ org.apache.hadoop.fs.rawlocalfilesystem.liststatus(rawlocalfilesystem.java:329) ... .. caused by: java.net.urisyntaxexception: relative path in absolute uri:output_upto_thu_apr_23_14:53:05_2015.log @ java.net.uri.checkpath(uri.java:1804) @ java.net

php - RSS Validator and "Server returned HTTP Error 302" Error -

i have php file in site create rss, , can see result browser. when want check https://validator.w3.org/feed/ , got error: server returned http error 302: http server returned redirect error lead infinite loop and when want rss file_get_contents, got error: failed open stream: redirection limit reached, ... please solve problem. ;) i solved problem, problem modsecurity :)

Vbscript list all PDF files in folder and subfolders -

well here code can not filter listing using objfile.extension sure thing silly set objfso = createobject("scripting.filesystemobject") objstartfolder = "c:\dev" set objfolder = objfso.getfolder(objstartfolder) wscript.echo objfolder.path set colfiles = objfolder.files each objfile in colfiles if objfile.extension = "pdf" wscript.echo objfile.name end if next wscript.echo showsubfolders objfso.getfolder(objstartfolder) sub showsubfolders(folder) each subfolder in folder.subfolders wscript.echo subfolder.path set objfolder = objfso.getfolder(subfolder.path) set colfiles = objfolder.files each objfile in colfiles wscript.echo objfile.name next wscript.echo showsubfolders subfolder next end sub on run comes error (11, 1) microsoft vbscript runtime error: object doesn't support property or method: 'objfile.extension' you'll want use

ios - Sprite Kit stop playing music file and start from the beginning -

whenever present scene, want start playing music file , stop music playing last time scene presented. i'm trying this. [self removeactionforkey:@"music"]; [self runaction:[skaction repeatactionforever:[skaction playsoundfilenamed:@"music.wav" waitforcompletion:yes]] withkey:@"music"]; should use avaudioplayer or [skaction playsoundfilenamed:] ? also know if there way play music file forever in scenes without starting beginning. to play background music in scenes recommend avaudioplayer . can write code somewhere in appdelegate access scenes. here sample code achieve using avaudioplayer // avaudioplayer *bgmusicloop; - (void)playbackroundmusic:(nsstring *)filename withextenstion:(nsstring *)fileextension { nsstring *filepath = [[nsbundle mainbundle] pathforresource:filename oftype:fileextension]; nserror *error; if(bgmusicloop) [bgmusicloop stop]; bgmusicloop = nil; bgmusicloop = [[avaudioplayer all

how to ios app new version upload on appstore with different system -

ios app has upload on appstore different system , want upload new version of on appstore different system. because when app upload on appstore have make certificate,provisioning profile mac.alll mac have different profile upload app on appstore how upload app on appstore? how make provsioning profile , certificate appstore?

file - c# Save Streamwriter after every 200 Cycles without Closing -

i'm using streamwriter write data file. system.io.streamwriter file = new system.io.streamwriter(path); while(something_is_happening && my_flag_is_true) file.writeline(some_text_goes_inside); file.close(); what noticed is, till close called no data written file. is there way can save contents file before closing. for purpose can use flush method. system.io.streamwriter file = new system.io.streamwriter(path); int counter = 0; while(something_is_happening && my_flag_is_true) { file.writeline(some_text_goes_inside); counter++; if(counter < 200) continue; file.flush(); counter = 0; } file.close(); for more information welcome msdn

ruby on rails - How to test ransack output? Rspec -

i`ve got little problem here , hope me. have list of hotels in table. here view: <% provide(:title, 'list of hotels') %> <h1>list of hotels</h1> <table> <tr> <th><%= sort_link @search, :name, "name" %></th> <th><%= sort_link @search, :breakfast, "breakfast" %></th> <th><%= sort_link @search, :price_for_room, "price room" %></th> <th><%= sort_link @search, :star_rating, "star rating" %></th> <th><%= sort_link @search, :average_rating, "average rating" %></th> <th><%= sort_link @search, :aasm_state, "state" %></th> </tr> <% @hotels.each |hotel| %> <tr> <td><%= link_to ""+hotel.name, controller: "hotels", action: "show", id: hotel %></td> <td><%= hotel.breakfast %>

download a file using a downloadable link into webView android -

i want download file using direct downloadable link webview. links " https://drive.google.com/uc?id=0bw6vr2lnxb3iufjrtk5ozdljata&export=download ". if open link using default browser browser automatically download file. dont want open default web browser want use webview. tried code: webview = (webview) findviewbyid(r.id.webview1); webview.getsettings().setjavascriptenabled(true); webview.loadurl(url); webview.setdownloadlistener(new downloadlistener() { @override public void ondownloadstart(string url, string useragent, string contentdisposition, string mimetype, long contentlength) { // todo auto-generated method stub toast.maketext(getapplicationcontext(), "yes", toast.length_short).show(); request request = new request( uri.parse(url)); request.allowscanningbymediascanner();

multithreading - IOS: opengles and EXC_RESOURCE WAKEUPS -

my team having problems wakeups per second (from here w/s) limit in main thread. when analyzed, how many wakeups caused what, found around 100 w/s unacounted for. after stripping our library element element found out, apples opengles framework problem. linking framework empty app leads 100 w/s in main thread. does have experience problem? possible configure framework in way, takes less of precious resource?

javascript - radio box selected item on angularjs -

i'm wonder how set selected item checked when i'm using radio button list my sample code this <div ng-repeat="vehicle in filteredvehicle"> <input type="radio" name="radiog_lite" id="radio_{{$index}}" class="css-checkbox" ng-value="vehicle" ng-model="$parent.selectedvehicle" ng-disabled="vehicle.enable == '0'" /> <label for="radio_{{$index}}" class="css-label radgroup1" ng-if="vehicle.enable == '1'"></label> <h5>{{vehicle.vehicletypename}}</h5> below have created plunker please me fix selected item selected vehicle on $scope.selectedvehicle plunkr thanks you should bind selectedvehicle object in array. reason behind angular add $$hashkey every object. use $scope.selectedvehicle = {}; $scope.filteredvehicle = {}; $http.get('data.json').then(function(d){ angular.foreach(d.data.

html - How can i make a comment box with an arrow centered on the right border -

something want arrow on right border , centered. responsive? the css .left { width: 920px !important; padding-bottom: 40px; min-height: auto !important; padding-right: 0; float: left; } .left > p:first-of-type { background: #ffd987; font-style: italic; padding: 5px 10px; margin-bottom: 40px; } .tip { background: #fff; border: 1px solid #ccc; padding: 10px; font-size: 1.2em; position: relative; width: 200px; } .tip:before { position: absolute; top: -14px; left: 98px; display: inline-block; border-right: 14px solid transparent; border-bottom: 14px solid #fff; border-left: 14px solid transparent; border-bottom-color: rgba(0, 0, 0, 0.2); content: ''; } .tip:after { position: absolute; top: -12px; left: 99px; display: inline-block; border-right: 12px solid transparent; border-bottom: 12px solid #fff; border-left: 12px solid transparent; content: &

vsto - C# How to Determine if Netwokr Path Exists w/o new Process -

i want check if network drive accessible , exit addin if not. it's outlook 2013 addin in vsto. anyway, search unc if possible \192.168.0.2\wan\ or use drive letter last last resort, not uses same letter drive in our company. anyway if directory.exists("path correct drive letter"); hangs. want see if there or not. can provide assistance , give me small example? oh , way, there answer process spawned net use. wanted without spawning new process wanted know if possible. thanks ton you can run check on secondary thread may cancel if hangs. simplest way use backgroundworker component. see how run simple bit of code in new thread? more information. see how to: create , terminate threads (c# programming guide) in msdn.

optimization - How to Optimize JSP loading by minimizing page load time? -

i working on spring mvc web project .application has jsp page page load time around 11 sec.i want minimize it. page consists of filters , data of filters rendered jstl tags on jsp page.one of filter has list size of approx 4000 records.this results in response size of 2.7 mb. how can reduce response size? i using model.addattribute("model",data) maping data on jsp page , on jsp use jstl looping iterate data. is there way compress jsp size of page reduces on network? edit i solved issue lazy loading of data similar facebook on scroll bar.

javascript - jQuery Destroy / Disable / Trigger Once Waypoints -

i'm trying use imakewebthings waypoints daniel eden's animate.css file essentially, have form appear once enters viewport. once form submitted, should disappear , never reappear. everything working perfectly, except once form submitted, reappears after scrolling , down page. i'm trying either destroy or triggeronce waypoint after completes first time, i'm not having luck. some searches have led me learn these .destroy , etc. javascript methods there anyway accomplish have or need rewrite it? waypoint: $('#contactform').waypoint(function() { $('#contactform').show().addclass('animated fadeinup').one('webkitanimationend mozanimationend msanimationend oanimationend animationend', function() { $('#contactform').removeclass('animated fadeinup'); }); }, { triggeronce: true }); ah simple fix. $('#contactform').waypoint(function() { $('#contactf

network programming - GNetLib - java.net.BindException: Cannot assign requested address: JVM_Bind -

i'm testing server using gnetlib networking on computer. whenever use ip of network, won't let bind. gnetserver netserver = new gnetserver(serverconstants.host, serverconstants.port); netserver.addeventlistener(new servereventlistener() { //random stuff not related problem }); netserver.bind(); my host "76.5.43.21" // not posting actual ip gist. port 43594, , i've tested connection using canyouseeme.org , says success. here full error: java.net.bindexception: cannot assign requested address: jvm_bind @ java.net.dualstackplainsocketimpl.bind0(native method) @ java.net.dualstackplainsocketimpl.socketbind(dualstackplainsocketimpl.java:106) @ java.net.abstractplainsocketimpl.bind(abstractplainsocketimpl.java:382) @ java.net.plainsocketimpl.bind(plainsocketimpl.java:190) @ java.net.serversocket.bind(serversocket.java:375) @ java.net.serversocket.<init>(serversocket.java:237) @ org.gnet.server.gnetserver.bind(gnetserver.java:98) @

css - Does SASS handle multiple level imports? -

problem: changing partial sass file imports, doesn't appear cause sass file generate css file. info: i'm using libsass (have tested both via sassystudio visual studio plugin, , via grunt libsass package grunt-sass . see below details: in sass file file.scss : @import '_file.scss'; in partial sass file _file.scss : body { background-color: magenta; } when save partial file, libsass detects change in _file.scss no updated file.scss , no file.css changes. if save file.scss once again see detected changes libsass, , file.css contains: body { background-color: magenta; } what not detect partial file change , automatically compile sass files importing partial? intended, or doing wrong? further information: clarify little more, issue seems saving partial doesn't cause non-partial sass files recompiled updated data partials. if had _forms.scss partial file, , wished update form input element padding, need save _forms.scss , save file

c# - Winforms showing different values from xml -

i have windows service project contains test.xml file. in properies changed copy always. i have created setup service , after installing service test.xml present in c:\program files(86)\service folder. now want edit test.xml file throgh ui. have created small winforms project 'editxml'. editxml accessing test.xml this document = xdocument.load(system.io.path.combine(appdomain.currentdomain.basedirectory, "test.xml")); i have added editxml.exe setup of services. after installing service editxml.exe present in folder. but when edit using editxml cant see changes in test.xml. why values different test.xml? correct approach? let me know if question not clear. i think have issue inssuficient permissions , windows file virtualization. when installer creates file inside program files folder, sets permission read operations. when try modify file using application running @ user account has write permissions, windows makes illusion file has been wr

websphere liberty - Dynamic Routing service not working , logs says 'Dynamic Routing servicesent 307 response to the client ihsserver13036 because client expired' -

currently, using liberty 8.5.5.5 our product,using dynamic routing feature 1.0.it's working pretty before, after may 20 days or long, not able access web application through http server, after restarted http server, use. i found there warning messages in console.log launching controller01 (websphere application server 8.5.5.5/wlp-1.0.8.cl50520150305-2202) on ibm j9 vm, version pxa6470sr8fp10ifx-20150313_01 (sr8 fp10+iv70681) (en_us) [audit ] cwwke0001i: server controller01 has been launched. [audit ] cwwkg0028a: processing included configuration resource: /opt/ibm/websphere/liberty/usr/servers/controller01/collective-create-include.xml [audit ] cwwkz0058i: monitoring dropins applications. [audit ] cwwkf0012i: server installed following features: [collectivemember-1.0, ssl-1.0, json-1.0, dynamicrouting-1.0, jsp-2.2, restconnector-1.0, admincenter-1.0, servlet-3.0, jaxrs-1.1, jndi-1.0, collectivecontroller-1.0, distributedmap-1.0]. [audit ] cwwkf0011i: server contro

sql - not used mysql comment ( <- not statement) -

i want know mysql comment # , -- # , - cannot used inside comment. i want use comment when going php mysql. special php option: magic_quotes_gpc = off mysql supports 3 types of comments: -- , # , /*...*/ . http://dev.mysql.com/doc/refman/5.7/en/comments.html

Postgresql join on jsonb -

i have tables. orders table: id: integer items: jsonb items table: id: integer title: string price: integer example order record id: 1, items: { "1"=>{"qty"=>3}, "3"=>{"qty"=>12} } example items records id:1, title: "tesla model s" id:2, title: "tesla model w" id:3, title: "tesla model d" please, result: id:1, title: "tesla model s", qty: 3 id:3, title: "tesla model d", qty: 12 in end, did. query works. select json_data.key id, json_data.value::jsonb->'qty' qty, items.title title orders, jsonb_each_text(orders.items) json_data inner join items on items.id = json_data.key::int orders.id=1

php - How to select and decode column value in codeigniter query -

i have table users data password column encoded using encrypt library in codeigniter. now, want select encoded column decode , compare password's user input (login validation). here's code. inserted value this: $this->db->insert("my_table",array("username"=>$this->input->post("username"),"password"=>$this->encrypt->encode($this->input->post("password")))); for validate input way: $data = $this->db->get("mytable"); foreach($data $d){ if($d["username"] == $this->input->post("username") && $d["password"] == $this->encrypt->decode($this->input->post("password")){ //success break; } } this works fine me but, want shorter , cleaner way this. know, also, future coding practice. here's have done far: $this->db->get_where("my_table",array($this->encrypt->decode("

osx - Init NSViewController without nib -

https://stackoverflow.com/a/28334583/4107801 i tried method mentioned in answer crashes bad access every time. maybe private apis have changed or i'm implementing incorrectly. here implementation: override func loadview() { view.frame = cgrect(origin: cgpoint(x: 100, y: 100), size: cgsize(width: 1000, height: 1000)) //view = self.view splitview = nssplitview(frame: view.frame) splitview?.autoresizingmask = .viewwidthsizable | .viewheightsizable splitview?.setposition(300, ofdivideratindex: 0) view.addsubview(splitview!) } loadview doesn't init contentview in controller have manually too. adding view = nsview(frame:cgrect(origin: cgpoint(x: 100, y: 100), size: cgsize(width: 1000, height: 1000))) solved problem.

python - Errors while using GUI function on OpenCV3 -

i installed opencv3 sources. correctly cv2.so library , can access correctly module in python. import cv2 but when use gui functions errors: cv2.imshow('frame',frame) cv2.error: /users/****/****/opencv-3.0.0-rc1/modules/highgui/src/window.cpp:534: error: (-2) function not implemented. rebuild library windows, gtk+ 2.x or carbon support. if on ubuntu or debian, install libgtk2.0-dev , pkg-config, re-run cmake or configure script in function cvshowimage this cmake output, can see cocoa:yes , suppose should ok. any suggestions? general configuration opencv 3.0.0-rc1 ===================================== -- version control: unknown -- -- platform: -- host: darwin 14.3.0 x86_64 -- cmake: 3.2.2 -- cmake generator: unix makefiles -- cmake build tool: /opt/local/bin/gmake -- configuration: release -- -- c/c++: -- built dynamic libs?: yes

PHP use variable from global space inside class -

hi i'm writing code in php. need use variable global scope inside class doesn't work. don't know if need use namespace or not , how ? thank sample : <?php $plantask_global_script = array("one", "two"); $plantask_global_config = array("three", "four"); $myvar = array_merge($plantask_global_script, $plantask_global_config); class env implements arrayaccess { static private $container = $myvar; public function offsetset($offset, $value) { if (is_null($offset)) { self::$container[] = $value; } else { self::$container[$offset] = $value; } } public function offsetexists($offset) { return isset(self::$container[$offset]); } public function offsetunset($offset) { unset(self::$container[$offset]); } public function offsetget($offset) { return isset(self::$container[$offset]) ? self::$container[$offset] : null;

javascript - Function doesn't fire on load, but works on resize -

so working on function resizes font size text fills of container possible across multiple lines without overflow. instance, i want text cover of 1200px of area within div without overflowing possible. script on resize not on load. $(document).ready(textfill); $(window).resize(textfill); function textfill() { $(".textfill").each(function() { var $text = $(this), $parent = $text.parent(); var textw = $text.width(), texth = $text.height(), parentw = $parent.width(), parenth = $parent.height(), ratio = (parentw + parenth) / (textw + texth); var originalsize = parsefloat($text.css('font-size')), newsize = originalsize * (.9 * ratio); $text.css("font-size", newsize); }); } #container { width: 400px; height: 300px; border: 1px solid blue; } .textfill { display: inline; } <script src="https://ajax.googleapis.com/ajax/libs/jque

Polymer 1.0: trouble with data-binding against plain Javascript object -

using polymer-starter-kit-1.0 (to going more quickly) trying establish data-binding against plain javascript objects (instead of other polymer custom-elements). this seems initial value of property binding to. for simplicity: added "test" object name property main app object, app.test = { 'name': 'john doe' } and added element on home page this: <h3>app name: <span>[[test.name]]</span></h3> this display initial value ('john doe'). when change name of javascript object javascript code directly, (on-click event of button) in app.test.name = 'jim smith' nothing changes in one-way bindings. however, if add input element this: <input value="{{test.name::input}}" /> then span element updated when text changed in input element. it if changes made directly javascript not observed polymer. what doing wrong? it looks may have not used bindings property properly. doesn'

git - undo commit in merged branch -

commit graph (how is): * hash1 - (head) last commit * hash2 - merge commit |\ | * hash3 - last branch commit should undone | * hash4 - commit should have been merged instead of hash3 | * hash5 - first branch commit * | hash6 - commit on master after branch creation |/ * hash7 - before trouble began ... commit hash4 last working commit, on different branch (not master). hash3 bad commit breaks project, merged master ( hash2 ). hash1 unsuccessful try fix. how can revert hash4 , merge hash6 working project again? commit graph (how should be): * hash2 - merge commit |\ | * hash4 - commit should have been merged instead of hash3 | * hash5 - first branch commit * | hash6 - commit on master after branch creation |/ * hash7 - before trouble began ... you have several options: git reflog reflog store history of every change made head . can checkout repository given commit (detached head), create branch point , stuff. for example: git reflog .. find out head@{n}

c++ - How can I expand call to variadic template base classes? -

i have set of non-orthogonal policies, of them implementing common named method, policies add safety checks. want users able combine policies allow more complex validation without creating policies each combination case hand. approach creating new policy class combine others. the simplified example below shows c combining class, here method id combined. expected result is, when calling id on c, sequentially call id of each base class. #include <iostream> using namespace std; struct { void id() { cout << "a ";} }; struct b { void id() { cout << "b ";} }; template<class a, class... as> struct c : public a, public as... { void id() { a::id(); as...::id(); // line not work, illustrative. } }; int main() { c<a, b> c; c.id(); //expected: result b } the question is: possible expand as... somehow without using recursive approach, using ... operator? sure. need contex

php - Laravel 5: Access database data from within model -

i'm trying use laravel access data database. have setup model, works fine, i'm trying fetch data table creating method within model fetches data , sets property of model equal fetched data. to fetch data, i'm trying use $this->id property fetch row's id , use fetch data table (eg: someothermodel::where('other_id', '=', $this->id)->get(); ) however, none of data database seems have been fetched model @ point (eg: $this->id null). constructor looks so: public function __construct() { parent::__construct(); $this->other_data = $this->getotherdata(); } is there way call $this->id property database can use within model itself? your syntax seemed me wrong: someothermodel::where('other_id', '=', $this->id)->get(); can try this: someothermodel::where('other_id', $this->id)->get(); reference: https://laravel.com/docs/5.1/eloquent#retrieving-single-models i hope help

go - Wrapping a function call into a closure when using goroutines -

this question has answer here: why golang handle closures differently in goroutines? 2 answers wrapping function call closure leads unexpected behaviour when using goroutines. consider following example: package main import ( "log" "sync" "time" ) var workernum = 5 var wg sync.waitgroup func block() { dur := 300 * time.millisecond //time.sleep() select { case <- time.after(dur): {} } } func startworker(worker int) { i:=0; < 3; i++{ log.printf("worker %d woke up! \n", worker) block() } wg.done() } func main() { i:=0; < workernum; i++ { //go func() { startworker(i) }() go startworker(i) } wg.add(workernum) wg.wait() } test here: http://play.golang.org/p/nmlntkbwvf one can see wrapping startworker(i) func() { startwo

excel - Export specific range into an HTML -

i trying export range ("a1:c10") sheet sheet1 html , save in same directory current workbook. want keep source formatting. i using following code, errors , cannot define destination folder same folder current workbook resides. sub export() dim rng range set rng = sheets("sheet1").range("a1:c10") activeworkbook.publishobjects.add( _ sourcetype:=xlsourcerange, _ filename:=file1, _ sheet:="sheet1", _ source:=rng, _ htmltype:=xlhtmlstatic).publish end sub i tried this: sub export() dim rng range set rng = sheets("sheet1").range("a1:c10") activeworkbook.publishobjects.add( _ sourcetype:=xlsourcerange, _ filename:="c:\exported.xlsx", _ sheet:="sheet1", _ source:=rng, _ htmltype:=xlhtmlstatic).publish end sub source:= expects string value address of range, not range object. the path of workbook contains macro can gotten thisworkbook.path . sub export() dim rng range file1 = th

python - Overloading the __str__ method in the inherited class? -

so have 2 classes defined follows: class a: def __init__(self) self.a = none #constructor initializes vara none def setvalues(self, a) def __str__() return something1 # belongs class b(a): def calla(): self.setvalues(x) # calls setvalues in a. def __str__() return something2 # belongs b in main() , print something1 of class a has been initialised in b . how can this? >>> b = b() >>> print a.__str__(b) something1

javascript - Will java script code ever be exported automatically? -

i've heard said gwt use closure compiler code pruning. if closure compiler wouldn't prune gwt code that's being used javascript javascript code call gwt code long javascript code given closure compiler? work , if why focus on @jsexport , @jstype? excited js interop seems closure compiler offers potential effortless interop.

javascript - Why is my variable unaltered after I modify it inside of a function? - Asynchronous code reference -

Image
given following examples, why outerscopevar undefined in cases? var outerscopevar; var img = document.createelement('img'); img.onload = function() { outerscopevar = this.width; }; img.src = 'lolcat.png'; alert(outerscopevar); var outerscopevar; settimeout(function() { outerscopevar = 'hello asynchronous world!'; }, 0); alert(outerscopevar); // example using jquery var outerscopevar; $.post('loldog', function(response) { outerscopevar = response; }); alert(outerscopevar); // node.js example var outerscopevar; fs.readfile('./catdog.html', function(err, data) { outerscopevar = data; }); console.log(outerscopevar); // promises var outerscopevar; mypromise.then(function (response) { outerscopevar = response; }); console.log(outerscopevar); // geolocation api var outerscopevar; navigator.geolocation.getcurrentposition(function (pos) { outerscopevar = pos; }); console.log(outerscopevar); why output