Posts

Showing posts from August, 2010

php - Quickest most efficient way to run a loop to find and verify over 1 million usernames off a different website? -

using php current script work it's going take extremely long time since there on 1 million usernames verify. this checks against external websites api , returns <span class="user">{userid}</span> if it's valid username , returns <span class="user">0</span> if it's not. $query = $db->query('select id, username users_to_verify'); // on 1 million. foreach($query $row) { $userid = $row['id']; $username = $row['username']; if(!preg_match("/<span class=\"user\">0<\/span>/", file_get_contents("http://website.net/api.php?username=".$username))) $db->query('update users_to_verify set verified = 1 id = $userid'); } } is quickest way this? i've dabbled curl both file_get_contents , curl seem have same performance, know of dependent on external websites response time, want make sure side using quickest ,

ios - How to find view controller of screen -

i have seen following code allows screen orientation of device: if(uiinterfaceorientationisportrait(viewcontroller.interfaceorientation)) { //do portrait work } else if(uiinterfaceorientationislandscape(viewcontroller.interfaceorientation)){ //do landscape work } the problem not sure substitute "viewcontroller" placeholder code. worth noting making keyboard app not sure if can use same view controllers might work other circumstances. controller can use tell orientation of screen? you can in 2 ways. uiinterfaceorientation orientation = [[uiapplication sharedapplication] statusbarorientation]; if (orientation == uiinterfaceorientationportrait || orientation == uiinterfaceorientationportraitupsidedown) { //portrait } if (orientation == uiinterfaceorientationlandscaperight || orientation == uiinterfaceorientationlandscapeleft) { //landscape } or if (uideviceorientationislandscape([uidevice currentdevice].orientation)) { //l

java - Camel Spring JavaConfig Maven-Camel-Plugin without any xml -

how can setup camel projects rely on spring dependency injection system while being xml free using maven camel run plugin. have tried ton of configurations, still seem stuck "shell context" file imports java configuration file. there anyway rid of this? note: on latest camel version of 2.17.1 camel route @component public class testroute extends springroutebuilder { @override public void configure() throws exception { from("timer://foo?repeatcount=1") .log("hello world"); } } java config @configuration @componentscan("com.mcf.xml.free.route") public class routejavaconfig extends camelconfiguration { } maven camel plugin <plugin> <groupid>org.apache.camel</groupid> <artifactid>camel-maven-plugin</artifactid> <version>${camel.version}</version> <configuration>

Making cells bold in a table using python-docx -

the code snippet below creates table required number of rows , columns in new word document i.e 2 columns , 14 rows. adds content rows , columns accordingly. from docx import document newdoc=document() newdoc.add_heading ('gis request form') newdoc.add_paragraph() #inserting table , header , value objects table table=newdoc.add_table(rows=14,cols=2) table.style='table grid' table.autofit=false table.columns[0].width=2500000 table.columns[1].width=3500000 #inserting contents table cells in range(0,14): row=table.rows[i] row.cells[0].text=reqdheaderlist[i] row.cells[1].text=reqdvaluelist[i] i have been trying make contents of in column 1 bold, not working. #inserting contents table cells in range(0,14): row=table.rows[i] row.cells[0].text=reqdheaderlist[i] row.cells[0].paragraphs[0].add_run(line[0]).bold=true row.cells[1].text=reqdvaluelist[i] help? you can achieve using following loop: bolding_columns = [0

dojo - Modify dijit.editor filters to allow tags -

i new dojo , trying use dijit.editor. i able create editor , adding html editor whenever pushes button. example, <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title>title</title> <script src="//ajax.googleapis.com/ajax/libs/dojo/1.10.4/dojo/dojo.js" data-dojo-config="async: true,parseonload: true"></script> <style type="text/css"> /* bring in claro theme */ @import "//ajax.googleapis.com/ajax/libs/dojo/1.10.4/dijit/themes/claro/claro.css"; </style> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mtjoasx8j1au+a5wdvnpi2lkffwweaa8hdddjzlplegxhjvme1fgjwpgmkzs7" crossorigin="anonymous"> <script> function ondrag(event) { event.datatransfer.setdata('text'

How to compile/eval a Scala expression at runtime? -

new scala , looking pointers idiomatic solution, if there one. i'd have arbitrary user-supplied scala functions (which allowed reference functions/classes have defined in code) applied data. for example: have foo(s: string): string , bar(s: string): string functions defined in myprog.scala . user runs program this: $ scala myprog data.txt --func='(s: str) => foo(bar(s)).reverse' this run line line through data file , emit result of applying user-specified function line. for points, can ensure there no side-effects in user-defined function? if not, can restrict function use only restricted subset of functions (which can assure safe)? @kenjiyoshida has nice gist shows how eval scala code. note when using eval gist, not specifying return value result in runtime failure when scala defaults inferring nothing . scala> eval("println(\"hello\")") hello java.lang.classcastexception: scala.runtime.boxedunit cannot cast scala.r

Use Python in C -

i need use features available in python program written in c. found several sources me one of them gives me command compile code: gcc -i/usr/include/python2.7 prog.c -lpython2.7 -o prog -wall && ./prog i had change gcc -i/usr/include/python3.4 prog.c -lpython3.4 -o prog -wall && ./prog but compiler returns: /usr/bin/ld: cannot find -lpython3.4 collect2: error: ld returned 1 exit status it's 1 of first times have used gcc don't understand when @ examples. have tried interface c , python using cython? the manual can found here: https://python.g-node.org/python-summerschool-2011/_media/materials/cython/cython-slides.pdf in section 4.10 talks briefly interfacing python , c. thoughts call c code cython, way have complete , direct access python features want use. here's more on interfacing external c code: http://cython-docs2.readthedocs.io/en/latest/src/userguide/external_c_code.html

ios - Debugger output not showing for keyboard in Xcode -

Image
i making custom keyboard. output normal part of app works fine, meaning can print things console. here working fine: however, no debug statements custom keyboard target made ios print console. for example, here print statement should output "loading view" console since keyboard view showing on screen nothing happens: i'll provide relevant xcode settings if needed. why output not showing up? in case still unsolved: the keyboard runs in different process main app. debugger attaches single process only. in order attach debugger keyboard, create new scheme in xcode (the stuff right of run/stop buttons) keyboard extension target , run 1 instead of main app scheme.

javascript - Access Child Element's DOM Node in React -

i working react & svg. in order centre viewbox on child <g> , need 'bbox' value calling getbbox() api function on child <g> element. code looks this: // <svg> element const svgparent = react.createclass({ componentdidmount : function(){ let elebbox = reactdom.finddomnode( this.refs.gele ).getbbox(); ... // child <g> element const templateparent = react.createclass({ render : function(){ return( <g ref = "gele"> ... the above line let elebbox = reactdom.finddomnode( this.refs.gele ) returns error: typeerror: _reactdom2.default.finddomnode(...) null and indeed, this.refs inside 'svg' element empty obj. how access child <g> element, can access dom node? thanks, if put ref on child can in parent so, no need dom node: const svgparent = react.createclass({ componentdidmount : function(){ let elebbox = this.refs.gele ...

mongodb - Push an array of documents embedded in a document -

i have collection in following format {name: "asd", age: 23} i want add array of documents such final collection looks like { name: "asd", age: 23, address: [ {city: "tokyo", country: "japan"}, {city: "beijing", country: "china"} ] } tried following code in pymongo db.collection.update({name:"asd", age:23},{"$push":{"address":{"city:"tokyo",country:"japan"}}},upsert=true) receiving following error: the field 'address' must array of type object in document i see there typo in query: {" city:" tokyo",country:"japan"} following update works in mongo shell: db.collection.update( {name: "asd", age: 23}, {$push:{ "address":{"city":"tokyo",country:"japan"} }}, {upsert:true})

bash - Echo text typed to a file -

usage example: $ startmem > command1 > command2 > command3 > end $ vi mem.txt mem.txt ------- command1 command2 command3 so need bash program echo whats typed file, excluding 'end' statement. just use cat here document. $ cat <<eof > mem.txt command1 command2 command3 eof $ cat mem.txt command1 command2 command3

android - Facebook login do not work on some devices -

Image
my problem following: notice users trying login in app fail login. happens maybe 20% of them , not sure phone use. notice observation on iphone , android phones. i believe maybe due 1 of parameter in facebook console, not sure one. did of entered in scenario before? @ moment can see api stat facebook see errors when users try login not know how error information at moment looks users end in error case of facebook api when logging in. objective c code: if([fbsdkaccesstoken currentaccesstoken] != nil) [self loginuser]; else{ fbsdkloginmanager *login = [[fbsdkloginmanager alloc] init]; login.loginbehavior = fbsdkloginbehaviorsystemaccount; // part swap app facebook app [login loginwithreadpermissions:@[facebook_email, facebook_publicprofile] handler:^(fbsdkloginmanagerloginresult *result, nserror *error) { if (error){ [login logout]; } else if ([result iscance

visual studio 2010 - OpenCL compiling with C++ bindings -

i'm trying compile cl.hpp khronos groups vs2010, , have following message: 1>c:\users\facundo\documents\visual studio 2010\projects\opencl\opencl\cl.hpp(4757): error c2039: 'resize' : not member of 'cl::vector<t>' 1> 1> [ 1> t=cl_context_properties 1> ] how compile c++/opencl projects on vs2010 correctly? cl::vector<> has been deprecated. by default cl.hpp should pick std::vector<> default vector class. maybe defined __no_std_vector or using cl::vector<> yourself?

ruby - Does Sinatra have a logger like in Rails? -

this question has answer here: logging in sinatra? 4 answers i'd have simple logger have in rails. log requests parameters. can's figure out how this. thanks. try configure enable :logging end see http://www.sinatrarb.com/intro.html#logging

mysql - excel vba - add table column with date based on adjacent cell that includes date and time -

i have excel table ("table1") 4 total columns. 3rd , 4th column contain 'clock in' , 'clock out' information formatted show date , time. example : 6/3/2016 10:54:52 i 2 things here...first, want create new, 3rd column reads date, formatted "d-mmm". should match date found in column 4. the second thing take date portion of text out of columns 4 , 5. @ end, example row of data might read follows (columns 3:5): c, d, e 7-jun, 10:54:52 am, 4:59:44 here have far code: sub test() dim currentsht worksheet dim lst listobject set curretnsht = activeworkbook.sheets(1) set lst = currentsht.listobjects("table1") lst.listcolumns.add position:=3 'not sure how rest end sub that's not excel way. dates numbers 0 represents 1/1/1900. add 1 , next day value of hour 1/24 . biggest problem of approach excel stop editing cell excel evaluate cells value. it'll still 7 - jun excel changes cells for

html - how to stack multiple images side by side so it overflows its <div> boundary -

i ran difficulty, used float or inline-block stack images side side, on reaching max-width of div tag, automatically stacks below. of course overflow-x: hidden; want stack many images possible in single line can animate it. <html> <head> <style> div {max-width: 250px;} </style> </head> <body> <div> <img src="" width="100px"/> <img src="" width="100px"/> <img src="" width="100px"/> <img src="" width="100px"/> </div> </body> </html> use this... <html> <head> <style> div {width: 250px;overflow: hidden; white-space: nowrap;} div img{display:inline;} </style> </head> <body> <div> <img src="http://www.familyfrie

Unable to use Go get properly -

i new user go , trying command. go github.com/tensorflow/tensorflow/tensorflow/contrib/go and getting error package github.com/tensorflow/tensorflow/tensorflow/contrib/go imports github.com/tensorflow/tensorflow/tensorflow/contrib/go imports github.com/tensorflow/tensorflow/tensorflow/contrib/go: cannot find package "github.com/tensorflow/tensorflow/tensorflow/contrib/go" in of: /usr/lib/go/src/pkg/github.com/tensorflow/tensorflow/tensorflow/contrib/go (from $goroot) /home/arafat/go/src/github.com/tensorflow/tensorflow/tensorflow/contrib/go (from $gopath) i know seems trivial issue stuck @ it. if code compile , install not in master branch (checked out default go get ), only in go branch of repo , try and: cd $gopath/github.com/tensorflow/tensorflow git checkout go then try again compilation.

How to test translation symmetry in Python? -

we 2 character values user define mapping (character translation), such 'a' -> 'p' . how test other pairs of strings see if same mapping/translation holds across characters in strings. example: 'abcd', 'pqrs' returns true 'aaa', 'ppp' returns true 'acb', 'pqr' returns false 'aab', 'pqr' returns false we want confirm offset (shift) of characters 1 string consistent. make sure target strings of same length; calculate offset , use all() , generator expression combination try ensure logic completes on first miss, if any, rather continue checking: def test(first, second, third, fourth): if len(third) != len(fourth): return false offset = ord(first) - ord(second) return all((ord(x) - ord(y)) == offset x, y in zip(third, fourth)) >>> test('a', 'p', 'abcd', 'pqrs') true >>> test('a', 'p', 'aaa',

fortran90 - Fortran runtime error 'Bad integer for item 3 in list input' -

i trying open existing file using open command. program compiles on execution error saying bad integer item 0 in list input. code i've used. character*10,dimension(5) :: fn,ln integer, dimension(5) :: rno,class real, dimension(5) :: phy,chem,math,comp,eng real, dimension(5) :: tot,p open (10, file = 'sda', status = 'old') i=1,5,1 read(10,*),fn(i),ln(i),rno(i),class(i) read(10,*)phy(i),chem(i),math(i),comp(i),eng(i) end open(21, file = 'filen', status='new') write(21,*),'fname lname rno class' i=1,5,1 write(21,*),fn(i),ln(i),rno(i),class(i) end file content fname lname rno class alok tata 4531 12 samay soni 4532 12 arjun mani 4533 12 tatwa das 4534 12 bruce wayne 4535 12 phy che mat com eng 90. 90. 90. 80. 99. 80. 80. 80. 70. 80. 70. 60. 60. 70. 60. 60. 70. 80. 90. 90. 80. 80. 80. 80. 80.

mysql - Need a sql query to find all 3 part names with spaces in 'customer info' table -

my "customer info" table contains column 'name' full name of customer given (with space between parts). basically, need find customers 3 part name "king george v" or "duke of york" - is, has more first name , last name. select * customerinfo length(custfullname) - length(replace(custfullname, ' ', '')) >2 this not perfect,it selects names empty spaces >2

how to pass parameter to open modal dialogue box in bootstrap using jsp? -

i want open modal dialogue box in bootstrap passing parameter in jsp. when user clicks on button dialogue box must opened. <a data-id="+subid+" type='button' class='btn btn-success btn-lg btn-block' data-toggle='modal' data-target='#mymodal'>view order</a> i understand want if parameter passed jsp button appear <% string msg2=(string)request.getsession().getattribute("name-param");%> <% if ( (msg2==null || msg2.isempty()) ) { %> //what want <% } else if(msg2!=null) { %> <a data-id="+subid+" type='button' class='btn btn-success btn-lg btn-block' data-toggle='modal' data-target='#mymodal'>view order</a> <% } %> and in servlet set parameter : request.getsession().setattribute("name-param",parameter);

java - For adding an object in set, is it necessary to override equals and hashcode both.? -

this question has answer here: why need override equals , hashcode methods in java? 27 answers recently interviewer asked me have class have overriden equals() method have not overridden hashcode() method. now necessary override hashcode() method too.? what happen if don't override hashcode method, set maintain unique property of not allowing duplicates.? the question internal implementation of set , here confusion if 2 objects return different hashcode() , according me equals() won't checked , unique property of set violated if 2 objects came out equal. is true.? the easiest way understand see hashcodes buckets.when store objects in sets go these buckets according calculated hashcode. when override equals , 1 object equal another, should land in same bucket. however won't case since haven't overriden hashcode method ensure

Secure Encrypt Decrypt Algurithm can use for Android,C#,PHP,iPhone -

i'm going encrypt data transferring between multi platform apps. question algorithm can used work these platforms? that should have these parameters: dynamic key , iv. supported in c#, android, swift, php. be secure enough. it welcome if give me samples or links each platform. update: i tried these classes: android: public class cryptor { private ivparameterspec ivspec; private secretkeyspec keyspec; private cipher cipher; public cryptor(byte[] key_par,byte[] iv_par) { keyspec = new secretkeyspec(key_par, "aes"); ivspec = new ivparameterspec(iv_par); try { cipher = cipher.getinstance("aes/cbc/zeropadding"); } catch (nosuchalgorithmexception e) { e.printstacktrace(); } catch (nosuchpaddingexception e) { e.printstacktrace(); } } public byte[] encrypt(byte[] input) thr

foreach - How to concatenate string in php? -

how concatenate string in image source. try set base path dynamic in image source not work. using in fore each loop. body can me, give me suggestion. new in php. here php code- $base_path = 'https://odesk.com'; $listing = ''; $count=1; if(sizeof($entry['contents'])>0){ foreach($entry['contents'] $child) { $count++; $cp = $child['path']; $cn = basename($cp); $image=''; $cp = htmlspecialchars($cp); $link = getpath("?path=".htmlspecialchars($cp)); if ($child['is_dir']) { $image ='<img src="'@$base_path'/images/folder.png" width="20">';// want here add base path $cn .= '/'; }else{ $image ='<input type="checkbox" value="'.$child['rev'].'" id="'.$child['rev'].'" name="checkbox_value[]" onclick="saveimages('.@$_session[&#

weird behavior of menu items in android app -

Image
i have weird problem. sdk , android have filled c disk space, uninstalled , deleted , installed android studio scratch. , continued work on projects. however, projects have built since then, show strange behaviour. when press menu items both on toolbar or in navigation drawer, while pressed, show black borders around them. see pictures below:

Posting form data and file using jquery ajax to asp.net core rc2 -

this question has answer here: how append whole set of model formdata , obtain in mvc 2 answers i trying post form has input text field , file upload control using jquery ajax. however, keep getting 404 not found error. below, have included relevant part of razor code brevity: here sample of razor code: <form id="uploadform" asp-action="fileupload" asp-controller="content" method="post" enctype="multipart/form-data"> <input asp-for="title" class="form-control" required /> <input asp-for="uploadformfile"> <button type="button" id="uploadbutton" class="btn btn-primary" >upload</button> </form> javascript: $(document).ready(function () { $("#uploadbutton").click(function (e) {

jsp - Overloading an EL function defined in TLD -

is possible overload(function name) el function? please @ following piece of tld: same function name rolldice <function> <name>rollit</name> <function-class>com.person</function-class> <function-signature>int rolldice()</function-signature> </function> <function> <name>rollit</name> <function-class>com.person</function-class> <function-signature>int rolldice(int)</function-signature> </function> no, el functions unfortunately not support method overloading (nor varargs). give each function different name.

c++ - Loss of data between the CPU and GPU when rendering with OpenGL -

i have been writing code basic rendering application. the renderer code consists of setting vertex array , vertex buffer objects rendering entities, , 3 texture units created use diffuse, specular , emission component respectively. wrote wrapper class shader, create , set uniforms. void shader::setvec3uniform(const glchar * name, vec3 data) { gluniform3f(glgetuniformlocation(this->program, name), data); } when set uniforms using above function, doesn't render expected result. when find location before set uniform, renders correctly. use function below set it. void shader::setvec3uniform(glint loc, vec3 data) { gluniform3f(loc, data.x, data.y, data.z); } so question is, data lost, data not reaching shader on gpu in time? stumped. no idea why subtle difference in way uniforms set causing such difference in render. can shed light on this? well, according docs , prototype function gluniform3f is: void gluniform3f(glint location, g

Laravel : How to check if relation have rows inside relation? -

this: //model public function logo(){ $logo = $this->belongsto(media::class, 'image_id'); echo $logo->count(); } //template echo $product->logo; gives me output 32, there 1 row. if run outside relation : //model public function logo(){ return $this->belongsto(media::class, 'image_id'); } //template echo $product->logo()->count(); output 1. how check how many rows have relation inside relation ? try product::with('logo')->first(); // or product::findorfail($id) specific product , based on query, try count($model->relationmethodname) , see if number looking for.

ruby on rails - Should i make a seperate app to send push notifications to 40-50k users in RoR App or use background jobs -

i have rails application in fact backend of popular ios application have user base of 200k users needs notified time time. daily 40-50k users notified using push notifications. these push notifications realtime , scheduled ones. eg: if new users signs notified within few seconds. eg: scheduled notifications run @ 10 pm daily limited users ranging 10k-30k or more upto 100k. i doing business reporting generate list of users fulfilling criteria , requires firing mysql queries take upto 1-2 minutes of time. my area of concern should have seperate application seperate mirror db send push notifications these users ios users doesnt feel lag while using application when push notifications triggered or business reporting query triggered. or should use background jobs rails active job, sidekiq or sucker punch perform push notifications , triggering business reporting queries. is background jobs in rails powerful can manage condition , doesn't let app users feel lag in e

Android: Bitmap resizing using better resampling algorithm than bilinear (like Lanczos3) -

is there way or external library can resize image using lanczos (ideally) or @ least bicubic alg. under android ? ( faster better of course, quality priority, processing time secondary) everything i've got far this: bitmap resized = bitmap.createscaledbitmap(yourbitmap, newwidth, newheight, true); however uses bilinear filter , output quality terrible. if want preserve details (like thin lines or readable texts). there many libraries java discussed example here: java - resize image without losing quality however it's depended on java awt classes java.awt.image.bufferedimage , can't used in android. is there way how change default (bilinear) filter in bitmap.createscaledbitmap() method or library morten nobel's lib able work android.graphics.bitmap class (or raw representation, @tron in comment has pointed out)? the promising imo use libswscale (from ffmpeg), offers lanczos , many other filters. access bitmap buffer native code can use jnig

javascript - Angular service and watching a variable -

i have angular service gets $http promise factory making rest call, works fine.: var userservice = function($cookies, datafactory, jsonhelper, $q) { var user_key = 'user'; var username_key = 'username'; var svcdata = { u: null, b: null, } var service = { setuser : function(user){ svcdata.u = user; $cookies.put(user_key, user.id); }, getuser : function(){ if(svcdata.u === null){ datafactory.getprincipalname().then(function(adata){ datafactory.getbduser(adata.data.username).then(function(data){ var reg = {}; jsonhelper.setupregistry(data.data, reg); jsonhelper.resolvereferences( data.data, reg, 5); console.log("request back"); svcdata.u = dat

c# - How to store value of SqlDataReader in an array? -

the course_id inside while loop have multiple values. wanted display values in gridview, last value being displayed. how can that? have store course_id in array? int course_id=0; string query_select_course = "select course_id course_program program_id = '" + program_id + "' "; sqldatareader dr_course = dataaccess.selectdatareader(query_select_course); while (dr_course.read()) { course_id = (int)dr_course.getvalue(0); // course_id should have multiple values. } dr_course.close(); string query_select_course_name = "select course_title courses course_id = '" + course_id + "' "; datatable dt = dataaccess.selectdata(query_select_course_name); course_datagridview.datasource = dt; make list<int> , add values in it. list<int> course=new list<int>(); while (dr_course.read()) { course.add((int)dr_course.getvalue(0)); }

php - How to make array construction? -

i have problem. have 2 arrays , need put 1 other this: array('1'=>1,'2'=>2,'3'=>array()); can advise how solve it? if first array $first = array('1'=>1,'2'=>2) and second is $second = array() then add in $first[] = $second if second is $second[3] = array(); then want array_merge $first = array_merge($first,$second) there sorts of array functions on left in link, come in handy.

node.js - npm ERR! when trying to install gulp-jshint -

when try install npm package receive error: macbook-pro-van-jamie:gulp egen$ npm install gulp-jshint –save-dev npm err! addlocal not install /users/egen/code/gulp/–save-dev npm err! darwin 15.5.0 npm err! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "gulp-jshint" "–save-dev" npm err! node v5.9.0 npm err! npm v3.7.3 npm err! header content contains invalid characters npm err! npm err! if need help, may report error at: npm err! <https://github.com/npm/npm/issues> i've set right permissions @ /usr/local/lib/node_modules this: sudo chown -r egen /usr/local/ what problem? the error result of incorrect command. typed: npm install gulp-jshint -save-dev this causes npm try install packages gulp , -save-dev . the correct command should be: npm install gulp-jshint --save-dev

ios - How to integrate my app delegate and View controller code in KONY app? -

i'm developing watch application using xcode. , actual ios app implemented using kony. , i'm trying add watch app ios app. but problem ios app developed in kony. , have written code in xcode in appdelegate.m , viewcontroller.m(rootviewcontroller) of ios bundle communicate watch , pass data.so working fine.for created new application , did phone watch communication , watch app implementation. now difficult part have integrate or copy code whatever have written in sample app using xcode kony application. means have add appdelegate.m , viewcontroller.m code in kony code developed kony ide. so how integrate whatever have done in xcode build kony build ? problem statement how integrate app delegate , view controller code in kony app? answer we understand integrating appdelegate methods in kony app. using kony can implement adddelegate methods using following steps. kindly replace attached appdelegateextension folder vmappwithkonylib.xcodeproj add

DB2 Fluent NHibernate mapping duplicate records in HasMany mapping -

i accessing pre-existing database (actually db2 on ibm i), , have issue mappings following (simple) structure in fluent nhibernate. have had construct artificial example, forgive ommissions. job ... public class job { public virtual string jobcode { get; set; } public virtual string owner{ get; set; } public virtual ilist<deliverable> deliverables { get; set; } public job() { deliverables = new list<deliverable>(); } } deliverable .. public class deliverable { public virtual string jobcode { get; set; } public virtual int package { get; set; } public virtual string owner { get; set; } public virtual string reference { get; set; } public virtual job job { get; set; } } i trying map 'hasmany' relationship between job , deliverable, follows .. public class jobmap : classmap<job> { public jobmap() { table("job"); id(x => x.jobcode).column("code&quo

java - when to stop reading telnet input? -

presently have 4 classes basic mud client : weatherdriver main class, , linereader put handle inputstream , lineparser parse queue of string 's, while connection holds apache telnet connection . based off apache weather telnet example . how linereader know when stop reading inputstream send message weatherdriver start parsing? linereader: package teln; import static java.lang.system.out; import java.io.bufferedreader; import java.io.ioexception; import java.io.inputstream; import java.io.inputstreamreader; import java.util.linkedlist; import java.util.queue; public class linereader { private string prompt = "/[#]/"; public linereader() { } public queue<string> readinputstream(inputstream inputstream) throws ioexception { inputstreamreader inputstreamreader = new inputstreamreader(inputstream); stringbuilder sb = new stringbuilder(); bufferedreader br = new bufferedreader(inputstreamreader); str

javascript - looping through JSON object with multiple childrens using java script -

i trying loop through json object [ { "yang_type": "container", "name": "c1", "value": "", "children": [ { "yang_type": "", "name": "type", "value": "uint32", "children": [] }, { "yang_type": "list", "name": "dns", "value": "", "children": [ { "name": "type", "value": "string", "children": [], "yang_type": "" }, { "yang_type": "leaf", "name": "ip-address",

android app to connect raspberry pi via bluetooth -

i trying connect raspberry pi 3 bluetooth smartphone using android control sensor. new android development but, not able connect bluetooth. have fragment bluetooth connection shown below. when open app , turn on bluetooth able see list of available device , when try connect not connecting. , not getting errors. please me. thanks private class connectthread extends thread { private final bluetoothsocket mmsocket; private final bluetoothdevice mmdevice; public connectthread(bluetoothdevice device) { // use temporary object later assigned mmsocket, // because mmsocket final bluetoothsocket tmp = null; mmdevice = device; log.i(tag, "construct"); // bluetoothsocket connect given bluetoothdevice try { // my_uuid app's uuid string, used server code tmp = device.createrfcommsockettoservicerecord(my_uuid); } catch (ioe

linux - How can a runit' service restart return instantly? -

i have runit service use run rails app using unicorn . its restart command uses signal (usr2) handle zero-downtime restart. basically, waits until new process ready before old ones die. this causes long (40 seconds) restart time, in service myservice restart doesn't return until end. while can give runit longer timeout (which do), want make restart fire-and-forget kind of action it'll return instantly (or after usr2 signal fired, without waiting complete. the entire logic taken multiple blog posts zero-downtime rails deployments unicorn restarts: https://gist.github.com/czarneckid/4639793 https://gist.github.com/jeanmertz/8996796 https://nulogy.com/who-we-are/company-blog/articles/zero-downtime-deployments-with-chef-nginx-and-unicorn/ this runit script (generated chef): #!/bin/bash # # file managed chef, using <%= node.name %> cookbook. # editing file hand highly discouraged! # exec 2>&1 # # since unicorn creates new pid on restart/rel

javascript - Facebook og:image throwing errors for byte array -

i'm trying let users share things our site, i'm having trouble when try use image byte array image. it works fine when use url regular image hosted on site, when try use image stored in database gives me error. here's example metatag image when it's using byte array: this example of javascript i'm using share it: fb.ui({ method: 'send', link: ' http://myurl.com/home/pagetoshare ', picture: ' http://myurl.com/home/getimg?imageid=1 ', name: 'shared page', caption: '', description: '' }, function (response) { }); and error message get: an error occurred. please try again later. api error code: 100 api error description: invalid parameter error message: picture url not formatted the first time tried going shared page in facebook debugger gave me warning saying image small, odd because image it&#

batch update for updating multiple records in spring mvc with mysql -

i have issue suppose have 100 records initially, , shown them on ui list of users. have given provision deactivate number users clicking "deactivate" button placed against every single record, capture "deactivated" users in list , send dao layer.[the logic of deactivating user set 'isdeleted' flag true, i.e.soft delete updating multiple records ids have placed list],there simple solution that, write loop->iterate through list-> , each record fire query update isdeleted flag true, not feasible solution if have 5000 records deleted @ once. have heard , implemented batchupdate concept "inserting" multiple records @ once, dont understand how can use batch update update several records @ 1 db call, please help, batch update code insertion follows, private static final string insert_user_permission = "insert permission_transaction(permissionid,userid,isdeleted) " + "values(?,?,?)"; @transactional

android - Add EditText dynamically with (if possible) String id into a Fragment -

i add edittext dynamically fragment. also, adding string id edittext. following code called after pressing button: int number_of_edittexts; //at beginning=0 context context = getactivity(); edittext edittext = new edittext(context); edittext.setid("nofet"+number_of_edittexts); relativelayout.layoutparams params=new relativelayout.layoutparams(relativelayout.layoutparams.wrap_content, relativelayout.layoutparams.wrap_content); params.addrule(relativelayout.center_horizontal); edittext.setlayoutparams(params); relativelayout rel=(relativelayout) getview().findviewbyid(r.id.list); rel.addview(edittext); number_of_edittexts++; it adds edittext, can't write edittext.setid("nofet"+numer_of_edittexts); edittext.setid(numer_of_edittexts); is there way want? , also, how can params.addrule(relativelayout.below,r.id.dynamic_id) ? element ids pure integers, can't set strings. ids assigned elements created in xml converted inte

java - Lambdas: local variables need final, instance variables don't -

in lambda, local variables need final, instance variables don't. why so? the fundamental difference between field , local variable local variable copied when jvm creates lambda instance. on other hand, fields can changed freely, because changes them propagated outside class instance (their scope whole outside class, boris pointed out below). the easiest way of thinking anonymous classes, closures , labmdas variable scope perspective; imagine copy constructor added local variables pass closure.

ios - NSPredicate for a Core Data Search -

Image
i have 3 nsmanagedobjet s; person, stuff, , collection. i want use nspredicate list of collection s theperson has. example: scott has objecta , objectb in collection letters , object1 in collection numbers. i want able fetch request , collection letters , numbers. i tried: nspredicate *predicate = [nspredicate predicatewithformat:@"any stuffs.persons == %@", person]; and: nspredicate *predicate = [nspredicate predicatewithformat:@"subquery(stuffs, $s, $s.persons == %@)", scott]; any suggestions? your subquery syntax wrong (for full explanation, see this answer or this answer ). should like: subquery(stuffs, $s, $s.persons == %@).@count > 0

go - Golang concurrency: how to append to the same slice from different goroutines -

i have concurrent goroutines want append (pointer a) struct same slice. how write in go make concurrency-safe? this concurrency-unsafe code, using wait group: var wg sync.waitgroup myslice = make([]*mystruct) _, param := range params { wg.add(1) go func(param string) { defer wg.done() oneofmystructs := getmystruct(param) myslice = append(myslice, &oneofmystructs) }(param) } wg.wait() i guess need use go channels concurrency-safety. can contribute example? there nothing wrong guarding myslice = append(myslice, &oneofmystructs) sync.mutex. of course can have result channel buffer size len(params) goroutines send answers , once work finished collect result channel. if params has fixed size: myslice = make([]*mystruct, len(params)) i, param := range params { wg.add(1) go func(i int, param string) { defer wg.done() oneofmystructs := getmystruct(param) myslice[i] = &oneofmystructs

php - jQuery, JavaScript - Network Error? -

i working on building javascript/jquery , ajax website. however, while testing encountering following error: timestamp: 6/11/2016 10:13:45 error: networkerror: network error occurred. to me, obvious culprit ajax call made in script; however, tried commenting out , still received same error. when website first loaded displays 3 alert boxes (selection=category&detail=test, , on), error appears , changing selection not trigger alert. here main page: <?php include('header.php'); ?> <div id='maincontent'> <?php /* if(!$_session['admin']) { echo "<p>you not have permission view page!</p>"; } else { */ echo "<form method='post' action='additem.php'> <div class='form-group'> <label>category</label> <select id='categoryselection' name='categoryselection'> <option value=1>playstation</option> <option value=2>wii</option&g