Posts

Showing posts from September, 2015

php array slice every 2th rule -

i have array on php outputs in txt file: printing grid -- 1 values -- undef = -9.99e+08 20.2 \nprinting grid -- 1 values -- undef = -9.99e+08 102.0 \nprinting grid -- 1 values -- undef = -9.99e+08 55.1 \nprinting grid -- 1 values -- undef = -9.99e+08 -18.3 \n what point, need nummeric values @ beginning of each rule. 20.2, 102.0, 55.1, -18,3 etc... example, there can more or less in txt file. now do? have tested array slice function can't exclude rule: printing grid -- 1 values -- undef = -9.99e+08 this array slice code... $arraygood = array_slice($arraybad, 1, 4); and foreach loop create text file: $file = fopen("array.txt","w"); foreach ($arraygood $meting => $waarde) { echo fwrite($file,$waarde . '\n'); } fclose($file); thanks! as posted in comments, understanding have array of strings similar following: $lines = array( "printing grid -- 1 values -- undef = -9.99e+08", "20.2 \nprinting grid --

My HTML document is not linking to my CSS stylesheet properly -

i have been copy , pasting html , css tutorials try make work, right have; page (html) <!doctype html> <html> <head> <meta charset="utf-8"> <title>title of document</title> <link rel="stylesheet" type="text/css" href="style/style.css" /> </head> <body> <h1>1this site</h1> <p>welcome site</p> </body> </html> style.css body {background-image:url(“background.png”);} h1 {font-family:arial, sans-serif;} the when load html in safari still unformatted. thanks in advance! check see if setting paths right if still have problem try use fill path : <link rel="stylesheet" type="text/css" href="http://127.0.0.1/test/style/style.css" />

phpstorm - JavaScript with function having inconsistent return points -

let's have class: function point(x,y){ var _x=x,_y=y; this.x = function(newx){ if (typeof newx !== 'undefined') { //function x() working setter _x=newx; } else { //function x() working getter return _x; } } } phpstorm complains function (x()) having inconsistent return points. found adding return undefined; after _x=newx; solves whine , code looks this. function point(x,y){ var _x=x,_y=y; this.x = function(newx){ if (typeof newx !== 'undefined') { //function x() working setter _x=newx; return undefined; } else { //function x() working getter return _x; } } } the question is: there way make phpstorm stop whining this? another option annotate methods return type properly, phpstorm knows function expected return undefined in cases. /** * @param {number} [newx] * @returns {number|undefined} */ this.x = function(newx) { // ... }

node.js - Sending sockets to client side, Error: Converting circular structure to JSON -

i'm working in node js , i'm trying send array, clients, server every client normal emit, keeps giving me error: data = json.stringify(ev); typeerror: converting circular structure json shortly, do. var clients = new array(); io.sockets.on('connection', function(socket) { clients.push(socket); socket.on('loginuser', function(data){ io.sockets.emit("getusers", clients); }); i've seen couple of other people having problem, answers didn't work out me. looking @ bigger problem, can't send array of sockets client side. sockets objects make sense in current context/process. if want control sockets client side, instead add sort of rpc functionality.

java - spring amqp rabbitmq MessageListener not working -

i trying use rabbitmq using spring amqp, below configuration. <rabbit:connection-factory id="rabbitconnectionfactory" port="${rabbitmq.port}" host="${rabbitmq.host}" /> <rabbit:admin connection-factory="rabbitconnectionfactory" /> <rabbit:queue name="${rabbitmq.import.queue}" /> <rabbit:template id="importamqptemplate" connection-factory="rabbitconnectionfactory" queue="${rabbitmq.import.queue}" /> <beans:bean id="importexchangemessagelistener" class="com.stockopedia.batch.foundation.importmessagelistener" /> <rabbit:listener-container connection-factory="rabbitconnectionfactory" concurrency="5"> <rabbit:listener queues="${rabbitmq.import.queue}" ref="importmessagelistener" /> </rabbit:listener-container> this simple message listener class, import org.springframework

database - iOS Insert Row with 2 Date Fields -

how 1 insert row table i've created 2 sqlserver smalldatetime fields via windows azure mobile services library? i'm trying use: [nsdate timeintervalsince1970] to store date-time value nstimeinterval or double. however, causes following error: error domain=com.microsoft.windowsazuremobileservices.errordomain code=-1302 "error: bad request." datetime fields should represented nsdate field in nsdictionary object sending insert or update call. so do: [table insert:@{ @"id": @"myid", @"deliverydate": [nsdate date] } completion:... ]; if send nsnumber instead, see -1302 error shown above.

java - How to Bypass restrictions on the hosts file in windows 8 programmatically? -

i want using hosts file in windows 8 in order block websites redirecting it, knew there restrictions put windows defender on hosts file in order prevent malicious softwares missing it, want programmatically (by java) bypass these restrictions in order edit hosts file.

Logstash + ElasticSearch: initial type mapping results in missing log lines -

we have classic logstash + elasticsearch + kibana setup log aggregation. use aggregate logs across servers , applications, , we've stumbled upon following problem: first time es receives log line (a json document in our case), creates mapping document (see http://bit.ly/1h3qwc9 ). of time, properties mapped strings, in cases they're mapped dates or numbers. in latter case, if log line (from different application) has same field, string value, es fail index (throwing exception log , continue usual). workaround we've configured es ignore malformed documents (index.mapping.ignore_malformed: true), feels more of hack. any ideas how solve issue in elegant way? it sounds guys don't care date types, or type. think best solution define dynamic template define types string: { "_default_" : { "dynamic_templates" : [ { "long_to_string" : { "match" : "*",

sql - Invalid Identifier. Is it the concat code? -

i keep getting error "invalid identifier" , know columns right... thoughts? also, know concat coding kind of messy. offered code it: ,mp_asin.parent_asin_name || ', ' || mp_asin.color_name teen which better? select mp_asin.category_code category_id ,mp_asin.subcategory_code subcategory ,mp_asin.parent_asin ,mp_asin.parent_asin_name ,mp_asin.color_name color_name ,mp_asin.product_site_launch_day psld ,concat(mp_asin.parent_asin_name, concat(',', concat(' ',mp_asin.color_name))) teen ,mp.brand_code brand_code ,mp.replenishment_code replen_code ,mp.replenishment_category_id replen_tier ,mp.asin asin , min(mp.replenishment_code) on (partition (concat(mp_asin.parent_asin_name, concat(',', concat(' ',mp_asin.color_name))))) min_teen_rc , max(mp.replenishment_code) on (partition (concat(mp_asin.parent_asin_name, concat(',', concat(' ',mp_asin.color_name))))) max_teen_r

vb.net - Can Multiple BackgroundWorkers use the same Function / end Variable? -

is okay if let's have backgroundwoker1 backgroundwoker2 both of them having : addhandler backgroundwoker1.dowork, addressof requestdatatravelpackagesname addhandler backgroundwoker1.progresschanged, addressof showloadinganim and in other line (with different time usage) addhandler backgroundwoker2.dowork, addressof requestdatatravelpackagesname addhandler backgroundwoker2.progresschanged, addressof showloadinganim is allowed? because tried similar thing, , appeared form malfunctions. doesn't gives me error / message. frame (gui) vanished. i'm thinking perhaps because of multiple background workers have. accessing same variable (at completed function) or in similar function / etc. there's absolutely no issue you're suggesting in principle. if there's issue it's implementation. the dowork event handler method gets executed on secondary thread. it's common have same method executing on multiple threads @ same time , there'

How do I indent a text line in TextView in android? -

i writing text in android take more 2 lines problem how indent second line text lines are. 1.my name qadeer hussain iam fine how ru. but want 1.my name qadeer hussain iam fine how ru. here second line not start right below 1 right below name use leadingmarginspan.standard spannablestring , or if need bullets use bulletspan : just create function this: static spannablestring createindentedtext(string text, int marginfirstline, int marginnextlines) { spannablestring result=new spannablestring(text); result.setspan(new leadingmarginspan.standard(marginfirstline, marginnextlines),0,text.length(),0); return result; } and then, everytime need indented line can do: mytextview.settext(createindentedtext("my text that's gonna indented", 10, 10)); the first parameter indentation of first line, second parameter indentation of next lines, in case want indent first line differently following ones.

update css on AJAX loaded html -

i loading in html ajax using jquery. triggering click event on elements within newly loaded html. i having problem setting css on newly loaded elements. here code... function updatescreen(year, month) { $.ajax({ url:'ajax_php/get_year_data.php', data: 'year=any', type: 'post', success: function(data) { $('.top-container').html(data); // highlight year $("#" + year).click(); // , month $("#" + year + ' .' + month).click(); $("#" + year + ' .' + month).css('background-color', converthex('#9fc7f5', 20)) console.log($("#" + year + ' .' + month).css('background-color')); } }); } the console.log returns expect see screen not show change in background color. can tell me why? cheers, george why doing post on get_year_data.php ? since it's getter request, more restful ge

javascript - ASP.NET Bootstrap Modal with UpdatePanel - possible solution? -

i'm no expert, please correct me if i'm wrong. don't believe twitter bootstrap modal dialogs work when used in asp.net updatepanels. @ least, never able simple confirmation bootstrap modal dialog work one, , i've read plenty of posts it's not possible. assuming above correct, , if it's not, i'd love know answer... i wondering if there might way solve issue somehow disabling updatepanel - not disabling controls - stop updatepanel acting updatepanel. work this: user clicks button in updatepanel, calls client-side javascript disables updatepanel , pops modal dialog. when user clicks "ok" in modal dialog, client-side javascript re-enables updatepanel call server. does think possible? don't know enough javascript , client-side programming have clue how this. mean, saying "i don't know enough" makes sound know more do, if know mean. so thought i'd post (probably silly) idea , see if come way make work. thanks! ps:

sql server 2008 - SQL-select previous day and exclude today -

i need include records registered yesterday exclude records has been registered today. not sure if query giving me correct numer of records. please help select id, lastmodifieddate stu_tbl last_modified_date > dateadd(d, - 1, getdate())) , _last_modified_date <> getdate()) try this: select id, last_modifieddate stu_tbl last_modified_date >= dateadd(d, -1, cast(getdate() date)) , last_modified_date < cast(getdate() date)

java - Override the method -

i'm asked override method implement new behaviors, have made constructor , method. private string name; private boolean disease; public area(position pos, string name, boolean disease) { super(pos); this.name = name; this.disease = disease; } public string getname() { return name; } and method have override disease can stopped on area if medicine enough public boolean hasdisease() { return disease; } i tried using if (medicine = true) { disease = false } return disease = true; } but cause other tests fail. you used = instead of == test equality. if(medicine == true) { // <-- fixed this. disease = false } return disease = true; } you can fix more: if(medicine) disease = false return disease;

animation - Animating circle to increase and decrease in size over a period of time - matlab -

Image
i create simple visualization whereby circle (country) increase/decrease in size(base on variables) respect time. how can done on matlab current dataset ? want each circle represent country , size of circle determined value in particular year. c1990 represents year 1990 can anyhow point me in right direction or me started ? thanks here 2 possible ways start, using scatter (note area of circles proportional values of 10*d , not radius or diameter) close figure(1) d=rand(10,10) cx=1:10; cy=cx; i=1:length(d(:,2)) scatter(cx,cy,(10*d(:,i))) drawnow pause(.1) end or plotting circles manually, radius of circle corresponding d figure(2) d=rand(10,10) cx=1:10; cy=cx; phi=0:pi/100:2*pi; i=1:length(d(:,2)) k=1:length(cx) r=d(k,i); plot(cx(k)+r*cos(phi),cy(k)+r*sin(phi)) hold on end drawnow pause(.1) hold off end (you can have area or radius of circles proportional d in either case)

reporting services - Visible Export Data Feed option SSRS report -

i working on ssrs reports , need visible "export data feed" option in ssrs reports. updated tag in render section adding attribute visible="true" in reportconfig file, don't find solution. can 1 me how can solve this. thanks, sid

php - rewriterule to prevent 500 internal error with accented Characters in url -

i got unsolved problem maybe basic 1 dont find answer. problem accent characters in url, i got 500 error(error code: 500 internal server error. request rejected http filter. contact server administrator. (12217)). for instant when search "blé", in url got: /content/search?searchtext=blé , result 500 error, in blog keywords: /content/keyword/blé : (result 500 error). i have created directory out of website folder , have created alias website directory. www.mysite.com/directory if put file accented name result same! can use rewriterule change accented words non-accented or can make url accept these accents? i need , appreciate if can me. this looks issue on tmg/isa firewall. on publishing rule have enable high bit character (right click on publishing rule, configure http, general tab).

php - How to delete an item into an array with a button -

Image
i have code array saves need each time press button, these items saved array showed later erase buttons, don't know how delete it, there part of code shows meant: echo "<table border=1>"; echo "<tr class='tabpreciostitles'>"; echo "<td>nom activitat</td> <td>nom tipus activitat</td> <td>tipus tarifa</td> <td>temps/km</td> <td>preu</td>"; echo "</tr>"; ($x=0;$x<count($savedarray[4]);$x++){ echo "<tr>"; echo " <td>".$savedarray[0][$x]."</td>"; echo " <td>".$savedarray[1][$x]."</td>"; echo " <td>".$savedarray[2][$x]."</td>"; echo " <td>".$savedarray[3][$x]."</td>"; echo " <td>".$savedarray[4][$x]."</td>&quo

Google Search Appliances -

how customize xml output of google search applianes.we need add images , ratings in search result.by default after crawling, when go search, items on indexes not proving details users needed.how cutomize or extend searh result google search appliances. if information in metadata of indexed documents isn't being displayed in xml of results when remove proxystylesheet url parameter, try adding getfields=* url parameter.

java - overriding hashCode, why is this.hashCode() not used? -

when overriding equals() , hashcode() methods in java why isn't used often: public int hashcode() { return (int) this.hashcode(); } or above prime introduced: public int hashcode() { final int prime = 31; //31 common example return (int) prime * this.hashcode(); } is bad practise or not work? the method: public int hashcode() { return (int) this.hashcode(); } would lead stackoverflowerror because recurse infinitely, unless replace this super . second method has same problem. in addition, casting value of type int int useless well. if not provide useful new method, don't override it.

Make a choice with a ComboBox, PyQT -

how ? i create programme wherein propose choice combobox. for exemple, if choice item in combobox, write in spinbox. probléme that, wirte in third spinbox without create new combobox. hope understand check out :) ` # -*- coding: utf-8 -*- import sys pyqt4.qtcore import qt pyqt4.qtgui import (qapplication, qwidget, qvboxlayout, qspinbox, qcombobox) class widget(qwidget): def __init__(self): super(widget, self).__init__() self.layout = qvboxlayout(self) self.spin = qspinbox(self) self.spin2 = qspinbox(self) self.spin3 = qspinbox(self) self.combo = qcombobox(self) self.combo2 = qcombobox(self) self.layout.addwidget(self.spin) self.layout.addwidget(self.spin2) self.layout.addwidget(self.spin3) self.layout.addwidget(self.combo) self.layout.addwidget(self.combo2) self.combo.currentindexchanged['qstring'].connect(self.on_combo_changed) self.combo2.c

parcelable - Unmarshalling unknown type code exception while reading parcel values in Android 4.4+ -

i'm using parcelable interface , working fine till android 4.3 (jelly bean) when install same app on device running under android 4.4+ (kitkat) crashing while reading parcel. throwing below error : java.lang.runtimeexception: parcel android.os.parcel@42acce90: unmarshalling unknown type code 6881383 @ offset 1864 when try read : getintent().getextras().getstring("type").contains("some_type"); i have put extra in intent : intent ointent = new intent(getactivity().getapplicationcontext(), eventfragment.class); ointent.putextra("type", "some_type"); after long time , r&d, came know should not use arraylist inside arraylist , within parcelable object. causing issue. so end-up using serializable interface provided java , both concept same.

jsf 2 - how we can get only number skipping fraction in jsf f:convertNumber? -

i have inputtext takes value user , bound number. if value "6000.0", subsequent pages show "6000". there way format such if user enters fractional number, show below? examples: user enters "35545.9" show "35545" user enters "5546.1" show "5546" user enter "7558.767" show 7558 user enter "548.7943" show 548 you can use: <h:inputtext value="#{receipt.amount}" > <f:convertnumber minfractiondigits="2" /> </h:inputtext> or <h:inputtext value="#{receipt.amount}" > <f:convertnumber pattern="#0.00" /> </h:inputtext > to add fraction digits

android - Want to publish my .apk file on playstore -

i want publish app on play store. first asked me signed .apk file , did using debug.keystore , again i'm trying upload .apk , saying "you created apk in debug mode, have create in release mode" tried method still got no success. can me plzzz? you need create own signed key in order publish app. simple , can done eclipse. just follow quick guide: right click on project in eclipse -> android tools -> export signed application package click next select "create new keystore", choose location, enter password click next , fill needed fields. write 25 years in validity. (it minimum) click next , chose want place apk google play thats all. next time when want update app select "use existing key" in step 3.

java - Solr delay at document delete -

maybe got same problem , can me, when delete document there delay between solr index refresh , got still on list document deleted thans in advance it looks using solrj updaterequest delete document. since not explicitly committing update, actual timing of index update depends on solr configuration. solr docs ( https://cwiki.apache.org/confluence/display/solr/near+real+time+searching ) "a common configuration hard autocommit every 1-10 minutes , autosoftcommit every second" if need make delete committed index right away, can add "commit" action updaterequest this: updaterequest req = new updaterequest(); req.deletebyquery("documentid:"documentid); req.setaction(action.commit, false, true); this have same effect adding "?action=commit" update request , perform soft commit right away.

c - Function returns only letters of string -

i wrote program should take string , return string letters original one, it's not working , can't figure out why. can me? #include<stdio.h> char *only_letters(char *s1ptr, char *s2ptr) { while(*s1ptr) { if((*s1ptr >= 'a' && *s1ptr <= 'z') || (*s1ptr >= 'a' && *s1ptr <= 'z')) { *s2ptr = *s1ptr; s2ptr++; } s1ptr++; } *s2ptr = '\0'; return s2ptr; } int main() { char *s1ptr, *s2ptr; printf("\n write string:\n"); scanf("%s", s1ptr); printf("\n%s\n", *only_letters(s1ptr, s2ptr)); return 0; } you have 3 problems. s1ptr , s2ptr 2 unallocated arrays caused undefined behavior. you're incrementing s2ptr point has value \0 . after returning have string has \0 . to show string, must pass without * (don't dereference it). try this char *only_letters(char *s

sql - Oracle - How to force user to INSERT multiple row -

i using oracle 11gr2 on academic assignment. there constraint room must have 3 - 5 people. know can write trigger check if room has more 5 people: create table people ( pid integer primary key ); create table room ( rid integer primary key ); create table living ( rid integer, pid integer, constraint living_pk primary key (rid, pid), constraint living_fk_rid foreign key (rid) references room(rid), constraint living_fk_pid foreign key (pid) references people(pid) ); create or replace trigger living_biu before insert or update on living referencing new new old old each row declare count number; begin select count(*) count living rid = :new.rid; if(count > 5) raise_application_error(-20002, 'too many people in room.'); end if; end living_bi; but can not check if number lesser 3 because can not insert things living. question how can create trigger force user insert more 3 rows , less 5 rows @ time? with standard p

Deploy TypeScript WebSite from GitHub to Azure -

i have .net website includes typescript files. i'm attempting deploy azure website github, i'm getting error associated typescript. it appears me may related use of newest version (1.0) whereas kudu build has 0.9 - i'm new enough can't sure that's issue, nor how fix it. here deployment log (sorry formatting): command: d:\home\site\deployments\tools\deploy.cmd handling .net web application deployment. packages listed in packages.config installed. restoring nuget packages... prevent nuget downloading packages during build, open visual studio options dialog, click on package manager node , uncheck 'allow nuget download missing packages'. packages listed in packages.config installed. shadow_findly -> d:\home\site\repository\shadow_findly\bin\release\shadow_findly.dll d:\program files (x86)\msbuild\microsoft\visualstudio\v12.0\typescript\microsoft.typescript.targets(96,5): error : project file uses different version of typescript compiler ,

html - Float Two Divs Side By Side -

Image
i'm sorry post this. i've read dozens of posts on same issue, can't solve this. how place blue , green boxes side-by-side? i've got plenty of space in wrapping div, , think dealing float correctly, still incorrect results. gives? <div class="titleframe" > <div class="image" > <img id="thief" src="thief.png"> </div> <div class="titletext"> <h1>my title</h1> <p>line1<br>line2<br>line3</p> </div> </div> .titleframe { margin:0 auto; width:750px; clear:left; height:300px; border: 1px solid red; } .image { width:100px; height:250px; border: 1px solid blue; } .titletext{ position:relative; float:left; padding-left:25px; padding-top:0px; height:150px; width:250px; border: 1px solid green; } add float:left; .image class.

php - simplexml_load_file not working with variable but works with string -

i trying connect crm (pardot). i have create url necessary call xml: //this log in , print api key (good 1 hour) console $rz_key = callpardotapi('https://pi.pardot.com/api/login/version/3', array( 'email' => 'myemail@email.com', 'password' => 'password', 'user_key' => '032222222222222b75a192daba28d' ) ); $number_url = 'https://pi.pardot.com/api/prospect/version/3/do/query'; $number_url .= '?user_key=032222222222222b75a192daba28d'; $number_url .= '&api_key='; $number_url .= trim($rz_key); $number_url .= '&list_id=97676'; $ike = simplexml_load_file($number_url); print_r($ike); now code returns : simplexmlelement object ( [@attributes] => array ( [stat] => fail [version] => 1.0 ) [err] => invalid api key or user key ) however, if echo $number_url , , copy , paste url browser, loads wonderfully. if copy , paste same echoed url simplexml_loa

bash - Synchronize access to shell variables while using Gnu parallel (i.e. critical section in Gnu parallel) -

i have for loop i'd convert parallel . however, i'm appending global ( bash ) array within loop. what's recommended way of dealing situation? parallel provide form of synchronization between jobs besides --keep-order ? i thought replacing array combination of flock , echo > some_shared_file , wanted know if there's standard way of implementing "critical section" parallel . bash has "thread local" variables. there no global variables can updated different threads. variables/arrays copied subprocesses, , changes in 1 not reflected in another. the more general answer -- if had resources updated different processes -- use sem comes gnu parallel.

Android get data using regexp -

i have html string in in trying string between tag using regexp , saving value array-list . not able string between tag array-list empty. <span><div style=\'float:left; width:350px;\'>pharmacie dar d\'bagh</div> my code data using regexp is private void findtextbyregexp() { arraylist<arraylist<string>>datalist1 = new arraylist<arraylist<string>>(); string pattern3 = "<span><div style=\'float:left; width:350px;\'>"; string pattern4 = "</div>"; string text = readfromfile(); pattern p = pattern.compile(pattern.quote(pattern3) + "(.*?)" + pattern.quote(pattern4)); matcher m = p.matcher(text); while (m.find()) { arraylist<string>dataadd = new arraylist<string>(); dataadd.add(m.group(1)); datalist1.add(dataadd); log.d(&quo

Outputting multiple lines of text with renderText() in R shiny -

i want output multiple lines of text using 1 rendertext() command. however, not seem possible. example, shiny tutorial have truncated code in server.r : shinyserver( function(input, output) { output$text1 <- rendertext({paste("you have selected", input$var) output$text2 <- rendertext({paste("you have chosen range goes from", input$range[1], "to", input$range[2])}) } ) and code in ui.r : shinyui(pagewithsidebar( mainpanel(textoutput("text1"), textoutput("text2")) )) which prints 2 lines: you have selected example have chosen range goes example range. is possible combine 2 lines output$text1 , output$text2 1 block of code? efforts far have failed, e.g. output$text = rendertext({paste("you have selected ", input$var, "\n", "you have chosen range goes from", input$range[1], "to", input$range[2])}) anyone have ideas? you can use re

jQuery Auto Refresh Send Value Variable -

i want pass value of variable using jquery auto refresh : var auto_refresh = setinterval ( function () { var p_box_sn = $("#p_box_sn").val(); $.ajaxsetup({ cache: false }); $('#counts').load('load.php?p_box_sn=p_box_sn').fadein("slow"); }, 1000 ); but show output : p_box_sn. wanted value var p_box_sn , sent load function. possible? since p_box_sn variable, need concatenate using + : $('#counts').load('load.php?p_box_sn=' + p_box_sn).fadein("slow");

php - insert single set of data multiple times mysql -

i have insert single set of data multiple times , n rows. insert mytable values ("john", 123, "us"); can insert n rows in single sql statement? here n dynamic value n user input , how make insert query n times , idea. $sql = "insert `mytable` values(`field1`,`field2`,`field3`) values "; $count = 5; for($i=0;$i<$coutn;$i++) { $sql .= " ('john','123','us' )"; } is correct way.. yep, can done easily, should this: insert mytable values ("john", 123, "us"), ("carl", 123, "eu"), ("jim", 123, "fr"); however, programming practice specify columns of table in query, example: insert mytable (column1, column2, column3) values ("john", 123, "us"), ("carl", 123, "eu"), ("jim", 123, "fr"); edit : can build query (in for cycle), $total user input: $sql = "insert mytable (colu

How to read multiple scan using zxing library in android -

this code scan single record return app. how scan multiple record without returning back. intent intentscan = new intent("com.google.zxing.client.android.scan"); intentscan.addcategory(intent.category_default); string targetapppackage = findtargetapppackage(intentscan); if (targetapppackage == null) { return showdownloaddialog(); } intentscan.setpackage(targetapppackage); intentscan.addflags(intent.flag_activity_clear_top); intentscan.addflags(intent.flag_activity_clear_when_task_reset); attachmoreextras(intentscan); startactivityforresult(intentscan, 0); update onactivityresult method this //method getting qr code qr code after scan public void onactivityresult(int requestcode, int resultcode, intent intent) { if (requestcode == 0) { if (resultcode == result_ok) { string contents = intent.getstringextra("scan_result"); toast.maketext(this, contents , toast.length_short).sho

ios - Present UIViewController from subclass of UIView -

i have created subclass of uiview , in app need present uiviewcontroller it, i have tried following : poiinfocontroller = [[poiinfocontroller alloc]initwithnibname:@"poiinfocontroller" bundle:nil]; [poiinfocontroller setmodalpresentationstyle:uimodalpresentationformsheet]; [[[[uiapplication sharedapplication] keywindow] rootviewcontroller] presentmodalviewcontroller:poiinfocontroller animated:yes]; but crash terminating app due uncaught exception 'nsinvalidargumentexception', reason: 'application tried present modally active controller .' please help, **edit crash log:** 2014-04-23 17:04:26.433 navigationlibsprintmom[4610:a0b] *** terminating app due uncaught exception 'nsinvalidargumentexception', reason: 'application tried present modally active controller <viewcontroller: 0x9d52140>.' *** first throw call stack: ( 0 corefoundation 0x017c15e4 __exceptionpreprocess + 180 1 libobjc.a.dylib

android - Custom Listview - multiselect items and colour -

i using custom listview adapter, , working well. i using checkbox stored checked values, think might better change background colour of list item when selected. i have tried (and failed) using selectors, , tried modify code change view background. here custom adapter code, can change set blue background when row selected, , maintain selection if multiple selected? public class imageadapter extends baseadapter { context context; arraylist<bitmap> images; arraylist foldername; boolean[] checkboxstate; public imageadapter(context c, arraylist<bitmap> images, arraylist foldername){ this.context = c; this.images = images; this.foldername = foldername; this.context = context; checkboxstate=new boolean[images.size()]; } public int getcount() { return images.size(); } public object getitem(int arg0) { // todo auto-generated method stub return null; } publi

algorithm - Similarity measurement of time-sequenced data with different length -

consider following data. groundtruth | dataset1 | dataset2 | dataset3 datapoints|time | datapoints|time | datapoints|time | datapoints|time |0 | |0 | |0 | |0 b |10 | b |5 | b |5 | b |13 c |15 | c |12 | c |12 | c |21 d |25 | d |22 | d |14 | d |30 e |30 | e |30 | e |17 | | | f |27 | | | g |30 | visualized (as in number of - between each identifier): time -> groundtruth: a|----------|b|-----|c|----------|d|-----|e dataset1: a|-----|b|-------|c|----------|d|--------|e dataset2: a|-----|b|-------|c|--|d|---|e|----------|f|---|g dataset3: a|-------------|b|--------|c|---------|d my goal compare datasets groundtruth. want crea

seo - How can I prevent Googlebot from crawling my Underscore client-side templates? -

Image
in google webmaster tools, under crawl errors/other, we're seeing 400 error urls this: /family-tree/<%=tree.user_url_slug%>/<%=tree.url_slug%> this not real url, or url intended crawled. underscore/backbone template: <script type="text/template" class="template" id="template-trees-list"> <% _.each(trees, function(tree) { %> <a href="/family-tree/<%=tree.user_url_slug%>/<%=tree.url_slug%>" rel="nofollow"> <%= tree.title %> </a> <% }); %> </script> why google crawling inside of script block? why google ignoring rel="nofollow" attribute? is there else can keep googlebot away our underscore templates? update: i'm open using robots.txt if can find right pattern keep pages , block bad pages. example, want keep /surnames/jones/queries while blocking /surnames/jones/queries/<%=url_slug%> . have thousands this. looks

mvvm - Encountering lag in WPF Tab Control when switching between tabs (new instance of view is created each time I switch tabs) -

i beginner wpf, , having lot of learning while coding, please bear me. have searched archives, , couldn't find answer fits question. i have view contains tab control, loaded 2 default tabs, , additional tabs added , removed programmatically based on user actions. the way having observable collection of viewmodels different types of views can add , remove. in xaml view, had few different datatemplates used determine kind of view load. the issue i'm facing when click 1 tab another, seeing lag - close 1 second. put break point in code behind view, , noticed initializecomponent() method being called view every time click on tab. the collection of viewmodels called activecontents , holds items of type activecontent . activecontent class 1 created, , contains object named contentitem hold viewmodel. here of code project: one of data templates xaml: <usercontrol.resources> <resourcedictionary> <resourcedictionary.mergeddictiona

python - shutil.move(scr, dst) gets me IOError: [Errno 13] Permission denied and 3 more errors -

documents = ['*pdf', '*docx', '*txt'] in range(len(documents)): if glob.glob(documents[i]): print(documents[i], true) shutil.move(glob.glob(documents[i])[0], '/home') else: print(documents[i], false) well, goes great until: shutil.move(glob.glob(documents[i])[0], '/home') which basically: shutil.move(scr, dst) and produces error: *pdf false *docx true traceback (most recent call last): file "/usr/lib/python3.2/shutil.py", line 326, in move os.rename(src, real_dst) oserror: [errno 13] permission denied during handling of above exception, exception occurred: traceback (most recent call last): file "teste.py", line 19, in <module> shutil.move(glob.glob(documents[i])[0], '/home') file "/usr/lib/python3.2/shutil.py", line 334, in move copy2(src, real_dst) file "/usr/lib/python3.2/shutil.py", line 146, in copy2 copyfile(src,

Can't get jQuery :not selector to work -

if type character inside input field of jsbin below, div slide down. on click of elements other div.wrap , children, want div slide up. can not seem right. keeps doing opposite of want. http://jsbin.com/sobecume/1/edit?html,css,js,console,output js $('.blah').keyup(function(){ $('.blah2').slidedown(); }); $('body:not("#wrap")').click(function(){ console.log("click!"); var display = $('.blah').css('display'); if (display !== 'none') { $('.blah2').slideup(); } }); i don't think can craft selector check against element's ancestors (i think?). try this: $('*').click(function(){ if($(this).closest('#wrap').length>0){return false;} console.log("click!"); var display = $('.blah').css('display'); if (display !== 'none') { $('.blah2').slideup(); } }); http://jsbin.com/sobecume/3

json - getJSON with [ ] doesn't work -

i'm not experienced in stuff, call api wich returns me this [ { "beatmapset_id":"18860", "beatmap_id":"66609", "approved":"2", "approved_date":"2010-08-15 10:04:19", "last_update":"2010-08-15 10:00:44", "total_length":"468", "hit_length":"447", "version":"legend", "artist":"dragonforce", "title":"revolution deathsquad", "creator":"lesjuh", "bpm":"250", "source":"", "difficultyrating":"3.95095", "mode":"0" } ] my html : $(document).ready(function(){ $.getjson('whatever.html', function(fbresults) { document.write(fbresults.beatmapset_id); }); }); now problem is,

vagrant - How to lock in a chef recipe -

i attempting run vagrant chef, running current bug ; https://tickets.opscode.com/browse/cook-3989?focusedcommentid=43724&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-43724 [2013-11-12t15:47:30+00:00] fatal: syntaxerror: compile error /tmp/vagrant-chef-1/chef-solo-1/cookbooks/postfix/metadata.rb:19: syntax error, unexpected ':', expecting $end display_name: 'postfix/main', this commenter states fixed doing following : i locked postfix recipe usage @ 3.0.2 in meantime how can done? you have 2 options: upgrade ruby you running ruby < 1.9. supported version of ruby 2.1 , 1.8 series deprecated , 1.9 series scheduled deprecation. change version what commenter meant "use older version of cookbook". can specifying -v flag knife or downloading older version community site.

google analytics not recording 33% of results -

hi have website running google analytics , results recording inaccurate. recording event in google analytics , recording same event in database count should match. finding google analytics not recording around 1/3 of results. know things can affect such people disabling javascript , cookies surely can't 1/3 of people. talking less 100 hits per day ga shouldn't sampling data. comments appreciated. edit: if have compared google analytics results results of own database interested in results. edit: in tests results have matched perfect, users results seem wrong. edit: found problem, have ssl configured on server , linking non ssl google analytics url. since different browsers handle sort of thing differently getting mixed results. i'm still having issue found problem. caused third party cookie issue. because app third party app running on site(similar facebook apps) , 3rd party cookies disabled wont recorded. issue fixed not using cookies google analytics.

ios - Trouble changing app's name in xcode 5 -

i using xcode 5.1 i have changed app's name before using same steps described this question . but reason having trouble right now. usually, have experienced this same screen . time when changed name did not change everything. when view project's targets, old app name still being used. if clean , build project, show old name in "progress bar" @ top of xcode. if @ project's supporting files folder, plist still has old app name ie. old-app-name-info.plist so far have manually changed project name, changed bundle identifier, changed product name in build settings, , changed name of scheme. don't know else do. the app has correct name when run on simulator or on iphone, old app name still being used throughout various areas in project folder's, xcode settings, etc. i want change use's old app's name , make them use new app name. edit: here's example. if go file inspector tab correct name shown project, if go issue navigator tab s

knockout.js - How to link checkbox and text value using knockout? -

i want clear text box when checkbox unchecked. this html: <input type="checkbox" id="chkminfixcharge" class="left" data-bind="enable: isenableminfixedcharge,checked: ischeckminfixedcharge" /> <input type="text" id="txtminfixcharge" class="minitext left" data-bind="value:?????" style="margin: 0px 10px;" /> use line of code you value:ischeckminfixedcharge()? urdefinedvariable:''

token - Laravel "remember_token" -

is safe use remember_token in users table authenticating user application? what purpose of token? currently, i'm using in forms check whether user logged in - if token not present, show login screen. each time user logs out, token regenerated. no it's not supposed used authenticate, it's used framework against "remember me" cookie hijacking. value refreshed on login , logout, if cookie hijacked malicous person, logging out making hijacked cookie useless since doesn't match anymore. http://laravel.com/docs/upgrade#upgrade-4.1.26

INSERT in MySQL 5.1 and 5.6 and then SELECT returns in a different order -

im trying 2 inserts 2 databases on different servers. 1 running mysql 5.1 (on nas) , mysql 5.6 (on ubuntu). i simple insert table(pri1,pri2,value) values (1,1,1); insert table(pri1,pri2,value) values (1,2,1); in order. when a select * table; mysql 5.6 returns pri1 pri2 value 1 1 1 1 2 1 which correct because order inserted. when same thing (insert in same order , select) mysql 5.1 returns: pri1 pri2 value 1 2 1 1 1 1 basically stores data in reverse , displays in order. why happen , how can prevent shows data correctly in mysql 5.6 ? thank you if need guaranteed specific order have use order by -clause, i.e. select * your_table order your_column desc without order by -clause, may appear if result in same order inserted them. not case. order may affected factors indexes or caching. by default, rows in result set produced select statement returned server client in no particular order. when query issued, server