Posts

Showing posts from February, 2012

windows - Open Excel on Jenkins CI -

i working on windows 7 (logged in session no.1), jenkins ci running windows service in session 0. problem is.. want open excel file through jenkins ci in session 0, want display gui on session 1. i know session 0 isolated in windows 7, possible run process in session 0 , output in session? please help. edit: took little trial , error, worked me (windows 7 64-bit). download pstools microsoft site we need psexec.exe , can extract everything. extract location accessible jenkins, preferably without spaces in path. open elevated command prompt: type cmd start's quicksearch, right click cmd.exe , select run administrator . type c:\path\to\psexec.exe -accepteula , press enter. type c:\path\to\psexec.exe -i 1 cmd , press enter. (if see command prompt appear, good, close now) in job configuration, configure execute windows batch command step write following: c:\path\to\psexec.exe -accepteula && c:\path\to\psexec.exe -i 1 cmd /c start c:\progra~2\micros...

vb.net - Binding ComboBox to DataTable That is not in Dataset -

i using vb.net develop small application. want bind combobox datatable not in dataset. binding dataset follows: bsos=new bindingsource(ds,"tablename") assume created own distinct table values follows: tblos = dstaset.tables("computers").defaultview.totable(true, "os") what want following: bsos = new bindingsource(tblos) but error comes: unable cast object of type 'system.data.datatable' type 'system.componentmodel.icontainer'. is there away without adding table dataset? this should work: combobox.datasource = tblos combobox.valuemember = "<column name want value>" combobox.displaymember = "<column name value want display in list>" to update datasource values can this: dim tblos datatable = combobox.datasource dim dr datarow = tblos.newrow() dr.item(0) = "value" dr.item(n) = "display" since datatable isn't bound doubt possible update automatically. i...

php - Mysql Match date -

i have table called promotions already inserted data: columns value `startdate` 15-03-2014 00:00:00 `enddate` 30-05-2014 00:00:00 `promotion_for` 1 (product_id) new query insert data columns value `startdate` 15-03-2014 00:00:00 `enddate` 30-05-2014 00:00:00 `promotion_for` 1 (product_id) i don't want insert new promotion if promotion running in same product during insert date. no idea how generate mysql query it. first add unique key promotions : alter table `promotions` add unique index(`startdate`,`enddate`,`promotion_for`); then: insert `promotions` ( `startdate`,`enddate`,`promotion_for`) values ('15-03-2014 00:00:00', '30-05-2014 00:00:00', '1') on duplicate key update `startdate`='15-03-2014 00:00:00', `enddate`='30-05-2014 00:00:00', `promotion_for` = '1';

service - Using onBind method and unable to start activity nullpointerexception Android -

my first time using service on android, read documentation , examples, wanna implement binded service activity, service scan available wifi networks , activity gets list of wifi, got stuck , don't know mistake, log said unable start activity nullpointerexception. manifest ok, ativity , service on diferents package. here code: activity, service public class starterservice extends activity { final string tag = "wificonn:..."; //edittext txt; wifimanager mywifi; scanservice scan; list<scanresult> sredes; //private scanservice scan; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); dobindservice(); scan=new scanservice(); //sret.clear(); sredes=scan.getwifi(); (int i=0; i<sredes.size(); i++) { scanresult rets = sredes.get(i); // txt.append("rest: " + rets.ssid +" " + rets.bss...

class - Using rand() and srand() in C++ -

i made class function returns randomly generated pair<int, int> represent coordinate pair. @ beginning of function have srand(time(null)) , use rand() % 50 random number pair. works great...as long have 1 object of that. if have 2 different objects of class , call function each object (by mean trying generate 2 different random coordinates 2 different objects of class), returns exact same coordinate pair each object. in retrospect, can understand why happens -- because i'm getting random number based off of current time, right? method should use return random pair every time call class's function?

c# - Schedule email at specific time with different timezone -

optimized way send daily digest email user @ time of 11.30am according time zone, sending email user working fine send @ specific time timezone? what have userprofile timezoneid,emailid dynamic daily email content currently doing console application send @ 11.30am @ utc time, but how handle in multiple timezone?can me out? i have achieved type of functionality via console application running scheduled task polls database every x minutes see if emails need sent. i assuming userprofile database table holding user list. to achieve add additional column table store last sent date/time. necessary when start sending timezone cannot send emails @ same time each day , need track ones have been sent or ones need sent. also due nature of type of task if reason fails or isn't running reason may need "catch-up" i.e. send missed emails (although may not requirement you) can achieved checking last sent column. assuming want send email @ (or close to) 11...

jsf - CommandLink inside the datatable doesn't work in some cases -

i have commandlink/commandbutton element of column in datatable. datatable integrated lazy model. code (not my, because primefaces showcase example) works perfect when number of records in table divisible page size. example page size 5 , number of records 60. but, when number of records 61, when reach last record in table, action listener every button not called. i've tried change p:commandlink h:commandbutton/p:commandbuton. i've tried stackoverflow tips related use update="@form" or immediate="true" or disable ajax requests ajax="false", result same. me looks problem datatable rendering. please @ source code. example based on primefaces showcase, i've added new column (this 1 commandlink). xhtml page: <h:form id="form"> <p:datatable styleclass="test-class" id="data" var="car" value="#{tablebean.lazymodel}" scrollable="true" livescroll="true" scrollrows=...

c# - Asynchronous Methods in Wp8 app -

Image
my application retrieves data server asynchronous calls apis. works fine long user remains in app. after implementing fast app resume , when app resumes after clicking on tile, control comes page on user left previously. if there asynchronous call running when user had deactivated app(hit start button previously), throws following exception. . in fact exception thrown following code. private async task<string> httprequest(httpwebrequest request) { string received; using (var response = (httpwebresponse)(await task<webresponse>.factory .fromasync(request.begingetresponse, request.endgetresponse, null))) { using (var responsestream = response.getresponsestream()) { using (var sr = new streamreader(responsestream)) { //cookiejar = request.cookiecontainer; //responsecookies = response.cookies; received = await...

c# - My function in asp.net doesnt output what i want -

my output peak timing = 7am 9pm non-peak timing = 9pm 7am every single type of graphs get. flat rate tariff, dont 24 hrs peak timing = 7am 9pm non-peak timing = 9pm 7am. dont understand why. @{ web..... open database..... var timing=""; foreach( var priceslot in otherplandetail){ var otherplanname=priceslot.planname; if(otherplanname=="flatratetariff") { timing="24 hours"; } else if(otherplanname=="tou_scheme_1") { timing="peak timing = 7am 9pm non-peak timing = 9pm 7am"; } else if(otherplanname=="tou_scheme_2") { timing="peak timing = 7am 9pm non-peak timing = 9pm 7am"; } else if(otherplanname=="tou_scheme_3") { timing="peak timing = 7am 9pm non-peak timing = 9pm 7am"; } else if(otherplanname=="tou_scheme_4") { timing="peak timing = 7am 9pm non-peak timing = 9pm 7am"; } else { timing="invalid"; } } <for...

What are the chances of getting Javascript long running script error when manipulating string -

i designing sql engine. ui user select parameters , based on parameter design sql statement. user have option join tables, apply conditions, create temp tables, ability apply many sql in-build functions etc. write many functions @ input , based perform action give sql statement. i can code using server side language want try javascript. obviously require lot of string manipulation. i worried if result "“ a script on page causing internet explorer run slowly. if continues run, compute may become unresponsive. " on ie or " a script on page may busy, or may have stopped responding. can stop script now, open script in debugger, or let script continue " on firefox. i know not sharing code & question little subjective. sure of may have faced similar issues/challenge in previous assignment & valuable suggestions big help. unless have misunderstood question, asking if there risk of getting dreaded message when doing couple of string manipulatio...

php - Not getting push notification from GCM eventhough response is success -

i want push notification using gcm, things done properly, api key & others. i'm getting following success message, not getting notification on mobile(device id proper, tried on different divices) {"multicast_id":6811225836747189127,"success":1,"failure":0,"canonical_ids":0,"results":[{"message_id":"0:1395652805845432%ae8ef3eff9fd7ecd"}]} may know correct way achieve objective? thanx in advance manifest code`` <permission android:name="com.demo.permission.c2d_message" android:protectionlevel="signature" /> <uses-permission android:name="com.demo.permission.c2d_message" /> <uses-permission android:name="com.google.android.c2dm.permission.receive" /> <receiver android:name="com.google.android.gcm.gcmbroadcastreceiver" android:permission="com.google.android.c2dm.permission.send" > <int...

vb.net - RegOpenKeyEx returns 2 when accessing wow6432node -

i try read uninstall keys registry using vb.net 2010. want know modify date of key, have use advapi32.dll functions. on local system key , modify dates can read, on remote registry not if key located under wow6432node. althought set key_query_value key_wow64_32key. here's code: dim subkey string = "software\microsoft\windows\currentversion\uninstall" dim hremotekey intptr dim regkeyptr integer = regconnectregistry(tbservername.text, new intptr(registryhive.localmachine), hremotekey) dim key_query_value integer = 1 + 512 dim openregkeyresult integer = regopenkeyex(hkey_local_machine, subkey, 0, key_query_value, regkeyptr) dim lpftlastwritetime system.runtime.interopservices.comtypes.filetime dim returnvalue integer = regqueryinfokey( _ regkeyptr, _ nothing, _ nothing, _ nothing, _ nothing, _ nothing, _ nothing, _ nothing, _ nothing, _ nothing, _ nothing, _ lpftlastwritetime)

ios - Detecting the word taps on attributed text in a cell (Solved) -

this code works else, when i'm trying use on uitextview placed in cell, cant seem attributed word tapt. uitapgesturrecognizer added on cell itself. this code creates attributed text: //color: + (nsattributedstring *)attributedmessagefrommessage:(nsstring *)message { nsarray* messagewords = [message componentsseparatedbystring: @" "]; nsmutableattributedstring *attributedmessage = [[nsmutableattributedstring alloc] initwithstring:@""]; (nsstring *word in messagewords) { nsdictionary * attributes; if ([word isequaltostring:@""] || !word) { return attributedmessage; } if([word characteratindex:0] == '@'){ attributes = @{nsforegroundcolorattributename:[uicolor colorwithred:72.0/255.0 green:192.0/255.0 blue:89.0/255.0 ...

jquery - Remove child elements with certain attribute value -

i'm trying filter out children elements, i'm not managing iterate throught children properly. whats wrong in code: $("#filter").on("click", function() { $("div#results > div").each(function () { if(!$(this).attr('subcategory', 0)){ $(this).remove(); } }); }); $(this).attr('subcategory', 0) set value attribute. try this: $("#filter").on("click", function() { $("div#results > div").each(function () { if($(this).attr('subcategory')==="0")){ $(this).remove(); } });});

sql - Is date - TRUNC(date) ever larger than 1? -

i reverse-engineering legacy code written company. includes following statement update table set deliverydate = trunc(deliverydate) deliverydate - trunc(deliverydate) > 1 is dead code? there way statement ever match row? maybe absurdly uncommon condition related daylight saving time? the statement executed on oracle server (version unknown). deliverydate - trunc(deliverydate) less one, update nothing. there no exception that.

Microsoft Diagnostics Runtime crash.dmp analysis (C#) -

i'm trying read in crash.dmp using functionality in microsoft.diagnostics.runtime .net componenet (also known clrmd). i have crash.dmp in known location (in string called pathtofile) that's not issue. rest of code looks this. datatarget datatarget = datatarget.loadcrashdump(pathtofile); clrinfo clrinfo = datatarget.clrversions[0]; string daclocation = clrinfo.trygetdaclocation(); when testing code, following error in command window: error processing directory: system.argumentoutofrangeexception. index out of range. must non-negative , less size of collection. parameter name: index. i'm assuming it's clrversions[0] bit can't life of me pin down. any appreciated. current status when running following command (which fails) clrruntime rt = datatarget.createruntime("path\to\mscordawks.dll"); i receive following error in cmd mismatched architecture between process , dac cheers anyone? i having same issue reading dump file ...

Trying to speed up list compare in EXCEL VBA -

i have code compares 2 lists in same worksheet , deletes entire row 1 of 2 lists, running (as data grows) , trying speed process. i not succeeding in doing great extent , i'm looking assistance, thanks! the code: sub clean_up_lists() 'run comparisons... clean lists' 'turn of screen updating speed macro' application.screenupdating = false dim ilistcount long dim x range dim ictr long 'get count of records search through(list deleted)' ilistcount = sheets("allocations").cells(rows.count, "b").end(xlup).row each x in sheets("allocations").range("n200:n400" & sheets("allocations").cells(rows.count, "b").end(xlup).row) 'loop through records in second list' ictr = ilistcount 1 step -1 if x.value = sheets("allocations").cells(ictr, 2).value sheets("allocations").cells(ictr, 2).entirerow.clearcontents 'if match exists --> clear contents allocatio...

linux - How to remove the last character from all lines but only if it is a certain character -

i have data in form kure|hiroshima kure|hiroshima kure|hiroshima no matching aachen| darmstadt mulheim aachen| and want remove last character if pipe (|). desired output kure|hiroshima kure|hiroshima kure|hiroshima no matching aachen darmstadt mulheim aachen thanks in advance you can use sed this: $ sed 's/|$//' file kure|hiroshima kure|hiroshima kure|hiroshima no matching aachen darmstadt mulheim aachen it looks | $ (which means "end of line") , deletes it. note can use sed -i in case want in-place edit.

c++ - Find the size of a c array in function -

this question has answer here: why isn't size of array parameter same within main? 13 answers how find length of array? 18 answers i trying write short function takes pointer array , returns it's size. far have this: int main (void) { double myarray[3] = {0, 1, 2}; int temp = arraysize(myarray); return 0; } int arraysize(double * myarray) { return sizeof(myarray) / sizeof(*myarray); } but doesnt seem working. appreciated, jack that's impossible - pointer points @ first element of array. there's no way extract array size that. you pass array reference, , infer size template parameter: template <typename t, size_t n> size_t arraysize(t (&)[n]) {return n;} this work if have access array (as in example). if it's decay...

unity3d - How to create aurora with unity 3D? -

i try create beautiful aurora @ game background how create aurora unity3d? if difficult explain, please tell me have learn you create own skybox. not sure if can play gif/video, might able to. otherwise create own using light. create own particles , emitters make many beams of light , change color , location simulate aurora, might difficult real looking aurora.

In Android,How to save a "dynamically created layout" and load back when I reopen app? -

Image
when app running, users adds views in layout . want store layout , when reopen app should return same state. how can achieve that? use onsaveinstancestate() , onrestoreinstancestate() callbacks save , restore views. more @ managing activity lifecycle , recreating activity . [edit] - per @kadatt comment. i think trying possible duplicate of android-saving-state-of-dynamically-changed-layout . i dont think there standard way of doing this. have implement own functionality save state of dynamic ui in form can loaded again.

Python unusual file sorting -

i have txt file contains data in following fashion: 23 1 65 15 19.2 19 2 66 25 25.7 10 3 67 35 16.5 100 4 68 45 10.4 20 5 69 55 6.8 201 6 64 65 9.2 within file, each value separated other using \t , \n next line. i want sort file based on first values of each line. expected output : 10 3 67 35 16.5 19 2 66 25 25.7 20 5 69 55 6.8 23 1 65 15 19.2 100 4 68 45 10.4 201 6 64 65 9.2 but actual output getting as: 10 3 67 35 16.5 100 4 68 45 10.4 19 2 66 25 25.7 20 5 69 55 6.8 201 6 64 65 9.2 23 1 65 15 19.2 its taking values strings , hence not taking entire numbers value integer. tried parsing, not working. ...

git - composer update not pulling latest dev-master -

i've created 2 git repositories need install in 1 of our web applications using php's composer . there 2 branches on each repository, master , dev-master . inside project want package install, i've created following composer.json package configuration: { "name": "laravel/laravel", "description": "the laravel framework.", "keywords": ["framework", "laravel"], "license": "proprietary", "repositories": [ { "type": "package", "package": { "name": "impression-works/pdf-generator", "version": "dev-master", "source": { "url": "git@github.com:...", "type": "git", "reference": "dev-m...

java - HTTP Status 404 - /CarFind_SearchTool/index.jsp -

higuys, i'm running first real project in java. i'm building simple site cars online . car seacrh find tool stressing me extreme. have learn't mvc - struts using eclipse in order write code. 'what i'm writing (code) index page ( index.jsp ), couple of select tags (populated drop down list), when selected returns 'make; model; modification....' in view.jsp (results/view page). have struts.xml , web x.ml shown below, in eclipse ide when right click on project (carfind searchtool) >> export >> war file browse tomcat 7.0/webapps/root , save .war file/project. when try run via url or via eclipse ide receive message. please can , me know how sort out whole mess. http status 404 - /carfind_searchtool/index.jsp type status report message /carfind_searchtool/index.jsp description requested resource not available. apache tomcat/7.0.50 there no console message displayed, however. project mvc : struts2 applications : eclipse i...

php - Multiselect drop down checkbox sending only first value -

i trying create multiselect drop down list , have created 1 plugin multiselect . created form : <form action="test1.php" method="post"> <div class="input select"> <label for="multiselect">select employee :</label> <select name="data[]"> <option value="1">umananda deva sarma</option> <option value="2">bhabesh sarmah</option> <option value="3">manika goswami</option> <option value="4">mridusmita buragohain</option> <option value="5">chinmayee nath</option> <option value="6">urmila brahma</option> <option value="7">kalindra barman</option> <option value="8">mr.biman chandra gogoi</option> <option value="255">shri phanidhar nath</option> <option value="256">ranjan kr. bora</option> <...

scala - How to use implicit value with out passing it in to function? -

i under assumption if, somewhere in system, there value marked implicit: implicit val moo = "world!" then 'plucked air' whenever , wherever needed? is correct? so if have following code: import execution.implicits._ def myfunc(stub:string)(implicit imp:string) = { //the compiler knows imp should same moo println(stub + " " + imp) } myfunc("hello") // <- should print "hello world!" however, how can avoid having define signature of function taking implicit? means way call chain have include in parameters not fit intended usefulness of implicits. how can genuinely 'pluck air'? thanks in short, can't. here options: forwarding implicits say have function executes future , need executioncontext : can either import scala.concurrent.executioncontext.implicits.global (or define own etc) in same file somefun , , this: import scala.concurrent.executioncontext.implicits.global def somefun...

computer vision - what library is able to extract SIFT features in Python? -

in python library able extract sift visual descriptors? know opencv has implementation not free use , skimage not include sift particularly. i suggest vlfeat, open source vision library. has python wrapper. implementation of sift in vlfeat modified original algorithm, think performance good.

loops - efficient programming in R -

i have data author_id paper_id confirmed author_name1 author_affiliation1 author_name 826 25733 1 emanuele buratti genetic engineering emanuele buratti 826 25733 1 emanuele buratti international center emanuele buratti 826 47276 1 emanuele buratti emanuele buratti 826 77012 1 emanuele buratti emanuele buratti 826 77012 1 emanuele buratti emanuele buratti 826 79468 1 emanuele buratti emanuele buratti author_affiliation genetic enginereing international centre genetic engineering , biotechnology, padriciano 66, trieste, italy international centre genetic engineering , biotechnology, padriciano 99, 34149 trieste, italy now have...

xml parsing - IndexedDB DB Datas To XML -

in project, have create xml file indexeddb datas. passing xml file webservice save datas server.. , in return, want read , parse xml file (or data) sent webservice.. give me suggestions.. idb "object stores" can store javascript objects. save xml data idb database you'll need transform xml object javascript object. function depend on xml needs - there's no one-size-fits-all approach xml transformation. in general, follow advice laid out here in translating xml objects json representation: for example, if sql table looked this: +------+--------+--------+ | | cola | colb | +------+--------+--------+ | row1 | cella1 | cellb1 | | row2 | cella2 | cellb2 | | row3 | cella3 | cellb3 | +------+--------+--------+ your javascript object may this: var myobjecttostore = { 'row1': { 'cola': 'cella1', 'colb': 'cellb1' }, 'row2': { 'cola': 'cella2', 'colb': 'cel...

How to connect to online mysql database from Java desktop app -

i pave paid hosting, , added database it. trying connect online database java desktop application but, got exception: communications link failure. here code: public kviz_dao(){ try{ class.forname("com.mysql.jdbc.driver"); konekcija = drivermanager.getconnection("jdbc:mysql://penal.ba:2082/mydatabasename?"+ "user=mydbuser&password=mydbpassword"); } catch(exception ex){ ex.printstacktrace(); } } can tell me i'm doing wrong. download connector j . add classpath , in code: // load mysql driver, each db has own driver class.forname("com.mysql.jdbc.driver"); // setup connection db connect = drivermanager .getconnection("jdbc:mysql://remoteuri/database-name?" + "user=user&password=userpw");

using unset in CakePHP MongoDB -

i using ichikawa cakephp mongodb plugin. have problem in using unset in it. have tried command in shell: db.patents.update({}, {$unset : {"lv.2" : 1 }},{'multi':true}) db.patents.update({},{$pull:{pid:"2"}},{'multi':true}) these working fine. but when converting them cakephp command follows: $this->detail->updateall(array('$unset'=>array('lv.2'=>1,array('multi'=>true)))); then doesn't work , gives error: mongocollection::update(): expects parameter 1 array or object, boolean given can me figure out problem. thanks. there no conditions the error message means query being generated equivalent of: db.details.update(true this can confirmed checking query log (easy if you're using debug kit ). how happening the second parameter model updateall missing, means have default: public function updateall($fields, $conditions = true) { ...

facebook - Accessing "location_post" data with FQL and "distance_meters" -

i'm trying post_ids stories published near geo point. while reading through facebook fql documentation came across example: https://developers.facebook.com/docs/reference/fql/location_post/ select ... location_post latitude = ... , longitude = ... , distance_meters = ... when try run query, message": "(#602) distance_meters not member of location_post table." am doing wrong? thanks! the fb documentation inaccurate here (again...). there's bug report this: https://developers.facebook.com/x/bugs/629578257122514/ you can use following query schema: select author_uid, id location_post distance(latitude, longitude, '52.516412', '13.377681') < 1000 this give posts or friends sent within 1000m around brandenburger tor in berlin...

linux - What are the reasons for UDP packets to be dropped by the network stack -

i see udp packets arriving on linux box (via tcpdump) destination port set 25555. however: nc -l -u 25555 shows no traffic. i've checked: iptables off destination mac address matches incoming interface destination ip address matches incoming interface ip checksum ok udp checksum ok also, all packets being dropped, it's not problem overlowing rx buffers. any ideas else may cause pakcets dropped? you have process on machine reading datagrams arriving on port 25555. can see /proc/net/udp : sl local_address rem_address st tx_queue rx_queue tr rexmits tm->when uid timeout inode ref pointer drops 104: 00000000:63d3 00000000:0000 07 00000000:00000000 00:00000000 00000000 0 0 1779298 2 fff810266fe0c 0 so process "stealing" datagrams want owned root (uid=0). , inode of socket 1779298, can search under /proc/pid/fd pids owned root. once figure out process listening there, you'll need decide whether terminate nc can ...

c# - Hide parameters in UML class diagram Visual Studio -

Image
i have written app in visual studio 2013. , generating class diagram it, first selecting architecure -> new diagram -> uml class diagram drag dropped classes architecture window blank class diagram generated class diagrams full parameter list operations. , many of methods have huge list of parameters. looks weird in diagram. whenever double click on operation, vs takes me code of method. feels class diagram shows signature of method in actual code. however dont want parameters displayed in class diagram nor want delete them. example, if there 3 methods in class diagrams: +meth1(param1: int) : int -meth2(param1 : stirng, param2 : string) : string #meth3(param1 : int, param2 : float) : float i want option / checkbox can switch signatures to: +meth1() : int -meth2() : string #meth3() : float so dont want manually delete parameter list method hide them. keep signature information in class diagram consistent in code, just hide/show them whenever require it. ...

c++ - Initialization list to constructor -

i'm working on assignment in school supposed make constructor our own list-class takes initialization list argument. this want able do: list ourlist {1, 2, 3}; this have far: list::list(std::initializer_list<int> il) { head_ = copy(il.begin(), il.end()); } list_node* list::copy(std::initializer_list<int>::iterator begin, std::initializer_list<int>::iterator end) { if(begin == end) return nullptr; list_node* new_list = new list_node(*begin); list_node* node = copy(begin++, end); new_list->next_ = node; return new_list; } in humble opinion, should work great. however, when try initialization ( list list {1,2,3}; ) seg-fault. please explain i'm doing wrong here? list_node* node = copy(begin++, end); this call copy again same arguments, recursing forever , never completing. you should have been able tell using debugger see crashed, , have seen there hundreds of calls list::copy , not 3 calls e...

python - Open image in django template -

i have folder, outside of app, contains gigabytes of pictures. need display of pictures listed in variable images . code looks this: settings.py # static files (css, javascript, images) # https://docs.djangoproject.com/en/1.6/howto/static-files/ static_url = '/mnt/images/' staticfiles_dirs = ( os.path.join(base_dir, "static"), '/mnt/images/', ) results.html {% im in images %} <img width="100" height="100" src="/mnt/images/1/{{im}}" alt="my image" /> <strong>{{ im }}</strong><br> {% endfor %} it works i'm not sure if changing static_url right way go (otherwise doesn't work). there better way display images outside base_dir

javascript - How can I programmatically create screenshots of a web page on my localhost to generate a workflow-screencast? -

to document webdesign process want take screenshot timestamp of page on localhost on every reload of page or when save html document or stylesheet. i use grunt task runner , headless browser phantomjs capture page. grunt-localscreenshots https://www.npmjs.org/package/grunt-localscreenshots it's easy capture page manually. it's cumbersome , takes 10 seconds task finish. screencapture process should happen in background, when page changes or saved. so wrote shellscript monitors directory filechanges , fires phantomjs-script. while true atime=`stat .` if [[ "$atime" != "$ltime" ]] phantomjs screenshot.js ltime=$atime fi sleep 0.5 done this phantomjs-script var page = require('webpage').create(); page.onconsolemessage = function(msg) { console.log(msg); }; page.open("http://127.0.0.1:8080/screenshot-test/dev", function(status) { if (status === "success") { window.settimeout(function() { v...

html - Does dowloading of javascript block a browser from downloading other resources? -

Image
i reading "high performance web sites", , in chap 6, author writes how downloading scripts blocks other downloads, hence, best practice put scripts @ end of document. i loaded random page in chrome, , developer tools, see several js downloading in parallel. happening here? has modern browsers evolved, , limitation no longer there? or did miss something? p.s. still don't quite understand how browser download/parse html/javascript/css when loading page. there blog post/resource explaining general principles? +++++++edit++++++ quote book: parallel downloading disabled while script downloading, browser won't start other downloads, on different hostnames. 1 reason behavior script may use document.write alter page content, browser waits make sure page laid out appropriately. my chrome devtools: there 2 separate reasons rearranging loading of resources; actual loading time , apparent loading time. placing style sheet link means loaded when co...

minecraft - How to make a clickable link that executes a command with bukkit -

i'm trying make bukkit plugin , can't seem find documentation on i've seen done, how input commands chat message user click on execute command on server "/motd" in form of clickable link url if (commandlabel.equalsignorecase("cmd") { player.sendmessage("pick command: " + </motd> + ", " + </mail> ); } replacing "" , "" output this: pick command: motd , mail and clicking them execute command server them. how this? you this: ichatbasecomponent comp = chatserializer .a("{\"text\":\"" + "choose one: " + "\",\"extra\":[{\"text\":\"" + "motd" + "\",\"clickevent\":{\"action\":\"run_command\",\"value\":\"" + "/motd" + "\"}}]}"); packetplayoutchat packet = new packetplayoutchat(comp, true); ((craftplaye...

android - how to make switch case click by array? -

please me, how make switch case click array or how make switch case become if? because have searchbar, , when doing search, items came out not in accordance array. example when clicking item/array of es cendol, class shown esberaskencur_resepminum.class, not escendol_resepminum.class. toast display showing items es cendol. please me. public class dingin_tab extends activity implements onitemclicklistener { public static final string[] titles = new string[] { "es beras kencur", "dawet ayu", "es cendol", "es doger", "es oyen", "es teler", "es temulawak", "es selendang mayang", "es cincau", "es merah delima"}; public static final integer[] images = {r.drawable.minumberaskencur, r.drawable.minumdawetayu, r.drawable.minumescendol, r.drawable.minumesdoger, r.drawable.minumesoyen, r.drawable.minumesteler, r.drawable.minumestemulawak, r.drawable.minumesselenda...

cakephp 2.4 - invalid character in json response -

in cakephp controller send json response with $response = array('success' => 1); return json_encode($response); i alway getting wrong json in view: syntaxerror: json.parse: unexpected character have tested jslint, error "unsafe character" char 0 line 1 firebug console output returns 65279 following statement. console.log(response.charcodeat(0)); what can do? utf-8 issue? you may have character &#65279; in json string unicode character zero width no-break space (u+feff) . may copied code via copy/paste without realizing it. not visible hard debug. try copy $response text text editor , erase space. here post may related. https://stackoverflow.com/a/9691839/2777098

visual c++ - Stop Camshift algorithm -

i using camshift algorithm final year project stuck on point. not able terminate algorithm automatically. after remove object in front of camera, algorithm keeps tracking. have heard termination criteria don't know whether applicable here or not. appreciated. in advance. here's code on github: code thanks ok figured out myself. roi in actual image can cropped new image. comparing actual object size , roi size, if ratio beyond specific value, can determine object lost. in case, ratio taken 0.3

java.lang.OutOfMemoryError: Java heap space. From trying to add scanner input values to an ArrayList -

not sure why i'm getting weird error, program not compile either there must wrong while loop made scanner. i've never seen particular error. private arraylist gradelist; public gradedistribution() { this.gradelist = new arraylist<integer>(); } public void addgrades(scanner reader) { int grade = integer.parseint(reader.nextline()); while (true) { if (grade == -1) { this.printgrades(); break; } else { this.gradelist.add(grade); //the error points line } } } i did not include printgrades() method assure not source of problem. have no idea i'm doing wrong seems should work. arraylist initialized know it's not that... you need move: int grade = integer.parseint(reader.nextline()); inside while loop. otherwise have infinite loop tries infinitely add value of variable grade gradelist . increases allocated size on every iteration , when exceeds limit exception thrown. ...

c# - async/await bad practice under Android? -

currently porting existing c# windows 8 / ios app android (with xamarin). i used lot of async/await file io, dialogs, network, etc… what happens when app paused/suspended during await call? under windows , ios there 2 possibilities: the app resumed later, if nothing had happened the app terminated if memory low. in both cases, there no memoy leak, there no changes in control flow. however, under android, activity can destroyed , recreated while process stays alive. in understanding of async/await means: an unclosed dialog wait forever, meaning objects accessible caller ("this", local variables etc.) stay in memory forever (memory leak) when awaited network request finishes while former activity has been destroyed android, code after "await" (e.g. file write) collide because 2 running instances of activity exist. are assumtions true? if yes, can done? (without making program complicated before of invention of async/await) an android a...