Posts

Showing posts from February, 2014

c - Make openssl RSA algorithm deterministic -

i trying compile program using openssl emscripten returning bogus keys. key rsa_generate_key() returns same every time, when given same seed, can test might going wrong. i have tried replacing rand_poll own implementation adds same numbers pool , have defined getpid_is_meaningless . what else need remove/disable/replace? testcase appreciated. thanks i want test other parts of program key rsa_generate_key() returns same every time, when given same seed. simply call rsa_generate_key() once, , dump result text file. then, create temporary constants , hard code keys , result calling rsa_generate_key() , replace calls rsa_generate_key() hardcoded constants. furthermore, when done uncomment calls rsa_generate_key() , comment out of constants. alternatively, "define wrapper around rsa key generation , return constant values. have 1 code location needs fixing later." - duncan jones.

node.js - Does Mongoose implement the $isolated operator -

does mongoose implement $isolated operator? can't find in documentation. probably does, add parameter query in official documentation, should work. mongoose wrapper common operations, but, @ same time, can bypass send directly db. then, don't miss feature db.

java - Nested update with select deadlock -

background i using code seems deadlock itself. in java, produces deadlockloserdataaccessexception periodically, , offending statement causing deadlock itself . (this being run in transaction innodb) update set a_field = (select sum(b_field) b b.a_id = a.id) = ? after doing reading, came across for update clause performing locking read. modified code below update set a_field = (select sum(b_field) b b.a_id = a.id update) = ? question is proper add for update lock inside nested update/select ? none of examples on locking reads documentation use for update in way. structure of tables below simplified version fields applicable query table a id int(11) primary key a_field int(11) table b id int(11) primary key a_id int(11) foreign key references (a.id) b_field int(11) indexes the indexes exist single column indexes on both primary keys, , foreign key table a. a plain answer question is: yes, mysql suppor

javascript - How to automatically stop YouTube video outside the viewport? -

i making simple one-page website has youtube embeded video on it. when visitor plays video , scrolls page, , video not in viewport more, video should stop. code built producing error: typeerror: player undefined [break on error] player.stopvideo(); here iframe code: <iframe id="player" width="1280" height="720" src="//www.youtube.com/embed/prn2lxpbsxc?rel=0enablejsapi=1" frameborder="0" allowfullscreen></iframe> here javascript (inside <head></head> ): <script type="text/javascript" src="scripts/jquery.js"></script> <script type="text/javascript" src="http://www.youtube.com/player_api"></script> <script type="text/javascript"> window.onscroll = function () { var player; function onyoutubeplayerapiready() { var player = new yt.player('player'); }

c++ - OpenCV - segfault instantiating surf feature detector -

i using c++ implementation of opencv 2.4.6.1 ubuntu 12.10 on x86_64 architecture. have been experimenting of feature detectors. found issue while instantiating surf detector through featuredetector::create method. i able instantiate , use free detectors such fast or brisk doing: cv::ptr<cv::featuredetector> detector = cv::featuredetector::create("fast"); cv::ptr<cv::featuredetector> detector = cv::featuredetector::create("brisk"); but obtaining segmentation fault @ moment instantiate , try use non free detectors surf or sift doing: cv::ptr<cv::featuredetector> detector = cv::featuredetector::create("surf"); cv::ptr<cv::featuredetector> detector = cv::featuredetector::create("sift"); nonetheless can instantiate them using directly concrete class implements them: cv::ptr<cv::featuredetector> detector = new cv::surffeaturedetector(); cv::ptr<cv::featuredetector> detector = new cv::siftfeaturedetect

Inspect WCF SOAP message payload -

i debugging wcf soap client. can modify client, don't have control on server. inspect actual messages sent , received in order find out why message works in soapui fails when sent client. the communication on ssl, can't use wireshark inspect messages on wire. i have enabled wcf tracing (with logentiremessage="true" ), while enormous amount of data logged, actual response payload not seem logged. shown " ... stream ... " in trace viewer. cant seem find http headers outgoing message in trace. anybody have idea how closer inspecting actual messages? edit: fiddler helped me find problem. (it utf-8 byte order mark in payload, server didn't like.) wfc tracing on other hand "high level" find kind of problem, far can tell. one option use fiddler . option wcf logging (as said), make sure mark log @ both transport , message level. here's works me: <?xml version="1.0" encoding="utf-8"?> <configuratio

mysql - return query of pdo statements -

i querying database pdo prepared statements , can not figure out how return actual query after executing query. have tried print_r($statement); , give the pdo prepared query. appreciated! $sql = ("select * `mysite` `info` :checksite or `users` :checksite"); $stmt = $pdo->prepare($sql); $stmt->bindparam(":checksite", "%$checksite%"); $stmt->execute(); $results = $stmt->fetchall(); foreach($results $row){ echo $row['users']; } this quite complicated task , 1 of drawbacks of using prepared statements. yet api doesn't offer such useful feature out of box. so, way raw sql parse placeholders manually. there home-brewed solutions in answer

asp.net - How to get relative path of image for src attribute -

i want display list of images on asp.net web page. pictures located in folder. aspx code looks this <asp:listview runat="server" id="lvpicturepaths"> <itemtemplate> <img src="<%# container.dataitem %>" /> </itemtemplate> </listview> in code behind have: private void getimagepaths() { list<string> pathforpictures=new list<string>(); var path=server.mappath("~/images/"); foreach(var pp in directory.getfiles(path)) { pathforpictures.add(pp); } lvpicturepaths.datasource=pathforpictures; lvpicturepath.databind(); } the problem src attribute of img tag need relative path, localhost/images... like: c:\inetpub\wwwroot\images\image1.jpg you can use: pathforpictures.add( page.resolveclienturl( system.io.path.combine( "~/images/", system.io.path.getfilename(pp) ) ) ); or

java - How to call a function with array parameters in main application? -

i've been doing tutorial on inheritance abstract class, , pass array function calculation of total price. then, when tried call function in main, didn't work , i've got error according method call. here calculation code in subclasses : public double calcprice(string[] a, int[] qty, int num){ int =0; for(i=0;i<=num;i++) { if (a[i]=="a") price=24.90; } double tot=price+qty[i]; return tot; } this method call in loop. don't know how call method error says " non-static method calcprice() cannot referenced static context " for(int i=0;i<=num;i++) { system.out.println("\t"+a[i]+"\t\t\t"+qty[i]+" "+calcprice()); } the main method static, , can't call non-static code. have 2 solutions. create instance of class performing calculation, , call calcprice on instance. make calcprice static. i suggest option 1 you've been doing research on classe

c - Why is the compiler OK with this? -

i spent embarrassing amount of time last night tracking down segfault in application. ultimately, turned out i'd written: anne_sprite_frame *desiredframe; *desiredframe = anne_sprite_copy_frame(&sprite->current); instead of: anne_sprite_frame desiredframe; desiredframe = anne_sprite_copy_frame(&sprite->current); in line 1 created typed pointer, , in line 2 set value of dereferenced pointer struct returned anne_sprite_copy_frame() . why problem? , why did compiler accept @ all? can figure problem in example 1 either: i'm reserving space pointer not contents points to, or (unlikely) it's trying store return value in memory of pointer itself i'm reserving space pointer not contents points to yeah, exactly. compiler (unless static analysis) can't infer that. sees syntax valid , types match, compiles program. dereferencing uninitialized pointer undefined behavior, though, program work erroneously.

ruby - wysihtml5-bootstrap cursor changing on submit -

i working wysihtml5-bootstrap gem ruby , using live text editor along pusher. when edit text inside 1 of text boxes, updates in other open views of save object. however, when update function called save content in box , update other open views of text, cursor moves beginning , renders service unusable unless user clicks after last word bring cursor ending position. using wysihtml5 .html() function update view of text, possible save cursor position , have cursor move location after .html() function runs? love have cursor not move or placed @ last position after .html() function runs. var channel = pusher.subscribe("update"); channel.bind("edit<%= @guide.id%>", function(data) { // alert('attempting set value: ' + data.message); var wysihtml5editor = $('#some-textarea').data("wysihtml5").editor; // console.log(wysihtml5editor); $(wysihtml5editor.composer.element).html(data.messa

javascript - Regexp (?<=string) is giving invalid group error? -

Image
this question has answer here: javascript/regexp: lookbehind assertion causing “invalid group” error 2 answers i'm trying create regular expression match string <tag>something</tag> , want result return something without tags. i tried using: string.match(/(?<=<tag>).*?(?=<\/tag>)/g); but giving error: syntaxerror:invalid regular expression: /(?<=<tag>).*?(?=<\/tag>)/: invalid group ; why not working? i think this /(?:<(tag)>)((?:.(?!<\/\1>))+.)(?:<\/\1>)/g this handy because \1 backreference matches tag pairs use on text this var re = /(?:<(tag)>)((?:.(?!<\/\1>))+.)(?:<\/\1>)/g, str = "this <tag>some text</tag> , <tag>matching</tag>", match; while ((match = re.exec(str)) !== null) { console.log(match[1],

regex - Parsing (partially) non-uniform text blocks in Perl -

i have file few blocks in file (and in variable, @ point in program). vlan2 up, line protocol .... reliability 255/255, txload 1/255, rxload 1/255^m .... last clearing of "show interface" counters 49w5d input queue: 0/75/0/0 (size/max/drops/flushes); total output drops: 0 .... l3 out switched: ucast: 17925 pkt, 23810209 bytes mcast: 0 pkt, 0 bytes 33374 packets input, 13154058 bytes, 0 no buffer received 926 broadcasts (0 ip multicasts) 0 runts, 0 giants, 0 throttles 0 input errors, 0 crc, 0 frame, 0 overrun, 0 ignored 3094286 packets output, 311981311 bytes, 0 underruns 0 output errors, 0 interface resets 0 output buffer failures, 0 output buffers swapped out here's second block, show how blocks can vary: port-channel86 down (no operational members) ... reliability 255/255, txload 1/255, rxload 1/255 ... last clearing of "show interface" counters 31w2d ... rx 147636 unicast packets 0

Python/MatPlotLib yield odd, unexpected contours -

Image
i'm trying contour plot function that's 0 @ 4 vertices of unit square, , 1 in middle of square. tried this: import matplotlib.pyplot z = [[0,0,0], [1,0,0], [0,1,0], [1,1,0], [.5,.5,1]] cn = matplotlib.pyplot.contour(z) matplotlib.pyplot.show(cn) and got this: i expected series of concentric squares, this: which when do listcontourplot[{{0,0,0}, {1,0,0}, {0,1,0}, {1,1,0}, {.5,.5,1}}, colorfunction -> (hue[#1]&)] in mathematica. what did wrong? edit: realize there's more 1 way draw contours given data. in case, series of concentric circles have been fine. for non-meshed data, suggested in comments, want use tricontour function: >>> import matplotlib.pyplot plt >>> z = [[0,0,0], [1,0,0], [0,1,0], [1,1,0], [.5,.5,1]] >>> x, y, z = zip(*z) >>> cn = plt.tricontourf(x, y, z) >>> plt.show() hth

Syntax for variables in html directory path -

i have page loads of repetitive directory paths images, , of images need replace new files (that same file name, in different directory) when duplicating page. rather updating folder name in each directory i'd replace variable , change variable once when duplicating pages. i've tried bunch of different combinations (like below) can't find works, , google efforts unsuccessful. var shirtloc='shirts/foldernamethatwouldbeupdated/' <img src="'shirtloc'+title.gif" width="952" height="119"> html not programming language markup language , such not provide variables or other programming tools. serverside scripting comes in, php, asp.net , jsp common examples. technically, javascript should not attempt that, comes myriad of problems , possible future issues not want deal with.

ios - MKMapView. create a path on the move -

i trying create line on mkmapview after users path. i've found rather old post, , i'm trying make work explained in accepted answer: does have examples on how create path using mkoverlaypathview? what don't how "extract" array of cllocation objects mentioned. right have set mapview setshowsuserlocations:yes, , updates movement fine, guess can cllocations objects somehow, , continuously draw line? im still ios, gentle. the map show location pin won't notify location changes. want add controller delegate of cllocationmanager , use startupdatinglocation . updates location can save , use add overlays map.

iframe - HTML code for opening a video link in a new frame/window that will remain on top of main window, and move with it as it scrolls -

first, beginner, , apologize in advance if sound ridiculous or not use correct terms. (i think latter issue may why can't find answer despite hours of searching , trying things out.) have figured out how create video link has video pop-up in new, smaller window. new window stay on top of main window, can watch video while i'm scrolling through , reading contents of main window. i have seen done in simple html code moving box of text, can't life of me figure out how make new pop-up video link work. here code i'm using new smaller window, different video source. <a href="#" onclick="mywindow=window.open('http://www.youtube.com/watch?v=6zwbsdprom8','mywindow','toolbar=no,location=no,directories=no,status=no, menubar=no,scrollbars=no,resizable=no,width=600,height=300'); return false;">click here open video in new window</a> i read in other forum entries not possible make pop-up window stay on top, i'm

sorting - Conditional time formula in excel -

i have column formatted "yyyy-mm-dd hh:mm:ss" (aka: datetime mysql). however, of times have not been set (ie. 00:00:00). i'm guessing can't sort time-portion alone of datetime column in excel, think need formula determine if cell has time 00:00:00. can shed light on issue? i'm not sure want results, formula return true/false depending on if time portion 00:00:00 =mod(a1,1)=0

asp.net mvc 4 - No access to Session on Error 400 -

i'm having issue how handle bad request (error 400) in mvc 4 application. followed article: http://www.digitallycreated.net/blog/57/getting-the-correct-http-status-codes-out-of-asp.net-custom-error-pages error pages setup send proper response codes. works codes i've tested far (403, 404, , 500). i'm having troubles 400 error code because lose access session , user objects when error thrown. using session , user generate menus (different users can see different menus depending on role). when call menu controller generate menu, throws null ref exception because there isn't session or user object. read don't have access session until after acquirerequeststate event raised. suspect haven't gotten there yet (how can check in debugger?). other options have? thinking store information in cookie instead of session, i'd rather not...

Can't export fields from certain pdfs with Javascript -

i have directory of 30 or pdf files, , 10 of them won't export fields text file me. i'm using javascript editor in adobe acrobat pro 9 in batch processing portion of program. the program simiple looks this: var fname = this.documentfilename; this.exportastext(true, null, fname + ".txt"); when run 10 files selected should getting text file has same name document processed, instead error log reads warning: no documents processed it doesn't give me other reasons why not end output file. i ran pdfinfo on file generated results , file did not, pretty same , neither encrypted: one didn't work: creator: adobe indesign cs4 (6.0.6) producer: adobe pdf library 9.0 creationdate: tue dec 7 15:58:15 2010 moddate: mon jun 3 12:11:12 2013 tagged: no pages: 5 encrypted: no page size: 612 x 792 pts (letter) file size: 405476 bytes optimized: no pdf version: 1.6 one worked: creator:

Trying to create smooth "swoop" shape using CSS3 -

i'm trying create smooth "swoop" shape css/no images. i've used chris coyier's " tabs round out borders " technique , i'm pretty close, rounding isn't quite smooth i'd like. i've tweaked , tweaked , i'm not getting it. there 2 issues i'm seeing. first is, it's not smooth swoop. jags bit. , second is, of course, in ie (8/9/10) - there's fine line showing in dark blue below main site navigation (home / volunteer etc). don't know if that's related swoop stuff @ apologies if that's off-topic, it's driving me crazy since can't figure out what's causing it. here's site: http://texascasa.wpengine.com/ and here's pastebin of relevant code . i'm using sass - let me know if you'd rather scrape plain css debugging , i'll happy put up. thanks help!

database - Rails 4.0 has_many :through associations, how to pull fields via id? -

i new rails , been playing around creating web app cooking, recipes, etc. work through learning new things. have gotten bit stuck on 1 particular aspect. i have 3 tables set work together: lessons, preparations, , ingredients. my models set this: class lesson < activerecord::base has_many :preparations has_many :ingredients, through: :preparation end class preparation < activerecord::base belongs_to :lesson has_many :ingredients end class ingredient < activerecord::base belongs_to :preparation belongs_to :lessons, through: :preparation end in lesson show view, want show name of ingredient. can seem ingredient_id in preparation table link ingredients. can view display integer (the ingredient_id) not name. i've tried bunch of things, cannot seem access ingredients table. any on how configured correctly? thanks.

xpages how to force a partial refresh afterPageLoad -

i asked question couple months ago, there has been no response thought try again. have block of ssjs manipulates number of values. there computed fields impacted these changes , not display correctly. have refresh button on xpage , partial refresh after works fine. need somehow trigger partial refresh on specific item (a panel in case) last step in afterpageload in ssjs. ideas? thanks refreshing panels ssjs without button, link or bit tricky. but think problem more located in order in wich trying compute fields triggering code in erlier event before fields rendered, avoid displaying wrong values in first place, maby post example code. if want refresh panel again after page has bean loaded try in onclientload clientevent fix it: <xp:eventhandler event="onclientload" submit="false"> <xp:this.script><![cdata[dojo.ready(function(){ xsp.partialrefreshget('#{id:yourpanel}',{}) });]]></xp:this.script>

Get download progress in Node.js with request -

i'm creating updater downloads application files using node module request . how can use chunk.length estimate remaining file size? here's part of code: var file_url = 'http://foo.com/bar.zip'; var out = fs.createwritestream('baz.zip'); var req = request({ method: 'get', uri: file_url }); req.pipe(out); req.on('data', function (chunk) { console.log(chunk.length); }); req.on('end', function() { //do }); this should total want: req.on( 'response', function ( data ) { console.log( data.headers[ 'content-length' ] ); } ); i content length of 9404541

ssis - data transfer from Multiple Excel files to SQL table -

need transfer data multiple excel files sql table. instance there multiple excel files in folder such 1.inr_08012013.xls 2.inr_08022013.xls 3.inr_08032013.xls note: @ datepart increments in file_name. i'm planning create ssis package , import data sql. know can import 1 excel file @ time i'm planning several @ time. there many excels don't want create multiple ssis packages job. i want create 1 ssis package(for multiple excel files) , import data sql. possible thru ssis, give me guidance. thanks! i not ssis user, using google found http://bi-polar23.blogspot.com/2007/08/loading-multiple-excel-files-with-ssis.html and http://codejotter.wordpress.com/2010/04/06/importing-multiple-text-files-using-ssis/ hope helps.

python - Select n random number from a sorted list of numbers -

i have list of numbers in sorted order. there may gaps between consecutive numbers . wrote following code find 50k random numbers list, takes time. there efficient version this? def selectnrandomvalsfromalist(mylist, n): retval = [] randomchoice = random.choice mylistremove = mylist.remove retvalappend = retval.append in range(n): value = randomchoice(mylist) mylistremove(value) retvalappend(value) return(retval) mylist = range(2000000) n =50000 selectnrandomvalsfromalist(mylist,n) don't reinvent wheel. use random.sample : return k length list of unique elements chosen population sequence. used random sampling without replacement. >>> import random >>> l = range(20) >>> random.sample(l, 10) [6, 15, 13, 3, 2, 4, 14, 17, 7, 10]

java - Spring form ModelAttribute field validation to avoid 400 Bad Request Error -

i've got articleformmodel containing data sent normal html form injected spring using @modelattribute annotation, i.e. @requestmapping(value="edit", method=requestmethod.post) public modelandview acceptedit(@modelattribute articleformmodel model, httpservletrequest request, bindingresult errors) { //irrelevant stuff } everything works fine point. problem articleformmodel contains double field ( protected , set using normal setter). works fine long data sent user number. when type word, 400 bad request http error . i've registered webdatabinder controller @initbinder protected void initbinder(webdatabinder binder) throws servletexception { binder.setvalidator(validator); } where validator instance of custom class implementing org.springframework.validation.validator interface don't know next. i'd able parse model, valid http response , display error message in form. initbinder() method called , can call validator.validate()

Grails - Dependencies problems -

i'm new grails , i'm starting new project (a plugin) now, when i'm trying execute commands ggts, generate-controller, run-app following | loading grails 2.2.4 | configuring classpath. | environment set development..... | packaging grails application..... | error error: following plugins failed load due missing dependencies: [hibernate, codecs, controllers, datasource, scaffolding, urlmappings, converters, mimetypes, filters, groovypages] - plugin: hibernate - dependencies: ! datasource (required: 2.2 > *, found: not installed) [invalid] - i18n (required: 2.2 > *, found: 2.2.4) ! core (required: 2.2 > *, found: 0.1) [invalid] - domainclass (required: 2.2 > *, found: 2.2.4) - plugin: codecs - dependencies: ! core (required: 2.2.4, found: 0.1) [invalid] - plugin: controllers - dependencies: ! core (required: 2.2.4, found: 0.1) [invalid] - i18n (required: 2.2.4, found: 2.2.4) ! urlmappings (

javascript - jquery: making button.click & json call work together but keeping them separated -

i have contact form encrypts form message : <script type="text/javascript" src="jquery-1.10.2.min.js"></script> <form name="form_contact" method="post" action="/cgi/formmail.pl"> // other input fields here <textarea name="message" id="message" required></textarea> <button id="sendbutton" type="submit">send</button> </form> the following javascript script works , things form message when people click on send-button: $(document).ready(function() { $("button[id$='sendbutton']").click(function(){ //check if message has been encrypted or empty var = document.form_contact.message.value.indexof('-----begin pgp message-----'); if((i >= 0) || (document.form_contact.message.value === '')) { document.form_contact.submit(); return; } else

shell - Starting unix background process maintaining the order -

i have script starts many processes in background , uses nohup make sure these processes keeps on running - nohup "./$__service_script1.pl" $__service_args < /dev/null > /var/log/$__service_name.log 2>&1 & the problem important me make sure processes starts in order of invocation. way wait until process has started before attempting start process? i tried wait, waits till process finished, want make sure process has started. simplest solution put sleep few seconds in between processes, there better solution ? thanks it depends on mean "definitely started". if mean fork(2) has completed , new process exists, each process started time nohup returns. new process has been created. the problem running there no guarantee how long nohup'ed process gets run before shell returns. when process start "definitely started" depends on process initialization. if not have source of applications or not able modify them other

twitter bootstrap - YiiBoster Extended grid sum operation -

i'm using extend yiiboster (last version) and want add total invoice , want tbsumoperation without success far i don't know how specify column on columns sum so far blank rectangle i copy pasted example page , put after columns=>(), 'extendedsummary' => array( 'title' => 'total employee hours', 'columns' => array( 'hours' => array('label'=>'total hours', 'class'=>'tbsumoperation') ) ), 'extendedsummaryoptions' => array( 'class' => 'well pull-right', 'style' => 'width:300px' ), can help? you have @ line init method 'dataprovider' => $griddataprovider, it result query , bind grid, column name sum should put in `extendedsummary. example: want sum working hours of employees. employee table has column hours this emp_id|name |hour

javascript - How do I make floated elements resize correctly -

i have been trying figure out while , try fails produce result after. so setup follows html <div class="container"> <div class="icon-holder"> <img src="https://cdn3.iconfinder.com/data/icons/free-social-icons/67/facebook_square-128.png" class="icon"/> </div> <div class="icon-holder"> <img src="https://cdn3.iconfinder.com/data/icons/free-social-icons/67/facebook_square-128.png" class="icon"/> </div> <div class="icon-holder"> <img src="https://cdn3.iconfinder.com/data/icons/free-social-icons/67/facebook_square-128.png" class="icon"/> </div> <div class="icon-holder"> <img src="https://cdn3.iconfinder.com/data/icons/free-social-icons/67/facebook_square-128.png" class="icon"/>

php - How to use a different version of cakephp? -

i have downloaded many cakephp versions, 2.3.1 2.3.9, test app using different versions. i know need override /lib directory version want use. but, there more efficient way? i have: /cakephp/2.3.1 /cakephp/2.3.2 /cakephp/2.3.3 /cakephp/2.3.4 .... how can switch version of cakephp easily? maybe link: /home/example.com/www/lib > /cakephp/2.3.2/lib overview: it's simple , requires changing path in single file. details: just keep cake versions in folder above app/ directory - this: app/ cake/ cakephp_1_3/ cakephp_2_1/ cakephp_2_2_beta/ cakephp_2_3_9/ then, whenever want try new version, change line sets cake_core_include_path in app/webroot/index.php file version of cakephp want use. example: define('cake_core_include_path', 'd:\wamp\cakephp\cakephp_2_3_9\lib'); notes: this works online - make sure change path location on server instead of local machine. i find helpful keep cakephp core files separate can

windows - Is there a way to turn off script parsing in PowerShell and execute commands with raw arguments? -

i'm trying pass raw arguments commands through powershell it's failing. powershell tries evaluate arguments before passed commands , result commands wrong arguments. know if there mode in powershell treat commands , arguments they're typed? alternatively, know powerscript quoting rules can escape parts tries evaluate? if using powershell v3 use new --% operator e.g.: tf.exe status --% /workspace:workspacename;* everything after --% until end of line not evaluated powershell. behaves kind of cmd.exe in zone. more info on --% see blog post .

graph theory - Suurballe's algorithm for k-best -

i'm interesting in adapting suurballe's algorithm find best k paths source destination instead of 2 best. think people time i've been searching hours , can't find paper explains clearly. there's reference paper on suurballe's wikipedia page talks it, gives no detail on extension past first 2 (how graph modified , results merged, etc.). incidentally, i'm working on vertex-disjoint problem, not edge disjoint problem spelled out on wikipedia. my concise question: how extend suurballe's algorithm beyond 2 paths? in literature called successive shortest paths problem, , works in same way, repeated. modify each discovered path's weights in same way modified first.

javascript - Google Maps API v3 - Snap to polyline edges -

does knows how make marker or polyline snap coordinates of existing polyline? i'm looking behavior in googlemaps engine lite: https://mapsengine.google.com if select polyline or marker there , try edit polyline coordinate (using ctrl or shift) snap marker or polyline coordinates there is, far know, no easy way it. polylines have locations (latlng objects) pass them , it. so, in mind, can take 2 approaches: instead of polyline , can draw polygon . change polyline include more points. polygon with approach, have draw thin polygon, thin enough line. wit approach can check if marker inside polygon using containslocation() method, , if not, set new position inside polygon. the drawback polygon needs very, thin, , need set width line. if width big, dragging inaccurate, , if small may miss it. polyline with approach, have add multiple points polyline, , move marker 1 of points every time went out. this way there no need create width calculate line,

repository - Untrack files from git in worktree -

i have 3 machine, local -> server -> server b , programming on local, use git push local code server a, on server set hook push code server b, both on server , server b have configure this $ git config core.worktree /home/www $ git config core.bare false $ git config receive.denycurrentbranch ignore and have hook git checkout -f how can change files on server b , not track it? i try git update-index --assume-unchanged path/to/file alway notice fatal: unable write new index file i'm sure user have permission in folder(can write, read , execute) try git update-index --skip-worktree path/to/file doesn't work you should have .gitignore file in repository. can include files should not tracked .gitignore , read more here .

python - How to compare the attributes start with $ in 2 functions and display match or mismatch -

my input file contain attributes if(match($option_enabledetails, "1") or match($option_enabledetails_juniper, "1")) { details($junifilexferstatus,$junifilexfertimestamp,$junifilexferindex) } @extendedattr = nvp_add(@extendedattr, "junifilexferstatus", $junifilexferstatus, "junifilexfertimestamp", $junifilexfertimestamp, "junifilexferindex", $junifilexferindex) i got lot of cases in input file, how can compare instances start $ in details , instances start $ in nvp_add here? import re caselines_index = [] cases = [] readlines = [] def read(in_file): global cases global caselines_index global readlines open(in_file, 'r') file: line in file.readlines(): readlines.append(line.strip()) line in readlines: case_search = re.search("case\s\".+?\"\:\s", line) if case_search: caselines_index.append(readlines.in

html - Border-bottom 1px too long on both sides CSS -

Image
what doing: on hover of button addding border-bottom of 5px. js fiddle: http://jsfiddle.net/mucnb/ problem: the problem border bottom extends 1px far on both left , right side. question: does know how fix this? relevant code: #main-nav li { display: block; padding-top: 15px; text-align: center; height: 35px; font-size: 18px; line-height: 18px; color: #fff; text-decoration: none; background-color: #00a0c8; } #main-nav li a:first-child, #main-nav li a:nth-child(2) { width: 224px; border-right: 1px solid #ffffff; } #main-nav li a:nth-child(3) { width: 225px; } #main-nav li a:last-child { width: 224px; border-left: 1px solid #ffffff; } #main-nav a:hover { height: 30px; border-bottom: 5px solid #0bc6f5; } since css borders 'miter' @ edges, you're going notice phenomenon. work around this, i've created rules highlight li behind a on hover. creates effect getting clean border @ bottom. can retain white separators between elements then.

java - Spring Social & JPA - Having two datasources pointing to the same database -

i working on java application uses spring social communicate twitter. application uses spring data (jpa) manage users locally. when authorize access on twitter , twitter makes request oauth1 callback url, application chokes , see following in log file (i've shortened stacktrace): error 2013-08-18 16:05:09,511 http-bio-8080-exec-44] org.springframework.transaction.interceptor.transactioninterceptor [transactionaspectsupport.completetransactionafterthrowing (): "application exception overridden rollback exception"] org.springframework.jdbc.uncategorizedsqlexception: preparedstatementcallback; uncategorized sqlexception sql [insert userconnection (userid, providerid, provideruserid, ra nk, displayname, profileurl, imageurl, accesstoken, secret, refreshtoken, expiretime) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)]; sql state [null]; error code [0]; can't operate on closed connection!!!; nested exception java.sql.sqlexception: can't operate on closed connect

Handling the Post event on Google Interactive post -

i use google interactive post let logged in user invite external users site. register invite on site once user has chosen post 1 of connections on google plus. is there way handle post event , know whether user has posted or not , invoke handler accordingly? here's how call today. var options = { contenturl: myurl, clientid: googleappid, cookiepolicy: "single_host_origin", prefilltext: text, calltoactionlabel: "start", calltoactionurl: somethingstring, recipients: connectionid, onclick: dosomethingonclick(), }; gapi.interactivepost.render('submit', options); just onclick there event onpost supported? there's onshare: function(response){ console.log('callback done'); // these objects returned platform // when sharing starts... // object {status: "started"} // when sharing ends... // object {action: "shared", post_id: "xx

Linux service can't load library path in the /etc/ld.so.conf.d -

i have service in linux. when start use service start or start in init.d. can't load config has stored in /etc/ld.so.conf.d/. process load library path in /etc/ld.so.conf.d/. can't launched service. but when run servcie script in shell, works fine. how load library path in /etc/ld.so.conf.d/? thanks lot. did run ldconfig (as root) lately? there's shared library cache that's updated program, , if updated file in /etc/ld.so.conf.d without running ldconfig , cache data out of date.

python - How to create a scipy.lti object for a discrete LTI system? -

as in subject, i'm using python/numpy/scipy data analysis, , i'd create object of class lti discrete system, specifying (num, den, dt) or (zeros, poles, gain, dt), or (a, b, c, d, dt), documentation never mentions how that. there nevertheless functions dsim/dstep/dimpulse take lti object , things it, guess it's possible. once have it, i'd things convert 1 representation (num/den -> zpk -> a,b,c,d), plot bode diagram, etc. also, it's not clear me if (num, den, dt) representation use coefficient z or z^-1, don't think there clear standard. it seems scipy.signal.lti class meant continuous time systems. checking documentation of example scipy.signal.dstep , 1 gets: system : tuple describing system. following gives number of elements in tuple , interpretation. * 3: (num, den, dt) * 4: (zeros, poles, gain, dt) * 5: (a, b, c, d, dt) so argument system cannot object of class lti . while documentation of scipy.signal

node.js - Counting visitors in a node http server -

my source code: var http = require("http"); var count=1; http.createserver(function(request, response) { response.writehead(200, {"content-type": "text/plain"}); response.write("hi, number "+count+" visitors"); response.end(); count++; }).listen(8888); i got 1,3,5,7,..... in each visit. why increment count 2? the request favicon.ico triggering request (i confirmed logging details each request , making normal request chrome). you need explicitly type of request (url, method, etc) you're wanting match. also, keep in mind, if server dies, @ stage, count reset. if don't want that, should persist somewhere less volatile, such database.

Why won't this Regex match in C# console, but yet matches in http://gskinner.com/RegExr/ -

given code: class program { static void main(string[] args) { var input = @"<rets replycode='0' replytext='v2.7.0 2235: success'> <count records='35' /> <delimiter value = '09'/> <columns> propobjectkey propmediakey propmediatype propmediaexternalkey propitemnumber propmediadisplayorder propmediasize propmimetype propmediabytes propmediafilename propmediacaption propmediadescription propmediaurl propmediacreatedtimestamp propmediamodificationtimestamp county propmediasystemlocale propmediasubsystemlocale uniqueid listingid propertytype propmediapixellength propmediapixelwidth </columns> <data> 98317611445 98317632498 50000967225 31 31 50045650613 10000000378 77466 db http://example.com/image/v2/1/yismirdzpzraa785vjagk9b6hz39r15uf8fhs6znryqlhh5oxnifwcpwucd464mb_qolrocd0mzi3tcxxf7-otxuyl_nn4cpoxbmfi2_nsjfj