Posts

Showing posts from July, 2013

linux - Whose stack is used when an interrupt handle is running? -

i trying understand steps followed when interrupt taken account processor. reading understanding linux kernel discovered first of processor needs determine vector associated interrupt, somehow address of isr computed. after checking if interrupt issued authorized source, checked if there change of privilege. "checks whether change of privilege level taking place—that is, if cpl different selected segment descriptor’s dpl. if so, control unit must start using stack associated new privilege level" my questions are: if interrupt runs @ expense of same process running when interrupt occurred, why not using process' kernel stack? there different stacks different privilege levels? know there kernel stack per process. if so, why switch of stacks needed?

Overloading in same class Java -

this question has answer here: function override-overload in java 6 answers i trying understand overloading @ moment , bit confused. understand when calling same method, cannot have exact same arguments. instance method called 2 int variables , 2 different int variables. if use int , float, okay. know return type not matter, being public or private method. matter? for instance, call public int name(int x) able call private int name(int x) ? am correct in assuming public double name(string x) cause overloading in class? public int name(int x, string y) valid? passing string argument int function? cause overloading or error? edit: not believe question duplicate, main question difference between public , private, method or different , cause overloading. did not see addressed in other question. from oracle tutorial : overloaded methods differentiat

batch file - "_ was unexpected at this time" error -

i made batch file, , put in code: if %var% == _,_,_ set var=%s1le1%,_,_ when tried batch file, said "_ unexpected @ time" %var% = _,_,_ %s1le1% = b can me? try : if "%var%" == "_,_,_" set "var=%s1le1%,_,_" , standard delimiter , when found if after comparison expression taken end of if. quotes should compare whole strings.

sql - How to reduce scan count on table with a composite index? -

we have table (t) ~3 million rows , 2 int columns (id1 , id2), set composite clustered key. early in stored procedure create table variable (@a) consists of list of ints. the slow query following select t.id1, t.id2 t inner join @a on a.id = t.id1 @a have few hundred rows, , t contains few million rows. problem t gets scan count of several hundred. don't know how make go away. i have tried create index on t column id1 , id2 included, not (the execution planner shows new index used). what can done reduce scan count on table t? (we using sql server 2014, web edition) try creating included (covering index): create index idx_t_id1 on t(id1) include id2 this allow query find needs in index pages , not have search in main table. way there clustered index on table t?

vb.net - add column in datagridview -

i use vb.net excel i have buttom "get name of column worksheet" combobox this code of button: private sub button7_click(byval sender system.object, byval e system.eventargs) handles button7.click dim excols new dictionary(of integer, string) form2.xlworksheet = ctype(form2.xlworkbook.sheets(form2.combobox1.text), excel.worksheet) form2.xlworksheet.activate() form2.xlworksheet dim lastcol integer = form2.xlworksheet.cells(1, form2.xlworksheet.columns.count).end(xldirection.xltoleft).column x integer = 2 lastcol excols.add(x, form2.xlworksheet.cells(1, x).value.tostring) next combobox2.datasource = new bindingsource(excols, nothing) combobox2.valuemember = "key" combobox2.displaymember = "value" addhandler combobox2.selectedindexchanged, addressof combobox2_selectedindexchanged end end sub this code of combobox: private sub combobox2_sele

javascript - JS - Color Picker Only first one works -

i using bootstrap colorpicker 2.1 in order display 2 colour pickers in form. works fine using 1 input however, when add second 1 first 1 working. maybe because sharing same class… any idea why happening? <form method="post"> <p><?php _e("box 1: " ); ?> <input class="form-control demo" data-horizontal="true" id="demo_forceformat" placeholder="<?php echo $box1?>" type="text" name="box1" value="<?php echo $box1?>" size="20"> <?php _e(" default: rgba(14,112,209,1)" ); ?></p> <p><?php _e("box 2 " ); ?> <input class="form-control demo" data-horizontal="true" id="demo_forceformat" placeholder="<?php echo $box2?>" type="text" name="box2" value="<?php echo $box2?>" size="20"> <?php _e("

c# - How to Convert StackFrame Collection to String? -

i have ienumerable<system.diagnostics.stackframe> frames store custom stackframe. want convert string type stacktrace.tostring() format. example: @ teststacktrace.form1.button2_click(object sender, eventargs e) in d:\programming\temp\teststacktrace\teststacktrace\form1.cs:line 66 @ system.windows.forms.control.onclick(eventargs e) @ system.windows.forms.button.onclick(eventargs e) @ system.windows.forms.button.onmouseup(mouseeventargs mevent) use stateprinter framework. can turn object graphs strings , automate assert part of testing. see https://github.com/kbilsted/stateprinter/blob/master/doc/automatingunittesting.md for making string string s = new stateprinter().printobject(stackframe)

Resize an image dynamically with CSS inside a table-cell div -

i trying create 2 columns of equal width, left 1 containing text , right 1 containing image. image resize down width of column if image width greater column width, image keep original size if image less column width. have tried instructions in this question , image, if larger, consume whatever space needs, squishing column on left containing text. wondering if has how "table-cell" divs behave, or if precedence issue browser accommodate image before text. code looks this: <div style="display: table; width:100%;"> <div style="display: table-row;"> <div style="display: table-cell; width: 50%; vertical-align: middle;"> <h1>header</h1> <p>description</p> </div> <div style="display: table-cell; width: 50%; vertical-align: middle;"> <img style="max-width: 100%;height:auto;" src="image.jpg">

video - Matlab thinks an AVI it's written is corrupt -

i'm using matlab interface scientific camera using mex, , matlab program uses videowriter() write file disc. camera rgb-capable, , if write file such, video fine. however, current application, need grayscale images, , i'm using rgb2gray() convert it. unfortunately, when analysis code tried read video file again, error: error using videoreader/init (line 450) unable read file. file appears corrupt. and attempting read video vlc confirms corrupt. difference in code between grayscale , colour versions line: frame = rgb2gray(frame); my whole writing section of code is: vid = videowriter('testvid.avi'); vid.framerate = framerate; vid.quality = 100; open(vid); = 1 : frames; %read frame data variable 'frame' frame = rgb2gray(frame); writevideo(vid,frame); end i've spent far long fighting this, ideas? you need close video object, using close(vid) after writing last frame.

vba - Writing Range in excel. -

colname = split(cells(, i).address, "$")(1) lastrow = .cells(.rows.count, colname).end(xlup).row ws.("?" & lastrow).copy ws1.cells(rows.count, "a").end(xlup).offset(1, 0) i number, converted column name. need range starting number 4 eg if =1, need range("a4" & lastrow) . have lastrow , can , how make a4 dim ws worksheet dim row integer dim col integer row = 4 col = 1 range(cells(row, col), cells(lastrow, col)) ws.range(cells(row, col), cells(lastrow, col))

Post with CURL to API -

i'm having trouble sending post request via curl: curl -h "content-type: application/json" -x post -d '{"username":"test@test.com", "password":"testpassword", "verify":"testpassword", first_name="mo", last_name="lester"}' http://stuff.com/signup the error message i've received said server isn't getting password, , none of data @ all. i tried posting quotes around url, without luck. new curl, forgive ignorance. you forgot quotes around first_name , last_name elements , you've included = in assignments instead of json : character results in invalid json other end won't able parse. corrected valid json request: curl -h "content-type: application/json" -x post -d '{"username":"test@test.com", "password":"testpassword", "verify":"testpassword", "first_name": "

node.js - Mongoose.js - population and additional fields? -

i want add additional data usermodel watchedmovies , have following schema: let userschema = new schema({ watchedmovies: [{ type: schema.types.objectid, ref: 'movie' }] }) and: let movieschema = new schema({ title: string }) i wondering possible add additional fields watchedmovies object , store along objectid? add watchedat date when i'm populating watchedmovies usermodel.find().populate('watchedmovies', 'title').exec(...) like: { _id: objectid(userid), watchedmovies: [{ _id: objectid(...), title: 'some title', watchedat: timestamp }] } watchedat attribute specifies when (date object) reference added usermodel is possible mongoose , how should change schema? thank you change schema to let userschema = new schema({ watchedmovies: [{ movie: { type: schema.types.objectid, ref: 'movie' }, watchedat: date }] }) then can populate .populate('

toggle wrapInner with jquery -

i can't seem find toggle method jquery's wrap. simply want toggle wrap of span when .toggle_comments clicked. $( document ).on('click', '.toggle_comments', function( event ){ $( ).closest( "p" ).wrapinner( $( "<span class='inline-comments-highlight-text'></span>" ) ); }); you don't find because such method doesn't exist. like: var spanhtml = "<span class='inline-comments-highlight-text'></span>", spansel = "span.inline-comments-highlight-text" ; $( document ).on('click', '.toggle_comments', function( event ) { var $p = $(this).closest("p"), $span = $p.children(spansel); if ( $span.length ) { $span.children().unwrap(); } else { $p.wrapinner(spanhtml); } });

emacs - Use orgmode agenda content in html -

i working on agenda , orgmode works great in of senses. unfortunatelly stalled in 1 point: export orgmode agenda content html. i know how export .org ics , works fine. know how export .org html , works. when export .org html miss content of agenda. mean, if have schedulled event, like: * convocatoria de proyectos visualizar15 deadline: <2015-04-05 dom> http://medialab-prado.es/article/tallervisualizar15proyectos the html is: convocatoria de proyectos visualizar15 http://medialab-prado.es/article/tallervisualizar15proyectos so miss content of deadline. not rewrite every date , use orgmode agenda content. is possible? best!

Postsharp NotifyPropertyChanged on xamarin -

i want try postsharp xamarin. install new postsharp 4.1. added project , want add notifypropertychanged aspect, not have suggestion in visual studio. try install postsharp patterns model nuget, thats fail, whats doing bad? not install package 'postsharp.patterns.model.controls 4.1.10'. trying install package project targets 'portable-net45+win+wpa81+monoandroid10+xamarinios10+monotouch10', package not contain assembly references or content files compatible framework. more information, contact package author. you need use postsharp.patterns.model package instead of postsharp.patterns.model.controls . latter supported on .net , contains undo-redo wpf controls.

orbeon - Orbean Server side embedding - CSS issues -

Image
we trying use orbeon form runner server-side embedding. the form renders on form runner, in our java web application form not rendered i.e. css issues. all /orbeon/* resources retrieved orbeon application, css not applied properly. suspect because of div added embedded/portlet. in form runner full size image in java web application full size image also, if use wizard view, works in form runner, not work in embedded java web application. sections shown on same screen. when orbeon forms produces whole page, adds orbeon class on body , , pretty css comes orbeon forms "prefixed" .orbeon … . done minimize risk of orbeon forms' css conflicting own css. i can't sure problem, if css doesn't apply when embedding, might need add class="orbeon" on element contains content you're embedding.

Java parallel db calls -

i've web application needs extremely fast. processing requires access multiple data sources. therefore decided might useful make parallel calls optimization. basically want make many different db calls in parallel. please recommend me simple , reliable way , technologies achieving goal, useful if provide few frameworks , design patterns. right using spring. you can use new java 8 completablefuture . allows use asynchronously existing synchronous method. say have list of requests in form list<dbrequest> listrequest want run in parallel. can make stream , launching requests asynchronously in following way. list<completablefuture<dbresult>> listfutureresult = listrequest.stream() .map(req -> completablefuture.supplyasync( () -> dblaunchrequest(req), executor)) .collect(collectors.tolist()); list<dbresul

java - Stateless and Stateful confusing definitions and outputs (contradicting to my view) -

from understand @stateless means state of every encountering of client server starting scratch, , @stateful means server saves in memory client's data. (" stateless means there no memory of past. every transaction performed if being done first time. statefull means there memory of past. previous transactions remembered , may affect current transaction. "). i have been reading http://www.tutorialspoint.com/ejb/ejb_stateless_beans.htm , http://www.tutorialspoint.com/ejb/ejb_stateful_beans.htm . examples there show in @stateless annotation, when client exits , re-enters, seems if server did save data , presented books added "previous" client, in @stateful annotation seems if server treated returning client new one, , didn't save list client created. i assume misunderstanding has misunderstanding of terms "state", "memory" or "transaction", @ moment, confused definition seems contradicting outputs. you hav

c - Flex, how to process HTML file -

i using libcurl , flex download images webpage. i have libcurl easy functions set download html file given url , have regular expression don't know how process downloaded html file. example: have file "fp" downloaded , saved in specific location , need pass fp regular expressions process structure of file is: %{ #include <...> ... %} %% /* regular expressions */ %% int main () { ... //c code file fp downloaded , saved } so, how "send" fp file regular expression process ? any suggestions ? thanks. after reading comment user58697 start reading yyin , discovered after having file opened in c can delegate yyin doing: fp = yyin assuming file called fp. once that, file processed in regular expressions. i found solution in 2nd example of this page .

rest - Understanding OAuth2 flow -

i'm developing android app consumes rest service uses oauth protocol. in first activity, app shows login screen. flow: 1) user puts username , password. 2) app makes request rest service, providing username , password. 3) rest service check credentials , if correct, ask access_token oauth2 provider server. 4) rest service answers app providing access_token , refresh_token 5) in next requests rest server (to data people, articles...) app provide access_token , refresh_token . 6) when rest service process request, validate access_token (using token info endpoint of oauth server). 7) if access_token correct , has not expired, rest service return data app asking for. when rest service detects access_token has expired, asks using refresh_roken . now, questions: when rest service retrieve new access_token after old 1 expires, has rest service send app in response? if so, has app check, in each request/response, if new new access_token has been sent rest s

ruby on rails - Use a hash to map to element id's with jQuery -

i have form want put submitted data correct form inputs. have hash keys id selector of form input , value the value specific form input. this hash looks like: @saved_answers = {"123456"=>"tom", "2345678"=>"brady", "789456"=>"football"} i passing hash used in jquery # found in view's script var form_saved_answers = '<%= @saved_answers.to_json %>'; now when in javascript file, want find input id key , place value in input field. this stuck, i've thought making each key/value pair array , run each function... there has more direct approach... any ideas? do without ' char var form_saved_answers = <%= @saved_answers.to_json %>; can form_saved_answers['123456'] if key not number can form_saved_answers.some_key

metaprogramming - C++11 variadic template parameter expansion -

i following: template<typename func> class functionwrapper { public: typedef decltype(func()) returntype; typedef ... argstype; functionwrapper(func func) { func_ = func; } returntype operator() (argstype args) { return func_(args); } private: func func_; }; the problem don't know how deduce argstype func type. i'd make work when function returns/accepts nothing well. the usecase be: functionwrapper<myfunction> wrapper; auto result = wrapper(1, 2, 3); you can determine argument , return type(s) in operator() , use perfect forwarding: template <typename func> class functionwrapper { func func_; public: functionwrapper(func func) : func_(func) {} template <typename... args> auto operator() (args&&... args) -> decltype(func_(std::forward<args>(args)...)) { return func_(std::forward<args>(args)...); } };

javascript - Need help checking if a value exist using JQuery .inArray() -

i display error message when user types value in input field (emailaddressval) matches value in array (invalidemailaddresses). don't know how go it. help! $(document).ready(function(){ $("input[name='emailaddress']").blur(function(){ // actual email validation function var emailreg = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/; var haserror = false; var emailaddressval = $("input[name='emailaddress']").val(); var invalidemailaddresses = ['aol.com', 'yahoo.com', 'yahoo.fr', 'juno.com', 'hotmail.com', 'gmail.com']; if($.inarray(invalidemailaddresses,emailaddressval) == -1) { alert('the email provided not business related domain'); } }); }); try following code $(document).ready(function () { $("input[name='emailaddress']&qu

How to insert a record for each result in a mySQL query? -

hello call mysql query select in console (or in phpmyadmin sql cmd) select hf, id ah hf !=0 group hf; after need execute command each returned line previous select foreach if (select count(*) `tot` `id` = @selectedid , `uto` = @selectedhf ) = 0 insert `tot` (`id`, `hf`) values (@selectedid, @selectedhf); end if; endforeach; how can "foreach" loop in mysql? you can single query, insert . . . select . no need loop, want check non-existence: insert `tot` (`id`, `hf`) select id, hf ah hf <> 0 , not exists (select 1 tot tot.id = a.id , tot.uto = @selectedhf) group hf;

apache - htaccess redirect urls with parameters to specific directory -

i want redirect specific urls from http://www.domain.com/com/page.asp?id=99 https://www.domain.com/de/directory/ and urls from http://www.domain.com/com/page.asp https://www.domain.com/de/ ive tried redirects cant done right. please me! rewritecond %{query_string} id=5 rewriterule (.*) https://www.domain.com/de/directory/? [r=301,l] works, biggest problem urls in cms https://www.domain.com/cms redirected if contain id try: rewriteengine on rewritecond %{query_string} ^id=99$ rewriterule ^page\.asp$ /de/directory/ [l,r] rewriterule ^page\.asp$ /de/ [l,r]

c - Why does the `sqrt()` print the desired output when I use `float`s instead of `double`s? -

#include <stdio.h> #include <math.h> double hypotenuse( double side1, double side2 ); int main( void ) { double a, b; printf( "enter values of 2 sides: " ); scanf( "%f %f", &a, &b ); printf( "\nthe length of hypotenuse is: %f", hypotenuse( a, b ) ); getchar(); getchar(); return 0; } double hypotenuse( double side1, double side2 ) { double c; c = (side1 * side1) + (side2 * side2); return sqrt( c ); } the above program works when use float a, b; instead of double a,b; . why? in code, use scanf( "%f %f", &a, &b ); but %f used float ,not double . try %lf double .

nest - _id is not getting autogenerated in Elasticsearch -

i have simple list of documents of type salesorder. while inserting them elastic search, _id taking value of salesorderid. need autogenerated. below class public class salesorder { [xmlelement("id")] public long salesorderid { get; set; } public long customerid { get; set; } public datetime? bookeddate { get; set; } public long salesorderno { get; set; } } this how inserting docs in elastic search elasticclient elasticclient = createelasticclient(indexname); if (!elasticclient.indexexists(i => i.index(indexname)).exists) { elasticclient.createindex(indexname, s => s.addmapping<t>(m => m .mapfromattributes())); } // create indexes var response = elasticclient.indexmany<t>(documents); you can specify id field es use this: [elastictype(name = "salesorder", idproperty =

c# - How to disable Visual Studio 2008 localized string replacement in Designer? -

i use visual studio 2008, , in application have line of code in mainmenu.designer.cs this.btnsettings.text = "(5) " + strings.settings; where strings.exit following /// <summary> /// looks localized string similar settings. /// </summary> internal static string settings { { return resourcemanager.getstring("settings", resourceculture); } } but when rebuild application, above line converts automatically following this.btnsettings.text = "(5) settings"; how can turn off? i have line of code in mainmenu.designer.cs do not edit xxxx.designer.cs files. changes lost when ide regenerates file. need move statement constructor. ought find in mainmenu.cs source file.

What happens in Inno Setup when you list the same file twice? -

what happens when setup inno setup .iss file install same file same location twice? inno setup realize doing, , include , install file once, or collect file install multiple times, , overwrite each instance? inno setup smart enough identify identical source file , include once installer. there's legitimate reason having duplicate source files; may want install same file different locations on target system. what inno setup won't identify identical target location (i cannot think of legitimate reason having identical target location). install file twice. installs twice identical location, second installation not happen (with executable files default flags, version match) or barely noticeable (as overwrite identical data file). [files] source: "myprog.exe"; destdir: "{app}" source: "myprog.exe"; destdir: "{app}" source: "requirements.txt"; destdir: "{app}" source: "requirements.txt"; destdir:

c# - SqlDependency fires immediately -

i want use sqldependency notifications when datas changed others applications using database. public class databasechangesnotification : idisposable { private static string chainedeconnexion = configurationmanager.connectionstrings["transfertcontext"].connectionstring; private static readonly lazy<databasechangesnotification> _instance = new lazy<databasechangesnotification>(() => new databasechangesnotification()); private databasechangesnotification() { system.diagnostics.trace.writeline("--- sqldependency start ---"); sqldependency.start(chainedeconnexion); } public void dispose() { system.diagnostics.trace.writeline("--- sqldependency stop ---"); sqldependency.stop(chainedeconnexion); } public static databasechangesnotification instance { { return _instance.value; } } public void abonnernotification(string req

mysql - how to execute the rest of the batch after exception thrown during the progress -

i trying have batch process number of insert queries using addbatch. during execute, throws out exception @ first query causes exception however rest of batch not processed. best approach handle matter? if using rollback , isolate error query before reprogress, may repeat same situation @ next error query. inefficient, particularly if batch insert volume huge. advice. can try surround first query try catch block , duck exception. although suggest not best coding practice. when have list of insert statements executed need take care whole got executed or none of operation got successeded.in addition per business scenario have have @ batch skip , restart ability if works you

matlab - creating a bus header file from a bus object specified in the workspace or from a bus selector -

i have bus object has many elements inside , in turn bus objects again. can tell me there way generate bus header files typedef struct busobject instead of doing manually using script? there direct function or way this? so example have bus object elements d,e again bus objects , have 2 bus elements each d_a,d_b,e_a,e_b. there function or simple way process bus object output as: typedef struct { uint8 d_a; uint8 d_b; }d; typedef struct { uint8 e_a; uint8 e_b; }e; typedef struct { d d; e e; }a; which bus header. you need set bus datascope exported. 1 way go workspace , double click defined bus. open bus editor gui. when click on bus name there a menu different options: name, data scope, header file, alignment. use drop down menu data scope select exported. code generator create header file. can specify filename of header file typing foo.h in header file field. if leave blank matlab create header file using bus name.

r - Combine information from hi-resolution time series with another with daily information -

i have measurement data - - 1 minute resolution, irregular. timeseries time signal 1 2015-03-30 00:00:00 17.3 2 2015-03-30 00:01:00 16.2 3 2015-03-30 00:02:01 18.4 4 2015-03-30 00:04:03 17.7 in second data frame, have daily information. dailyinfo firstevent yesterday 1 2015-03-28 17:01:43 2015-03-27 15:25:51 2 2015-03-29 17:04:55 2015-03-28 17:01:43 3 2015-03-30 16:59:03 2015-03-29 17:04:55 the dailyinfo$firstevent boundaries. want like timeseries %>% group_by(between(time, dailyinfo$yesterday, dailyinfo$firstevent)) in tutorials, information present within 1 data frame (e.g. iris %>% group_by(species) %>% ... ). my workaround count number of rows between each set of boundaries, replicate firstevent -entry often, concatenate , put resulting vector timeseries new column. this not elegant, maybe can me how use dplyr this? use cut timeseries %>% mutate(interval = cut(time, dailyinfo$firstevent)) %>%

weblogic - BouncyCastle jars giving SHA1 Digest Error for JDK 1.7 -

for project, have digitally sign string , using bouncycastle jars same. environment details follows. weblogic 12c jsf, primefaces java version : 1.7.0_45 bc jars : bcmail-jdk15on-152.jar, bcpkix-jdk15on-152.jar, bcprov-ext-jdk15on-152.jar, bcprov-jdk15on-152.jar alternatively have used bcprov-jdk16-1.45.jar , bcmail-jdk16-1.45.jar result same. error getting is, java.security.nosuchalgorithmexception: error constructing implementation (algorithm: sha1withrsaencryption, provider: bc, class: org.bouncycastle.jce.provider.jdkdigestsignature$sha1withrsaencryption) @ java.security.provider$service.newinstance(provider.java:1262) ~[?:1.7.0_45] @ sun.security.jca.getinstance.getinstance(getinstance.java:236) ~[?:1.7.0_45] @ sun.security.jca.getinstance.getinstance(getinstance.java:206) ~[?:1.7.0_45] @ java.security.signature.getinstance(signature.java:355) ~[?:1.7.0_45] @ digisigner.sign(digisigner.java:185) [digisigner.class:?] ... 40 more caused by:

c# - Error:System.Data.SqlClient.SqlException (0x80131904): Conversion failed when converting the nvarchar value -

error:system.data.sqlclient.sqlexception (0x80131904): conversion failed when converting nvarchar value 'ff' data type int. @ system.data.sqlclient.sqlconnection.onerror(sqlexception exception, boolean breakconnection, action 1 wrapcloseinaction) @ system.data.sqlclient.sqlinternalconnection.onerror(sqlexception exception, boolean breakconnection, action 1 wrapcloseinaction) @ system.data.sqlclient.tdsparser.throwexceptionandwarning(tdsparserstateobject stateobj, boolean callerhasconnectionlock, boolean asyncclose) @ system.data.sqlclient.tdsparser.tryrun(runbehavior runbehavior, sqlcommand cmdhandler, sqldatareader datastream, bulkcopysimpleresultset bulkcopyhandler, tdsparserstateobject stateobj, boolean& dataready) @ system.data.sqlclient.sqlcommand.finishexecutereader(sqldatareader ds, runbehavior runbehavior, string resetoptionsstring) @ system.data.sqlclient.sqlcommand.runexecutereadertds(commandbehavior cmdbehavior, runbehavior runbehavior, boolean returnstrea

ios - Convert all values of Container into NSString -

i have problem communicate server. webserver expects parameters in json object string. every number , every boolean in every container needs string. for example have nsdictionary full of key values (values kinds of types - numbers, arrays etc.). example: { "anexamplenumber":7e062fa, "anexampleboolean":0, "anexamplearrayofnumber":[17,4,8] } has become: { "anexamplenumber":"7e062fa", "anexampleboolean":"0", "anexamplearrayofnumber":["17","4","8"] } i tried standard nsjsonserializer doesn't give me option need. tried transform in dictionary manually string seems overhead. have hint me? maybe serializer or function convert objects in container strings? (i assume mean nsjsonserializer , not nsserializer .) i doubt you'll find pre-rolled solution this. it's not general problem. note, incorrect json, json serializers shouldn't it. the best

html - How to use CSS to create two column page layout? -

i create 2 column web page in that example . each column contains description photo next - know how use css achieve that? .col-half { width: 40%; float: left; padding:15px; } .col-half div { background-color:orange; color:white; margin:5px; border:1px solid black; background-image:url('http://img1.wikia.nocookie.net/__cb20100915194254/starwars/images/7/7f/jabba_swsb.png'); background-size:cover; min-height:150px; } <div class='col-half'> <div>asdf</div> <div>zyzzz</div> <div>asdf</div> <div>12345</div> </div> <div class='col-half'> <div>asdf</div> <div>zyzzz</div> <div>asdf</div> <div>12345</div> </div> note width 40%, make room margin/padding. can adjust see fit.

Fast App resume not working under password lock screen on windows phone 8 -

i have implemented fast resume in windows phone 8 app , working fine in every case except following scenario. steps: 1)phone password locked 2)toast received. 3)tap on toast. 4)app activated. 5)the page last on backstack opens reset state. 6)no more navigation in fast resume app should receive 1 more navigation deep link on tapping on toast missing in case. please find sample here . this feature of windows phone. if reminder or toast send lock screen (even without password), navigation application limited. think there no way fix behavior ... i got more unpleasant situation reminders of applications: 1) if screen not locked , gave reminder of application, click on reminder open application, can take action in response reminder. , good. 2) when lock screen (even without password) , send reminder of application, there no ability navigate application clicking reminder. reminder, can cancel or postpone while. user must unlock screen, open program , try u

Converting a C++ String Class to a Python String -

i have c++ class able output strings in normal ascii or wide format. want output in python string. using swig (version 3.0.4) , have read swig documentation. believe need use typemap construct achieve goal. have written following: %typemap(out) my_namespace::mystring * { $result = pystring_asstring($1); } with no success. when try access c++ string python, following output: <swig object of type 'mystring *' @ 0x02b6fc68> obviously, i'm doing wrong. can point me in right direction? in advance. i use pyboost c++/python interfaces , amazing , easy that. if can, recommend it. std::string automatically mapped python string. in case, may solution define __str __ method object or directly pass char* (i see in swig docs never followed way).

java - extract language from a web page with Jsoup -

for example have <html lang="en"> ...... web page </html> i want extract string "en" jsoup. i tried selector , attribute without success. org.jsoup.nodes.document htmldoc = jsoup.parse(html); element taglang = htmldoc.select("html").first(); system.out.println(taglang.text()); looks want value of lang attribute . in case should use attr("nameofattribute") like system.out.println(taglang.attr("lang"));

css - How to deactivate compressing in grunt less? -

the grunt-contrib-less package provides option compress , should allow managing uglifying/minifying/compression of destination css file. boolean default value false . for reason woesn't work me -- whatever set parameter to, output css file compressed. ho working correctly? gruntfile.js module.exports = function(grunt) { // project configuration. grunt.initconfig({ pkg: grunt.file.readjson('package.json'), less: { development: { options: { paths: ["public/css"], compress: false }, files: { "public/css/style.css": "public/css/style.less" } }, production: { options: { paths: ["public/css"], compress: false, plugins: [ new (require('less-plugin-autoprefix'))({browsers: ["last 2 versions"]}), new (require('less-plugin-clean-css'))([]) ],

java - Parsing a complex JSON file -

i need parse json file , put data html table. using gwt application, data shall read file on server side , passed client on page load. the format jsonobjects in file follows: { "object 1": [ { "value1": [ "subkey1", "subvalue2" ], "value2": "val", "value3": { "key1": val1, "key2": val2, "key3": val3} }, { "value2": [ "subkey1", "subvalue2" ], "value2": "val", "value3": { "key1": val1, "key2": val2, "key3": val3} }, .... .... ], "object 2": [ { "value1": [ "subkey1", "subvalue2" ], "value2": "val", "value3": { "key1": val1, "key2": val2, "key3": val3} }, { "value2": [ "subkey1", "subvalue2" ], "value2": "val", "value3": { "key1

c# - create multiple threads and communicate with them -

i have program, takes long time initialize it's execution rather fast. it's becoming bottleneck, want start multiple instances of program (like pool) having initialized, , idea pass needed arguments it's execution, saving initialization time. the problem found howto start new processes passing arguments: how pass parameters threadstart method in thread? but start process , able communicate send each thread needed paramenters required it's execution. the best aproach found create multiple threads initialize program , using communication mechanism (named pipes example it's running in same machine) able pass arguments , trigger execution of program (one of triggers break infinite loop, example). i'm asking if can advice more optimal solution rather 1 came with. i suggest don't mess direct thread usage, , use tpl, this: foreach (var data in your_initialization_logic_method_here) { task.run(() => yourdelegate(data), //other param

mysql - SQL - Query to find if a string contains part of the value in Column -

i trying write query find if string contains part of value in column (not confuse query find if column contains part of string). example have column in table values abc,xyz. if give search string abcdefg want row abc displayed. if search string xyzdsds row value xyz should displayed select * table @param '%' + col '%'

php - How to echo something outside of function? -

in following code want echo green outside of public function . public function lol(){ $green ="green"; } for example want echo $green in following code. public function green(){ echo"this $green"; } try following code : function __construct() { parent::__construct(); $green ="green"; } public function green(){ echo"this $green"; } place $green variable in constructor.

winrt xaml - Setting Visibility based on another control's visualstate -

is possible set visibility on grid or other element based on visual state of control? i'm starting wrap head around visualstatemanager concept (having found style triggers can't used in universal apps) can't work out if can done or not. to specific scenario, able set visibility of 1 or more elements if specific item/index in listview selected? if so, how? i maintain listview selection in property of viewmodel , bind grid.visibility property. need ivalueconverter convert selected item's datatype system.windows.visibility , required grid.visibility binding. in case logic determine visiblity more complex, e.g. requires application state, add property bool isimportantitemselected viewmodel , bind grid.visibility property. approach allows keep complex logic in viewmodel. you'd need ivalueconverter again convert bool system.windows.visibility .

android - Manupilate a single row in listview -

Image
the problem my way add view makes every fifth item add view when want 1 position have "mängd" row. why can edit listitems when visible on screen. child static @ 5 items though got 20 item.... there way item 1 have , not position - firstvisibleposition i think problem listview my code not understandable @ time because of other things hope problem anyways. this main question it seems thing add position 0 happens 6 , 12 why listview wierd ? it's on swedish, got list view. every listview item has empty linearlayout add view when press down arrow button. problem every fifth item gets or can click on first 5. i dont why make listview complicated. want able child in list without seening it! code getview public view getview (int position, view convertview, viewgroup parent){ if (convertview == null) { convertview = layoutinflater.from(getcontext()).inflate(r.layout.view_meal_item_editable, null); }

javascript - How get JSON data from external URL -

Image
i able read information small page. i have address of json service displays following information: and wish keep number appears. i tested example , work correctly, when try url nothing happens. not know if understand problem correctly, wish please me. if have questions, try explain best possible. i ask apologize inconvenience. the code used var getjson = function(url) { return new promise(function(resolve, reject) { var xhr = new xmlhttprequest(); xhr.open('get', url, true); xhr.responsetype = 'json'; xhr.onload = function() { var status = xhr.status; if (status == 200) { resolve(xhr.response); } else { reject(status); } }; xhr.send(); }); }; getjson('http://myaddress/json.do?_uln[1]').then(function(data) { alert('your json result is: ' + data.result); //you can comment this, used debug result.innertext = data.result; //display result in html element }, fu

How to validate a url address in jquery using Regex? -

i have searched lot didn't answer. how validate urls www.google.com , http://www.google.com using regular expressions? in advance. you can use function test valid url as: function validateurl() // return true or false. { var urlregex = new regexp( "^(http:\/\/www.|https:\/\/www.|ftp:\/\/www.|www.){1}([0-9a-za-z]+\.)"); return urlregex.test(textval); }

php - Remove data from array according to the second one -

i have array contain - name, email, , id have second array contain same parameters, different data i remove cells, first array, emails don't exist in second array. instance - first array: array (size=4) 0 => array (size=3) 'name' => string 'shlomi green' (length=25) 'email' => string 'shlomig$mail.co.il' (length=25) 'contactid' => string '28' (length=2) 1 => array (size=3) 'name' => string 'roi keen' (length=21) 'email' => string 'roi@mail.com' (length=16) 'contactid' => string '53' (length=2) 2 => array (size=3) 'name' => string 'ronen' (length=8) 'email' => string 'ronen$mail.com' (length=23) 'contactid' => string '43' (length=2) 3 => array (size=3) 'name' => string 'shlomi' (length=10)

android - How to convert the URL path into image and showing on the list view -

based on location trying search stores , search result showing on list view of cell . getting name,address,related icons , rating google problem how show image on list view of list cell.i got url path of image.i convert url path bitmapimages using bitmap getbitmapfromurl().but showing npe(null pointer exception). below going paste code. public class nearbyactivity extends activity implements locationlistener { // private listadapter adapter; listview lvplaces; imageview ivphone,ivcamera,ivprinter,ivmore; string name,vicinity,formatted_phone_number,rating,icon; double mlatitude=0; double mlongitude=0; sharedpreferences spref; arraylist<hashmap<string, string>> placeslistitems = new arraylist<hashmap<string,string>>(); // customlistadapter customlistadapter; public imageloader imageloader; private static final string name = "name"; private static final string vicinity = "vicinity"; priv