Posts

Showing posts from August, 2015

javascript - Function not running, no error on firefox -

so, i'm working on random sentence generator. i'm trying work, function not seem running (this saved html file , i'm running in firefox). here's code far: <html> <body> <h1>hello.</h1> <br> <p>this website made me. no, not own domain. however, can run file computer. looking @ website. please enjoy!</p> hey! @ button made! i'm working on more stuff @ this. <button onclick="generatesentence()">click me random sentence!</button> <p id="output"></p> <script> function generatesentence() { alert("test") var subjectran = math.floor(math.random() * subject.length) var verbran = math.floor(math.random() * verb.length) var adjectiveran = math.floor(math.random() * adjective.length) var objectran = math.floor(math.random() * object.length) var adverbran = math.floor(math.random() * adverb.length)

matlab - crop image and display cropped image in axes -

i have image , want crop applied code cropping image not showing cropped image on axes : imrect(iedge2) hplot = plot(xbox, ybox); pause(2) delete(hplot) cla('reset') imshow(i, []); % no need specify 'parent' now. title('cropped image', 'fontsize', 12); i want show message on top of axes area "crop image" when crop process occurs , after selection of area cropped area shown `axes2 .some body please tell me there function or method so? thanks , regards`

ruby - Rails find_in_batches with locking -

i need process large number of records in batches. , each batch should processed in it's own transaction. there way wrap each batch in transaction , lock records in batch @ same time? model.scheduled_now.lock.find_in_batches |batch| model_ids = batch.map(&:id) model.update_all({status: 'delivering'}, {"id in (?)" , model_ids}) # creates , updates other db records # , triggers background job perform_delivery_actions(batch) end does select update in example commits transaction after each batch? or need put internal transaction block , lock records manually inside each batch (which means 1 more query)? the reason don't want put outer transaction block want commit each batch separately, not whole thing @ once. i ended implementing own find_in_batches_with_lock : def find_in_batches_with_lock(scope, user, batch_size: 1000) last_processed_id = 0 records = [] begin user.transaction records = scope.where("id &g

Changing CSS for mobile devices with Javascript -

i've encountered bit of confusing challenge css/javascript. i'm making simple page, , want layout different mobile users. however, can't seem change size of input forms. if user's on mobile, have following javascript run: document.getelementbyid("bookimage").style.display="none"; document.getelementbyid("inputs").style.width="140px"; so hides image, , should reduce width of input boxes 140px. unfortunately, while hides image, input fields unchanged. i took code outside if statement applies device, , on desktop inputs resized. tried setting style.display="none", again works desktop nothing on mobile. cleared phone's cache, no change. when set width directly in css styles section has no effect on phone displays. (i'm using samsung running android if that's relevant.) i can't fathom why works 1 particular function. advice appreciated.

html - post entire form php -

this question has answer here: php: “notice: undefined variable”, “notice: undefined index”, , “notice: undefined offset” 22 answers i'm creating script on website echo contents of entire form. html code looks this: <form action ="forma.php" method ="post" name="form-txt"> first name:<br> <input type="text" name="firstname"><br> last name:<br> <input type="text" name="lastname"> <input type="submit" name="submitsave" value ="submit"> </form> php code looks this: <?php error_reporting(e_all); ini_set('display_errors', 1); //use html name element attach html php scripts //v-----------------=|txt file codes|=-----------------v $text = $_post["form-txt"]; echo $t

php - Change my array dynamically -

i have function returns array this: [ "var0 => 300 pr. d. joÃo", "var1 =>a passar", "var2 =>", "var3 => 904 q.bela vista", "var4 =>a passar", "var5 =>", "var6 => 905 monte virgem", "var7 =>a passar", "var8 =>", "var9 => 300 telheira - c", "var10 =>a passar", "var11 =>", "var12 => 200 cast. queijo", "var13 =>20:39", "var14 =>5min" ] and need result next example: it's necessary in format. [ "route" => "300 pr. d. joÃo", "eta" =>"a passar", "waittime" =>"", "route" => "904 q.bela vista", "eta" =>"a passar", "waittime" =>"", "route" =>" 905 monte virgem", "eta" =>"a passar", &quo

perl - Malformed Session ID Cookie -

set-cookie: sessionid=836cfc64b5856712b040a0b1b3bf4237; secure; httponly set-cookie: watson-dpat=gbjqjag%2fyflxphkcwjvswqpebuumikj38zzfm8uzntboerxbexs4wvxbit5jetjbkeo1rt16pnz6%2bi17ofreqvxjny%2fifzrorvbxxvzdmfkrpfrlxxj6znvfcvurl1dtfw3nl8ne1qdwpukqmnt8%2bd9vfk7bgjlaziht0zfhnffwjt7frcwbujayjkd%2bqui2wtil6b8kglpi6gg1buh5upde%2bc8ovrqyafjrfyoaprdx7khhthdxiv7g%2fznexxhafscqxi4cwea5kg9ygcypr8sio%2fd7woq0kyerhudkbzath53ccii25it5xd0plnt3cvc4bws8txkmt82v9dwcyulto64l%2bgnh30itpyv72xoifheztt2kisfhxmy6z86ueajzznd4ns6rwc7s2e8ldxwylxrcu996xslmzpybgszaeflplg7c%2bcxztlall5fn8emmbgn30w%2brxlntcaj3lrk2nvzqcim1ghmdqoovocsvpwijovbrf8lc75egsr8c%2fovq20fok3ndw4f0upfbegzyuatxjonu7qdrhsglrxxkygvcyhewewuoq2kvti2m%2frd%2bmrx9384p1v6uu8xfau16iqoidv0vew3mlpw4fxcowrqnwky0iiybijrwvcigloiy%2fnxgo7ohw7aacgh1u8iluaurz5aie1bej4l%2fjai91iutessbg6fsxd3aqmlkixdgldjbgtetmoxhxvydjvjsavuqdftokp3ycrnhltzqdq3vg8txtlzecsyqhz7dgwp%2b98p3zjvtad9xb%2bdzxhf4caub7ve99bwo5fo1du3krhx7peakgseldcoxtokjihemmjbeqrbc1qwj4ur9klbpbdibshd

css - Microsoft Edge turning site into responsive -

i have site i've built has basic responsive media queries in small width browsers. nothing fancy. seeing in 1500px + wide monitor, when view site in edge triggers media queries - if viewing site on mobile phone. in every other browser media queries work fine. i curious if has come across before in own projects, or if have special bug showing in edge. appreciated.

c# - Override some Methodes of VirtualPathProvider -

i want use default implemented virtualpathprovider of asp.net mvc web application. in other words want inherit own virtualpathprovider default asp.net virtualpathprovider , override getcachekey method. what should do? anyone can help? cheers create custom virtual path provider class, overriding method want, , call hostingenvironment.registervirtualpathprovider within application_start (defined in global.asax.cs ) install it: protected void application_start() { hostingenvirontment.registervirtualpathprovider(new myvpprovider()); }

angular - Use property from output binding in parent component -

i'm sure must missing simple here, have child component emits object via output event. parent component subscribes output in template this: <div class="tree-panel-container"> <div class="tree-panel-content"> <content-tree (contextselected)="contextpanelselected($event);"></content-tree> </div> <context-panel> <div class="context-panel"> <h2>{{contexttitle}}</h2> </div> </context-panel> </div> within exported class of same component function this: contextpanelselected($event) { console.log($event); } the console.log in function correct, know output object coming through expected. want though use property on output object populate value of {{contexttitle}} in template. can suggest how this? many thanks. you use following: contextpanelselected(value) { console.log(value); this.contextt

python - 'NoneType' object is not subscriptable -- using `np.fromregex` -

this question has many answers (see python math - typeerror: 'nonetype' object not subscriptable ). question different, because correctly expect np.genfromtxt(...) return array (i.e np.genfromtxt(...) not in place function). i trying parse , store following single dimensional array: http://pastie.org/10860707#2-3 to so, tried: pattern = re.compile(b'[\s,]') theta = np.fromregex("reglogtheta", regexp = pattern, dtype = float) this traceback (how should formatted?): traceback (most recent call last): file "/users/ahanagrawal/documents/java/machl/chap3/examscorevisual2.py", line 36, in <module> theta = np.fromregex("reglogtheta", regexp = pattern, dtype = float) file "/library/frameworks/python.framework/versions/3.5/lib/python3.5/site-packages/numpy/lib/npyio.py", line 1240, in fromregex newdtype = np.dtype(dtype[dtype.names[0]]) typeerror: 'nonetype' object not subscriptable if run this, please

c++ - Qt QFileSystemWatcher: signal fileChanged() gets emited only once -

i trying qfilesystemwatcher out , somehow doesn't work expected. or doing wrong? i've set qfilesystemwatcher watch single file. when modify file first time, filechanged() gets emited, that's ok. when modify file again, filechanged() doesn't emited anymore. here source code: main.cpp #include <qapplication> #include "mainwindow.h" int main(int argc, char **argv) { qapplication app(argc, argv); mainwindow window; window.show(); return app.exec(); } mainwindow.h #include <qdebug> #include <qfilesystemwatcher> #include <qmainwindow> #include <qstring> class mainwindow : public qmainwindow { q_object public: mainwindow(); private slots: void directorychanged(const qstring & path); void filechanged(const qstring & path); private: qfilesystemwatcher * watcher; }; mainwindow.cpp #include "mainwindow.h" mainwindow::mainwindow() { watcher = new qfilesystemwatcher(this

mainframe - Join statements in a line -

i'd join few instructions in single line in natural program. : **before statement1 statement2 statement3 **after statemen1 statement2 statement3 i know quite easy doing in languages, i'm not sure it's possible in natural. there aren't restrictions in language prevent putting statements on 1 line. example, here's whole program on 1 line. define data local 1 #a (a10) end-define move 'xx' #a write #a end however, not fun read , applies languages. keep in mind next person having maintain code.

html - marginLeft as a Javascript variable -

i'm trying animate 'div' in mobile version of website. $(function(){ $( "#iconreorder" ).bind( "tap", taphandler ); function taphandler( event ){ $( "#iconreorder" ).animate({ marginleft: "15px" }, 500 ); } }); when 'div' wil change position i'd able tap once again on , let return default position. i tried create 'if' statement...but can't understand why doesn't work. i'd assume 'marginleft' of 'div' variable javascript code in order move right if 'marginleft=10px' , move left (default position) if "new" 'marginleft not equal 10px anymore. i've tried following code: var x = ("#iconreorder").style.marginleft; if (x = "10px") { $(function(){ $( "#iconreorder" ).bind( "tap", taphandler ); function taphandl

loops - Limiting max character output in Java? -

i having trouble formatting output of loop have 15 characters per line. can please help? public class ascii { public static void main(string[] args) { (int ascii = 43; ascii <= 120; ascii++) { system.out.print((char)ascii + " "); } } } this accomplish that: for (int ascii = 43, = 1; ascii <= 120; ascii++) { system.out.print((char)ascii + " "); if (i++ % 15 == 0) { system.out.println(); } }

node.js - Running node-serialport in nw.js -

i trying run node-serialport in nw.js . after following nw.js documentation concerning native modules , node-serialport seems build fine, , runs in regular node process. unfortunately, following error in nw.js console window: {project_dir}\node_modules\serialport\node_modules\bindings\bindings.js:83 uncaught error: module version mismatch. expected 48, got 46. how can run these together? missing obvious? note i'm running: windows 7 x64 node v4.4.4 npm v2.4.1 nw.js v0.15.0 node-gyp v3.3.1 serialport v3.1.2 apparently needed update current version of node (v6.2.0) instead of lts version (v4.4.4). after updating , rebuilding serialport, works perfectly!

java - Adapter constructor of own implementation is not accepting hashMap.values() -

i implemented own adapter arrayadapter<> . within constructor using hashmap gets uuid key , random class called room . basically, smarthome app has rooms carry devices (fyi). however, implementation of constructor roomadapter (found @ https://github.com/codepath/android_guides/wiki/using-an-arrayadapter-with-listview ) using super() - method not take hashmaps. code public roomadapter(context context, hashmap<uuid, room> room) { super(context, r.layout.list_item_room, room.values()); } i @ beginners stage java, don't know have for. tried converting collection received when call room.values() arraylist used before tried use hashmap. is there decent way fix problem @ position in code or have change code , use arraylist room ? the reason hashmap#values() not return arraylist . returns collection<t> object contains of values in map . arraylist<t> collection<t> , collection<t> not arraylist<t> adapter not know co

java - String Palindrome Program -

i created string palindrome program, getting nullpointer exception. here code have written: public class javaapplication2 { /** * @param args command line arguments */ char c[]={'i','c','i','c','i'}; string s = new string(c); string s1=null; int i,j; char c1[]; public static void main(string[] args) { //todo code application logichere javaapplication2 ja=new javaapplication2(); ja.palindrome(); ja.ans(); boolean b1= ja.ans(); system.out.println(b1); } public void palindrome() { for(i=s.length()-1,j=0;i>=0;i--) { c1[j]=s.charat(i); j++; } } public boolean ans() { string s2= new string(c1); if(s2.equals(s)) { return true; } else return false; } } i can't figure out how deal , why error occuring.

eclipse - Cross Deploying Java -

i have java project consists on 3 classes(program,proxy,events) program has main function on it. i have properties file in same level src folder. i want deploy project can run in cronjob on ubuntu server have no idea how so. 1- how deploy it? can see 3 .class in bin folder, thought 1 output file of sort. 2- put settings file when deployed? using eclipse btw from directory, in terminal, run java program run application. you'll want settings file in same directory (depending on how loading in code, if loading classpath resource, spot put it). alternatively, if want have single file, in eclipse, can export code jar file: file > export > java > runnable jar file pick project choose filename jar (usually ending in .jar extension) on last page of wizard, choose program main class to run it, enter java -jar xyz.jar xyz.jar named it.

ios - Is there anyway to view scheduled local notifications -

is there way view of scheduled local notifications app? just trying debugging, , nice see list of notifications, instead of having wait until fire. _mike this gives array local notifications scheduled. can loop through uiapplication *app = [uiapplication sharedapplication]; nsarray *eventarray = [app scheduledlocalnotifications];

amazon web services - Bitnami Multiple sites redirecting to One site -

i new bitnami/apache/aws , have been assigned figuring out why 3 of our sites redirecting 1 specific site. have spent countless hours on , think have narrowed down app.conf files. when try access /wp-admin or /administrator urls take me other site. here 2 of app.conf files. let me know if looks out of place. in advance. main site others redirecting to <virtualhost *:80> documentroot /opt/bitnami/apps/www.blueleafdef.com/htdocs servername blueleafdef.com serveralias www.blueleafdef.com serveralias blueleafdefr.uat.ignitedev.com errorlog /opt/bitnami/apps/www.blueleafdef.com/log/error.log customlog /opt/bitnami/apps/www.blueleafdef.com/log/access.log common <directory "/opt/bitnami/apps/www.blueleafdef.com/htdocs"> options +indexes +followsymlinks -multiviews allowoverride order allow,deny allow </directory> </virtualhost> one example of other site <virtualhost *> documentroot /opt/bitnami/apps/www.fuelsnews.com/htdocs servername

authentication - Spring security WSO2 IS integration - Figure out how to assign authorities/customize wso2 token -

i stuck issue couple of days. so trying assign roles spring security framework. goal decode token wso2 identity server 5.0 through openid , assign role can authorize request based on roles (authorities) this securityconfig class in simple spring boot app @profile("oauth") @configuration @enableresourceserver public class securityconfig { } so, configuration, able decode token. however, in debug mode, when made request id_token simple spring boot app, received error: java.lang.classcastexception java.lang.string cannot cast java.util.collection and happens in defaultaccesstokenconverter class, particularly in line of code when map object converted string [] roles public oauth2authentication extractauthentication(map<string, ?> map) { ... if (user==null && map.containskey(authorities)) { @suppresswarnings("unchecked") string[] roles = ((collection<string>)map.get(authorities)).toarra

java 2d - How to copy a region of an image enclosed by cubic curves -

Image
i have java program works similar bezier tool in inkscape. purpose of program allow user use curves draw path around object (like head of person) , extract (copy) pixels inside enclosed curves. in attached picture, can see there 3 blue curves form enclosed area. i'd know how copy area enclosed these 3 curves? the code use draw curves (i omit red tangent lines , red control points simplicity): cubiccurve1 = new cubiccurve2d.double( p1.x, p1.y, p1control1.x, p1control1.y, p2control1.x, p2control1.y, p2.x, p2.y); cubiccurve2 = new cubiccurve2d.double( p2.x, p2.y, p2control2.x, p2control2.y, p3control1.x, p3control1.y, p3.x, p3.y); cubiccurve3 = new cubiccurve2d.double( p3.x, p3.y, p3control2.x, p3control2.y, p1control1.x, p1control1.y, p1.x, p1.y); g2d.setpaint(color.blue);

html - Grid layout of divs in angular2 -

Image
i have view in application display thumbnails in grid layout. when create divs no content appear desired: when add content divs, layout goes haywire: i can't figure out why happening. i'm using *ngfor directive angular2: <div class="board-thumbnail-container" *ngfor="let board of boards"> <img class="board-thumbnail" [src]="getboardimage(board)"> <h3><span>{{board}}</span></h3> </div> and css behind it: .container { width:400px; } .board-thumbnail-container { position: relative; width: 174px; height: 174px; margin-right: 5px; margin-bottom: 5px; display: inline-block; border-style: solid; border-color: lightblue; border-radius: 7px; padding: 5px; text-align: center; } .board-thumbnail { position: relative; max-width: 160px; max-height: 160px; } .board-thumbnail-container > h3 { position: absolute; bottom: 0px; left: 0;

windows - Get full results of query without install mongodb -

Image
im using windows computer dont have administrator access on (can't install programs). i have mongo query return >1 million results. i save results of query file. since can't install mongodb, can't run query using mongo shell (at least tutorial makes seem way). have tried using robomongo, can't find way make robomongo spit out results of query (without copy+pasting every set of 50). i'm able use robomongo via precompiled binary, means doesnt require installation. this seems easy , common thing do, missing? there way download zipped mongo instalation main windows download page search all version binaries download win32/mongodb-win32-x86_64-2008plus-latest.zip then run mongoexport , enjoy! mongoexport --db test --collection traffic --out c:\traffic.json the other way robomongo want 1000000 documents :-) please see below: enter amount , hit enter.

html - cannot add line of "row numbers" in textarea -

i tried add textarea line of row numbers example: http://alan.blog-city.com/jquerylinedtextarea.htm this code , allready use css , js in project: <!doctype html> <html> <head> <title>code</title> <link href="jquery-linedtextarea.css" rel="stylesheet"> <script src="jquery-linedtextarea.js"></script> </head> <body> <textarea class="lined" name="mytext"></textarea> <script> $(function () { $(".lined").linedtextarea( { selectedline: 1 } ); $("mytext").linedtextarea(); }); </script> </body> </html> what wrong ? it seems forget call jquery library... just add code below on <head> : <script src="http://ajax.googleapis.com/ajax/libs/jquery/1

vim plugin - How to remap a key in Vim with an internal blockwise visual mode call? -

i'm trying map key general function uses [surround.vim] take every line in paragraph , add parentheses. ex: 1 0 1 1 2 1 0 0 3 2 0 0 to (1 0 1 1) (2 1 0 0) (3 2 0 0) i can local macro output {j^v}k$hsb . the map <c-t> {j\<c-v>}k$hsb told on irc use \<c-v> denote blockwise visual segment not work. i've tried variety of other solutions, no success far. :map <c-t> {j<c-v>}k$hsb works me.

python - Tensorflow session returns as 'closed' -

i have ported cifar-10 convnet tutorial code own images , able train on data , generate tensorboard outputs etc. my next step implement evaluation of new data against model built. trying use cifar10_eval.py starting point running difficulty. i should point out original tutorial code runs entirely without problem, including cifar10_eval.py . however, when moving particular code application, following error message (last line). runtimeerror: attempted use closed session. i found error thrown tf's session.py # check session. if self._closed: raise runtimeerror('attempted use closed session.') i have checked directories in files should reside , created, , seems should (they mirror created running original tutorial code). include train, eval , data folders, containing checkpoints/events files, events file, , data binaries respectively. i wonder if pointing out how can debug this, i'm sure there may in data flow got disrupted when transitioning code. unf

amazon elb - Do we need explicitly setup routing table for the subnet where a public ELB is running within? -

(i trying understand how elb networking works within vpc, , post question) when add 2 subnets public elb, aws elb create-load-balancer --load-balancer-name my-load-balancer --listeners "protocol=http,loadbalancerport=80,instanceprotocol=http,instanceport=80" --subnets subnet-15aaab61 subnet-198aab81 , assume need setup these 2 subnets public subnets before running step -- understanding correct? also, assume above public subnets must configured automatically assign public ips each of instances (otherwise, dns resolution of elb destination won't public addressable ip) -- understanding correct? next, have instances running in 2 private subnets , register them elb created above. guess need make sure 2 public subnets , 2 private subnets connected -- do need work make happen? (i.e., default 10.0.0.0/16 -> local rule sufficient? thought so, [1] seems otherwise because added nat rule in context of elb setup procedure) thanks helping me understand elb related netwo

c#: assigning a .tsv file to a string[,] array -

i'm looking write .tsv file string[,] array using readalllines , subsequent loops i'm running lot of null exceptions , array bounds issues. reason i'm going route because other methods have proved complicated me resolve. below code i'm working with: string[] words; public form1() { initializecomponent(); } private void button1_click(object sender, eventargs e) { words = system.io.file.readalllines(@"file.tsv"); int k = words.count(); string[] count = words[1].split(' '); int k2 = count.count(); string [,] wordsnew = new string[k, k2]; (int = 0; < k; i++) { string[] temp = words[i].split(' '); (int j = 0; j < k2; j++) { wordsnew[i, j] = temp[j]; } } } regardless of little changes make , how assign wordsnew , keep running either null exception or index out of bo

Jquery countdown warn user 5 minutes before time over -

i'm using jquery countdown in project ( http://hilios.github.io/jquery.countdown/ ). want warn user 5 minutes before end counter (displaying alert) , 10 minutes after end of counter . in website documentation saw that, there event called elapsed giving information time over. any suggestions please? guess have work event call finaldate. problem fixed. warn user , used offset.minutes event on update callback. here code flag2 = true; $('#clock').countdown(dateseance, { elapse: true }).on('update.countdown', function (event) { if (event.offset.minutes == (4) && flag2) { alert("less 5 minutes before end of counter"); flag2 = false; } we use flag2 display alert once. when counter 4mn 59 s alert displayed.

How to turn number from float into closest whole number php? -

i have form write number , print other numbers until reach "x" number. when write 33.3 output 34.3, 35.3, 36.3 , etc. if 'x' number 100 last printed number 99.3 :/ how can make last printed number int number? , how can make second number 34.3 34? if possible write examples :) here 1 way it. <?php $number = 96.3; $x = 100; while ($number <= $x) { echo $number; if ($number != $x) { echo ', '; } $number = intval($number) + 1; } output: 96.3, 97, 98, 99, 100 intval truncate fractional part of number , convert integer. add 1 number on each iteration of loop until reach x.

c++ - how to make input prompt for 7 column by ifstream -

i typed in file name want show on prompt screen says "'c:\test\sp.csv' not recognized internal or external command," though file available on path. 1 - why did error happen? how fix it? c:\users\ms>c:\test\sp.csv 'c:\test\sp.csv' not recognized internal or external command, operable program or batch file. 2 - code below shows 1 column, if want input 7 columns, how edit code below? how print out on prompt screen using ifstream 7 column header , price. date open high low close volume adj close 6/21/2013 1588.62 1599.19 1577.7 1592.43 5797280000 1592.43 6/20/2013 1624.62 1624.62 1584.32 1588.19 4858850000 1588.19 int main(){ int open; string filename; cout <<"enter file name: "; getline(cin, filename); //c:\\test\\sp.csv ifstream infile(filename.c_str(), ios::in); while(!infile.eof()){ infile >> open; cout << open << endl; }

javascript - How to assign Angular Service object to $scope object -

i'll try keep simple possible. i have controller state 1 saves form object(with several fields) service array upon submit , proceeds state 2. on next page there button go state 1. want user able go , ng-model fields populate saved. function have in controller. var setform = function(){ if (estatesvc.forms[0]){ $scope.personalform = estatesvc.forms[0]; } } setform() using console.log($scope.personalform) . able see estatesvc.forms[0] assigned $scope.personalform . but, example, ng-model="personalform.example" input field not update estatesvc.forms[0].example . controller .controller('personalctrl', function ($scope, estatesvc) { $scope.personalform = {}; var setform = function(){ if (estatesvc.forms[0]){ $scope.personalform = estatesvc.forms[0] } } setform() $scope.addform = function(form, number){ estatesvc.addform(form, number) } }); service .service('estatesvc', function () { // angularjs in

html - Prevent span elements from wrapping -

Image
my ui shows list of email addresses retrieved backbone. rendered span of span s contain span s. here's typical generated html: but getting breaks inside span s (notice beginning of angelstwo on 2 lines), because using wrong html tags ( ul , li sounds better list). can this: i tried div s got 1 entry per line , don't want that. is there can make work span s? or should change else ul , li ? span elements are, default, inline elements. in inline formatting context boxes can wrap. (this happens text when wraps around floated image.) div elements are, default, block elements. in block formatting context boxes occupy available horizontal space ( width: 100% ). this why spans , divs aren't working want. if switch display: inline display: inline-block , you'll block-level behavior, prevent wrapping line boxes, elements stack horizontally other inline elements. w3c references: 9.2.2 inline-level elements , inline boxes 9.2.1 block-l

Read xml file and write ids' values into related textbox in C# -

Image
i have xml file named "numbers.xml" this: <?xml version="1.0" encoding="utf-8" ?> <program> <box id="aaa" value="78678"/> <box id="bbb" value="37287"/> <box id="ccc" value="783"/> <box id="ddd" value="7867"/> <box id="eee" value="786"/> <box id="fff" value="23"/> <box id="ggg" value="453"/> <box id="hhh" value="4537"/> </program> i want read xml file , fill textboxes. in windows forms application txtaaa.text value must take id="aaa" value 78678. likewise txtbbb.text value must take id="bbb" value 37287. how can this? edit: i tried this: xmldocument xmldoc = new xmldocument(); xmldoc.load(openfiledialog1.filename); xmlnodelist nodelist = xmldoc.documentelement.childnodes; xmlnode xmlnode = no

Why is 'git log' so slow on windows 7 64? -

i using 'git log' on windows7 command line , slow. i tried: git/bash extremely slow in windows 7 x64 but did not help. how can speed things up?

SQL Server - Select most recent records with condition -

i have table this. table : id enrolldate exitdate 1 4/1/16 8/30/16 2 1/1/16 null 2 1/1/16 7/3/16 3 2/1/16 8/1/16 3 2/1/16 9/1/16 4 1/1/16 12/12/16 4 1/1/16 12/12/16 4 1/1/16 12/12/16 4 1/1/16 null 5 5/1/16 11/12/16 5 5/1/16 11/12/16 5 5/1/16 11/12/16 need select recent records these conditions. one , 1 record has recent enroll date - select that two or more share same recent enroll date , 1 , 1 record has either null exit date or recent exit date - select record null. if no null record pick record recent exit date two or more same enroll , exit date - if case exists, don't select record so expected result above table should : id enrolldate exitdate 1 4/1/16 8/30/16 2 1/1/16 null 3 2/1/16 9/1/16 4 1/1/16 null i wrote query group by. not sure how select conditions 2 , 3. select t1.* table t1 inner join(select id,max(enrolldate) maxentrydate t

multithreading - Does completableFuture in Java 8 scale to multiple cores? -

lets have single thread calls bunch of methods return completablefuture , add of them list , in end completablefutures.allof(list_size).join()). futures in list can scale multiple cores? other words futures scheduled multiple cores take advantage of parallelism? completablefuture represents task associated executor . if did not specify executor explicitly (for example, used completablefuture.supplyasync(supplier) instead of completablefuture.supplyasync(supplier, executor) ) , common forkjoinpool used executor. pool obtained via forkjoinpool.commonpool() , default creates many threads many hardware threads system has (usually number of cores, double if cores support hyperthreading). in general, yes, if use defaults, multiple cores used completable futures.

algorithm - Why does Python take O(n) time to remove the first element from a list? -

the python wiki page on time complexity says deleting item takes o(n) time. description of deque class in documentation of collections module says " list objects [...] incur o(n) memory movement costs pop(0) , insert(0, v) operations change both size , position of underlying data representation". why lists need o(n) time? isn't list bunch of elements, or pointers elements, physically next each other in memory, along pointer list starts? if so, why can't list type have popleft method, similar 1 in collections.deque , removes first element in o(1) time appropriately incrementing start pointer of list? i not trying solve specific problem. want satisfy curiosity why designed way. edit: here diagram of how popleft method work: before calling popleft : ------------------------------------------------------------------- | | quick | brown | fox | jumps | on | -------------------------------------------------------------------

css - Foundation 6 - columns are not float left? -

i have list of items, put in columns this <div class="small-6 columns"> <img src="img.png" /> <p>title</p> <p>desc</p> <a href="#">abc</a> </div> but, few of them not float left, although set them : float : left !important; .column, .columns in foundation floated left default. if encounter grid issues better need read docs here , make sure call right css , js scripts. script source can found here . select 1 right you. code: <div class="small-6 columns"> <img src="http://placehold.it/350x150" /> <p>title</p> <p>desc</p> <a href="#">abc</a> </div> <div class="small-6 columns"> <img src="http://placehold.it/350x150" /> <p>title</p> <p>desc</p> <a href="#">abc</a> <

apache spark - Use jupyter nbconvert to run pyspark job on standalone mode -

i've ever used jupyter notebook run on pyspark standalone mode. it need set: pyspark_driver_python_opts="notebook ..." pyspark_driver_python=ipython and run ${spark_home}/bin/pyspark --master spark://ip:7077 we use jupyter our production solution, , think jupyter nbconvert excellent command scheduling or daily batch job. currently, still cannot find way use jupyter nbconvert run pyspark standalone. hope can kindly provide experience this. great thanks!

silverstripe - Restricting access to a certain Page Type based on group member is in? -

i working on project gym. have page type called gymlocationpage . every gym have own gymlocationpage added admin - every gym have login each of gym managers. in security area have created group called gym manager , have added them group when member gets created. when gym manager logs in, want them able view , edit their gym's gymlocationpage , no other pages/model admins etc. how go doing particular page type , making sure current logged in user gets edit particular gym's page. e.g bob new yorks gym manager => can access new york's gym location page (can't see other gym locations or other pages etc). john californias gym manager => can access californias gym location page (can't see other gym locations or other pages etc). silverstripe has pretty nice permission management . can create permissions in code , add manually user group. <?php class foo extends dataobject implements permissionprovider { /** * return ma

c# - Conversion of a datetime2 error using a nullable date column and EF 6.1.3 -

Image
we using database first approach (sql server) , defined nullable date column. generated context in visual studio en confirmed [column(typename = "date")] added. when save new record ( we confirmed value either null or has value > 01-01-2000 ) got following exception. conversion of datetime2 data type datetime data type resulted in out-of-range value" exception. we looked @ other questions , this article not find real reason error other changing database column nullable datetime2. known restriction of ef? this happens when datetime field in database optional , value not set. 1 of entity-framework architectural things. i recommend 1 debug issue, see if shows date 0001/1/1 , in case initializing field value or property nullable datetime value-type struct as said (we confirmed value either null or between datetime.minvalue , datetime.maxvalue ) solution 1 can find this: var value = values[name]; if (value datetime) { var date = (

php - Angularjs http.delete is not working after deploying project on server -

i working on laravel5.1 project. while working on localhost using xampp http.delete works fine after hosting project on remote server delete option not working though other properties working fine. here portion of code $scope.removesaletemp = function(id) { $http.delete('api/saletemp/' + id). success(function(data, status, headers, config) { $http.get('api/saletemp').success(function(data) { $scope.saletemp = data; }); }); } 'api/saletemp/' goes saletempapicontroller public function destroy($id) { saletemp::destroy($id); } view part: <tr ng-repeat="newsaletemp in saletemp"> <td>@{{newsaletemp.item_id}}</td><td>@{{newsaletemp.item.item_name}}</td><td>@{{newsaletemp.item.selling_price | currency}}</td><td><input type="text" style="text-align:center"

javascript - What is the error in .catch inside webcam.js file -

in application using webcam. access used webcam.js ( https://pixlcore.com/ ). when opened in eclipse shows error as: syntax error on token "catch", identifier expected . little code snippet: var self = this; this.mediadevices.getusermedia({ "audio": false, "video": this.params.constraints || { mandatory: { minwidth: this.params.dest_width, minheight: this.params.dest_height } } }) .then( function(stream) { // got access, attach stream video video.src = window.url.createobjecturl( stream ) || stream; self.stream = stream; self.loaded = true; self.live = true; self.dispatch('load'); self.dispatch('live'); self.flip();

geospatial - charts as data points(markers) in arcgis javascript API -

i have requirement marker points(graphics) on esri map should dynamic pie chart data set of own. is possible using arcgis javascript api? it kind of depends, how want use it. if want visualize points charts, simplest way create symbology in arcmap , host map service. according supported functionality arcgis server. charts supported. if cannot create service, , want create charts runtime in javascript. option create charts images , add point on map picturemarkersymbol.

java - Select first booking of each vehicle in JPQL -

Image
i'm trying select first booking of each vehicle having difficulties. query have is @namedquery(name = "findbookingbyvehicle", query = "select c.colour, c.seats, c.make, c.model, b.departuredate, b.returndate, b.bookingdate, e.fname, e.lname vehicle c join c.booking b join b.employee e c = b.vehicle , b.employee = e order b.bookingdate, b.departuredate ") but selects of bookings of each vehicle. my table structure is: how go selecting first booking of each vehicle? i ended using query had select of bookings vehicle , removed bookings of later date in ejb.

c++ - How to add multiple conditions in do-while loop? -

how add both string red , blue in while(). add them while(color!="red"||"blue");. when run code points out error, please me this. you have 3 problems. first, need this: while(color!="red" || color!="blue"); then remove semi-colon because otherwise you'll have hanging code block. next, || wrong operator here. should , instead: while(color!="red" && color!="blue") if think logically, need both predicates true. or not appropriate here.

Build java REST API with cassandra -

i trying build rest api cassandra database don't see documentation or examples online, using datastax java driver 3.0.0. public class cassandradbutil { private cluster cluster; private poolingoptions options; private session session; public void connect(string node) { options = new poolingoptions(). setmaxrequestsperconnection(hostdistance.local, 32768); cluster = cluster.builder() .addcontactpoint(node) .withaddresstranslator(new ec2multiregionaddresstranslator()) .withpoolingoptions(options) .build(); metadata metadata = cluster.getmetadata(); system.out.printf("connected cluster: %s\n", metadata.getclustername()); (host host : metadata.getallhosts()) { system.out.printf("datacenter: %s; host: %s; rack: %s\n", host.getdatacenter(), host.getaddress(), host.getrack()); } session = cluster.connect("dropalletcassdb"); } public session getsession()

c# - Difference between these two async implementations -

i using ef's async methods fetch data database. of time well. have come few objectcontextdisposed exceptions of late, , curious why solution works: here original code threw objectcontextdisposed : public task<list<string>> geteventparametermru(eventparameter parameter, int count = 20) { using (var repo = new configurationrepository()) { return repo.geteventparametermru(_currentworkpack, parameter, count) } } here new code doesn't throw: public async task<list<string>> geteventparametermru(eventparameter parameter, int count = 20) { using (var repo = new configurationrepository()) { var result = await repo.geteventparametermru(_currentworkpack, parameter, count); return result; } } could explain me difference is, , why works? just fyi, in usages of method, call await geteventparametermru() thanks geteventparametermru apparently method starts task retrieve data. getev

php - How to save image path into database in Laravel? -

i want upload image , retrieve in database when need this.my code working upload image it's path did not save in database.in database it's showing null .here code: if ($request->hasfile('profilepic')) { $file = array('profilepic' => input::file('profilepic')); $destinationpath = 'img/'; // upload path $extension = input::file('profilepic')->getclientoriginalextension(); $filename = rand(11111,99999).'.'.$extension; // renaming image input::file('profilepic')->move($destinationpath, $filename); }else{ echo "please upload profile image!"; } $profile->save(); my question: how save image path database? and how retrieve image database? updated: profile.php class profile extends model { protected $table = "profiles"; public $fillable = ["firstname","lastname","middlename",&