Posts

Showing posts from April, 2011

using c# parse and iterate through json object to address each field -

this simple question can't seem find direct answer. read in single json object. want parse , able directly address token or value , format writing file output, use in application. using c# , newtonsoft library. my code: jsontextreader reader = new jsontextreader(re); while (reader.read()) { if (reader.value != null) console.writeline("value: {0}", "this value <tags>: " + reader.value); } how can address each line? example, desc , gets reference game world. must commoplace. thanks, johnh use jarray , jobject objects instead, this: var json = system.io.file.readalltext("yourjsonfilepath"); var objects = jarray.parse(json); foreach(jobject root in objects) { foreach(keyvaluepair<string, jtoken> tag in root) { var tagname = tag.key; console.writeline("value: {0}", "this value <tags>: " + tagname); } }

iphone - Can I make a phone call in my app without an alertview popping up and return to app? -

i have been using: [[uiapplication sharedapplication] openurl:[nsurl urlwithstring:@"telprompt://123456789"]]; to make phone call app , after phone call return app. problem don't want have alertview pop every time have make call. have used: [[uiapplication sharedapplication] openurl:[nsurl urlwithstring:@"tel://123456789"]]; but doesn't return app me. there way can have no alert view , have app returned foreground?

jquery - Can I Toggle content of Element based on pixel height of element? -

using bootstrap 2.3.2 i've used toggle button show , hide text using collapse plugin see allows me reveal , hide entire contents of element. what need have 170px of element's content visible , when button clicked, reveals rest of text in element - need without adding additional elements, needs based on height. is possible bootstrap? or if not, jquery? this can done using css element styling , applying classes via javascript: the html: <div class="toggle"> huge text here... </div> css: .toggle{ height:170px; } .open{ height:auto; } and js (using jquery): $('.toggle').on('click', function () { $(this).toggleclass('open'); }); what script detect when click on .toggle and, if clicked, toggles class .open sets propertie height auto , leading element text huge can grow. here working example: http://jsfiddle.net/8sxnz/1/

ruby on rails 3 - railstutorial 10.3.1: undefined local variable or method `microposts_path', `micropost_path' -

have problem testing in 10.3.1 access control : failures: 1) authentication authorization non-signed-in users in microposts controller submitting destroy action failure/error: before { delete micropost_path(factorygirl.create(:micropost)) } nomethoderror: undefined method `micropost_path' #<rspec::core::examplegroup::nested_3::nested_3::nested_1::nested_3::nested_2:0x00000004edd970> # ./spec/requests/authentication_pages_spec.rb:117:in `block (6 levels) in <top (required)>' 2) authentication authorization non-signed-in users in microposts controller submitting create action failure/error: before { post microposts_path } nameerror: undefined local variable or method `microposts_path' #<rspec::core::examplegroup::nested_3::nested_3::nested_1::nested_3::nested_1:0x0000000521c758> # ./spec/requests/authentication_pages_spec.rb:112:in `block (6 levels) in <top (required)>' i add in routes.rb this: resources :mis

Css: align image and select with overflow -

i have following html code : <div> <img src="..." /> <select> ... </select> <div> and following css : div { width: 100px; height: 32px; overflow: hidden; } img { width: 32px } select { width: 150px; display: inline-block; } i need vertical align image , select field. fact select field in overflow normal. goal show part of select field not in overflow next image. currently, select field below image. i'm no sure if explanation clear, ask more details if need. you need nest 2 divs: outer 1 "overflow:hidden;", , inner 1 wide enough contain 2 elements: html: <div class="wrap"> <div class="inner"> <img /> <select></select> </div> </div> css: div.wrap { width:100px; height:32px; overflow:hidden; } div.inner { width:200px; } img {width: 32px;} select {width: 150px;}

printf - C++ snprintf "cannot pass objects of non-POD type" -

i trying write program has config , key file. config file reads ever inputted key file, parses , executes key values needed. i getting error: warning: cannot pass objects of non-pod type ‘struct std::string’ through ‘...’; call abort @ runtime. i receiving error on line: snprintf(command, 256, "tar -xvzf %s %s", destination, source); system(command); more of code try , better explain: std::string source = cfg.getvalueofkey<std::string>("source"); std::string destination = cfg.getvalueofkey<std::string>("destination"); int duration = cfg.getvalueofkey<int>("duration"); int count, placeholder, placeholderadvanced; count = 1; char command[256]; snprintf(command, 256, "tar -xvzf %s %s", destination, source); system(command); //creates folder 1. snprintf(command, 256, "mkdir %i", count); system(command); //removes last folder in group. snprintf(command, 256, "rm -rf %i", duration); syste

.net - Map two enumerations to a third single enumeration -

what best way in c# map combination of 2 enumerations third enumeration? basically need class static method can accept enumerationa , enumerationb , in method or class have static mapping enumeration should return x,y combination. does have examples? your question unclear, here's guess @ want. public enum { x, ... } public enum b { y, z, ... } public enum c { cat, dog, ... } private static readonly dictionary<tuple<a, b>, c> lookup = new dictionary<tuple<a, b>, c> { { tuple.create(a.x, b.y), c.cat }, { tuple.create(a.x, b.z), c.dog }, ...etc... }; public static c lookup(a a, b b) { return lookup[tuple.create(a, b)]; }

vb.net - Running function of one application from within another application -

i've got 2 standalone applications: first one: namespace firstapplication class mainwindow public sub new() initializecomponent() end sub public function runbatch(parameter string) double 'do work return somevalue end function end class end namespace second application: namespace secondapplication class mainwindow public sub new() initializecomponent() end sub public sub runbatch() 'call runbatch() first application, show result msgbox(runbatch) end function end class end namespace both wpf, .net 4.0 based. goal have second application call on first 1 , execute function in it. the key part both applications used independently , second calls on first. because both applications need exist executable, don't want solve

ruby on rails - Avoid sql injection ActiveRecord order -

i trying avoid sql injection when ordering need make sure nulls last. query = books.order(@vals['order'] + ' nulls last') but if take @vals['order'] api parameter susceptible sql injection. there better way form order avoid this? if api, offer kinds of ordering api consumers , catch order criteria upfront in code (e.g. whitelisting approach). if @evals['order'] == 'title' ordering = 'title' elsif @evals['order'] == 'published' ordering = 'created_at' else ordering = 'id' end query = books.order(ordering + ' nulls last') it's not prettiest of codes, @ least safe without need parse parameter.

tsql - Create User from a different DB in SQL Server -

is there way can create user on database master db(or other db) if exists (select 1 j_test.sys.database_principals name = n'test_user') drop user j_test.[test_user]; --doesnt't work. you either need change context database or dynamically go there: exec j_test..sp_executesql n'drop user test_user;';

elasticsearch - Elasicsearch nodes disconnecting -

we have issue nodes in cluster leaves cluster without apparent reason. we run on elasticsearch v0.20.6, jvm 7u25. use unicast discovery. this embedded es instance, 7 nodes in cluster. nodes 47, 48, 49 , 50 on 1 location (network), 24, 25 , 26 on another. the same thing happens after while every time, index files deleted between tests. 1 of 24, 25, 26 nodes thinks master (which again leads split-brain scenario - ok , understand why happens, question why disconnect happening. first, node47 elected master. other nodes joins, , things runs smooth couple of hours or so. then suddenly, here first traces of visibly going wrong, around 19:10: node47: 2013-08-14 19:09:49,243 debug [org.elasticsearch.transport.netty] (elasticsearch[local][transport_client_worker][t#3]{new i/o worker #3}) [local] disconnected [[local][vbxjxeqgriynfzvk-1jciw][inet[/**node24**:8800]]{local=false}], channel closed event 2013-08-14 19:09:54,109 debug [org.elasticsearch.transport.netty] (elasticsearch

c# - Get DLL or EXE dependencies, using NDepend -

i need list of referenced assemblies used in exe or dll file. looking ndepend option through console can have programatically solution this. as far know, ndepend reads dependencies visual studio project, don't know if it's possible tell ndepend analize dll , reads referenced assemblies. anyone knows if it's possible ndepend? if not, there's tool or mechanism can use achieve this? thank you, let me know if need detail. use reflection programmatically managed references: http://msdn.microsoft.com/en-us/library/system.reflection.assembly.getreferencedassemblies.aspx . or use tool jetbrain's dotpeek, managed references use dependency walker other kinds of references: http://www.dependencywalker.com/faq.html

javascript - Close Popup Window by Clicking on Parent onfocus -

i'm trying close popup created clicking on link within parent window, clicking on parent window. function controls seems work fine, not allow me click on links again open popup. suggestions? in advance! the code listed below. fyi, code not formatted because involves numerous hacks legacy cms: var chklistwindow; function chklistpopup(guidnum){ if(typeof chklistwindow === "null" || typeof chklistwindow === "undefined"){ //do nothing }else{ chklistwindow.close(); } chklistwindow = window.open('','_blank', 'width = 1050, height = 680, scrollbars=no, titlebar=no, status=no, toolbar=no, location=no, top=0;'); chklistwindow.document.write( "<div class='scrollbox' style='width:100%; height:680px; margin:-15px 0 0 -10px; padding:0; border:0; text-align:center;'>" +"<div class'scrollcontent' style='position:absolute; margin:80px 0 0 75p

java - JTable not showing data -

i have got problem. connect mssql java. return data sql.i want show jtable data didnt assign jtable defaulttablemodel. code: public void displaytable(resultset result,resultsetmetadata resultmeta){ int i; defaulttablemodel table = new defaulttablemodel(); int columncount=resultmeta.getcolumncount(); system.out.println(columncount); try{ for(i=1;i<=columncount;i++) table.addcolumn(resultmeta.getcolumnname(i)); while(result.next()){ string [] row=new string[columncount]; for(int j=1;j<=columncount;j++) row[j-1]=result.getstring(j); table.addrow(row); } for(int =0;a<columncount;a++){ system.out.println(table.getcolumnname(a)); } tablo.setmodel(table); }catch(exception ex){ system.out.println(ex); } }

excel - Clear dynamic range vba -

i trying clear dynamic range starting on cell m22 using , going last column use of last column eluding me. thanks sub clear() workbooks.open filename:=thisworkbook.path & "\..\master info page.xlsx" sheets("sheet1") lastcol = .cells(13, .columns.count).end(xltoleft).column lastrow = .cells(.rows.count, lastcol).end(xlup).row end sheets("sheet1").range(cells(m22, 13), cells(lastrow, lastcol)).clear end sub couldn't do: with sheets("sheet1") .range("m22", .cells(.rows.count, .columns.count)).clear end

automatic ref counting - iOS: destroy subviews in viewDidDisappear? -

i have uinavigationcontroller uiviewcontroller pushed onto it. in viewcontroller s view , have 2 subview uiscrollview s. recreate these scrollview s every time in viewwillappear method in viewcontroller , add them subviews viewcontroller's view. using arc, should destroying 2 scroll views in viewdiddisappear method? better practice memory usage. edit: did investigation, , without removing scroll views , setting them nil in viewdiddisappear method, not released. viewcontroller's view gets increasing number of subviews viewwillappear called. mentioned in comments, never deallocate main viewcontroller. stays on navigation controller's stack. why must manually release scroll views? it may not necessary @ all. if uiviewcontroller removed screen , being deallocated, automatically deallocate view hierarchy (including subviews have added). easy way check override dealloc methods of classes you're interested in (using objc category method added class), , l

c preprocessor - How to transfer #define-constants to another C++-project? -

i have 2 c++-projects in visual studio 2010, , 1 of them has check if #define -constant has been set in other project (this 1 dll, first 1 executable). according constant being set in executable dll should compiled in way (with #ifdef , #ifndef ). how possible, or there way control way dll compiled remotely? the usual way stuff defines central (shared) header, traditional names config.h , instead of using vs specific project settings . if want pry them out of existing project files, vim/grep on .vcproj decent job.

ruby on rails - Trying to show error messages, but running into: undefined method `errors' for nil:NilClass -

i trying implement error messages in rails , somehow fail work @ 1 point. the view trying add error messages: <%= form_for([@post, @post.comments.build], html: {class: 'form-horizontal'}) |f| %> <% if @comment.errors.any? %> <div id="errorexplanation" class="span5 offset1 alert alert-error"> <button type="button" class="close" data-dismiss="alert">&times;</button> <h4>something went wrong!</h4><br> <% @post.errors.full_messages.each |msg| %> <p><%= msg %></p> <% end %> </div> <% end %> and controller: def create @post = post.find(params[:post_id]) @comment = @post.comments.create(params[:comment].permit(:commenter, :body)) redirect_to post_path(@post) end and error mes

android - alarms or services for periodic jobs -

for android application needs periodic jobs done, more appropriate solution? it seems me services right choice. can run periodic jobs alarms in background , after rebooting. should continue use whichever easier or stick 1 of them in case? what drawbacks , advantages of 2 choices? in short, don't want invent way follow patterns other android developers follow. use service , alarmmanager . continue getting alarms after rebooting subscribe boot_completed intent (you need corresponding permission).

parse Soap Array into PHP Array -

i need on one; i need parse soap result several php arrays. <soap-env:envelope xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:xsd="http://www.w3.org/2001/xmlschema" xmlns:soap-enc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:clr="http://schemas.microsoft.com/soap/encoding/clr/1.0" soap-env:encodingstyle="http://schemas.xmlsoap.org/soap/encoding/"> <soap-env:body> <i2:getdataresponse id="ref-1" xmlns:i2="http://schemas.microsoft.com/clr/nsassem/teleperformance.statistics.webservice.dataservice/ctistatserver"> <return href="#ref-4"/> </i2:getdataresponse> <i3:data id="ref-4" xmlns:i3="http://www.twenty4help.com/ps/dataservice.wsdl"> <values href="#ref-5"/> </i3:data> <soap-enc:array id="ref-5" soap-enc:arraytype="xsd

jboss7.x - AS 7.1.1 : JNDI Look up for JMS connection factroy is not working -

i trying write sample program jms using jboss. went through following link how use jboss jms http://docs.jboss.org/jbossmessaging/docs/usermanual-2.0.0.beta1/html/using-jms.html i getting exception while looking connectionfactory i.e. "inictx.lookup("connectionfactory")" javax.naming.communicationexception: receive timed out [root exception java.net.sockettimeoutexception: receive timed out] @ org.jnp.interfaces.namingcontext.discoverserver(namingcontext.java:1058) @ org.jnp.interfaces.namingcontext.checkref(namingcontext.java:1127) @ org.jnp.interfaces.namingcontext.lookup(namingcontext.java:478) @ org.jnp.interfaces.namingcontext.lookup(namingcontext.java:471) @ javax.naming.initialcontext.lookup(unknown source) @ messageproducer.main(messageproducer.java:46) caused by: java.net.sockettimeoutexception: receive timed out @ java.net.plaindatagramsocketimpl.receive0(native method) @ java.net.plaindatagramsocketimpl.receive(unknown source) @ java.

javascript - Best strategy to maintain a sorted list subject to realtime updates -

i'm building html list similar facebooks timeline feature. list ontain @ 100 items, performance isn't requirement. unlike facebook's timeline however, list quite dynamic. example different events arrive in realtime , depending on timestamp, might prepended list, inserted (i can't guarantee new events arrive in time order) , removed. on top of that, nice animate updating of list (add/inser/remove) too, that's separate issue. i wonder best strategy maintain list (sorted time of course), once i've built initial data? thanks. as suggested in other answer, have data-time property on each element. when new data arrives, locate first element data().time lesser new time. if there such element, use element.before(newelement) , otherwise container.append(newelement) . way list kept sorted. illustration: http://jsfiddle.net/jxlgr/

html - HTML5 CSS page is loading in the middle of the content, not desired -

Image
i have been working on html5 page using css, , seems going well, page isn't loading @ top using firefox 23. when loaded page in chrome appeared jump same spot firefox loaded, jumped page top. this page seems loading on initial load using firefox 23. the page can found on internet, http://ipatch.github.io/kegcop/ update: loaded html page without stylesheet , appears still loading undesired behavior. you're experiencing behavior because of autofocus attribute have set in first input, (as name suggests) add focus when page loads

Java parse xml file when node inner text is html -

right i'm using saxparser own handler, can parse node values except 1 has type="html" my characters function this: public void characters(char ch[], int start, int length) throws saxexception { if(content){ string tmp = new string(ch, start, length); system.out.println("content : " + tmp); content = false; } and particular node has following format, output give me bunch of \n , nothing else. <content type="html"> &lt;img alt="" src="http://cdn2.sbnation.com/entry_photo_images/8767829/stranger-bad-robot-screencap_large.png" /&gt; &lt;p&gt;bad robot, production company founded geek culture hitmaker j.j. abrams (&lt;i&gt;lost&lt;/i&gt;, &lt;i&gt;fringe&lt;/i&gt;, &lt;i&gt;star trek: darkness&lt;/i&gt;, &lt;i&gt;alias&lt;/i&gt;,&amp;nbsp;etc.), has released a&amp;nbsp;&lt;a

PayPal REST API - Sandbox returning 401 for API requests but successful access token -

i using paypal rest api in java make request testing (sandbox) servers access token, succeeds, , sending access token same sandbox servers payment fails 401 not authorized. i followed paypal rest api instructions found here: https://developer.paypal.com/webapps/developer/docs/api/#authentication--headers , here https://developer.paypal.com/webapps/developer/docs/integration/direct/make-your-first-call/ i tried using oauthtokencredential object provide clientid , clientsecret returns me access token, not appid provided paypal nor expiresin time in minutes. in addition, complains missing sdk_conf.properties file in classpath. i created own class make call using apache's httpclient full response , works: custom paypalapi interface resteasy @path("v1/oauth2/token") public interface paypaloauthapi { @post @produces(mediatype.application_json) @consumes(mediatype.application_form_urlencoded) public oauthinfo requestaccesstoken( @h

c# - Filtering bad words and all permutations of intentionally misspelled words? -

what's way using regular expressions filter curse words block of text? i don't want replace "ass" in classic (a clbuttic mistake), needs able earch word boundary. additionally, need catch permutations such l33tpeak, spaces in word, etc. doesn't have perfect (the system going have message flagging capabilities) should majority of cursing people may use. pg13 example: if trying block word "moist", should able match "moist" "m01st", "moist", "m0ist" , "m oist". here's c# equivalent closed thread located @ "bad words" filter , based off answer @unknwntech provided: public string replacebadwords(string data, string[] badwords, out int badwordcount) { int count = 0; regex r; string op = data; foreach (var word in badwords) { var expword = expandbadwordtoincludeintentionalmisspellings(word); r = new regex(@

php - fgetcsv skip blank lines in file -

i have script did, grabs files in "logs" folder , merge them in 1 array file, problem that, script breaks if there blank line or empty line! how can tell automatically skip blank empty lines , go next? blank lines not @ top or bottom! in middle of csv file <?php $csv = array(); $files = glob('../logs/*.*'); $out = fopen("newfile.txt", "w"); foreach($files $file){ $in = fopen($file, "r"); while (($result = fgetcsv($in)) !== false) { $csv[] = $result; } fclose($in); fclose($out); } print json_encode(array('aadata' => $csv )); ?> as can read in documentation fgetcsv() : a blank line in csv file returned array comprising single null field, , not treated error. checking before adding data array should sufficient: while (($result = fgetcsv($in)) !== false) { if (array(null) !== $result) { // ignore blank lines

ssl - Async task and https android -

i have android app , added ssl website secure login information when logging in. have async task sends information check database etc. after setting ssl correctley , see works on website. tried changing http: https: in url async task , crashes error: 08-19 19:14:16.779 9314-9465/com.beerportfolio.beerportfoliopro e/androidruntime: fatal exception: asynctask #1 java.lang.runtimeexception: error occured while executing doinbackground() @ android.os.asynctask$3.done(asynctask.java:299) @ java.util.concurrent.futuretask$sync.innersetexception(futuretask.java:273) @ java.util.concurrent.futuretask.setexception(futuretask.java:124) @ java.util.concurrent.futuretask$sync.innerrun(futuretask.java:307) @ java.util.concurrent.futuretask.run(futuretask.java:137) @ android.os.asynctask$serialexecutor$1.run(asynctask.java:230) @ java.util.concurrent.threadpoolexecutor.runworker(threadpoolexecutor.java:1076) @ java.ut

Checking username on local server using jquery, ajax and php ajax() not connecting -

so have mysql database on local system , connecting using php. know there nothing wrong the server (apache) because have used in calls using php. the problem think "ajax() request i have started using ajax. followed tutorial implement way check if username exists on db asynchronously. all code works until ajax() request. i don't errors. see on screen result of code: $("#availability_status").html(' checking availability...'); //add loading image in span id="availability_status" i have been searching solution day , it's driving me mad. thank in advance! <!doctype html public "-//w3c//dtd xhtml 1.0 strict//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"> <head> <meta http-equiv="content-type" content="text/html;

java - Error in Hibernate NamedQuery -

i'm sure stupid, can't figure out why hibernate upset named query. can please me? here's query , domain objects in reference, followed stacktrace. @namedquery(name = "findsummaryreportrollups", query = "select new com.bean.summaryreportrollup(org.region, org.market, header.projectionyearmonth, detaillineitems.attribute, sum(detaillineitems.value)) header header inner join organizationext org on header.location = trim(org.id) inner join header.detaillineitems detaillineitems " + " header.location in (:locations) group org.region, org.market, header.projectionyearmonth, detaillineitems.attribute ") header @entity @table(name = "header") @sequencegenerator(name="header_seq", sequencename="header_seq", allocationsize=1) public class header implements serializable { private static final long serialversionuid = 1l; @id @generatedvalue(strategy=generat

scala - Why does Numeric treat unary differently to binary? -

what's this? import numeric.implicits._ def myadd[t: numeric](x: t, y: t) = x + y // works myadd(1,2) def myinc[t: numeric](x: t) = x + 1 // fails @ x: not find implicit value parameter num: scala.math.numeric[any] myinc(9) scala 2.10 something x+1 --> numeric+int? so after looking @ http://www.scala-lang.org/api/current/#scala.math.numeric , seeing one , fromint , fiddle bit in repl , came with: scala> def myinc[t: numeric](x: t) = x + implicitly[numeric[t]].fromint(1) myinc: [t](x: t)(implicit evidence$1: numeric[t])t scala> myinc(9) res1: int = 10 scala> def myinc[t: numeric](x: t) = x + implicitly[numeric[t]].one myinc: [t](x: t)(implicit evidence$1: numeric[t])t scala> myinc(9) res2: int = 10 it not related being method 1 argument, instead on compiler inferring t type any .

Android Run class on new thread -

this question has answer here: how fix android.os.networkonmainthreadexception? 45 answers networkonmainthread 3 answers i trying parse .pls file urls play. used following code, giving networkonmainthread exception. never did threaded apps before; how can run class on new thread? public class getstreamingurl { private static string logtag = "getstreamingurl"; private context mcontext; public string url1; public linkedlist<string> url2; public getstreamingurl(context context) { log.i(logtag, "call constructor"); this.mcontext = context; } public linkedlist<string> getstreamingurl(string url) { log.i(logtag, "get streaming url"); final bufferedreader br; string murl = null; linkedlist<string> murls = null; try { urlconne

osx - JTooltip in JTable on Mac in Java does not select the row when clicked on -

on windows if click on table tooltip (jtooltip), remove tooltip , select row in table. on mac, seems remove tooltip , not select row in table. the code uses standard jtable , overrides gettooltiptext method jtable. no custom jtooltip created or that. code: public class myjtable extends jtable { @override public string gettooltiptext(mouseevent event) { return "hello world"; } } * *update: on further investigation issue seems due similar bug report . tooltipmanager.showtipwindow() creating tooltip heavyweight component on mac , lightweight component on windows, causes mouselistener not fired. worse part regardless if set popuptype lightweight, still create heavyweight component in method when java code calls popupfactory.getpopup(...) no idea how fix it. normally different tooltip given each row or cell , not entire table. move mouse tooltip changes , displayed in different location never opportunity click on tooltip. so, maybe

php - Lazy loading facebook like buttons - Why dont they appear -

i creating page client, , first - load 10 results directly onto page. results render facebook button perfectly. looking @ code see first 10 resutls have facebook embedded page content directly expect , see facebook button! now. click bottom link of page, loads 10 more results. these 10 more results use exact same code previous 10, facebook button not appaer. when @ code see html copy-paste of original code, rather embedded page in first 10 examples. my best guess lazy loading buttons onto page, not being processed in same way. don't know how fix it... any thoughts on can here? try calling fb.xfbml.parse(null,fb.canvas.setsize) after doing next page

php - A more efficient way of binding a big insert or update? -

ok im new binding, here code works. learned format tutorial imagine there more efficent ways it. in example there 4 names in reality doing lot of inserts , updates in project im working on have 20 or fields. approach clarity when talking 20 fields or more take lot of real estate. lets @ code first. here functions uses: // prepare statement public function query($query){ $this->stmt = $this->dbh->prepare($query); } public function bind($param, $value, $type = null){ if (is_null($type)) { switch (true) { case is_int($value): $type = pdo::param_int; break; case is_bool($value): $type = pdo::param_bool; break; case is_null($value): $type = pdo::param_null; break; default: $type = pdo::param_str; } } // run binding process $this->stmt->bindvalue($param, $value, $type); } // execute

ios - How to get the path of multiple images selected from library in iPhone? -

i new in iphone app development. in code, able select multiple images library , path of 1 image. creating copy of image in documents directory in folder called "images" , trying zip it. want path of selected multiple images, copy them in documents directory in same folder "images" , want zip them later. please tell me how can above mentioned tasks in code. how code looks of now: - (void) imagepickercontroller:(qbimagepickercontroller *)imagepickercontroller didfinishpickingmediawithinfo:(nsdictionary *)info { if (imagepickercontroller.allowsmultipleselection) { nsarray *mediainfoarray = (nsarray *)info; nslog(@"selected %d photos", mediainfoarray.count); nsdata *webdata = uiimagepngrepresentation([[mediainfoarray objectatindex:0] objectforkey:@"uiimagepickercontrolleroriginalimage"]); nslog(@"web data length is: %u",[webdata length]); nsarray *paths = nssearchpathfordirectoriesindomains(nsdocumentdirectory, n

mysql - Cannot add or update a child row: a foreign key constraint fails -

i've table 1. create table `parent` ( `id` bigint(19) not null default '0', primary key (`id`), ) engine=innodb default charset=utf8; 2. create table `child_1` ( `parentid` bigint(19) not null default '0', `id` bigint(19) not null default '0', primary key (`parentid`,`id`), key `child_1_fk1_idx` (`parentid`,`id`), constraint `child_1_fk1` foreign key (`parentid`, `id`) references `child_2` (`parentid`, `id`) on delete cascade ) engine=innodb default charset=utf8; 3. create table `child_2` ( `parentid` bigint(19) not null default '0', `id` bigint(19) not null default '0', primary key (`parentid`,`id`), key `child_2_fk1_idx` (`parentid`), constraint `child_2_fk1` foreign key (`parentid`) references `parent` (`parentid`) on delete cascade ) engine=innodb default charset=utf8; unfortunately, i've deleted second table constraint. constraint `child_1_fk1` foreign key (`parentid`, `id`) references `child_2` (`parentid`,

How can I get the total lines committed today in git? -

i found general statistics on git time repo has existed i'm interested in doing like: git today and things # of commits, # of lines , etc. broken down author. i interested in # of lines current user.. can combine results of other things on own if want see graphical representation of git repository's activity, use gitstats utility: http://gitstats.sourceforge.net/ all following commands assume use of, e.g., bash. running following command can first commit has same date today. > first_commit=`git log --pretty=format:"%h" --since "$(date +%y-%m%-d):00:00" and following command process git repository statistics: > gitstats -c commit_begin=<commit_id> . target/gitstats and combining these can simple command can set alias, if wish: > first_commit=`git log --pretty=format:"%h" --since "$(date +%y-%m%-d):00:00" | tail -n1`; gitstats -c commit_begin=$first_commit . target/gitstats then open ./targe

behavior - Hibernate ManyToOne and OneToMany -

i have relationship mapped example. @entity @table(name = "shop") public class shop implements serializable { ... @onetomany(mappedby = "shop", fetch=fetchtype.lazy) private set<event> events; ... } @entity @table(name = "event") public class event implements serializable { ... @manytoone(fetch = fetchtype.lazy) @joincolumn(name = "shop_id", nullable = false) private shop shop; ... } when local getevent() called loaded in colletion 1 list few events, each event have inside shop might have inside event , successively.. ok?. can problem responsing json structure? i had problem during serialization json ... @ org.codehaus.jackson.map.ser.std.collectionserializer.serializecontents(collectionserializer.java:72) @ org.codehaus.jackson.map.ser.std.collectionserializer.serializecontents(collectionserializer.java:23) @ org.codehaus.jackson.map.ser.std.asarrayserializerbas