Posts

Showing posts from August, 2011

c# - SendInput not working after attaching thread input to a target process -

i'm making application needs work ui of program doesn't seem implement ui automation elements (inspect.exe shows main pane , no children). so researched best ways implement features need were, , found sendinput(), apparently newer version of keybd_event() , mouse_event(). however, since requires keyboard focus , since can't afford set target window foreground (to avoid bothering user while runs), kept searching until found this answer . did skurmedel said, , joined application's thread target's window thread. now, if setfocus() target , sendinput(), target window won't affected. my question either "why doesn't work?" or "what doing wrong?", guess code example sorting out: threadhandler class class threadhandler { #region p/invoking , constants definition const uint wm_gettext = 0x000d; [dllimport("user32.dll")] static extern intptr setfocus(intptr hwnd); [dllimport("user32.dll")]...

html - Clicking on label doesn't check radio button -

i'm trying make color picker setting html this: <ol class="kleurenkiezer list-reset clearfix"> <li> <input type="radio" id="kleur_wit" name="kleurenkiezer" value="wit"> <label for="kleur_wit" style="background: white;"></label> </li> <li> <input type="radio" id="kleur_creme" name="kleurenkiezer" value="creme"> <label for="kleur_creme" style="background: #fffceb;"></label> </li> <li> <input type="radio" id="kleur_lichtbruin" name="kleurenkiezer" value="lichtbruin"> <label for="kleur_lic...

php - Can't send mail from localhost/xampp -

failed connect mailserver @ "mail.google.com" port 587, verify "smtp" , "smtp_port" setting in php.ini or use ini_set() i configured xampp php.ini , sendmail.ini file use gmail account sending email php script. using xampp. after changing [mail function] part of php.ini looks (i have deleted commented outlines simplicity) [mail function] smtp = mail.google.com smtp_port = 587 mail.add_x_header = off and sendmail.ini file looks this [sendmail] smtp_server=mail.google.com smtp_port=587 smtp_ssl=auto error_logfile=error.log auth_username=babar+gmail.com auth_password=********** so have missed? why getting error? you using wrong smtp settings gmail. correct ones are: in php.ini [mail function] ;smtp = localhost ;sendmail_from = me@example.com sendmail_path = "c:\sendmail\sendmail.exe -t -i" in sendmail.ini [sendmail] smtp_server=smtp.gmail.com smtp_port=587 smtp_ssl=tls auth_username=me@example.com auth_password=******...

Change Page does not work in jquery mobile ios and phonegap -

i explaining situation below facing app working on. the app consists of login module stores data application local storage. when initiate application checks key in local storage , accordingly call changepage in application. if clear out local storage , restarts application transitions works perfect. if data there in application local storage , application launched takes me home screen defined. i have jquery listview on there. when call changepage in later scenario nothing happens i.e when land home page. in first scenario works fine when start login screen. here code logout localstorage.removeitem("userdata"); localstorage.removeitem("default_data"); $("#block-ui").show(); $.mobile.loading('show'); settimeout(function(){ $.mobile.loading('hide'); $("#block-ui").hide(); $.mobile.changepage("index.html",{allowsamep...

condition - wix selectTree dosn't update -

i'Ä…m trying instaler thats components on selectedtree dependent on property value. create own ui dialog edit componen binded property. <?xml version="1.0" encoding="utf-8"?> <wix xmlns="http://schemas.microsoft.com/wix/2006/wi"> <fragment> <ui id="wixui_producttype"> <propertyref id="productkey" /> <dialog id="productchoosedlg" width="370" height="270" title="product key"> <control id="description" type="text" x="25" y="23" width="280" height="15" transparent="yes" noprefix="yes" text="specify product" /> <control id="title" type="text" x="15" y="6" width="200" height="15" transparent="yes" noprefix="yes" text="product code" />...

postgresql - psycopg2: re-using connection object after connection closing -

i not find way re-use connection object. after executing conn.close() still have object in memory there must way re-use it. what's best way it? from connection class documentation : close() close connection (rather whenever del executed). connection unusable point forward; interfaceerror raised if operation attempted connection

debugging - KendoUI Tabstrip aria-controls -

i know if can control attribute aria-controls of tabstrip using kendoui. indeed, want change manualy select different div , don't know why it's not working : <ul class="k-tabstrip-items k-reset"> <li class="k-state-active k-item k-tab-on-top k-state-default k-first" role="tab" aria-selected="true" aria-controls="tabstrip-1"> <a class="k-link">baseball</a> </li> <li class="k-item k-state-default" role="tab" aria-controls="tabstrip-2"> <a class="k-link">golf</a> </li> </ul> to controls div s : <div class="k-content k-state-active" id="tabstrip-1" role="tabpanel" aria-expanded="true" style="display: block;"> <p>text1</p> </div> <div class="k-content" id="tabstrip-2" role="tabpanel" aria-hidden=...

c - Stack-based overflow code from Hacking: The Art of Exploitation -

this might related this , i'm not sure if it's in same boat. so i've been re-reading hacking: art of exploitation , have question of c code in book, doesn't quite make sense me: let's assume we're in ~2000 , don't have stack cookies , aslr (maybe do, hasn't been implemented or isn't widespread), or other type of protection have now-a-days. he shows piece of code exploit simple stack-based overflow: #include <stdlib.h> char shellcode[] = "..." // omitted unsigned long sp(void) { __asm__("movl %esp, %eax); } int main(int argc, char *argv[]) { int i, offset; long esp, ret, *addr_ptr; char *buffer, *ptr; offset = 0; esp = sp(); ret = esp - offset; // bunch of printfs here... buffer = malloc(600); ptr = buffer; addr_ptr = (long *) ptr; for(i = 0; < 600; i+=4) { *(addr_ptr++) = ret; } for(i = 0; < 200; i++) { buffer[i] = '\x90'; } ptr = buffer + 200; for(i = 0; < strlen(shellcode); i++) { *(ptr++)...

c++ - rectangle to circle in string with C -

i use strings present information , it's hex string. , shape of these string sequences rectangle. however, want change shape circle deleting useless hex number , replacing "0" for example: hex string "f1ffffffff" "ff2fffffff" "fff3ffffff" "ffff4fffff" "fffff5ffff" "ffffff6fff" "fffffff7ff" "ffffffff8f" "fffffffff9" "ffffffffff" the output hex string in shape of circle "000ffff000" "002fffff00" "0ff3fffff0" "0fff4ffff0" "fffff5ffff" "ffffff6fff" "0ffffff7f0" "0fffffff80" "00ffffff00" "000ffff000" i've tried use programme of generating circle follows: void main() { int radius; cout << "input circle's radius: "; cin >> radius; (int = 1; <= radius*2; i++) cout << "="; cout << endl; ...

laravel - Seeding database with path from code? -

i've been using laravel's migrations path parameter so: artisan::call('migrate', array('--path' => 'path/to/my/migrations')); is there anyway can run seed command in same way? have number of seed files want use don't want run them @ same time. any advice appreciated. thanks instead of --path can set --class namespace seeder class. artisan::call('db:seed', [ '--class' => 'namespace\seeds\databaseseeder' ]); this work on laravel 5.1

continuous integration - Jenkins email plug-in -

i work on big project many other developers , using jenkins our continues integration tool. have many automated test suite run jenkins every day. question how can configure jenkins send automatic emails specific developer/s has/have checked in code caused test case failure? can using email plug-in? yes. in "manage jenkins" add smtp server , in "configure" of job, add email address in "email notification" section. can add more 1 email, separating space.

ios - Unable to locate error: MyViewController class is not key value coding-compliant for the key activity -

Image
well known error, strange case: terminating app due uncaught exception 'nsunknownkeyexception', reason: '[<phcomposerviewcontroller 0xb65c1e0> setvalue:forundefinedkey:]: class not key value coding-compliant key activity.' i understand means outlet referencing controller's property, property missing. deleted property few commits ago outlet in storyboard. exists somewhere don't know. of cause, tried "clean", re-clone repo, reboot, etc... i tried global text search "activity" (in storyboard xmls , everywhere in project dir), no result. this problem somehow related internationalization support, added. have 3 sets: base, russian, english. problem disappears when convert english "strings" "interface"... also, error raises when launch on old installation (current version appstore). current available version doesn't have i18 support. point think more related internal language. i have walk-around "st...

xml - java - JAXB Null value -

maybe simple request, haven't found way it. i have build xml output these one: <person name="mike"> <orders id="1"> <order ido="1"></order> </orders> </person> i have values query in db, in case querys returns no "orders" xml have this: <person name="mike"> </orders> <person> is these possible?, know kind of strange requirement of client. i know have case in our code often. define xml first xsd, , generate jaxb. so, orders 0..1, , list inside orders 1..n. if annotating classes, think need this: @xmlelement(name = "orders") protected list<order> orders; public list<order> getorders() { if (orders == null) { orders = new arraylist<order>(); } return this.orders; } this return list. if list empty, should <orders /> returned.

How to get latitude and longiture from captured image -- android -

i new android development. writing code retrieve lat , long image capture.i can able take image using camera event , onactivityresult. eprotected void onactivityresult(int requestcode, int resultcode, intent data) { uri _uri = null; cursor cursor = null; try { final int pick_image = 1; if (requestcode == pick_image && data != null && data.getdata() != null) { _uri = data.getdata(); if (_uri != null) { // user had pick image. cursor = getcontentresolver() .query(_uri, new string[] { android.provider.mediastore.images.imagecolumns.data }, null, null, null); cursor.movetofirst(); // link image final string imagefilepath = cursor.getstring(0); // toast.maketext(getapplicationcontext(), imagefilepath, ...

objective c - NSTask - Respond to input request from OpenSSL -

it seems i'm having trouble understanding nstask in cocoa. application want launch openssl. currently, i'm able send information (launch path, arguments etc.) , can response using nspipe. need able though respond input requests application asks for. following code, can send , read response file: nstask *task; task = [[nstask alloc] init]; [task setlaunchpath: launchpath]; [task setarguments: arguments]; [task setcurrentdirectorypath:dir]; nspipe *pipe; pipe = [nspipe pipe]; [task setstandardoutput: pipe]; nsfilehandle *file; file = [pipe filehandleforreading]; [task launch]; nsdata *data; data = [file readdatatoendoffile]; nsstring *response = [[nsstring alloc] initwithdata: data encoding: nsutf8stringencoding]; once launch nstask, i'm expected provide things domain name, country etc. reason question because need able generate certificate signing request openssl , send it, along other data, on server. code above not broken, i'm not sure how can go sending ...

python - Datastore vs Memcache for high request rate game -

i have been using datastore ndb multiplayer app. appears using lot of reads/writes , undoubtedly go on quota , cost substantial amount. i thinking of changing game data stored in memcache. understand data stored here can lost @ time, data needed for, @ most, 10 minutes , it's game, wouldn't bad. am right move solely use memcache, or there better method, , memcache 'free' short term data storage? yes, memcache free , can use free "datastorage". keep in mind can purged @ time (more purged if heavily used) , not available. check memecache availability use capabilities api .

What's wrong with this MATLAB function? -

i have function, fitness.m . function defined below: function = fitness(par) n = size(par,1) l = size(par,2) fitness_val = zeros(1,n); i=1:n j=1:l fitness_val(i) = fitness_val(i) + str2num(par(i,j)); end end = fitness_val i executing code: %par char array par = 1110001101 0110010001 1100010100 0110010111 1100111100 1100000101 fitness(par) my output should be a = 6 4 4 6 6 4 instead throws weird error this: >> fitness(par) index exceeds matrix dimensions. what wrong code? simply follows , not have worry index exceed matrix dimensions. par cell for = 1:numel(par) fitness_val(i) = sum(par{i}=='1'); end this make assumption par cell contains strings, should not far stretch or in function format function fitval = fitness(par); fitval = zeros(1,numel(par)); = 1:numel(par) fitval(i) = sum(par{i}=='1'); end end par matrix functio...

java - Accessing oracle database via SID through JDBC without host:port -

when i'm looking information on how connect oracle database via jdbc, find same solutions show how connect known host:port. have pass connect string jdbc:oracle:thin:[user/password]@[host][:port]:sid to jdbc , works. protected connection connect() { connection conn; try { class.forname(oracle.jdbc.oracledriver.class.getcanonicalname()); } catch (classnotfoundexception e) { return null; } try { conn = drivermanager.getconnection("jdbc:oracle:thin:@1.1.1.1:1536:sid", "user", "passwd"); } catch (sqlexception e) { return null; } return conn; } the problem approach though is, have find out on host:port database is. when use database tools pl/sql developer or others, don't need this. user prompted database name , the tool can somehow connect nevertheless. know how done. achieve requiring tnsping in path, , in helper class (not shown in above example ...

c++ - How to use Point cloud library sample consensus to find planes? -

i have point cloud represents surface (like mountain), i'm using point cloud library read cloud , visualize it. have several planes (not air crafts, flat geometrical surfaces) in scene, i'm trying find them using sample consensus library exists in pcl . i can't figure out how use it, should run window on cloud , check every window if it's plane or not ? i think should @ this tutorial , this 1 too . easy understand , achieve looking for.

servicestack - Service Stack XmlServiceClient null result in VS 2013 but works fine in VS 2012 -

when build project in vs 2012 following code works fine, when build in vs 2013 null objects on of calls. any ideas why? var client = new xmlserviceclient(apihost); client.localhttpwebrequestfilter += (request) => { request.headers.add("x-api-token", session["token"].tostring()); request.headers.add("x-api-key", session["key"].tostring()); request.headers.add("x-user-id", session["uid"].tostring()); }; var _order = client.get(new orderlookuprequest { id = 176352 }); var _orderitems = client.get(new orderitemlookuprequest { orderid = 176352 }); _order , _orderitems both null when built using vs2013. i using: using system; using system.collections.generic; using system.linq; using system.web; using system.web.mvc; using servicestack.serviceclient.web; it version mismatch in application.

sql - I am trying to alphabetize a combo box using a query in my vb code. How do i get it to work Im having problems? -

i want know if possible somehow use query in vb code alphabetize list in combo box have dataset connected to? here code: private sub valuesourceavailabilitybindingnavigatorsaveitem_click(sender object, e eventargs) handles valuesourceavailabilitybindingnavigatorsaveitem.click me.validate() me.valuesourceavailabilitybindingsource.endedit() me.tableadaptermanager.updateall(me.valuetrackerdataset) end sub private sub form3_load(sender object, e eventargs) handles mybase.load 'todo: line of code loads data 'valuetrackerdataset3.sa_countrycode' table. can move, or remove it, needed. me.sa_countrycodetableadapter.fill(me.valuetrackerdataset3.sa_countrycode) 'todo: line of code loads data 'valuetrackerdataset2.sa_client' table. can move, or remove it, needed. me.sa_clienttableadapter.fill(me.valuetrackerdataset2.sa_client) 'todo: line of code loads data 'valuetrackerdataset1.cubes...

javascript - Altering Feedback.js to send info & picture to an email address -

i stumbled upon cool js renders screenshot highlighted area feedback on website. website program can found here: http://experiments.hertzen.com/jsfeedback/ however, i'd send email (to address of choosing) once data collected instead of whatever doing now. i've been looking through , i'm assuming done in feedback.js file under send: function( adapter ) { however, i'm not entirely sure how change there keep screenshot , data. when initialize feedback() , can set options. in case url option important. url should point php script uses $_post[] data send feedback.js. after got data can send in email php. here example how set options: feedback({ label: 'what problem', header: 'report issue', nextlabel: 'next', reviewlabel: 'review screenshot', sendlabel: 'send email', closelabel: 'cancel', messagesuccess: 'done!', messageerror: 'oops..', url: 'path/t...

QT: Which slot to use for Window show -

i have 2 windows. upon button click of window form a, need open window form b , load data through http request in b's table widget. want know slot need implement done? connect(forma->button, signal(clicked()), formb, slot(showandinitialize())); for form b need implement own slot void showandinitialize() can call this->show() , initiate http request.

gnome - I need to remove add-apt-repository gnome3 on Ubuntu -

i have installed following repository: sudo add-apt-repository ppa:gnome3-team/gnome3 how uninstall now? thanks. use --remove flag. sudo apt-add-repository --remove ppa:repo_name/subdirectory

python - Why increment an indexed array behave as documented in numpy user documentation? -

the example the documentation assigning value indexed arrays shows example unexpected results naive programmers. >>> x = np.arange(0, 50, 10) >>> x array([ 0, 10, 20, 30, 40]) >>> x[np.array([1, 1, 3, 1])] += 1 >>> x array([ 0, 11, 20, 31, 40]) the documentation says people naively expect value of array @ x[1]+1 being incremented 3 times, instead assigned x[1] 3 times. the problem what confuse me expecting operation x += 1 behave in normal python, x = x + 1 , x resulting array([11, 11, 31, 11]) . in example: >>> x = np.arange(0, 50, 10) >>> x array([ 0, 10, 20, 30, 40]) >>> x = x[np.array([1, 1, 3, 1])] + 1 >>> x array([11, 11, 31, 11]) the question first: what happening in original example? can 1 elaborate more explanation? second: it documented behavior, i'm ok that. think should behave described because expected pythonistic point of view. so, because want convinced: there reaso...

sql - Inner join speed issue (Linked Server column) -

i have view (view a) pulls in columns number of tables. pulls in column view (view b) gets data linked server table. now, view b runs fine, pulling 11,000 rows in second. view runs fine. however, if inner join view view b on column comes linked server, entire query runs slow times out. if inner join view view b on column not come linked server, runs fine. so traced issue joining on column resides on linked server. have no idea how fix it. can give me pointers? the circumstances different, both co-workers , have seen evidence if have this: select linkedserver.database.owner.table whatever then sql server select entire table other server first, , apply clause afterwards. might happening you. we solve problem using openquery instead of qualified method shown above, , putting openquery results temp table. join temp table.

java - Difference between public interface and abstract interface? -

this question has answer here: java abstract interface 9 answers can tell me difference between specifying interface public , abstract? public interface test{} and abstract interface test{} the former interface can accessed anywhere. latter (since abstract superfluous ) interface can accessed within same package, has default access modifiers.

javascript - Make Dropdown close on selection? -

i trying dropdown menu close after makes selection within dropdown. here javascript code horizontal dropdown.. ;( function( window ) { 'use strict'; var document = window.document; function extend( a, b ) { for( var key in b ) { if( b.hasownproperty( key ) ) { a[key] = b[key]; } } return a; } function cbphorizontalslideoutmenu( el, options ) { this.el = el; this.options = extend( this.defaults, options ); this._init(); } cbphorizontalslideoutmenu.prototype = { defaults : {}, _init : function() { this.current = -1; this.touch = modernizr.touch; this.menu = this.el.queryselector( '.cbp-hsmenu' ); this.menuitems = this.el.queryselectorall( '.cbp-hsmenu > li' ); this.menubg = document.createelement( 'div' ); this.menubg.classname = 'cbp-h...

linux - Remove the last page of a pdf file using PDFtk? -

can please tell me how remove last page of pdf file, using pdftk? using cat operation, , specifying page range. pdftk infile.pdf cat 1-r2 output outfile.pdf

how to make auto completer work with Jquery UI -

i trying use autocomplete, ajax call work when use out side auto completor. following code doesnt work. how set data source properly? $("#searchbox").autocomplete({ source: [{ var search_val = $("#searchbox").val(); $.ajax( { type : "post", url : "./wp-admin/admin-ajax.php", data : { action : 'wpay_search', user_name : search_val }, success : function(data) { //$('#search_result').html(data); return data; } }); }] }); i think easier way pass in callback function source, more flexible , suited trying accomplish. according jquery ui documentation: the callback gets 2 arguments: a request object, single term property, refers value in text input. example, if user enters "new yo" in city field, autocomplete term equal "new yo". a response callback, expects single argument: data suggest use...

windows - Why does qwindows.dll from Qt5.0.2 cause my application to crash -

we deploying qt5.0.2 application built vs2010 includes platforms/qwindows.dll file in bin directory. upgraded qt5.0.1 qt5.0.2 , discovered on non-development machines our application crashing after loading. narrowed problem down qwindows.dll file. when use qwindows.dll version qt5.0.2 (file size 803kb) application crashes. when leave other included dlls same replace qwindows.dll 5.0.1 version (799kb), works. known bug? there else need include 5.0.2 version of dll work? answering own question... we had batch script automatically copied relevant prebuilt qt dlls our application's installation directory subdirectories of latest downloaded qt package's vs2010 directory. appears in qt5.0.1, qt dlls appeared in both lib , bin subdirectories of msvc2010 , whereas in qt5.0.2, qt dlls appear in bin subdirectory. since automatically copying dlls lib subdirectory, when migrated 5.0.2 nothing copied , old 5.0.1 dlls remained in our application's installatio...

connection - ssh connects but scp doesn't work -

i using ssh / scp local machine because work on server remotely. working university, connect home via ssh server check , never had problem. today tried home copy file local machine , realized can't. ssh works fine, connected server scp not work. i don't understand problem might be. if ssh port closed, wouldn't able connect via ssh. scp works fine university. thanks in advance!

c# - How to make a installation file in visual studio -

Image
i have executable file made in visual studio (c#/winforms), , make installation file which, when run, places executable file in specific directory, example c:/program files , creates shortcut on desktop - application install in windows. i don't know how approach this. couldn't find guides online either. add visual studio installer setup project solution, , configure want. reference other project, , tell put executable.

web services - Play Java 2.1.1 "TimeoutException: No response received after... " -

i have code in controller: public static result index() { return async(ws.url(my_webservice_url).get().map( new function<ws.response, result>() { public result apply(ws.response response) { return ok(index.render(form(response.getbody())); } } ); } basically, it's copy example on play site i'm receiving message [timeoutexception: no response received after 2147483647] after around 1 minute , , if have set ws.url(my_webservice_url).settimeout(integer.max_value) or add ws.timeout=99999999999 in application.conf. i saw similar post here, without answer. thank in advance! problem * magically * resolved after creating new project , pasting code.

oracle - simple query to generate the o/p with sql -

table contains column1 b c d e simple query display output as column1 b e c d i tried using select * table order rowid; iz der other exact way fetch desired result? this should do: select * table order case column1 when 'b' 1 when 'e' 2 when 'a' 3 when 'c' 4 when 'd' 5 end here is sqlfiddle demo. , results are: ╔═════════╗ ║ column1 ║ ╠═════════╣ ║ b ║ ║ e ║ ║ ║ ║ c ║ ║ d ║ ╚═════════╝

jquery - New Twitter API - they say no way to use ajax but will this work? -

i working on fixing older connection string twitter's api pulls number of followers display it. the site : www.democracywatch.ca can see current request syntax when "inspect element" on empty twitter square on bottom right (it should have number of followers , should display of recent feeds). the current code jquery/ajax: jquery(function($) { $.ajax({ url: 'https://api.twitter.com/1.1/users/show.json', data: {screen_name: 'democracywatchr'}, datatype: 'jsonp', success: function(data) { $('#followers div.twitter').html(data.followers_count); } }); you can see tried replace http https , added .1 before /users in url getting "unauthorized" response them. understand on should oauth requests... not sure code add have in...

asp.net mvc - true instead of True (C#) -

the goal return true instead of true controller view. the problem i'm storing variable boolean indicates if product exists or not in shopping cart/summary. to realize this, i'm doing follow: [...] isadded = sessionstore.checkexistanceonsummary(product.productid) [...] but, when show value of isadded on view, return true or false — , javascript expecting true or false . what need send true or false instead of way c# sending. what i've tried i tried change above's code fragment this: isadded = (sessionstore.checkexistanceonsummary(product.productid) ? "true" : "false") but debugger returns me following error: error 5 cannot implicitly convert type 'string' 'bool' a few lines of code the implementation of checkexistanteonsummary is: public bool checkexistanceonsummary(nullable<int> productid) { list<products> productslist = (list<products>)session[s...

where to save a custom log file in android? -

i created class write log file , works well: public class logfile { string route; context context; public logfile(context context, string date) { this.context = context; this.route= context.getfilesdir() + "/log_"+date+".txt"; } public void appendlog(string text){ file logfile = new file(ruta); if (!logfile.exists()){ try{ logfile.createnewfile(); } catch (ioexception e){ e.printstacktrace(); } } try{ bufferedwriter buf = new bufferedwriter(new filewriter(logfile, true)); buf.append(text); buf.newline(); buf.close(); } catch (ioexception e){ e.printstacktrace(); } } } but route generates /data/data/com.myaplication.myaplication/files/log_20130717.txt , cant access directory device. need access file if problem occurs device. file explorer of tablet see directories: /root/data , /root/android/data. android helps cr...

python - Creating multiple list from loops -

i want make multiple lists loops, code is: port in portlist1: print port.getname(),port.getsize() register in port.getregisters(): j=j+1 print j j=0 output is: b 10 1 c 15 1 f 30 1 i want make list every time: list1=[[b,10],1] list2=[[c,15],1] list3=[[f,30],1] can me here? lists = [] port in portlist1: l = [[port.getname(), port.getsize()]] register in port.getregisters(): j=j+1 l.append(j) lists.append(l) j=0

How to creat a nested list from an array PHP -

i have list of awards i'd group , list year. i'm able list items, have been unsuccessful in nesting them. /////array array ( [0] => array ( [award] => array ( [id] => 5 [order] => 4 [publish] => 1 [year] => 2015 [title] => test award #5 [copy] => duis aute irure dolor in reprehenderit. [slug] => test-award-5 ) ) [1] => array ( [award] => array ( [id] => 4 [order] => 3 [publish] => 1 [year] => 2014 [title] => test award #4 [copy] => duis aute irure dolor in reprehenderit. [slug] => test-award-4 ) ) [2] => array ( [award] => array ( [id] => 1 [order]...

How to generate all binary matrix by permuting subdiagonal elements in Matlab -

i interested in considering changes the sub-diagonal entries let diagonal , upper-triangular entries zero. closed formula total number of permutations given 2^( n choose 2 ). n=4 case have d_1 x(2,1) d_2 x= x(3,1) x(3,2) d_3 x(4,1) x(4,2) x(4,3) d_4 where upper triangular entries , d_i's equal zero. i know there 64 different matrices, how generate them n? first, figure out how extract/emplace subdiagonal elements. how just: sub_idx = find(~triu(ones(n))); now use vector of indices permanent mapping of binary values subdiagonal. now, need matrix of possible binary values: num_combs = 2^length(sub_idx); binary_combs = dec2bin(0:num_combs-1).' - '0'; and k'th combination matrix is: mtx = zeros(n); mtx(sub_idx) = binary_combs(:,k); (editing add single output matrix option) if want them in 1 big 3d matrix, instead: tmp = zeros(n*n, num_combs); tmp(sub_idx, :) = binary_combs; mtx =...

angularjs - Get div height from directive $watch function while div is rendering -

i new angular , trying write error_div directive user registration error_div shows listed errors if username/password not valid. here directive: angular.module(app_name).directive('errordiv', function($timeout) { return { template: '<li data-ng-repeat="error in login_errors">' + '{{error}}' + '</li>', link: function(scope,element,attrs) { scope.$watch('login_errors', function() { console.log(document.getelementbyid('error_div_login').offsetheight); }, true); } }; }); here html <div id="error_div_login" error-div></div> the problem if there 3 errors generates 3 list elements increases div height 56px, the console.log(document.getelementbyid('error_div_login').offsetheight); will return 42 height of first 2 list elements. to 56,...

python 2.7 - findAll() in BeautifulSoup missing nodes -

the method findall() in beautifulsoup not return elements in xml. if code below , open url, can see there 10 pubmedarticle nodes in xml. findall method finds 6 of them. there 6 * on output instead of 10. doing wrong? import urllib2 bs4 import beautifulsoup url = 'http://www.ncbi.nlm.nih.gov/entrez/eutils/efetch.fcgi?db=pubmed&rettype=abstract&id=23858559,23858558,23858557,23858521,23858508,23858506,23858494,23858473,23858461,23858404' data = urllib2.urlopen(url).read() soup = beautifulsoup(data) x in soup.findall('pubmedarticle'): print '*' edit: i've discovered 'findall' relative current node, can set root node soup. the entities in provided xml named "pubmedarticle", try following: for x in soup.pubmedarticleset.findall('pubmedarticle'): print '*'

protection - How to protect files(docs) form being downloaded -

i have documents on subdirectory example www.example.com/documents, inside document folder have files(e.g. file1.doc, file2.docx, , on). want users view files not download it. how can this? in order view file user need download them... maybe don't point think not option

Discrete Bar Chart colors nvd3.js -

i using nvd3.js discrete bar http://nvd3.org/ghpages/discretebar.html i inspecting code , seen color been derived inline style="fill: #ffbb78; stroke: #ffbb78;" i track on discretebarchart function color = nv.utils.getcolor() what don't realizing , asking color takes parameter ? it requires , array of colors => ['#aec7e8', '#7b94b5', '#486192'] , work. var chart = nv.models.discretebarchart() .... .... .color(['#aec7e8', '#7b94b5', '#486192']); nvd3 inherits defaults colurs set d3 here hope helps.

html - How to adjust this web page's look? -

i'm using smarty, php , html. i'm giving url of js fiddle of web page. can see there first question contained within box , othe questions , answers displayed out of box. want display them box. tried lot of tricks nothing worked me. @ last i'm asking here. can me in regard? in advance. smarty template code , fiddle link can see plain html of page follows: code smarty file: <table class="manage_box" cellpadding="5" cellspacing="1" style="border:1px solid #996633; font-size:13px;" width="100%" > <tbody> {if $all_questions} {assign var='que_seq_no' value=1} {foreach from=$all_questions item=qstn_ans key=key} <tr> <td align="center" colspan="2"> <table border="0" width="100%" cellpadding="0" cellspacing="0"> <tr class="question_info"> <td valign="top"...

c++ - Generate Doxygen Comments -

i generating large amount of code, , need make match specific coding standard. looking command line program pass file, , it'll automatically add doxygen style comments parameters , return values, etc. int dosomething(int p1, int p2, int p3) { return 42; } would become like /** @param p1 @param p2 @param p3 @return */ int dosomething(int p1, int p2, int p3) { return 42; } any suggestions? know many ides automatically if type /** , hit enter, on whole code base @ once.

MongoDB Java Driver: How to insert into any collection from Java Driver -

i have client facing application function takes in 2 arguments strings, arg1 collection, arg 2 function, arg 2 hash of object so in java have foo(string collection, string object): /*and have db object mongodb driver collection want insert "users" */ mongoclient mongoclient = new mongoclient( "localhost" ); db db = mongoclient.getdb("mydb"); now here having trouble db.runcommand({insert : collection (? can this), ????}) <- dont know how right , append object i did bunch of searching before hand , lot of examples found had predefined collection need abstract this. any extremely useful, thank you. update: i not looking coll.find() java method. want visualize someones mongodb data better output shell provides. looking general db.runcommand(string) can take in insert/find/findone() whatever passed in string. can collection names using runcommand understand on basic level, cannot apply specific commands user defined col...

jquery - Uncaught TypeError: Object [object Object] has no method 'iosSlider' -

looking experts help... our site using iosslider ( https://iosscripts.com/iosslider/ ) mobile slider... however, in chrome inspector following error uncaught typeerror: object [object object] has no method 'iosslider' i've checked, , jquery loaded once in head before calling iosslider js... is: $(document).ready(function() { /* custom settings */ $('.iosslider').iosslider({ desktopclickdrag: true, snaptochildren: true, infiniteslider: true, navslideselector: '.slidercontainer .slideselectors .item', scrollbar: true, scrollbarcontainer: '.slidercontainer .scrollbarcontainer', scrollbarmargin: '0', scrollbarborderradius: '0', keyboardcontrols: true }); }); also tried $(document).ready(function() { /* custom settings */ jquery('.iosslider').iosslider({ desktopclickdrag: true, snaptochildren: true, in...

html - request.FILES always empty on file upload -

i totally stumped on this, , must doing incredibly stupid. trying upload file on django project. problem seems no form data getting passed through server--only csrf token. running django 1.5.1, python 2.7, virtualenv, on mac, , using built-in django development server. my html form is: {% load url future %} <form enctype="multipart/form-data" method="post" action="{% url 'showreport' %}"> {% csrf_token %} <label>upload grade csv file: </label> <input type="hidden" id="testing" value="maybe" /> <input type="file" id="grade_csv" /> <input type="submit" value="generate report" /> </form> my model: from django.db import models class document(models.model): file = models.filefield(upload_to='/media/', blank=true, null=true) my forms.py: from django import forms .models import document class docume...

ios - How to unhide an animate a UITableView Section? -

in current uitableview have 3 different sections, each section has 1 cell. in between section 1 , section 2 have uisegmentedcontrol 2 different segments. so give guys idea, think of calculation app, needs know unit using, wether mg/l, or lb's, etc... i need make section #3 (& it's cell of course) appear if selected segment no.2 example. if (selectedsegment == 2) { //some code animate section & cell in & out if user changes selection in segmented control. } i trying achieve same result can seen when try edit contact in contact book in ios. pressing edit button nice animation goes on display additional sections. when done, animation nicely takes additional sections away, (in case, in case after user has chosen segment #2 , later change mind , go segment #2). thanks guys! to started, general idea how work. may need tweak code little bit app. first edit numberofsections this: - (nsinteger)numberofsectionsintableview:(uitabl...

vb.net listbox- Remove ALL items that DON'T contain specific text -

i'm working listbox in vb.net , trying remove items listbox don't contain specific text @ click of button. here's code: dim integer = 0 listboxprepublish.items.count - 1 if instr(listboxprepublish.items(i), "-8-") > 0 = false listboxprepublish.items.removeat(i) exit end if next this removes 1 item @ time though. how can tweak remove items don't contain "-8-" @ once? edit: in case asks, listbox items list growing rather large i'm adding sort feature users can widdle down options if want to. that's why i'm not filtering before adding listbox here complete code backward loop mentioned in comments - should work: for integer = listboxprepublish.items.count - 1 0 step -1 if not listboxprepublish.items(i).contains("-8-") listboxprepublish.items.removeat(i) end if next

Processing calls void setup() twice, and I need a work around -

i'm working on program reads in images (.jpg) , text source files , assembling them single pdf. know processing isn't best language in, 1 know how in. anyway, having issue processing calls setup 2 times. i've seen issue resolved when size() first line within setup, can't have happen, because have read in , store data, find width of widest image, make sure tall enough accommodate pages more 1 image, , add text before can decide on how wide , tall window is. looking suggestions how might structure code can information without having call setup twice, because that's causing pdf contain 2 copies of data. i've included setup if helps anyone. thanks! void setup(){ font = loadfont("timesnewromanpsmt-20.vlw"); file clientsfolder = new file("c:/users/[my name]/documents/processing/exerciseprogram/clients"); clients = clientsfolder.listfiles(); for(file x : clients){ println(x.getname()); } //test files see if end in .txt, ,...