Posts

Showing posts from June, 2011

c# - When accessing value-type properties of an object stored in a dynamic, does it cause boxing of those properties' values? -

consider following code... public class valueholder<t> { public t heldvalue{ get; set; } } when assigning x here, there of course no boxing. var intvalueholder = new valueholder<int>(){ heldvalue = 44 }; int x = intvalueholder.heldvalue; but in case valueholder stored in dynamic? there boxing when assigning heldvalue y? dynamic dynamicvalueholder = new valueholder<int>(){ heldvalue = 44 }; int y = dynamicvalueholder.heldvalue; i'm not sure mechanism dynamic member resolution i'm not sure how check this. note i not storing value-type in dynamic, examples this... dynamic x = 44; // 44 boxed ...is not i'm asking. in example i'm storing object in dynamic no boxing needed there, when access value-type property on object, that value-type property boxed? clears i'm after here. i quote this msdn document: " type dynamic behaves type object in circumstances. however, operations contain expressions of type dyna

c# - EventTrigger listening to Loaded is triggered twice? -

firstly not sure if triggered twice. loaded event if tested in code behind triggered once (even tried using addhandler accepting third argument handledeventstoo ). looks that. have storyboard setup in xaml , should run once when loaded raised. seems start 2 times, second time right after window shown. i know because have attached property used on doubleanimation inside storyboard. attached property has 1 propertychangedcallback handler. handler triggered twice same value of e.newvalue (from argument). should not triggered twice that. can determine target (which animated) , set attached flag mark has been done on prevent problem of twice triggering, prevent other actual triggers (which not loaded ). doubleanimation created newly each trigger (so cannot mark flag on because each time propertychangedcallback triggered time of doubleanimation , no way flag , prevent execution). here code, simple test: public class testowner { public static readonly dependencyproperty tes

database - Is there an SQL query that will count the number of occurrences of an event WITHOUT grouping the data by the event being counted? -

note i'm doing in ms access, solution using basic sql operators appreciated. suppose have table each row represents coin flip in series of coin flips. disclaimer: i'm using coin flips analogy don't have explain actual data set. select * coinflips; id flip time ------------------- 1 heads 1 2 tails 2 3 heads 3 4 heads 4 5 heads 5 6 tails 6 how write query returns of rows above additional column counts number of 'head' flips occurred row's occurrence. in other words, want result like: desired output id flip time numheads -------------------------------- 1 heads 1 1 2 tails 2 1 3 heads 3 2 4 heads 4 3 5 heads 5 4 6 tails 6 4 to in ms access, need correlated subquery or join/aggregation. other databases have direct support functionality, not ms access. select cf.*, (sel

ruby on rails - How to merge two instance of a Model like hashes -

i can merge 2 hashes this: array = [{a: 1, b: 2, c: 3}, {a:3, b:1, d:5}] array[0].merge(array[1]) |k, v1, v2| [v1, v2].compact.max end and want merge 2 activerecord::base instances , create new one. activerecord::base class doesn't have merge method. how can merge 2 instances of rails model , create new instance? activerecord::base#attributes returns hash. these hashes can merge values of rails model instances.

c# - Adding XML nodes into an existing XML config file -

i have xml file contains node (in middle of xml file): <stationssection> <stations /> </stationssection> i need append becomes this: <stationssection> <stations> <add comment="i'm here!" destinationfolderpath="c:\" ftphostname="ftp://upload.domain.com/" ftpfolderpath="myfolder/" ftpusername="555" ftppassword="secret!!!" ftptimeoutinseconds="20" /> <add comment="i'm here!" destinationfolderpath="c:\" ftphostname="ftp://upload.domain.com/" ftpfolderpath="myfolder/" ftpusername="555" ftppassword="secret!!!" ftptimeoutinseconds="20" /> </stations> </stationssection> that data ("comment", "destinationfolderpath", etc.) stored in generic list of custom object - called "updatedstations". when try add them this: foreach (var

jquery - Javascript - bring up infobox on click image -

i have images, need have clickevent on them bringing infobox on each image. $('.show-infobox').on('click', function() { // hide infoboxes prevent multiple showing @ once $('.infobox').addclass('hidden'); // show infobox background $('.infobox-container').removeclass('hidden'); // show infobox matching last part of id $('#' + this.id.replace('show')).removeclass('hidden'); }); $('.hide-infobox').on('click', function() { // manually hide infoboxes , background $('.infobox-container').addclass('hidden'); $('.infobox').addclass('hidden'); }).children().on('click', function() { return false; }); @charset "utf-8"; .container { height: 800px; width: 1000px; margin: 0; } body { padding:0px; width:100%; } header { top: 11px; width: 100%; padding-b

ios - ViewController does not have a member named managedObjectContext -

i trying use coredata in popoverpresentationviewcontroller keeps saying view controller called popovervc not have member named managedobjectcontext. i have tried: 1. initializing inside init popoverviewcontroller: required init(coder adecoder: nscoder) { super.init(coder: adecoder) self.appdelegate = (uiapplication.sharedapplication().delegate) as! appdelegate self.managedobjectcontext = appdelegate.managedobjectcontext! } 2. passing view controller got calling app delegate override func prepareforsegue(segue: uistoryboardsegue, sender: anyobject!) { switch(segue.identifier!) { case "popoversegue": let controller = segue.destinationviewcontroller as! popovervc controller.managedobjectcontext = self.managedobjectcontext! break default: break } } normally can access in other view controller using: ((uiapplication.sharedapplication().delegate) as! appdelegate).managedobjec

reactjs - Testing Webpack built React components with Jest -

i have come across problem need run jest tests on react application being built webpack. problem handling require of css files , images etc webpack process loader. need know best approach test components correctly. the react component: import react 'react'; // css file problem want test // returns after webpack has built it. import style './boilerplate.css'; var boilerplate = react.createclass({ render: function() { return ( <div> <h1 classname={style.title}>react-boilerplate</h1> <p classname={style.description}> react , webpack boilerplate. </p> </div> ); } }); export default boilerplate; the jest test: jest.dontmock('./boilerplate.js'); var boilerplate = require('./boilerplate.js'); var react = require('react/addons'); var testutils = react.addons.testutils; describe('boile

C# Convert dynamic object to interface -

namespace mynamespace { public interface imyinterface { string getmethod(); } public class myclass : imyinterface { public string getmethod() {} } } //main program var ruleclass = activator.createinstance(assembly.getexecutingassembly().fullname, "mynamespace.myclass"); if( ruleclass != null) { imyinterface myclass = (imyinterface)ruleclass; //throws exception. } how can convert ruleclass imyinterface type can call specific methods in it? use unwrap method. imyinterface myclass = (imyinterface)ruleclass.unwrap(); you can create directly too var myclass = activator.createinstance(typeof(myclass)) myclass;

hadoop - Distinct in hive -

i want use distinct in hive query.so query looks like insert overwrite table tablename select distinct a.id id , a.id sid left join b on a.id = b.id; so in above query want insert same value 2 different column.with distinct query doesn't work ,otherwise works.

sql - POSTGIS ST_Intersects returns contained polygons but not enclosing polygons -

i have postgresql table called parks in database postgis extensions has column named perimeter data type geography. if issue query clause like: where st_intersects( parks.perimeter, st_geogfromtext('polygon((-122.31755953233409 47.61300937889849, ...))') ) i see results parks partially overlap query polygon , parks entirely contained within query polygon bit not see park contains query polygon. the documentation st_intersects says: st_intersects — returns true if geometries/geography "spatially intersect in 2d" - (share portion of space) by definition should see result if parks.perimeter encloses query polygon. i solve second st_contains slow down time critical query , should unnecessary. does have explanation why seeing behavior , can fix without second clause? thanks.

how can i read and rewrite a matrix from another file in python? -

i try read matrix file can specific values , rewrite them. have file matrix of 10 10 , print it. how can specific numbers matrix? this code open matrix: f = open ( 'matrix.txt' , 'r') l = [] l = [ line.split() line in f] print(l) this output: [['0,', '0,', '0,', '0,', '0,', '0,', '0,', '0,', '0,', '0,'], ['0,', '0,', '0,', '0,', '0,', '0,', '0,', '0,', '0,', '0,'], ['0,', '0,', '0,', '0,', '3,', '3,', '0,', '0,', '0,', '0,'], ['0,', '0,', '0,', '0,', '3,', '3,', '0,', '0,', '0,', '0,'], ['0,', '0,', '3,', '3,', '2,', '2,', '3,', '3,', '0,', '0,'], ['0,', 

javascript - How to expose custom functions to angularjs expressions -

i have function, inarray like/need expose angularjs epressions: the function function inarray( needle, haystack, assockey ){ assockey = assockey || false; for(var i=0;i<haystack.length;++i){ if( assockey ){ if( haystack[i][assockey] == needle ){ return true; } } else if( haystack[i] == needle ){ return true; } } return false; } the html in question <div ng-show="inarray(currentuser.id, item.comments, 'commenter_id')"> have commented on already. </div> where simplified item example be: item = { post: 'sfdcsdvsdv', images: ['1.png','2.png'], date: 'some date', comments:[{ commenter_id: 321654987, comment: 'sdfvsdvsdfv', date: 'some other date' },{ commenter_id: 65498721, comment: 'ptyopoinmu', date: 'some other date' }] } this cod

java - how to validate SWT textbox to allow '*' character in it? -

i trying validate swt textbox accept alphanumerics, ' . ' , ' * ' characters, user able enter wildcard patterns (e.g.- *.txt ). with below code not able input ' * ' character(with * button in num pad of keyboard also). please help. text.addverifylistener(new verifylistener() { @override public void verifytext(verifyevent e) { e.doit=character.isletterordigit(e.character) ||e.keycode=='.' ||e.keycode=='*' ||e.keycode==swt.arrow_left ||e.keycode==swt.arrow_right ||e.keycode==swt.bs; } }); you testing keycode field against character - key code value not same character value. use: || e.character == '.' || e.character == '*' or if want allow keypad . * use: || e.keycode == swt.keypad_decimal || e.keycode == swt.keypad_multiply

Calling an assembly function from C -

one of generated functions doesn't compute should , trying debug separately. have assembler , try call stripped down c program. however, reason end getting segfaults in function (so, calling function seems work, execution fails). there might wrong passing arguments.. the functions signature is void func(int, int, float*, float*, float*); the function ignores first 2 arguments , received 3 arrays of 32 floats each. add element-wise latter 2 , store result element-wise first array. however, in kind of weird order (as opposed streaming linearly through it, reason doing not in scope of question). that's offset_arrays in assembler code. i checked x86 calling conventions (that's architecture using) , first 6 integer or pointer arguments passed in registers rdi, rsi, rdx, rcx, r8, , r9. here' function implementation: .text .globl func .align 16, 0x90 .type func,@function func: .cfi_startproc xorl %eax, %eax movabsq $offset_ar

javascript - Filtering combobox not working for common store combos -

i using extjs 2.3 . have 3 comboboxes following stores. here, combo2 , combo3 share same store. following combo stores- combo1 store: vice president manager employee student combo2 , combo3 store: assignments meetings salary now requirement is, if 'student' selected combo1, 'salary' should filtered out combo2 , 3 (it should not display 'salary' option) i doing following code on change listener of combo1- listeners: { change: function(combo, record, index) { var combo1val = combo.value; // give selected value correctly this.filtercombo(combo1val , combo2); this.filtercombo(combo1val , combo3); } } and function body filtercombo: function (combo1val , combo) { if (combo1val == 'student') { combo.store.filterby(function (record) { return record.get('text') != 'salary'; }); } else { combo.store.clearfilter

web crawler - R: Webscraping irregular blocks of values -

so attempting webscrape webpage has irregular blocks of data organized in manner easy spot eye. let's imagine looking @ wikipedia. if scraping text articles of following link end 33 entries. if instead grab headers, end 7 (see code below). result not surprise know sections of articles have multiple paragraphs while others have 1 or no paragraph text. my question though is, how associate headers texts. if there same number of paragraphs per header or multiple, trivial. library(rvest) wiki <- html("https://en.wikipedia.org/wiki/web_scraping") wikitext <- wiki %>% html_nodes('p+ ul li , p') %>% html_text(trim=true) wikiheading <- wiki %>% html_nodes('.mw-headline') %>% html_text(trim=true) this give list called content elements named according headings , contain corresponding text. library(rvest) # assumes version 0.2.0.9 installed not on cran wiki <- html("https://en.wikipedia.org/wiki/web_scraping

ios - Cloud Kit's performQuery in Swift 2.0 -

hi. i'm trying make cloud kit based app. data fetch i'm using this privatedatabase.performquery(query, inzonewithid: nil) { results, error in if error != nil { print(error) } else { print(results) item in results { self.workoutdata.append(item as! ckrecord) } } } but xcode says '[ckrecord]?' not have member named 'generator' can me please? you need unwrap ckrecord array so: if let res = results { item in res! { //do things item } }

vb.net - How to add image to label in ASP.net (VB) -

i want show arrow , down arrow in aspx web page's label according condition if successrate > x result = "uparrow" elseif successrate < x result = "down" else : result = "samearrow" end if and got idea implement in windows form using method dont know how implement in webpage please let me know there way show , down arrow or me change codes in web page private sub uparrow() img = image.fromfile("c:\uparrow.jpg") label1.image = img end sub add html "img" element asp.net label's text property shown below. works. string imagepath = "http://localhost:51746/website1/tulips.jpg"; label1.text = string.format("<img src='{0}' style='height:100px;width:100px;'/>", imagepath);

javascript - How to create dynamically a simple json array? -

i know questions exists 100 times, can't transfer solutions code, hope can me. should pretty easy don't working. this code other variable because of reasons: my code: for (var key in array) { } the json want: [{ key: "one", y: 5 }, { key: "two", y: 2 },]; pseudo json: [{ key: key, y: array[key].data },{ key: key, y: array[key].data; },]; you can try solution: var data = []; (var key in array) { data.push({ key : key, y : array[key].data }); } console.log(data); but, pseudo json: ? demo - see console (chrome) output

java - Cannot launch any activity except the launcher activity -

first question on stackexchange hope can forgive me mistakes. i developing app csipsimple project fork. whenever try launch activity intent or activity launcher app, app crashes. here stack trace when try launch activities (it same activity except splashactivity launcher activity , runs fine.): edit error (accidentally removed manifest entry problem persists.) 07-21 15:33:18.584: e/androidruntime(5827): fatal exception: main 07-21 15:33:18.584: e/androidruntime(5827): process: com.myapp.client, pid: 5827 07-21 15:33:18.584: e/androidruntime(5827): java.lang.runtimeexception: unable start activity componentinfo{com.myapp.client/com.myapp.client.loginactivity}: java.lang.nullpointerexception 07-21 15:33:18.584: e/androidruntime(5827): @ android.app.activitythread.performlaunchactivity(activitythread.java:2184) 07-21 15:33:18.584: e/androidruntime(5827): @ android.app.activitythread.handlelaunchactivity(activitythread.java:2233) 07-21 15:33:18.584: e/androidruntime(582

c# - setting the selected row programmatically for a DataGridRow (not by using the index!) -

i have form datagridview on it, gets populated in form's constructor datasource using data adapter ( adsdataadapter ). shows people's first name , surname , reference number (which primary key of underlying table in database). rows in datagridview ordered surname field (by using order by clause in select statement gets passed data adapter). after datagridview populated, want able type surname in textbox , , have datagridview navigate first row first letters of surname matches user types. how go doing navigation? the "navigate" solution private void textbox1_textchanged(object sender, eventargs e) { (int i=0;i<thedatagridview.rowcount;i++) { if (thedatagridview.rows[i].cells["surname"].value.tostring().startswith(textbox1.text)) { thedatagridview.currentcell = thedatagridview.rows[i].cells["surname"]; // optionally thedatagridview.firstdisplayedscrollingrowindex = thedatagridview.curre

sql - Adding time and date -

i have 2 columns in mssql 2008 r2: workingdate , startime . due mistake in design of application starttime not defined date+time, time (e.g. 1899-12-30 16:00:00.000 4:00 pm) now, facing problem cannot add date , time. why select convert(datetime,'2015-07-01 00:00:00.000') + convert(datetime,'1899-12-30 16:00:00.000') 2015-06-29 16:00:00.000 , not 2015-07-01 16:00:00.000 thanks help sorry: found solution: date comes vba , first day 1899-12-30 , not 1900-01-01 in sql !!! therefore have add +2 !! try this: select dateadd(second, datepart(hour,'1899-12-30 16:00:00.000') * 3600 + datepart(minute,'1899-12-30 16:00:00.000') * 60 + datepart(second,'1899-12-30 16:00:00.000'), '2015-07-01 00:00:00.000') the idea use dateadd function add needed time in seconds base date ( 2015-07-01 00:00:00.000 ). in order convert record time seconds using datepart

ios - Is it possible to exclude the object with the latest date? -

i have core data model entity has attribute "creation date" what i'd create fetch request has objects not latest. content of core data store changes while user looks @ data (i.e. uitableview) can not set "latest object" , use nspredicate. so there way create format exclude data set latest date? yes, can build nsfetchrequest following settings: sort date, descending order set offset 1 execute fetch , skip first record. you can load nsfetchedresultscontroller if appropriate.

javascript - HighCharts change the title dynamically -

this highcharts javascript code $(function () { var chart = $('#container').highcharts({ chart: { type: 'line' }, title: { text: 'monthly average temperature', x: -20 //center }, .... .... // here need change title based on if condition, dont how if(boolean value){ chart.title.text :'some positive title'; }else{ chart.title.text :'some negative title'; } // writing above way shows me error }); i sending boolean variable android code. , based on boolean value must change title please me out. use settitle if(boolean value){ chart.settitle('some positive title'); }else{ chart.settitle('some negative title'); } update : since want update title on load itself, simple solution use variable chart title. http://jsfiddle.net/g7rjcrv9/ $(function () { var someflag = true; var charttitle = '

c++ - How do you scale the title bar on a DPI aware win application? -

Image
i making app dpi-aware per monitor setting <dpiaware>true/pm</dpiaware> in manifest file. can verify process explorer indeed working or calling getprocessdpiawareness. this working fine , can scale in client area fine in code. however, problem if drag app system-dpi monitor non-system dpi monitor, title bar , system menu either become big or small. isn't case built-in apps (e.g. calc, edge browser, etc..) there must away scale properly. how devs @ ms did this? the screenshot below should explain problem better. notice, padding between close, min, , max button different when it's scaled (96dpi). sample app i'm attaching simple app per-monitor dpi aware. does how devs @ ms did this? this has pretty disappointing answer. using alin constantin 's wincheat , inspecting top-level window of calculator, see window size of 320x576, , client size 320x576. in other words, microsoft entirely avoids problem suppressing non-client area of wi

geolocation - ElasticSearch, filter locations where either longitude or latitude should be larger than 0 -

what try achieve aggregation of geo_bounds. however, in test database got strange values location might negative (this isn't per strange) doesn't make sense in case. for queries, might result in bounding box covers country not expecting. i filter geo_bounds aggregation either longitude or latitude must larger 0. i know there filter aggregations, specified on https://www.elastic.co/guide/en/elasticsearch/reference/1.6/search-aggregations-bucket-filter-aggregation.html not sure how range check longitude or latitude. in our index model got structure have location object contains lon , lat. as negative values valid location, they're treated valid es. so, 2 options here: validate data during indexing (way better imo, seems late in case) or filtering out points negative location values in query. the problem on-the-fly filtering es can filter geo-points 4 filters only. , filters not cheap in terms of performance. can use geo_bounding_box need, this: ind

crm - LINQ Query To Return Duplicates Exclusively -

i'm working on linq query. i'd resulting list return list of records contain duplicates exclusively, based on emailaddress1 field , grouped emailaddress1 field. for instance: emailaddress1@gmail.com emailaddress1@gmail.com emailaddress2@gmail.com emailaddress2@gmail.com emailaddress2@gmail.com emailaddress3@gmail.com emailaddress3@gmail.com etc. any advice on this? thanks. var contacts = (from c in xrm.contactset c.statecode != 1 orderby c.emailaddress1, c.createdon descending select new { c.firstname, c.lastname, c.emailaddress1, c.contactid, c.createdon }).tolist(); based on previous query: var duplicatedemails = (from c in contacts group c c.emailaddress1 g g.count() > 1

javascript - how can I call another function after completing each function? -

$('.chide').each(function(index) { settimeout(function(el) { el.animate({opacity:0}); }, index * 200, $(this)); }); i want run function after completed above function how can please help.. if app/site can use modern features use promises. promise.all(arrayofpromises).then(function(arrayofresults) { //... }); its sane way of organizing code, solid polyfills available: http://www.html5rocks.com/en/tutorials/es6/promises/

javascript - jQuery Lazy Load XT - Force Image Load On Custom Event -

i have custom event switchslideevent firing each time switchslide() method called jquery carousel plugin no documentation. i using lazy load xt ( https://github.com/ressio/lazy-load-xt ) lazy load images, however, plugin loads images on following events load orientationchange resize scroll . lazy load xt initialized so: $.extend($.lazyloadxt, { selector: 'img[data-original]', srcattr: 'data-original', edgey: 200, updateevent: 'load orientationchange resize scroll switchslideevent' }); i've tried following solutions, haven't had success: pass switchslideevent lazy load xt updateevent option (seen above) manually re-initialize lazy load xt .on('switchslideevent') so: i'm getting console.log events, carousel images "slid" view not loading until scroll page. $(document).ready(function(){ $(document).on('switchslideevent', function(){ console.log("custom event fired"); $

C++ comment style: /*M ... M*/, what 'M' stands for? -

i have seen 3rd party source code comments in /*m ... m*/ style. 'm' stands for? (perhaps used kind of version control, or code documentation system (like doxygen)?) i saw in many (if not all) source code files in opencv. you may browse itseez's opencv repository under github clicking here . oh. forget mention, comment style seems exist in head of file, , seems declare license. example : /*m/////////////////////////////////////////////////////////////////////////////////////// // // important: read before downloading, copying, installing or using. // // downloading, copying, installing or using software agree license. // if not agree license, not download, install, // copy or use software. // // // license agreement // open source computer vision library [...] // //m*/ note: doesn't correlate version control , c++ this problem of cross-os eol-problem (win|*nix) , visualization of not-native

html - How to set footer to bottom of page -

this question has answer here: make div stay @ bottom of page's content time when there scrollbars 10 answers footer @ bottom of page i created responsive webpage in bootstrap3, need set footer on bottom of page, position fixed has problem in desktop use #footer { position: fixed; bottom: 0; width: 100%; } and possible duplicate of make div stay @ bottom of page's content time when there scrollbars

sql server - conversion failed when converting date /time from character string -

Image
select [proc_id] ,[contact_date_new] ,[cpt_code_new] ,[chargeable_yn_new] ,cat.cdm_category ,dateupdated [dbo].cdm_audit_eap_ot] @coldate between @start_date , @end_date after add new parameter @coldate , start getting above error. @coldate has "contact_date_new" or "dateupdated". users choose either 1 depend on looking for. if specify column directly, report work fine. contact_date_new between @start_date , @end_date dateupdated between @start_date , @end_date the @coldate in query not treated column name, instead string type variable. when try compare values @startdate , @enddate fails. hence error. can create stored procedure follows suit need :- create procedure [ssrsreport] @start_date date, @end_date date, @coldate nvarchar(25) begin set nocount on declare @sql1 nvarchar(max) if @coldate = 'contact_date_new' begin set @sql1 = 'select [proc_id] ,[contact_date_new] ,[cpt_code_

Java JNA UnsatisfiedLinkError -

i following tutorial : http://stuf.ro/calling-c-code-from-java-using-jna . difference class called main.c not ctest.c. i've created library inside project folder says there. on next step created java file line modified : ctest ctest = (ctest) native.loadlibrary("ctest", ctest.class); to ctest ctest = (ctest) native.loadlibrary("main", ctest.class); i have imported jna-4.1.0.jar project. on run gives me error : exception in thread "main" java.lang.unsatisfiedlinkerror: unable load library 'main': native library (win32-x86-64/main.dll) not found in resource path ([file:/d:/eclipse/workspace/rxtx/bin/, file:/d:/eclipse/workspace/rxtx/lib/rxtxcomm.jar, file:/c:/users/angelo/downloads/jna-4.1.0.jar]) @ com.sun.jna.nativelibrary.loadlibrary(nativelibrary.java:271) @ com.sun.jna.nativelibrary.getinstance(nativelibrary.java:398) @ com.sun.jna.library$handler.<init>(library.java:147) @ com.sun.jna.native.loadlibrary(

python - pass multiple argument to sys.stdout.write -

is possible pass multiple argument sys.stdout.write ? examples saw uses 1 parameter. the following statements incorrect. sys.stdout.write("\r%d of %d" % read num_lines) syntax error: sys.stdout.write sys.stdout.write("\r%d of %d" % read, num_lines) not enough arguments format string sys.stdout.write("\r%d of %d" % read, %num_lines) syntax error: sys.stdout.write sys.stdout.write("\r%d of %d" % read, num_lines) not enough arguments format string what should do? you need put variables in tuple : >>> read=1 >>> num_lines=5 >>> sys.stdout.write("\r%d of %d" % (read,num_lines)) 1 of 5>>> or use str.format() method: >>> sys.stdout.write("\r{} of {}".format(read,num_lines)) 1 of 5 if arguments within iterable can use unpacking operation pass them string's format() attribute. in [18]: vars = [1, 2, 3] in [19]: sys.stdout.write("{}-{}-{}".form

how to access array in jquery -

the array : [[object { button={...}}, object { input={...}}, object { checkbox={...}}, object { textarea={...}}], [object { textarea={...}}] ] in curly brackets have set properties color,value,type etc. want each object of array , check through properties type of object , call function perform further things. in php use : foreach($a $b){ // , here .. }; kindly me through , hope can understand trying say. // var counter page numbers function pagination(i) { alert(i); i--; //page array var result = page; //console.log(result[i]); var $currentelem; $(result[i]).each(function() { currentelem = $(this); console.log(currentelem); }); } .each used when you're looping on elements of jquery collection. loop on contents of array or object. use $.each() : $.each(result[i], function(n, currentelem) { console.log(currentelem); }); and shouldn't use $(this) unless this dom element. if it&#