Posts

Showing posts from April, 2011

jekyll - Does Liquid have a does not contain or not in array operator? -

when calling items , array in liquid template, how call does not contain or not in array ? unless rescue ! create [a, b, c] array. {% assign input = "a,b,c" | split:"," %} unless print if constrain not met. this prints nothing: {% unless input contains 'a' %}no a{% endunless %} this prints " no z ": {% unless input contains 'z' %}no z{% endunless %}

How do I configure global Mercurial options (like extensions) in Cloudbees Jenkins? -

i have cloudbees jenkins instance configured build several mercurial projects. configure global mercurial options go in ~/.hgrc , such as: [extensions] eol = when setting own standalone jenkins instance, log in user running jenkins , set environment. for cloudbees, it's not clear how should handle this. don't see way configure mercurial jenkins plugin use specific configuration file. if that, i'm not sure or when fill in file. can somehow create ~/.hgrc applies entire cloudbees jenkins instance? or need on per-job basis? might able set hgrcpath in pre-build step via envinect , or maybe modify project .hgrc via script build action. however, seems neither of these happen enough in build process take effect when job starts. i feel i'm missing obvious. can suggest proper way accomplish this? go system configuration page , create new mercurial installation. leave installation directory blank , set executable hg , set whatever need in custo...

c# - Asp.net visible button when 2 parameters match -

hello want make button visibile when userid stored in database match current userid. string clientid = context.user.identity.getuserid(); jobdescriptions job = new jobdescriptions(); if (job.postedby == clientid) { button2.visible = true; else { button2.visible = false; } postedby id of user posted on website saved on jobs table. problem button not visibile when statement should work. the solution if (!string.isnullorwhitespace(request.querystring["id"])) { int id = convert.toint32(request.querystring["id"]); jobreqmodel model = new jobreqmodel(); jobdescriptions job = model.getjob(id); string clientid = context.user.identity.getuserid(); if (job.postedby == clientid) { button2.visible = true; ...

How to get response from python to php? -

php never response if use sleep 5 minutes or more in python. using sleep around 2 minutes , working, not know happening, problem? sample code uploadfile_database.php: <?php $file_id=1; $response=exec('python /home/xyz/test.py '.$file_id); echo $response; ?> test.py import os, json import sys sleep(300) #sleep(420) print "hello" exec not work you're expecting. output of python script need pass output parameter exec . ex. $output = array(); $exit_code = exec('python /home/xyz/test.py '.$file_id, &$output); you use shell_exec work you're expecting

image - Weird behaviour of bwareafilt in MATLAB and what algorithm does it use? -

i have following questions: what algorithm bwareafilt uses? weird behaviour: when input matrix totally black, following error error using bwpropfilt (line 73) internal error: p must positive. error in bwareafilt (line 33) bw2 = bwpropfilt(bw, 'area', p, direction, conn); error in colour_reception (line 95) iz=bwareafilt(b,1); actually, using function take snapshots webcam, when block webcam totally, above following error. so believe error due internal implementation mistake. case? how overcome this? let's answer questions 1 @ time: what algorithm bwareafilt use? bwareafilt function image processing toolbox accepts binary image , determines unique objects in image. find unique objects, connected components analysis performed each object assigned unique id. can think of performing flood fill on each object individually. flood fill can performed using variety of algorithms - among them depth-first search can consider image graph edges c...

c++ - non-blocking communications in MPI: order of messages -

what happens if processors sends same message same destination same tag? when receiver wants read it, read last one? what if 2 different processors send same message (same tag) 1 processor? 1 receive , in order? 3- how can know how many pending messages specific processor in queue in order receive of them?

vbscript - paypal payment not going through with any of the options -

using asp classic paypal live express checkout it shows payment amount @ checkout, payment doesn't go through. payment doesn't leave customer's account. have tried using wife's paypal account complete checkout. i using paypal checkout system , have added api information in expresscheckout.asp , paypalfunctions.asp i have tried adding these api options too, still wouldnt work l_paymentrequest_n_namem l_paymentrequest_n_numberm l_paymentrequest_n_amtm l_paymentrequest_n_qtym any great.... tks

Excel file (azure blob) does not download in chrome -

excel files stored in azure blob containers. downloaded without incident in ie in chrome page displays message (and in canary crashes): this file appears corrupt and provides link download , point. i've tried setting content-type different excel formats result same. here's blob code: memorystream memorystream = new memorystream(); createfile(memorystream, grid); memorystream.position = 0; var blockblob = container.getblockblobreference(randomfilename); blockblob.properties.contenttype = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; blockblob.deleteifexists(); var options = new blobrequestoptions() { servertimeout = timespan.fromminutes(10) }; try { blockblob.uploadfromstream(memorystream, null, options); } catch (exception e) { _logger.error("uploading excel file: error: {0}", e.message); } return new uri("https://myblobs.blob.core.windows.net/"...

android - Two ListViews in two different fragments produce an Error -

i have 2 fragments 2 listviews in app. have attempted following both listviews in each fragment: listview listview = (listview)view.findviewbyid(r.id.list1); listview.setadapter(new listadapter() { //sets adapter } but when run, produces error: can't have viewtypecount < 1 is there better method doing? appreciated

php - submit form data from a foreach loop -

i have foreach loop form inside each result so: foreach($this->results() $that) { <form> <input type="text" name="name[]"> <input type="text" name="this[]"> </form> } and on. question how each forms data. understand can following: $_post['name'][0]; $_post['name'][1]; etc, way done without knowng how many forms be. mean foreach loop $_post data , each form? many thanks foreach ($_post['name'] $val) { /* want, want want value */ } $_post['name'] array. use count or array function want on then.

Actionscript 3 Search for string in array, propblem -

i have problem searching strings in array. want search 1 word , if exists, want trace position of string in array. i believe should this: if (myarray contains "11111111") { trace("*position*") } else { trace("cant find it"); } what kind of syntax using there , have checked documentation of array class? should first thing check always, there pretty straightforward method it: var arr:array = ["1111", "2222", "3333"]; trace(arr.indexof("3333")); //traces index: 2

hibernate - unable to pass two lits to the jsp using apachi tiles -

i using spring mvc apache tile , hibernate.i pass tow lists jsp page.but print there's no thing prints. my controller class follows : if(userexists!=0){ model.addattribute("maintabs",new maintab()); model.addattribute("maintabslist",loginservice.listmaintabs()); model.addattribute("subtabs",new subtab()); model.addattribute("subtabslist",loginservice.listsubtab(userexists)); return "redirect:/loginsucess"; }else{ model.addattribute("error", "error : invaliduser !,please try again!"); return "loginform"; } jsp page follows (menu.jsp): <c:if test="${not empty subtabslist}"> <c:foreach var="ob" items="${subtabslist}"> <c:out value="200"/> <%-- <c:out value="${ob.maintab}"/> --%> <%-- ...

Android Google Map in FragmentDialog being overlayed by the Dialog's own gray overlay -

Image
i migrated mapview activity's layout dialogfragment. pretty painless migration: a button on activity launches dialog, setting latlng map requires: case r.id.btn_open_map: android.support.v4.app.fragmentmanager fragmentmanager = getsupportfragmentmanager(); directionsmapdialogfragment mapdialogfragment = new directionsmapdialogfragment(); mapdialogfragment.setlatlng(mlatlng); mapdialogfragment.setretaininstance(false); mapdialogfragment.show(fragmentmanager, "fragmentname"); break; in fragment it's pretty standard code. use custom layout, have button overlaying map launches googlemaps app: <framelayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" ...

jquery - how to add minutes and hours to countdown360 timer -

Image
js timer works seconds, how add minutes , hours? using https://github.com/johnschult/jquery.countdown360 countdown timer > official page shows seconds http://jsfiddle.net/johnschult/gs3wy/ the description on site describes "a simple countdown timer in seconds", there no option change minutes but there other countdown timers more configurable. see, example,any listed here: http://plugins.jquery.com/?s=countdown+timer if want use countdown timer mentioned, you're going have modification source code. starters, replace 37 references of "seconds" "minutes" , edit of math convert times minutes. if great if submit changes pull request original author too.

windows phone 8.1 - WP8.1 Calendar look-alike -

Image
i'm searching windowsphone 8.1 calendar look-alike. don't want store data/appointments in it, want monthly view date-picker control, not normal date-picker. i came across winrtxamltoolkit offer calendar, don't style of it. it's bulgy me. see attached image of want (without colored stripes) have checked out telerik or syncfusion? both offer calendar controls customizable. http://www.telerik.com/windows-universal-ui http://www.syncfusion.com/products/windows-phone/calendar

ios - NSURLSession ignoring NSURLSessionConfiguration Cache Policy -

even after setting cache policy, nsurlsession still loading cached data: let url = nsurl(string: urlstring); var sessionconfig = nsurlsessionconfiguration.defaultsessionconfiguration(); sessionconfig.requestcachepolicy = nsurlrequestcachepolicy.reloadignoringlocalandremotecachedata; var session = nsurlsession(configuration: sessionconfig); is there reason why session ignoring .reloadignoringlocalandremotecachedata ? from nsurlrequest class reference page nsurlrequestreloadignoringlocalandremotecachedata = 4, // unimplemented nsurlrequestreloadrevalidatingcachedata = 5 // unimplemented i guess, constant there should not used.

cmd - Automate an Ant Script to run at set times -

i have set build process requires ant script run. trying automate run every day @ set time not sure if possible windows scheduler. the cmd type in cmd ant -f ./setup.xml loadallsoucres any advice welcome. michael

gps - Update Location and Time After Vehicular Accident via Facebook -

i 4th year student studying electrical engineering. i'm doing project final year car security , protection system. first part of project track stolen vehicle , send location update owner's phone. i'm using gps/gprs/gsm module shield v3.0 , arduino uno this. first part done. second part of project alert driver's near ones after accident occurred. i'm using pressure sensor , vibration sensor detect accident. know can done sending text relatives gsm modem when accident has occurred, wondering if can post automatic facebook status stating time , location driver , car can found easily. cannot figure out how part done or write code. how access user's facebook account? using c programming btw. can explain me how can accomplish it? or, if can name other tutorial or forum discussion, helpful too. :) that prefilling , autoposting, both not allowed on facebook. had lot of discussions in developers group on facebook: https://www.facebook.com/groups/fbdevelo...

swift - Turn off #available(OSX 10.10, *) if that's your target? -

i use containsstring in app. app has targets 10.10 , nothing older. swift complains , suggests introducting horrible syntax... if #available(osx 10.10, *) { if !nsstring(string: line).containsstring(" ") { continue } } else { // fallback on earlier versions } well since app won't run on earlier, code useless. there way turn off globally? don't want or need it.

All the F# templates in VS 2015 RC disappear -

i installed in fresh win 8.1 machine vs 2015 rc. load vs , create f# project. fine. eventually, other stuff (that have not remember) , found no single f# template (for projects) exist anymore in vs. c#/vb ones. that's bug in 2015 rc. it's fixed, need wait release. https://github.com/microsoft/visualfsharp/issues/411

version control - How do I force "git pull" to overwrite local files? -

how force overwrite of local files on git pull ? the scenario following: a team member modifying templates website working on they adding images images directory (but forgets add them under source control) they sending images mail, later, me i'm adding images under source control , pushing them github other changes they cannot pull updates github because git doesn't want overwrite files. the errors i'm getting are: error: untracked working tree file 'public/images/icon.gif' overwritten merge. how force git overwrite them? person designer - resolve conflicts hand, server has recent version needs update on computer. important: if have local changes, lost. or without --hard option, local commits haven't been pushed lost. [*] if have files not tracked git (e.g. uploaded user content), these files not affected. i think right way: git fetch --all then, have 2 options: git reset --hard origin/master or if on other branch...

php - Parsing/Open XML document in echo -

i have radio automation software (radioboss) , wish artist information (milky chance) , song title (stolen dance) through xml document ( http://inlivefm.6te.net/nowplaying2.xml ) of php echo, not able obtain information. i present project / php code see if can detect fault. <?php $x = simplexml_load_file('http://inlivefm.6te.net/nowplaying2.xml'); echo '<font color="#d81c1c" face="oswald" size="4px" style="display:inline">'; echo $x->player[0]->title[0]; echo ' - '; echo '</font>'; ?> i tried analyze through link: how display info if tag value x i tried test explanation in link without success, came ask help. the information presented in attributes in xml provided. have read attributes of element. you can achieve goal using php code below. $xml = simplexml_load_file('http://inlivefm.6te.net/nowplaying2.xml'); echo '<font color="#d81c1c"...

ios - getting error GestureRecognizer with UIImageview in swift -

i using 20 uiimageview have given tag value of each imageview now want add gesturerecognizer on each image view for index in 0 ... fields.count - 1{ let gesturerecognizer = uitapgesturerecognizer(target: self, action: "fieldstappedaction") gesturerecognizer.numberoftapsrequired = 1 println(fields[index]) fields[index].addgesturerecognizer(gesturerecognizer) } now trying tag using fieldstappedaction func fieldstappedaction (recognizer:uitapgesturerecognizer){ let tappedfield = recognizer.view as! tttimageview tappedfield.setplayer(currectplayer) } but not working when taped imageview getting app crashed in time of tap. fieldstapped]: unrecognized selector sent instance 0x7fc95a4abf90 *** terminating app due uncaught exception 'nsinvalidargumentexception', reason: '- your selector has arguments needs colon after name. so: let gesturerecognizer = uitapgesturer...

javascript - Problems retrieving nested data from json -

i working on small project , made following json data -> http://www.smartbustracking.be/json/data.json . the following below code loops through json data. can read "busuur" not nesting of bussen. am writing code wrong of syntax not correct <script type="text/javascript" language="javascript"> $.getjson("http://www.smartbustracking.be/json/data.json", function(json){ //$each same loop $.each(json, function(i, field) { $("#bussen").append("<li><a href='javascript: world.onpoidetailmorebuttonclicked();'>" + field.busuur + " " + field.bussen.busnummer + ": " + field.bussen.busnaam + "</><li><br />"); }); }); </script> bussen array "bussen":[{"busnummer":"530","busnaam":"test bus...

google maps - Why do people use CURLOPT_PROXYPORT 3128 without CURLOPT_PROXY? -

i asked in comment accepted answer this question, perhaps since comment on old question, , perhaps because answer obvious who's sure of it, got no response. wanted sure... see countless examples of code accessing google maps api through php curl, specified: curl_setopt($ch, curlopt_proxyport, 3128); and yet there no curlopt_proxy specified or mentioned. me, makes no sense. think it's case removed proxy line sample code had before posting it, , else has blindly copy-pasted code , posted code. can confirm that? , if it's case curlopt_proxy line omitted, know significance of port 3128? don't see port number mentioned anywhere else other in similar code snippets using google maps. apparently , port 3128 used 'squid', popular web proxy server able proxy other protocols (e.g. ftp). according wikipedia , squid: has wide variety of uses, speeding web server caching repeated requests; caching web, dns , other computer network look...

PHP Warning: PHP Startup: Unable to load dynamic library -

i run php script , error: php warning: php startup: unable load dynamic library '/usr/local/lib/php/extensions/no-debug-non-zts-20090626/ixed.5.2.lin' - /usr/local/lib/php/extensions/no-debug-non-zts-20090626/ixed.5.2.lin: cannot open shared object file: no such file or directory in unknown on line 0 what mean? it means there extension=... or zend_extension=... line in 1 of php configuration files (php.ini, or close it) trying load extension : ixed.5.2.lin unfortunately file or path doesn't exist or permissions incorrect. try search in .ini files loaded php ( phpinfo() can indicate ones are) - 1 of them should try load extension. either correct path file or comment out corresponding line.

android - Navigation drawer icon arrow instead of three lines -

Image
i have created new project in eclipse navigation drawer , instead of 3 lines icon on top left of screen have arrow icon. have found nothing on stack on flow seems help. have tried change setdisplayhomeasupenabled , sethomebuttonenabled not here part of code (by way default code eclipse) 1 have , idea? i believe can try setting custom activity button hamburger button. here code. so can change programmatically using homeasupindicator() function added in android api level 18 , upper. actionbar().sethomeasupindicator(r.drawable.ic_yourindicator); if use support library getsupportactionbar().sethomeasupindicator(r.drawable.ic_yourindicator);

html - jQuery .append finishing div on its own? -

i have div <div id="articles-feed"> i'm trying append more stuff. getting json data parse json.parse , format bit , try add code. the thing is, parsed data contains array of categories, , need display of them, figure i'd .append 3 times, for-loop in between relevant data. now strange thing happens when run function, </div> gets added after first .append , 2nd , 3rd .append added outside of <div class="article-box"> . if try target class directly using $('.article-box') 2nd .append , nothing happens. can figure out i'm doing wrong? my html: <div id="articles-sidebar"> <h2>search articles archive:</h2> <form id="searchbox" method="post"> <input name="searchword" type="text" placeholder="author, title, keyword..."> <input type="submit" value="search"> </form> </...

ruby on rails - Paperclip image upload (base64) - getting 500 internal server error (undefined method 'permit') -

i'm trying upload image using paperclip; followed paperclip quick start guide closely possible, i'm doing wrong , can't find out what. i'm new ruby , rails; whole project set angularjs framework. what i'm doing sending post request contains base64 encoded image: dataservice.add("uploads", {image: file}) [...] the service looks this: add: function(type, object) { return $http.post(api_url + "/" + type, object) [...] "file" base64 encoded image; hope clear how post works. backend: controller: module api class uploadscontroller < applicationcontroller # post api/uploads def create p params @upload = upload.create(upload_params) @upload.save end private def upload_params params.require(:upload).permit(:image) end end end model: class upload < activerecord::base attr_accessor :content_type, :original_filename, :image_data before_save :...

grails - How to update a server side datatable on change a checkbox from outside of datatable -

i using data table grails. have check box outside data table , on event want load table again check box value. here attempts below : in view check box >> <g:checkbox id="wrapcheck" name="wrapcheck"/> wrapped here attempts in view calling server method >> $('#wrapcheck').on('click', function (e) { setwrapactivestatus(); var referenceid = $('#callforwrap').val(); jquery.ajax({ type: 'post', datatype: 'json', url: "${g.createlink(controller: 'androidgame',action: 'ajaxandroidgamelist')}?wrapcheck=" + referenceid, %{--url: "${g.createlink(controller: 'androidgame',action: 'ajaxlistbywrapactivestatus')}?wrapcheck=" + referenceid,--}% success: function (data, textstatus) { if (data.iserror == false) { $('#example').datatable().ajax.reload(); } else { ...

Facebook Graph API search using since updated_time parameter -

i using facebook graph api in python. every post has 2 datetimes: created_date updated_date when providing since parameter, returning feeds created_date greater or equal since parameter. example, if provide since=2015-06-05 return posts 5th june, 2015 now. but suppose there post posted on 7th june, 2015 , few activities (likes, shares, comments, etc.) happened on 8th june, 2015. in scenario updated_time of post changes created_time same (7th june, 2015). if pass parameter since=2015-06-08 , won't able track of activity on post. is there solution can pass since parameter on updated_time instead of passing created_time ? as @cbroe points out, isn't supported facebook graph api. (it can done using fql , that's deprecated , won't supported longer). that said, creativity (and bit code) similar effect can achieved combining couple of queries. in application, perform query following parameters: until=2015-07-07 (or whatever since date ...

Apache / Gunicorn and Django Issue -

i have application runs using client --> apache --> gunicorn --> wsgi --> django when run code starts run , receive following within apache logs, (20014)internal error: proxy: error reading status line remote server 127.0.0.1 proxy: error reading remote server returned /app/view no exceptions show in code. if run code without gunicord/proxy layer works. affects requests. heres apache conf.d file. <virtualhost 10.0.6.1:443> servername app.domain.net alias /static /production/pythonenv/app/lib/python2.7/site-packages/rest_framework/static/ errorlog /var/log/httpd/app-error.log customlog /var/log/httpd/app-access.log common loglevel warn rewriteengine on rewritecond %{request_filename} !-f rewriterule ^/(.*) http://127.0.0.1:9008/$1 [p] proxypassreverse / http://127.0.0.1:9008/ setenv force-proxy-request-1.0 1 setenv proxy-nokeepalive 1 requestheade...

How to parse a VARCHAR passed to a stored procedure in SQL Server? -

i have 2 tables tbl_products , tbl_brands , both joined on brandid . i have stored procedure should return products belong brand ids passed parameter. my code follows. create proc sp_returnprdoucts @brandids varchar(500) = '6,7,8' begin select * tbl_products p join tbl_brands b on p.productbrandid = b.brandid b.brandid in (@brandids) end but giving error brandid int , @brandids varchar when hard code way follows works fine , returns desired data db .. create proc sp_returnprdoucts @brandids varchar(500) = '6,7,8' begin select * tbl_products p join tbl_brands b on p.productbrandid = b.brandid b.brandid in (6,7,8) end any :) another alternative use 'indirection' (as i've called it) you can do.. create proc sp_returnprdoucts @brandids varchar(500) = '6,7,8' begin if (isnumeric(replace(@brandids,',',''))=1) begin exec('select * tbl_produ...

c# - Check if connect to remote server by Webclient -

i want check if project can connect remote server webclient in asp.net c# , something. here code webclient webclient = new webclient(); webclient.credentials = new system.net.networkcredential(username, password); if (webclient.openread(url83).isconnected) // here, want check { xmltextreader reader1 = new xmltextreader(webclient.openread(url83)); reader1.whitespacehandling = whitespacehandling.none; //do } as described here best way check internet connectivity might like try { using (var client = new webclient()) using (var stream = client.openread(url83)) { xmltextreader reader1 = new xmltextreader(stream); reader1.whitespacehandling = whitespacehandling.none; //do } } catch (webexception ex) { // occurs when error occur while reading network stream }

javascript - Preserve `this` with recursive setImmediate() -

salam (means hello:)) in node.js app, need use setimmediate() recessively call function , keep context intact next execution. consider following example: var i=3; function myfunc(){ console.log(i, this); --i && setimmediate(arguments.callee); } myfunc(); output: 3 // regular `this` object 2 { _idlenext: null, _idleprev: null, _onimmediate: [function: myfunc] } 1 { _idlenext: null, _idleprev: null, _onimmediate: [function: myfunc] } as can see, after first execution this overwritten. how should work around this? do this: function myfunc(){ console.log(i, this); --i && setimmediate(myfunc.bind(this)); } as may notice, removed arguments.callee : its use deprecated , forbidden in strict mode .

RoundCube OAuth with Azure Active Directory -

i have mail box has authentication azure ad authentication. doing poc roundcube authentication login mail box should not user name , password. application authentication happens using azure active directory , same auth token should passed roundcube authenticated mail box while login roundcube. can please point me solution same. many thanks, thirumalai m based on comment, believe looking implement "on-behalf-of" scenario. please take @ following sample have on our github: https://github.com/azureadsamples/webapi-onbehalfof-dotnet in sample, native client calls web api , web api calls downstream web api after obtaining token act on behalf of original user. sample uses active directory authentication library (adal) in native client obtain token user call first web api, , in first web api token act on behalf of user call second web api. both flows use oauth 2.0 protocol obtain tokens. let me know if sample helps you, or if need additional ...

Selecting/Invoking Menubuttons in python Tkinter -

i trying create menu calls sql database life expectancy data across world. i'm having trouble menubutton, want set first value ("no region selected") initial value. there 3 things want: how set value default (ideally equivalent of invoked normal radiobuttons), there better want option menubutton, , there decent web page can me (tutorialspoint got me in initial direction, unless i'm looking in wrong places, can't find how select , invoke radiobuttons in menubutton). ideally, i'd advise on how not have menuoptions stretch everywhere too. limit of 20? here's of stripped down piece of code. edit: i've found solution select/invoke issues. mb.menu.invoke(0) from tkinter import * import tkmessagebox import tkinter import sqlite3 def selectstuff(): selectionregion = str(countryvar.get()) mb.config(text = selectionregion) sqllocation = 'alldata/lifeexpectency.sqlite' sqldb = sqlite3.connect(sqllocation) cursor = sqldb.cursor() ...

multithreading - How to thread Matplotlib in Python? -

when thread matplotlib , dont close graph window (by mouse - close window button) following error: exception runtimeerror: runtimeerror('main thread not in main loop',) in <bound method photoimage.__del__ of <tkinter.photoimage instance @ 0x7ff408080998>> ignored exception runtimeerror: runtimeerror('main thread not in main loop',) in <bound method photoimage.__del__ of <tkinter.photoimage instance @ 0x7ff3fbe373f8>> ignored tcl_asyncdelete: async handler deleted wrong thread aborted what do: have main loop calling methods of instance. matplotlib method threaded init function of instance. cant call matplotlib method inside instance, don't know why, thread via __init__ : def __init__(self): .... thread = threading.thread(target=self.drawcharts...

php - Example of how to use bind_result vs get_result -

i see example of how call using bind_result vs. get_result , purpose of using 1 on other. also pro , cons of using each. what limitation of using either , there difference. the deciding factor me, whether call query columns using * . using bind_result() better this: // use bind_result() fetch() $query1 = 'select id, first_name, last_name, username table id = ?'; using get_result() better this: // use get_result() fetch_assoc() $query2 = 'select * table id = ?'; example 1 $query1 using bind_result() $query1 = 'select id, first_name, last_name, username table id = ?'; $id = 5; if($stmt = $mysqli->prepare($query)){ /* binds variables prepared statement corresponding variable has type integer d corresponding variable has type double s corresponding variable has type string b corresponding variable blob , sent in packets */ $stmt->bind_param('i',$id); /...

tsql - SQL Server : coalesce, the part of string is missing -

i have code: declare @results varchar(500) select @results = coalesce(@results+', ', '') + convert(varchar(12),k.t1) ( select '('+cast(count(distinct(g.roomid)) varchar) + ') '+ rt.classname t1 db_pms.guests g left join db_pms.roomtypes rt on rt.roomtypeid=g.roomtypeid g.groupid = 47 , g.status >= 0 group g.roomtypeid, rt.classname ) k select @results results the part select '('+ cast(count(distinct(g.roomid))as varchar) + ') '+ rt.classname t1 db_pms.guests g left join db_pms.roomtypes rt on rt.roomtypeid=g.roomtypeid g.groupid = 47 , g.status >= 0 group g.roomtypeid, rt.classname returns (1) Люкс (4) Полулюкс (2) Стандарт dbl (6) Стандарт twn (1) Стандарт+ twn and after using select @results = coalesce(@results + ', ', '') + convert(varchar(12),k.t1) i (1) ...

c# - Accessing code behind method Variable in aspx page -

i working in custom detailed view. have program page views program. when user clicks on update button, user redirected manage programs page. manage programs page contains method fetches rows from. public string programsdetails() { using (sqlconnection con = new sqlconnection(str)) { string htmlstr = ""; sqlcommand cmd = con.createcommand(); cmd.commandtext = " select * programs progid=@progid"; cmd.parameters.addwithvalue("@progid", "1"); con.open(); sqldatareader reader = cmd.executereader(); if (reader.read()) { int progid = reader.getint32(0); string progtitle = reader.getstring(1); string progbudget = reader.getstring(4); string progstardate = reader.getstring(5); } con.close(); return htmlstr; } } how can access variable .aspx page? lets access progtitle . i have used method seems it...

sqlite3 - SQLite increases auto-inc value even if record isn't added -

i believe there's way in innodb stop auto-increment value increasing if record insert attempt failed/was ignored: innodb_autoinc_lock_mode however, each time connects server, use query on sqlite3: "insert or ignore iplist (ip) values (" + string(ip) + "); " unfortunately, if ip in table, auto increment value increases anyways. if lots of people connect server value incredibly high. how stop doing in sqlite3? the documentation says: note "monotonically increasing" not imply rowid increases one. 1 usual increment. however, if insert fails due (for example) uniqueness constraint, rowid of failed insertion attempt might not reused on subsequent inserts, resulting in gaps in rowid sequence. autoincrement guarantees automatically chosen rowids increasing not sequential. to ensure autoincrement values sequential, drop autoincrement keyword table definition , use plain integer primary key: the autoincrement keyword ...

node.js - How to pass command line argument in electron -

i started using electron. have doubt how pass command line arguments in electron when i'm using npm start run electron. in node.js using: node server.js 1 two=three four command prompt : var arguments = process.argv.slice(2);arguments .foreach(function(val,index, array) { console.log(index + ': ' + val); }); in node.js working. need know how can make work in electron. can please give solution this? the way of passing arguments same, thing have take care path of electron. in package.json written npm start perform electron main.js . have execute command explicitly , pass arguments "proper path of electron" i.e ./node_modules/.bin/electron . command ./node_modules/.bin/electron main.js argv1 argv2 and these arguments can access process.argv in main.js and if wish access these parameters in app there following things : 1.in main.js define variable global.sharedobject = {prop1: process.argv} 2.in app linclude...

Couchdb using nano , how to write search query -

i facing problem using couchdb. using nano module in nodejs. how can implement search match user name , password. tried this body.rows.foreach(function(row) { if(row.doc._id==user_id && row.doc.password==password){ found = true; data = row; } }); but slow process your code body.rows.foreach ... map function (it iterates on every row) executes filter function if(row.doc._id==user_id ... row. thats couchdb views - same. but slow process true. because of couchdb creates index (a b-tree file inside couchdb's database directory) , keeps index up-to-date. performance advantage every request result taken prepared index instead of just-in-time calculation in example. the couchdb view map function like: function(doc) { emit([doc._id,doc.password], null) } the key of every row [:username,:password] , value null . if request /:db/:ddoc/_view/:name?key=[":username",":password"] you row immediately. append &inc...

php - Showing Sum of amount based on another row value on SESSION -

i have view cart session this id name disc qty -- ---- ------ ------ 1 aaaa d1 2 1 aaaa d5 1 2 bbbb d1 1 1 aaaa d1 1 what want is, showing query session result this name total ---- ------ aaaa 4 bbbb 1 how can this? i have query show cart: <?php if(count($_session[data1][id])>0) for($i=0;$i<count($_session[data1][id]);$i++) { if($_session[data1][id][$i]!='') { ?> <td ><?=$_session[data1][id][$i]?></td> <td ><?=$_session[data1][name][$i]?></td> <td ><?=$_session[data1][disc][$i]?></td> <td ><?=$_session[data1][qty][$i]?></td> <?php } } ?> you can loop through data adding quantities array indexed name. quick'n'dirty example <?php $names = array("aaa", "bbb", "aaa", "bbb"); $qts = array(1, 2, 3, 4); ($i=0; ...

xml - Get nth child node without knowing node name Groovy -

i have xml this: <node1> <node2> <node3> <node4> <node5> <node6> </node6> <node7> </node7> </node5> </node4> </node3> </node2> </node1> how can name of 6th node - assuming don't know node's name "node6"? i have: def text = <xml above> def list = new xmlslurper().parsetext(text) thanks in advance. how about: def text = <xml above> def node = new xmlslurper().parsetext(text)[0] 5.times { node = node.children()[0] } assert node.name() == "node6"

python - How to convert Mat from opencv to caffe format -

i using opencv crop face camera. , used caffe predict image belongs male or female. have original code load image static image. however, want use image camera it. original code in caffe model = caffe.classifier(...) image_path = './static_image.jpg' input_image = caffe.io.load_image(image_path ) prediction =model.predict([input_image]) now, use opencv capture frame , call predict method val, image = cap.read() image = cv2.resize(image, (320,240)) gray = cv2.cvtcolor(image, cv2.color_bgr2gray) faces = face_cascade.detectmultiscale(gray, 1.3, 5, minsize=(30,30)) f in faces: x,y,w,h = f cv2.rectangle(image, (x,y), (x+w,y+h), (0,255,255)) face_image = gray[y:y+h, x:x+w] resized_img = cv2.resize(face_image, (45,45))/255. after having resized_image, conver caffe type such function def format_frame(self,frame): img = frame.astype(np.float32)/255. img = img[...,::-1] return img however, when ca...

Differences in Javascript date in XP and OSX -

var d = new date(); var date = d.gettime(); var age = math.floor(date/1000 - time); time unix timestap 1434168603 retrieved table. if console.log(time) , both numbers equal on xp , mac osx (chrome). if console.log(date/1000) , example 1 1433914098 (rounded) on xp 1434168768 (rounded) on osx, leading incorrect submission time on xp. on osx it's correct. what causing this?

c# - How to change name of .cshtml file on asp.net mvc? -

i created asp.net mvc project on visual studios, in many folder have folder called home has 3 .csthml files: about.cshtml, contact.cshtml, , index.cshtml. i change about.cshtml blah.cshtml , contact.chstml lala.cshtml. i've tried properties name not changed across other files in project. should use files in project or create controller? click on file, push f2 , rename (type in new name) or right click file , select rename. make sure not running application (which may issue). if change name, action in controllers should updated.

c# - Use in operator in stored query in ms access with ado.net -

following stored query in ms access update tblcontacts set isactive = 0, dtupdated = vdtupdated contactid in (vcontactid); contactid integer. following c# code executes above stored query public void delete(string contactid) { using (var cm = new oledbcommand()) { cm.connection = accessconnection(); cm.commandtype = commandtype.storedprocedure; cm.commandtext = "deltblcontacts"; cm.parameters.addwithvalue("vdtupdated", datetime.now.tostring()); cm.parameters.addwithvalue("vcontactid", contactid); cm.connection.open(); cm.executenonquery(); cm.connection.close(); } } when execute above code, not single record affected. i feel passing data stored query in string form pain point.

R - Get joint probabilities from 2D Kernel Density Estimate -

Image
i have 2 vectors s , v, , using function kde2d , following plot of joint density: using data, possible obtain empirical estimate of joint probability, in form p(s[i],v[j]) ? in question how find/estimate probability density function density function in r suggested use approxfun height of value in 1d kde plot. there way extend idea 2 dimensions? one approach use bilinear interpolation of grid returned kde2d : library(fields) points <- data.frame(x=0:2, y=c(0, 5, 5)) interp.surface(k, points) # [1] 0.066104795 0.040191482 0.001943069 data: library(mass) set.seed(144) x <- rnorm(1000) y <- 5*x + rnorm(1000) k <- kde2d(x, y)

ffmpeg - Splitting up a variable in bash -

i have bunch of songs have downloaded trying convert .mp3 , rename. after converting .m4a file mp3 ffmpeg , in format of artist name - song name.mp3. want able separate song name , artist name own variables, can rename file , tag songs song name , artist name. so, how can separate variable 2 variables, each respectively containing artist name , song name, 2 pieces of information separated ' - ' in bash? using shell v='artist name - song name.mp3' v=${v%.mp3} song=${v#* - } artist=${v% - $song} echo a=$artist, s=$song this produces output: a=artist name, s=song name notice approach, sed solution below, consistently divides artist , song @ first occurrence of - . thus, if name is: v='artist name - song name - 2nd take.mp3' then, output is: a=artist name, s=song name - 2nd take this approach posix , works under dash , busybox under bash . using sed $ v='artist name - song name.mp3' $ { read -r artist; read -r song; ...

java - mybatis execute an update SQL,and then throw Exception of Deadlock -

this update used here, , exception not happen, don't know how registration problem sql: update sys_privilege set privilege_code = ?, type = ?, level = ?, name = ?, parent_id = ?, sort_num = ? id = ? cause: com.mysql.jdbc.exceptions.jdbc4.mysqltransactionrollbackexception: deadlock found when trying lock; try restarting transaction ; sql []; deadlock found when trying lock; try restarting transaction; nested exception com.mysql.jdbc.exceptions.jdbc4.mysqltransactionrollbackexception: deadlock found when trying lock; try restarting transaction @ org.springframework.jdbc.support.sqlerrorcodesqlexceptiontranslator.dotranslate(sqlerrorcodesqlexceptiontranslator.java:269) @ org.springframework.jdbc.support.abstractfallbacksqlexceptiontranslator.translate(abstractfallbacksqlexceptiontranslator.java:72) @ org.mybatis.spring.mybatisexceptiontranslator.translateexceptionifpossible(mybatisexceptiontranslator.java:73) @ org.mybatis.spring.sqlsessi...

ios - How can I detect when a UITableView has been scroll past the very bottom/top? -

Image
i've got view has 3 tableview's. 1 "main table view", , have 'answers table view' , 'percentage table view'. when screens loads, main table view occupies top 95% of screen. bottom of screen uiview containing 2 buttons. "answers" , "percentage". the way works, if click "percentage" changes height of main table view 0, , gives height answers table view. animates "answers/percentage" view top, , reveals either answers or percentage tableview below it. here's example: as can see, click on "percentage" animates up. if click on "percentage" again animates down. however, want if "answers/percentage" view @ bottom of view, , user scrolls main feed reaches end of tableview's contents (not end, end , little bit more), want animate in .gif. similarly, if "answers/percentage" @ top, , user scrolls lower "answers table view" down past point there no m...

javascript - Sendmessage to Close "Leave This Page" Popup -

i using vba ie automation , have ran issue closing "leave page" popup. have had success sendmessage in past have been unable identify childhwnd. ie.quit if ie.busy doevents hwnd = findwindow(vbnullstring, "windows internet explorer") if hwnd <> 0 childhwnd = findwindowex(hwnd, byval 0&, "button", "&leave page ") if childhwnd <> 0 sendmessage childhwnd, bm_click, 0, 0 the hwnd identified without problem childhwnd comes 0 every time , sendmessage fails fire. used enumchildwindows try identify controls text , classname , "button" , "&leave page ". have tried without additional space , without & sign. still no luck. have suggestions? in advance.

recursion - How to recursively identify cells of specific type in grid? -

i'm learning f# , i'm building minesweeper app. part of that, i'm trying have method detonates adjacent mines if mine detonated, recursively. if have grid like: | 0 | 1 | 2 | ------------------------ 0 | e-1 | m | e-2 | 1 | e-2 | e-4 | m | 2 | m | e-3 | m | and detonate mine in 0,1, in turn detonate mine in 1,2 , in turn detonate mine in 2,2. mine in 2,0 not detonate because isn't adjacent of others. at point i've implemented field list: module cellcontents = type t = | empty of int | mine | crater module location = type t = { row: int; column: int } module cell = type t = { content : cellcontents.t location : location.t } module field = type t = cell.t list what i'm having trouble how start cell 0,1 , end list of mines adjacent. so, need list (showing coordinates): let minestodetonate = [ {row=0;column=1};{row=1;column=2};{row=2;column=2} ] i have no trouble getting adjacent mines...