Posts

Showing posts from June, 2012

f# - Compile-time constraint for complete pattern match -

i'm looking warning number incomplete pattern matches. know is? more fully, want make fsc.exe return incomplete pattern matches compile-time errors rather warnings + run-time exceptions. know warning number is? specifically, relates compiled .fs / interactive fsi .fsx repl interaction. the warning: incomplete pattern matches on expression. example, value 'lalala (_)' may indicate case not covered pattern(s). how customise: see "--warnaserror[+|-] []" ref: https://msdn.microsoft.com/en-us/library/dd233171(v=vs.140).aspx use --warnaserror+:25 to know 1 produced myself warning using let f (some x) = x gaves me warning fs0025: incomplete pattern matches on expression. e xample, value 'none' may indicate case not covered pattern(s).

c++ - not reading file line by line -

so need read n numbers file , print on screen prime. code determine if number prime working after checks number doesn't want check other n numbers. #include <iostream> #include <fstream> #include <conio.h> using namespace std; int main() { int n = 0; unsigned int x = 0; cout << "n= "; cin >> n; ifstream f("numbers.txt"); (int = 1; <= n; i++) { int p = 1; f >> x; if (x % 2 == 0) { if (x == 2) cout << x << endl; } else { (int = 3; <= x / 2; i++) { if (x%i == 0) p = 0; } if (p == 1) cout << x << endl; } cout << "i= " << << "x= " << x<<endl; } f.close(); _getch(); return 0; } the file 53 34 65 234 756 342 988 997 1 2 97 234 87 234 867 37 234...

documentation - doxygen generated makefile references missing utility - docsetutil -

trying build documentation project. the project uses doxygen product rpm contains /usr/bin/docsetutil binary? doxygen 1.8.4 generated output makefile looking it... thx. that binary part of mac os x developer toolchain. on os x 10.9.5 system, exists @ /applications/xcode.app/contents/developer/usr/bin/docsetutil . i don't know of workaround other platforms, you'll want have makefile or separate doxyfile or doesn't attempt build docset unless you're on os x system. , build docsets on mac, if have access one. it interesting see if free replacement docsetutil gnu/linux ever pops up, dash developer has opened door offline documentation browsers on other platforms use docsets ( e.g. , zeal ). far know (and don't know much), dash web site @ kapeli.com acting central repository @ moment. ref : had same question, , discovered answer in this otherwise unrelated bug report typo3 cms. i'm leaving answer here other folks find way of search engin...

Are there limits to Selenium grid -

i got requirement client implement selenium grid. requirement details follows: number of nodes running concurrent test cases: 200-250 3 selenium nodes per machine (~ 66 85 machines running 200-250 nodes) every machine windows machine , has 8gb ram the test cases long-running in nature. 10000 steps per test case. (click, type etc considered test steps) the option of using grid services providers browserstack ruled out. have grid setup locally. i looking answers questions like, has tried grid setup such level of complexity? there limitations of selenium support such large setup? there performance impact due excessive context switches between threads? problems should prepared face? thank help. it seems possible me. things consider: long running tests many steps should broken down smaller test units. each grid node, if have 8gb of ram , dual-proc, should able handle 10+ browsers, not 3. if tests simple, use phantomjs 2.x headless browser , more speed , throug...

java - Getting values with jedis pipeline -

i have list of ids want use retrieve hashes redis server using java client jedis. mentioned in documentation, jedis provides way use pipeline declaring response objects , sync pipeline values: pipeline p = jedis.pipelined(); p.set("fool", "bar"); p.zadd("foo", 1, "barowitch"); p.zadd("foo", 0, "barinsky"); p.zadd("foo", 0, "barikoviev"); response<string> pipestring = p.get("fool"); response<set<string>> sose = p.zrange("foo", 0, -1); p.sync(); however, list has variable length keeps changing every few minutes. thus, not able predict number of response objects need declare. there way around that, like: pipeline p = jedis.pipelined(); response<list<list<map<string,string>>> records; (int id: ids) records.add(p.hgetall(id)) p.sync(); i guess want achive done this. list<response> responses = new arraylist<>(); p...

Javascript returning array into index[0] of return function array -

completely new javascript, attempting webgl project. here working towards in end, idea have 2 loops // create vertex data grid drawn function creategrid(gl, x, y) { var vertexbuffer; vertexbuffer = gl.createbuffer(); gl.bindbuffer(gl.array_buffer, vertexbuffer); var matrix= [] for(var = 0, < x, ++i) { for(var j = 0, < y, ++j) { matrix.push(createsquare(i,j)) } } gl.bufferdata(gl.array_buffer, new float32array(matrix), gl.static_draw); var grid = {buffer:vertexbuffer, vertsize:3, nverts:matrix.length, primtype:gl.triangle_strip}; return grid; } i trying dynamically create wall of squares essentially. have 2 functions. // create vertex data square drawn function createsquare(gl, x, y) { var square = [ x+ .5, y+ .5, 0.0, x+ -.5, y+ .5, 0.0, x+ .5,y+ -.5, 0.0, x+ -.5,y+ -.5, 0.0]; return square; } // create vertex dat...

How directory structure for Web project (html + css + js + java/spring) should look with javascript Jasmine unit tests? -

i trying incorporate project jasmine javascript unit tests. should put in source tree? current structure: projectname/ css/ img/ js/ index.html (etc) it should in public directory, or outside of it? incorporating frontend part java spring project. should whole structure should like? i go similar fashion have java unit tests set up. if have source folder @ root of project , test folder same package layout , classes serve tests, same thing @ root of web project: js_test, jstest ... the question you're asking unfortunately has no standard. @ point developer decide layout of his/her own project. in industry has own benefits (perhaps in terms of propriety) @ end of day different team or developer may have different layout developer among his/her own projects.

javascript - JQuery - How can I determine if a specific class has been Toggled? -

<div class="tab1"><div> <div class="tab1 active"></div> given code above how can tell using jquery tab1 class has been changed or 'made active' one solution think there better version of adding id tab1 div , checking if class has 'active' appended on it. [psuedocode below] $('#tab1').click(function() { var myclass = $(this).attr("class"); if(myclass.stringat(6-12) == active){ // } }); you can use hasclass() check whether has class active . note in code tab1 class , not id should be $('.tab1').click(function() {//note tab1 class in code if($(this).hasclass('active')){// check if div has class active or not //do operation }) })

dll - how to use OpenSmile in C# and MFCC Extraction -

i wanna use opensmile library in c# , extract mfcc feature of wav files, don't know how can use 'opensmile_release.dll' there 1 can me? i export main file function , create native dll. then import c#.

ruby - How to make a method to split two strings in an array? -

i'm trying return 2 strings in array individual words: list = ['hello name ryan', 'hole me llamo'] def splitter(inp) inp.each.split(' ') end print splitter(list) this returns: ruby splitter.rb splitter.rb:4:in `splitter': undefined method `strsplit' # <enumerator: ["hello name ryan", "hole me llamo"]:each> (nomethoderror) splitter.rb:7:in `<main>' it works if don't use .each , use inp(0) or inp(1) 1 string returns. how can both strings returned? here 1 should : def splitter(inp) inp.flat_map(&:split) end splitter list # => ["hello", "my", "name", "is", "ryan", "hole", "me", "llamo"] in code inp.each method call array#each , without block gives enumerator . , string#spilt exist, there not method enumerator#split , that's why nomethod error blows up. and if want array of words each i...

android - Binary SMS not working -

i sending binary sms 1 emulator another, both galaxy nexus api 22. message gets sent, 3 problems arise: on sending emulator, default sms app displays sms normal sent text message. on receiving emulator, notification pops when sms received, , sms appears in default message app normal received text message. my app not receive binary sms. sender (main activity oncreate): button.setonclicklistener(new view.onclicklistener() { @override public void onclick(view view) { smsmanager.getdefault().senddatamessage( "5556", null, (short) 2345, "this binary sms!".getbytes(), null, null); } }); manifest entry receiver: <receiver android:name=".receiver" android:exported="true"> <intent-filter> <action android:name="android.intent.action.data_sms_received" /> <data ...

swift - Updating Current Location -

let locationmanager = cllocationmanager() @iboutlet var map: mkmapview! func getlocation ()-> cllocation! { self.locationmanager.startupdatinglocation() sleep(1) self.locationmanager.stopupdatinglocation() var x = locationmanager.location return x } override func viewdidload() { super.viewdidload() self.locationmanager.desiredaccuracy = kcllocationaccuracybest self.locationmanager.requestwheninuseauthorization() var mapcoord:cllocation! = getlocation() var maplat:double! = mapcoord.coordinate.latitude //where thread error var maplong:double! = mapcoord.coordinate.longitude //setup of rest of map completed my code above, in swift. receiving error: thread error of unexpected nil value while calling coordinates getlocation() function. changed both maplat , maplong test causing nil. app load receive message in output saying current location cannot updated have no asked permission; however, have function request permission ...

Spring bean injection throwing null pointer exception -

i'm trying inject beanb beana, reason, spring injection isn't working. when try use beana in beanb, i'm getting null pointer exception. here configuration... web.xml <?xml version="1.0" encoding="utf-8"?> <web-app id="webapp" version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"> <context-param> <param-name>contextconfiglocation</param-name> <param-value> /web-inf/spring/application-context.xml </param-value> </context-param> <listener> <listener-class>org.springframework.web.context.contextloaderlistener</listener-class> </listener> </web-app> application-context.xml <?xml version=...

shell - BASH script : usage displays even if you provide a switch without argument -

i've tried many ways , i'm stumped. when try sudo admpanel -a without argument script displays message usage() method instead of error msg i've built it. on other hand if sudo admpanel -a firstname displays me error msg portion. if enter sudo admpanel -a firstname lastname functions way supposed to. below script : #!/bin/bash # program name : admpanel.sh progname=${0##*/} version="1.0" script_shell=${shell} usage() { echo "usage: ${progname} [-h|--help ] [-a|--add] [-r|--remove] [-d|--display] [-c|--check] [argument_1] [argument_2]" } help_message() { cat <<- _eof_ ${progname} ${version} add/remove/display user(s) on admin panel. please note password hardcoded. please consult system administrator if don't know it. $(usage) options: -h, --help displays help. -a, --add add user -r, --remove remove user -d, --display display users -c, --check check specific user ...

javascript - How to call the console debug pannel in firefox addons -

java-script : i call "ctrl + shift + j" open console what's method call window on firefox addon ? i use "custom buttons" addon thanks here how open console pannel var win = event.target.ownerdocument.defaultview; win.gdevtoolsbrowser.selecttoolcommand(win.gbrowser, "webconsole"); also possible hudconsoleui.togglebrowserconsole();

ios - Swift - Allow Rotation on iPad Only -

Image
how allow universal app written in swift on ios 8.3 sdk support portrait mode on iphone, both portrait , landscape mode on ipad? i know in past has been done in appdelegate. how in swift? you can programmatically, or better yet, can edit project's info.plist (which should more practical, since it's global device configuration) just add "supported interface orientations (ipad)" key

Oracle SQL: Can I combine columns from different tables into one table? -

i wonder if can combine columns different tables 1 results. table a: id cola colb 1 b table b: id colc cold cole 1 c1 d1 e1 1 c2 d2 e2 table c: id colf colg 1 f g expected results: id cola colb colc cold cole colf colg 1 b c1 d1 e1 f g 1 c2 d2 e2 is there way combine columns different tables one? thank in advance. i 'simple' solution full outer join , however, not give gaps have second row (because tablea contains 1 row). so, solve that, can make little more complex , generate numbers per id each of tables. can make full outer join on each of subselects, , use generated row number second field in join. way, won't cartesian product, , you'll result drew it, gaps missing rows. i don't have database @ hand test it, let me know if works. select coalesce(a.id, b.id, c.id) id, a.cola, a.colb, b.colc, b.cold, b.cole, c.colf, c.colg (select id, row_number() on...

sql server - PowerBuilder 12.5.1 and Windows 8 incompatibilities? -

i have powerbuilder 12.5.1 application developed on windows 7 64-bit. have running on windows 8.1 64-bit, connecting microsoft sql server 2008r2. application starts, display initial window lots of textboxes/checkboxes/etc , can access database powerscript , read output of query variable. when application tries open window containing datawindow, crashes. doing wrong?

java - Changing only 1 JTable column renderer from default -

hello have following situation, want set columns in jtable specific renderer (centered) , want right column have background color yellow. i've tried following code: public class lview extends jinternalframe { private static final long serialversionuid = -4248667075312220111l; private lmodel model; private jpanel mainpanel; private jbutton btnrefresh; private jtable ltable; private defaulttablemodel ltablemodel; private string [] columnnames = {"col1", "col2", "col3", "col4", "col5"}; public lview() { super("l title", true, true, true, true); setsize(650,300); mainpanel = new jpanel(new flowlayout()); jpanel toppanel = new jpanel(); btnrefresh = new jbutton("refresh"); btnrefresh.addactionlistener(new actionlistener() { @override public void actionperformed(actionevent arg0) { try { model.refresh(); } catch (exception e) { model.logexcep...

android - Following Google's tutorial, getting errors about ViewHolder not being able to hold a View, wants a TextView instead -

so, official documentation, bet i'm doing wrong somewhere can't understand how supposed work. take @ example code of "creating lists , cards": https://developer.android.com/training/material/lists-cards.html in source code of myadapter class, following lines can found: // provide reference views each data item // complex data items may need more 1 view per item, , // provide access views data item in view holder public static class viewholder extends recyclerview.viewholder { // each data item string in case public textview mtextview; public viewholder(textview v) { super(v); mtextview = v; } } // create new views (invoked layout manager) @override public myadapter.viewholder oncreateviewholder(viewgroup parent, int viewtype) { // create new view view v = layoutinflater.from(parent.getcontext()) .inflate(r.layout.my_text_view, parent, false); ...

sip servlet - Mobicents SIP error response handling - what's the proper way to re-proxy? -

the mobicents sip servlet container appears handle error responses differently other sip containers i've used. situation that: on receipt of invite, app handles , proxies (supervised) downstream (so may receive responses invite). on receipt of error response initial target, app proxies new destination (in non-supervised way). this should prevent initial error response propagating upstream (since transaction has new target). however, mobicents container, though invite indeed proxied out new destination, received error response still propagates upstream. believe bug in mobicents implementation - how 1 work around this? code: public void doinvite(sipservletrequest req) { req.getproxy().proxyto(req.getrequesturi()); } public void doerror(sipservletresponse res) { proxy p = res.getproxy(); p.setsupervised(false); p.proxyto(...); // request proxied, error response still passes // upstream - retargeting of transaction (through // proxying new ...

Selenium XPath of preceeding element -

i have scenario wherein html tags generated dynamically through ajax shown below <div> <span class="rptname">qlms</span> <span id="button_id_91">//generated dynamically <span id="button_span_right_91"> <span id="button_91"/> </span> </span> <span class="rptname">qlrs</span> <span id="button_id_92">//generated dynamically <span id="button_span_right_92"> <span id="button_92"/> </span> </span> </div> the span elements generated dynamically, in such scenarios how xpath based on text search(qlms,qlrs present in span). need click event on <span id="button_92" or "91"/> please let me know how achieve in such scenario. thanks in advance seems pretty tricky. using following-sibling should help. filtering out...

android studio - Facebook Login AsyncTask #4 NullPointerException Crash On Launch -

i've looked @ 15 different threads relating issue have , far none of solutions have worked me. while i'm leaning towards being android manifest configuration problem can't seem see or figure out i'm doing wrong there. hoping set of eyes , minds me out. 05-29 11:43:46.679 5265-5300/com.example.android.slidingtabsbasic e/androidruntime﹕ fatal exception: asynctask #4 java.lang.nullpointerexception @ java.util.concurrent.concurrenthashmap.containskey(concurrenthashmap.java:781) @ com.facebook.internal.utility.queryappsettings(utility.java:802) @ com.facebook.login.widget.loginbutton$1.run(loginbutton.java:509) @ java.util.concurrent.threadpoolexecutor.runworker(threadpoolexecutor.java:1076) @ java.util.concurrent.threadpoolexecutor$worker.run(threadpoolexecutor.java:569) @ java.lang.thread.run(thread.java:856) it seems though app_id returning null? or hash? did facebook android quick star...

primefaces - Set to null JSF spinner -

in project using spinner jsf primefaces library. i'm trying when textbox cleared value set null, set minimum value defined. somebody can give me hint or direction? i trying make onblur event didn't workout. try : should prevent 0 affected variable when leaving empty in view, , set null . <h:outputlabel for="spinner1" value="enter integer : " /> <p:spinner id="spinner1" value="#{bean.number1}" > <p:ajax listener="#{bean.spinner1changed}" /> </p:spinner> with : integer number1; // + getter/setter public void spinner1changed(ajaxbehaviorevent event) { if (number1 == null) number1 = null; }

playframework - Play Framework and Threadpools -

is there limit on number of threads play framework exposes application? thread size inside play app darn precious? if use thread pool create myself in application , not use 1 provided play. recommended? can please throw light on how play handles threads? the limit of threads in play application have determined maximum memory allocated vm. threads consume fair bit of memory each, since own stack. essentially, maximum number of threads possible depends on arguments pass jvm , total ram on computer, etc. you should let play manage threads you. configuration documentation located here . part of design of play deals in minimizing number of threads need, unless you're doing lot of blocking calls shouldn't need touch it. play uses akka handle threading. configuration internal actor system can found here . juicy part in parallelism-factor , parallelism-max . if @ commented reference configuration akka: # parallelism factor used determine thread pool size using # fo...

docker - How do I enable monitoring and logging for my containers on Bluemix? -

i created first containers on bluemix. pleased how easy create them both through gui , cli. need debugging, went monitoring , logging page app container in bluemix ui have @ logs , discovered need enable monitoring , logging. followed link instructions , scrolled through them quickly. overwhelming. step 1 "log in container or vm root user", there no guidance how container. need build image ssh daemon running? if so, how? need provide ssh key when run container? if so, how? there related question remains unanswered: unable connect through ssh key bluemix container assistance appreciated. both of default containers provided part of service have ssh enabled. when launching these containers bluemix ui, there input fields on bottom right expose port (expose port 22 ssh) , paste in ssh public key. make sure paste in starts ssh-rsa , ends either == or email address. you'll need assign public ip address. if you're providing own container, here's link f...

sorting - I need to sort MYSQL results by a number passed in OR another column -

Image
here table select statement: sqlfiddle want group job_id , sort number passed in, (in case number 2) if there no match show result default marked true if none marked true sort production_days desc the end result should have: all jobs show column production_days = 2 except 103 did not have matching column, sorted is_default desc i have tried select *, case production_days when 2 0 when is_default = 1 1 else 2 end sort `jobs` group job_id order job_id, sort edit: desired results are: rows unique job_id have number 2 in production_days column if job_id not have 2 in column looking 1 in is_default column. not care how results achieved in 1 select statement. i going rephrase understand it: want sort jobs have production_days = 2 first, jobs is_default true, , other jobs. to that, first broke query down 3 groups , put them together. started getting ones had value 2 in production_days, easiest. hardcoded 0 @ end demonstrate first group: select ...

jquery - Bootstrap modal won't close -

that's put far: http://jsfiddle.net/1geq21c9/ if remove return false; in line 5 , try add new user error jsfiddle. opening same thing browser can briefly see new table row, modal closes , row gone again. with return false; statement works fine except modal won't close anymore (programmatically). still can closed hand. i tried few approaches of closing modal didn't improve anything. another issue encountered never got of modal events. tried piece of code , nothing happened: $("#addusermodal").on("hidden.bs.modal", function () { ... }); any kind of or hints appreciated, modal not closing/row disappearing thing since managed work around missing modal events already. i can't tell why code won't work... if you're okay this, $('.modal').modal('hide'); instead of $('#addusermodal').modal('hide'); will trick. edit you have spelling issue. addusermodal instead of addusermod**e**l...

c# - Changing DateTime Format from one form to another -

i wish make "tdate" format "d, mmm, yyyy" , send 1 form has data grid view different form contains textbox. so far tried make as: frm.txtdate.text = (this.dgvevents.currentrow.cells[2].value.tostring("d, mmm, yyyy")); this code of class :- public int createticket(string tname, datetime tdate, string type, string venue) { eventticketentities database = new eventticketentities(); ticket t = new ticket(); t.ticketname = tname; t.ticketdate = tdate; t.tickettype = type; t.ticketvenue = venue; database.tickets.add(t);//we add our promoter our advertiser table! return database.savechanges(); //returns affected rows .... } and code show new form when "proceed" button clicked. public void btnproceed_click(object sender, eventargs e) { ticketform frm = new ticketform(); frm.txtname.text = (this.dgvevents.currentrow.cells[1].value.tostring()); frm.txtdate.text = (this.dgvevents.currentrow.cell...

sql server - How to select value from second column if first column is blank/null in SQL (MS SQL)? -

can me build sql query if column1 null/blank should value column2, if column2 blank/null should value column3. below table using price1 price2 price3 120 140 160 the output looking is price 120 140 160 i have tried select price1 price price1 not null union select price2 price price1 null union select price3 id price2 null select coalesce (price1,price2,price3) select isnull(price1,isnull(price2,price3)) select case when price1 not null price1 when price1 null price2 when price2 null price3 end price id none of above syntax gets data i'm looking for. please help if think have empty strings can try : select case when coalesce(price1, '') <> '' price1 when coalesce(price2, '') <> '' price2 when coalesce(price3, '') <> '' price3 end price

In ant exec task can one supress the \t[exec] prefix added to all output from the child process? -

in ant when running command exec task written stdout or stderr in child process has " [exec] " prepended every line written both console , log file. there way suppress behavior or explicitly supply prefix? (ie: "" or maybe indent) this because ant build run in ide prefix scrambles ability of ide jump source files clicking on output error messages javac , other compilers you may run ant -emacs option. however in case suppress prefix tasks. otherwise may implement own log handler.

javascript - jQuery .click() not working on Android Lollipop -

i'm having troubles using .click() function stuff need on cordova app. the .click() function works on 4.x doesn't on 5.x did doing href="javascript:function()" not recommended using csp enabled. how can made .click() function work on 5.x ? the frameworks im using: apache cordova 5.0 jquery mobile 1.4.5 jquery 1.11 my code: <a href="javascript:chk('si');" class="chk chksi">si</a> <a href="javascript:chk('no');" class="chk chkno">no</a> <div class="clear"></div> <br /><br /> <a id="btnok" href="javascript:btnok();"><img src="img/registrar.png" class="center" width="75%"></a> old code: $(document).ready(function() { $(".chk").click(function() { $(".chk").removeclass('active'); $(this).addclass('active'); });...

Image Size Not Applied when opening OpenXML Word Document Created in C# -

i creating openxml word document inside c# web application , writing google chart image it. i'm specifying dimensions of image, seems, correctly. however, when open word document, image right height, not right width. in fact, square. when click on image inside of word , go size , position, correct dimensions displayed. in case, 2.08" 5.04". when click "ok" after changing nothing, image stretches right size. if try identify size appears as, close half defined width, may coincidence. the native size of image 3.13" (h) 7.55" (w), doesn't seem should matter. i followed following posts pretty closely: how to: insert picture word processing document (open xml sdk) inserting image docx using openxml , setting size i'm guessing i'm missing setting of sort, don't know one. paragraph or run need sized entire width of page? width of document need specified? public void addimage(string imagename, byte[] imagedata) ...

java - How to set dynamic return type for rest template -

i want set dynamic return type of object returned postforobject . have tried, not working.herein decrypteddata return type changing object . object[] decrypteddataarray = resttemplate.postforobject(url, datatobedecryptedlist.toarray(), object[].class); if(decrypteddataarray instanceof decrypteddata[]){ if (decrypteddataarray != null && decrypteddataarray.length > 0) { fielddatamap = setdecrypteddata(fielddatamap, (decrypteddata[]) decrypteddataarray); } }

jquery append elements until they will reach certain amount -

i have <ul> , want append <li> elements until reach amount of 10 how best practice in jquery? it great if solution can consider can have example 5 <li> , in case want append 5 more elements reach amount of 10... you can while loop while(!$('li:gt(9)').length){ $('ul').append('<li></li>'); } just use :gt() see if eleventh element exists yet or not.

html - jQuery check if VARIABLE currentscore is between object keys -

here code. want , display messages after checking if variable currentscore between object keys <html> <head> <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script> </head> <body> <div class='hidemeadmin'> <div data-score="40" data-role="awww....."></div> <div data-score="50" data-role="average"></div> <div data-score="60" data-role="good"></div> <div data-score="80" data-role="perfect"></div> </div> </body> <script> //function $(document).ready(function(){ var containerscoretext = ".hidemeadmin"; var numberitems = $(containerscoretext).children().length; var scorevariable = {};// create object var currentscore = 45; ...

jsp - Spring MVC static resources in separate jar -

recently had question co-workers if can put our static resources(css, images, js) in separate jar file , access static resources spring mvc application. looking on google didn't find interesting. question is, possible? , if so, can please explain it. thank you, spring boot servers static resources form classpath:/resources/ , classpath:/static/ , classpath:/public/ (and more). if create jar file 1 folder in it( "public" example) static resources , put jar in classpath, content served. if don't use boot, can configure application serve resources folder: @override public void addresourcehandlers(resourcehandlerregistry registry) { registry .addresourcehandler("/resources/**") .addresourcelocations("/resources/","classpath:/public/"); }

curl - sandbox paypal account transferring money to invalid accounts through php code -

in api, i'm using php code automatically transfer money amount 1 sandbox paypal account sandbox paypal account.but through php code, transactions occurring both valid invalid sandbox user accounts must not not happen @ all. furthermore, cannot find way check in code whether receiver's sandbox account valid or not. if it's valid, transfer money receiver's account. here code.... // paypal_class.php class paypal { public function __construct($username, $password, $signature) { $this->username = urlencode($username); $this->password = urlencode($password); $this->signature = urlencode($signature); $this->version = urlencode("122.0"); $this->api = "https://api-3t.sandbox.paypal.com/nvp"; //the functions can modified need urlencoded $this->type = urlencode("emailaddress"); $this->currency = urlencode("usd"); $this->subject = urlencode("instant...

postgresql - updating cloumn with Index in postgres -

i updating on ~8m rows in table. column updating client_id , table has composite index on user_id , client_id . going affect indexing in way ...? doing large update slower indexes, since indexes have updated also. might issue, or not. depends on many things. after update indexes should, reindex might in order make space usage better. if 8m rows majority of table, vacuum full may in order reduce disk space usage, if table heavily updated time, might not worth it. so if want, can remove index, update , recreate index, impossible if faster doing update index in place.

angularjs - function is not being called with a karma spyOn -

my controller is: window.map.controller('schedulehomecontroller', ['$scope', '$location', '$route', '$routeparams', 'cache', 'patientcache', function($scope, $location, $route, $routeparams, cache, patientcache) { cache.set('ui', 'headermessage', ''); if(cache.get('patient', 'currentpatient').patientid !== $routeparams.patientid) { cache.set('patient', 'currentpatient', patientcache.getpatient(parseint($routeparams.patientid, 10))); } switch($route.current.originalpath) { case '/patients/:patientid/schedule': cache.set('ui', 'schedulepage', 'daily-schedule'); $scope.showschedulenavbar = true; break; default: $scope.showschedulenavbar = false; break; } } ]); my test is: f...

php - how to give array index a named key on runtime -

Image
here trying use xmlserializer class convert data mysql table xml file.i want xml file this for ,i need change numeric indexes 'book'.currently can generate array of following form:it has numeric indexing ,but purpose both of indexes (0 , 1) have 'book'. how can change both numeric indexes 'book'?? full code: include('xmlserializer/xml/serializer.php'); $host='localhost'; $user='root'; $pass=''; $db='xmlserializer'; $dbh=new pdo("mysql:host=$host;dbname=$db",$user,$pass); $sql='select lname,fname employee'; $sth=$dbh->prepare($sql); $sth->execute(); $xml=array('library'=>array()); $i=0; while($result=$sth->fetch(pdo::fetch_assoc)){ array_push($xml['library'],$result); } print_r($xml); $serializer=new xml_serializer(); $result=$serializer->serialize($xml); if($result===true){ file_put_conten...

javascript - Back button with refreshed page -

how can in go refreshed page in button. googled not work me. problem explanation: have button in page. when clicking on button goes previous page. want when click on button go , load new refreshed page. you this: javascript function gobackwithrefresh() { var last_url = document.referrer; if( last_url ) { window.location.href= last_url; } else { window.history.back(); } } trigger <a href="javascript:gobackwithrefresh();">my button link</a>

python - friends_of_friend_ids(user) function error (trying to determine 2nd degree connections) -

the function friends_of_friend_ids(user) supposed find friends of friend. function should count user's friends following rules (see below). i'm following example in book 'data science scratch: first principles python" , there errata in 1 of previous functions. have adjust friends_of_friend_ids(user) make work again. foaf = friend of friend correct code (i think) users = [ {"id": 0, "name": "ashley"}, {"id": 1, "name": "ben"}, {"id": 2, "name": "conrad"}, {"id": 3, "name": "doug"}, {"id": 4, "name": "evin"}, {"id": 5, "name": "florian"}, {"id": 6, "name": "gerald"} ] #create list of tuples each tuple represents friendships between ids friendships = [(0,1), (0,2), (0,5), (1,2), (1,5), (2,3), (2,5), (3,4), (4,5), (4,6)] #add f...

Relative urls vs Protocol-relative URLs -

i wondering if use relative url follows : "/myfolder" it change to mydomain/myfolder but maintain if root http or https similar "//" approach. i.e if page loading relative url "/myfolder" has https change to "https://mydomain/myfolder" tl;dr: yes. relative references applied against base uri ( see how ). in html5, document base url is, in common case (i.e., no base element , no iframe - srcdoc document , no about:blank ), the document's address . so if have document @ http://example.com/foo , link relative reference /bar link url http://example.com/bar . , if document @ https://example.com/foo , link https://example.com/bar .

c# - How do I place a text over a image in a button in WinRT -

i want create button using image background , on top of background want place text. i tried this: <button style="{staticresource imagebuttonstyle}"> <stackpanel> <textblock text="test"></textblock> <image source="ms-appx:///skins/images/buton.png" stretch="none" /> </stackpanel> </button> the text not centered correctly. <button style="{staticresource imagebuttonstyle}"> <stackpanel> <textblock text="test"></textblock> <label padding="0">my button text</label> </stackpanel> </button> the control label doesn't exists. how center correctly text on image in first attempt? know better way? you should use grid instade stackpanel. try this: <button > <grid> <image source="..." stretch="none" /> ...

clojurescript - Convert vector of maps to a tree -

i need convert vector of maps this: [{:id 1 :parent nil :name "a"} {:id 2 :parent 1 :name "b"} {:id 3 :parent 2 :name "c"} {:id 4 :parent 2 :name "d"} {:id 5 :parent 4 :name "e"}] to this: [{:id 1 :parent nil :name "a" :nodes [{:id 2 :parent 1 :name "b" :nodes [{:id 3 :parent 2 :name "c"} {:id 4 :parent 2 :name "d" :nodes [{:id 5 :parent 4 :name "e"}]}]}]}] update: as per requested far have this: (defn enum [s] (map vector (range) s)) (defn build-tree [tree current-path current-parent gr] (if-let [nodes (gr current-parent)] (let [current-path (conj current-path :nodes) new-tree (assoc-in tree current-path nodes)] (first (for [[i node] (enum (get-in n...

css - Responsive youtube video with i-frame -

i have following frame in html , contain youtube video.here frame-: <iframe width="420" height="315" src="https://www.youtube.com/embed/dgpo56imqua?showinfo=1" frameborder="0" allowfullscreen></iframe> how can make i- frame responsive you can use intrinsic ratio. containing element responsive , stays @ specific aspect ratio. iframe inside positioned absolutely element. html <div class="videowrapper"> <!-- copy & pasted youtube --> <iframe width="420" height="315" src="https://www.youtube.com/embed/dgpo56imqua?showinfo=1" frameborder="0" allowfullscreen></iframe> </div> css .videowrapper { position: relative; padding-bottom: 56.25%; /* 16:9 */ padding-top: 25px; height: 0; } .videowrapper iframe { position: absolute; top: 0; left: 0; width: 100%; height: 100%; } more info on css tri...

javascript - how to execute a jquery plugin in specific part of page by scrolling? -

i need code execute jquery plugin in specific part of page: example in middle of page there div tag id test , in div plugin exist someting ,now wanna when page loaded nothing happen plugin when user start scroll down page , see div id test plugin start work ! there idea me? thanks this seems want: http://ahmadassaf.com/blog/web-development/scripts-plugins/attaching-javascript-listeners-page-scroll-plugins-hints/ just google "jquery scroll listener" find more plugins

java - Getting error while inserting data to MySQL using Hibernate -

hi developing project in eclipse using hibernate. found error in hibernate.cfg.xml file please problem. i have included necessary libraries. hibernate.cfg.xml <hibernate-configuration> <session-factory> <!-- related connection start --> <property name="connection.driver_class">com.mysql.jdbc.driver</property> <property name="connection.url">jdbc:mysql://localhost:3306/hibernate</property> <property name="connection.user">root</property> <property name="connection.password">93pb3ganv0</property> <!-- related connection end --> <!-- related hibernate properties start --> <property name="show_sql">true</property> <property name="dailet">org.hibernate.dialect.mysqldialect</property> <property name="hbm2ddl.auto"...

javascript - removing a div using jquery but keeping divs inside it -

i trying remove div after timed event using jquery.. initial timer follows..... $(document).ready(function () { settimeout(function () { $("#loader-wrapper .loader-section, #textbit").hide("slow"); $("#logo").animate({ left: '-115px', top: '-60%' }); $("#logo-side").animate({ opacity: 9 }, 2000); $("#loader-wrapper").remove(); }, 2000); }); i doing few things here divs outside loader-wrapper div logo needs remain on page while loader-wrapper needs go after timed event has performed functions... in current form loader-wrapper removed (without .hide transition happening) , logo div nested inside it... can suggest/provide workaround ? the html looks .... <div id="loader-wrapper"> <div id ="wrapper"> <div id="logo"><a href="index.html"><img src="images/mthc/logo-main.png" height="...

jquery - Fade in and Fade Out Text in DIV - Remove Loop -

i have created div 3 different quotes fade in , fade out. i using below jquery code same. (function() { var quotes = $(".changetxt"); var quoteindex = -1; function shownextquote() { ++quoteindex; quotes.eq(quoteindex % quotes.length) .fadein(1000) .delay(4000) .fadeout(500, shownextquote); } shownextquote(); })(); html code <div class="toptext"> <div class="changetxt"> ”the simple act of paying positive attention to<br> people has great deal productivity” <p>- tom peters</p> </div> <div class="changetxt"> ”if deprive of outsourcing , competitors<br> not, putting out of business” <p>- lee kuan yew</p> </div> <div class="changetxt"> ”focus on being productive<br> instead of busy” <p>- tim ferris</p> </div> <...

ruby on rails - rake assets:precompile, Command failed with status (137): -

i trying precompile assets using assets:precompile command getting below error. ** invoke assets:precompile (first_time) ** execute assets:precompile /root/jruby-1.7.9/bin/jruby /root/jruby-1.7.9/bin/rake assets:precompile:all rails_env=production rails_groups=assets --trace ** invoke assets:precompile:all (first_time) ** invoke assets:cache:clean (first_time) ** invoke assets:environment (first_time) ** execute assets:environment ** invoke environment (first_time) ** execute environment ** execute assets:cache:clean ** execute assets:precompile:all rake aborted! command failed status (137): [/root/jruby-1.7.9/bin/jruby /root/jruby-1....] /root/jruby-1.7.9/lib/ruby/gems/shared/gems/rake-10.1.1/lib/rake/file_utils.rb:55:in create_shell_runner' org/jruby/rubyproc.java:271:in call' /root/jruby-1.7.9/lib/ruby/gems/shared/gems/rake-10.1.1/lib/rake/file_utils.rb:45:in sh' /root/jruby-1.7.9/lib/ruby/gems/shared/gems/rake-10.1.1/lib/rake/file_util...