Posts

Showing posts from April, 2010

ios - setting property in dispatch_async but property is NULL after block finishes -

i using following code change property called topplaces inside view controller. line [flickrfetcher topplaces] returns nsarray , property topplaces is, of course, nsarray. dispatch_queue_t downloadqueue = dispatch_queue_create("flickr topplace", null); dispatch_async(downloadqueue, ^{ nsarray *topplaces = [flickrfetcher topplaces]; dispatch_async(dispatch_get_main_queue(), ^{ self.topplaces = topplaces; }); }); dispatch_release(downloadqueue); however, after block finishes executing, if log value of self.topplaces , still null reason. there missing? your ivar not set until after current method has finished. call [flickrfetcher topplaces] running in parallel current method , takes random amount of time complete. when complete, makes call main thread, executed on next iteration of run loop this means in second dispatch_async() block need call methods display data after setting ivar.

windows - compiling BUTT with mingw64 cannot convert 'char*' to ' LPWSTR {aka wchar_t*}' in assignment -

i'm trying compile butt ( http://butt.sourceforge.net/ ) on windows mingww64. seem running errors of type error: cannot convert 'char*' 'lpcwstr {aka const wchar_t*}' most. there simple option enabling unicode missing? can see options being passed g++ @ top of paste. 0_0@0_0-pc /z/src/butt-0.1.12 $ make make -c src check ../config.mk ... ok. make[1]: entering directory `/z/src/butt-0.1.12/src' g++ -i/usr/local/include -i/usr/local/include -i/usr/local/include -i. -i/usr/ local/include -wall -o2 -dversion=\"butt-0.1.12\" `` -ifltk -i/usr/local/includ e -i/usr/local/include/fl/images -mwindows -dwin32 -duse_opengl32 -d_largefile_s ource -d_largefile64_source -d_file_offset_bits=64 -dfltk1 -dhave_fltk -ilibvorb -dhave_libvorbis -iliblame -dhave_liblame -c -o fltk/fl_native_file_cho oser.o fltk/fl_native_file_chooser.cpp in file included fltk/fl_native_file_chooser.cpp:26:0: fltk/fl_native_file_chooser_win32.cxx: in member function 'voi...

c++ - How does ifstream know where is the delimeter -

so when readfile("animal.txt") gave me zebra baboon orangutan gorilla aardvark lion tiger cougar ocelot panther rat mouse gerbil hamster elephant rhinoceros hippopotamus i know how ist >> s identify delimiter , separate long string individual words. provided txt , implementation below . animal.txt zebrababoonorangutangorillaaardvarkliontigercougarocelotpantherratmousegerbilhamsterelephantrhinoceroshippopotamus and sortedlist readfile(string infile) { sortedlist result; string s; ifstream ist(infile.c_str()); // open file // check if file opened correctly if(ist.fail()) throw runtime_error("file not found"); // read file list while(ist >> s){ cout<< s << endl; cout << ist << endl; result.insert(s); } return result; } the operator>> when applied stream on left , string on right. will read "white space...

jquery - Bootstrap Dropdown toggle triggered from javascript won't stay open consistently -

jsfiddle fiddle works intended using same exact code site! copy , pasted. my site to replicate issue have these steps exactly. go fresh load of page. scroll bottom , click "contact" in middle column. when try , select form options, dropdown closes. why happening? fiddle has exact same code, js , all. on fresh load, toggle button works intended. once "contact" link brought in, breaks. here custom script wrote scroll top , open dropdown. // scroll top , open contact form --> $("a[href='#top']").click(function() { $("html, body").animate({ scrolltop: 0 }, "slow"); return false; }); $("a[href='#top']").click(function() { $('#nav-contact.dropdown-toggle').dropdown('toggle'); return false; }); <!--// end contact form scripts --> i don't know js i'm trying learn put site personal project enrichment. explanations appreciated. ideas? the jsfiddle work...

c - segmentation fault while freeing memory integer array -

so problem within function while i'm trying free memory array q. int makegrid (float *x, float *y, float squaresize, float map, int npoints) { int score=0, i; int m = map/squaresize; int nsqr = m*m; int *q; q = null; q = (int *) malloc (sizeof(int)*nsqr); for(i=0;i<nsqr;i++) q[i] = 0; int helper1 = 0; int helper2; float helperf; for(i = 0; < npoints; i++) { helperf = x[i] - e; helper1 = floor(helperf/squaresize)*(m); helperf = y[i] - e; helper2 = floor(helperf/squaresize); helper1 += helper2; q[helper1]++; } for(i=0;i<nsqr;i++) { if(q[i] >= 1 && q[i] <= 4) score--; else if (q[i] == 0) score++; else score+=5; } free(q); q = null; return score; } the function's goal create score generated grid, map size of whole grid, while squaresize size of each square in grid, npoints size of both x , y vectors, , function called loop...

javascript - resize div on window resize -

Image
i have code <!doctype html> <html> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <link rel="stylesheet" type="text/css" href="../css/style.css" /> <style> html,body { width: 100%; margin: 0; padding: 0; } #main { margin: 0 auto; width: 963px; height: 642px; } #preload { display: block; position: absolute; width: 100%; height: 100%; } .loading { position:absolute; top: 43%; left: 47%; z-index: 2; display: none; } </style> </head> <body> <div id="main"> <img id="preload" src="preload.png"/> <img class="loading" src="../effects/loading icon/loading3.gif" /> </div> <script type="text/javascript" src="jquery-1.9.1.min.js"></script> <script type="te...

android - 1st Activity's listview not updated after 2nd activity inserts into database via ContentProvider; onLoadFinished not called -

problem: upon returning 2nd activity first activity's listview not reflect database changes made 2nd activity. if make trivial change code (to make emulator happy) , refire app listview accurately shows database changes 2nd activity made during last session. the guts of app: mainactivity: extends activity implements loadermanager.loadercallbacks<cursor> =>oncreate: simplecursoradapter set; getloadermanager().initloader(loader_id, null, this) =>onresume: super.onresume(); getloadermanager().restartloader(0, null, this) ...oh gawd! there's problem: initloader , restartloader using different loader id's. this stumped me last 5 hours. why leaving question: in trying solve problem didn't run answer (maybe it's bone-headed of thing suggest for) next person stumbles in unique way, here's potential answer. make sure loadermanager id's same in initloader , restartloader. in addition other posts alex , commonsware , rest of them run ...

java - Advanced Terrain Generation -

i need generate terrain. easy enough might say, need create biomes if will(can't think of name) , lakes, trees , on height map. so have no idea how use height map or perlin noise. if me out. need 3d , 2d help. if explain math behind it, me understand good. that such broad question impossible answer. there lots of different ways go terrain generation , lots of ways implement them well. depending on graphics hardware targeting , needs programmable shaders or old fixed function pipeline. can implemented in directx or opengl. i'm assuming looking for... http://youtu.be/lbgpupldgz0 this done so-called heightmap. took black , white image darker spots representing low elevations , lighter spots representing high. converted image single color channel (red in case, thought irrelevant choose). started making grid of triangles. walked through image , used pixels difference in 0-255 range change 'y' vertex position. the biggest problem encountered getting norma...

javascript - How do I store an Object's functions pointers in an array? -

i trying store function pointers of object's functions in array.but it's giving me problems when want access property of object within function.could 1 solve or give me idea how work around it? function o(){ this.name="hello"; this.f=function(){ alert(this.name);//why "this" refer array arr rather object? }; this.arr=[]; this.arr["x"]=this.f; } var d=new o(); d.arr["x"](); in case, this reference object function called method of (in case, array). you'll want store reference o function somewhere within scope, such as: function o(){ var self = this; this.name="hello"; this.f=function(){ alert(self.name);//why "this" refer array arr rather object? }; this.arr=[]; this.arr["x"]=this.f; } var d=new o(); d.arr["x"](); this pretty common pattern in javascript, , has...

c# - Set ComboBox Text on Basis of SelectedIndex -

i trying set text property of combobox on basis of selectedindex problem text becoming string.empty after changing index of combobox. each item in combobox correspond string in datatable having 2 columns name , description what need when users select's name (index changes) when want show description of in combobox what have tried : private void tbtag_selectionchangecommitted(object sender, eventargs e) { // data selected index tagrecord tag = tbtag.selecteditem tagrecord; // after getting data reset index tbtag.selectedindex = -1; // after resetting index, change text tbtag.text = tag.tagdata; } how have populated combobox //load tag list datatable tags = tagmanager.tags; foreach (datarow row in tags.rows) { tagrecord tag = new tagrecord((string)row["name"], (string)row["tag"]); tbtag.items.add(tag); } helper class used : private class tagrecord { public tagrecord(string tagname, string tagdata) ...

jboss7.x - Pentaho kettle engine is breaking the jboss7.1.3 logging -

we're developing project in javaee6 migrated seam2.3. , have dependency on kettle-engine. what found kettle-engine causing jboss logging break down, mean it's not logging. tried fresh project , include project in dependency , same problem occurs. any idea why? i'm using javaee6 maven archetype , here's dependency: <dependency> <groupid>pentaho-kettle</groupid> <artifactid>kettle-engine</artifactid> <version>4.2.0-ga</version> <scope>compile</scope> <exclusions> <exclusion> <groupid>xerces</groupid> <artifactid>xercesimpl</artifactid> </exclusion> </exclusions> </dependency> our findings end in conclusion technologies we're using jboss7.1.3/javaee6/pentaho kettle-engine not compatible together. fortunately started plan drop kettle-engine in favor of ejb timers. so worked me rem...

progress 4gl - I need to my query make it as multiple index how is it is possible -

for each customer no-lock cs-id = "abc" , em-id = "123" , vehicle = yes: display customer. end. index idx1 cs-id em-id country state idx2 cs-id vehicle my query took idx2 not took multiple index if take both index performance improve. question : how make query multiple index. note: condition should same this article covers multiple index selection in progress in arcticle mention following: when selection criteria includes use of and, more 1 index used when components of each index involved in equality matches , , indexes not unique. in query not specifying country , state don't believe multiple index kick in. progress not use amount of data in each determine index use. going assume using cs-id, em-id returns less rows compared idx2 using vehicle, force progress use idx1 follows for each customer no-lock customer.cs-id = "abc" , customer.em-id = "123" , customer.veh...

hyperlink - Open Iframe content links in new window -

i have task where: i have frame contains external url content. externale content has list of several links articles. task open each of these links in seperate window, when clicked. my code similar this: i want open each of links within ibnlive open in new window, instead of same window. could please or suggest me on this, or please suggest alternatives if there any http://www.emanueleferonato.com/2007/08/22/create-a-lightbox-effect-only-with-css-no-javascript-needed/ you can add target="_blank" on links want open in new window for example <a href="yourlink" target="_blank">asd</a>

iphone - Create and store HTML file in ios -

i want create html file in ios programmatically. how should create html file , store in document directory? this way create file in document directory nsarray *paths = nssearchpathfordirectoriesindomains(nsdocumentdirectory, nsuserdomainmask, yes); nsstring *documentdirectory = [paths objectatindex:0]; nsstring *filepath = [nsstring stringwithformat:@"%@/%@", documentdirectory,@"index.html"]; nsdata *data=[@"<html><body>hai</body></html>" datausingencoding:nsutf8stringencoding]; [data writetofile:filepath atomically:yes];

jquery - event can be only triggered by mouse, without any impact on Tab clicking -

i have following code. however, event triggered when both mouse entering selector , selector given focus via tab . $("selector").mouseenter(function(){ $(this).addclass("red"); }) i event can triggered mouse, without being able tab it.

java - Org.json.JSONException: Unterminated string at character 1834 -

i fetching data webservice, parsing json string. while parsing exception: "org.json.jsonexception: unterminated string @ character 1834" my code is, string jsonstring=getjsonstring(response); jsonobject json = new jsonobject(jsonstring); the string is, [{"lotdescription":"david weekley homes traditional collection in baxter village offers floor plans featuring innovative design , unsurpassed quality. charming community combines work, play , living, within village. in baxter village, you&rsquo;ll enjoy:&nbsp; parks, playgrounds"}] it parsing till word "village" , raising exception while parsing " you’ll " seems html content. what solution this? you need add character \ . [{"lotdescription":\"david weekley homes traditional collection in baxter village offers floor plans featuring innovative design , unsurpassed quality. charming community combines work, play , living, within village. i...

java ee - stop solr search after timeout -

i'm using solr , search on distributed lucene indices on network. send queries arbiter searchers (solr) , result. some of queries take lot of time (more minute) finished on searchers , slow down search other queries. how can set timeout solr if query takes more specified time, cancels search? settimeallowed function it! public solrquery settimeallowed(integer milliseconds) set maximum time allowed query. if query takes more time specified milliseconds, timeout occurs , partial (or no) results may returned. if given integer null, parameter removed request parameters: milliseconds - time in milliseconds allowed query

ios - Solve for Swipe feature (facebook) Xcode -

i have found out swipe feature , can use in app. https://github.com/yoonbongkim/swipemenudemo problem when use, need change root view controller in appdelegate.m . ybswipeviewcontroller *swiperootviewcntrlr = [[ybswipeviewcontroller alloc] initwithmainviewcontroller:mainnavigationcntrlr menuviewcontroller:menunavigationcntrlr]; self.window.rootviewcontroller = swiperootviewcntrlr; as result, original viewcontroller not working. original viewcontroller linked other controller. can still swipe. when viewcontroller need call other class, application crush. know how do. i'd suggest going exact same thing 317 stars on github https://github.com/meiwin/mwfslidenavigationviewcontroller i'm not saying class provided doesn't work it's lot easier if there's big community behind project.

Replacing contents of file in android sd card at an offset -

how replace contents of file in android sd card @ offset or same size of size of file had contents with you can use randomaccessfile randomaccessfile raf = new randomaccessfile(yourfile, "rw"); raf.seek(thestartingposition) raf.write(...)

C#/WPF intellisense order by type VS2012 -

Image
the order alphabetical: i want order type , ie: poperty first , after attached property , on... there way that? i don't believe there selection tool (choosing want show default), perhaps implement this. intellisense realise use most, , keys towards that, other there's no solution really. ofcourse if want play around, can find intellisense in tools>options>text editor> c#> intellisense. edit - comment given link, mean entirely mapping own intellisense, rather opting things show in order

Accessing file system resources using the Apache Sling Resource API -

i want access file system using sling resource api . can access jcr nodes not don't know how access file system resource . how resourceresolver resolve resource objects filesystem ? to access filesystem resources sling resources need install org.apache.sling.fsresource bundle , create @ least 1 osgi configuration activate it. see docs @ http://sling.apache.org/documentation/bundles/accessing-filesystem-resources-extensions-fsresource.html

android - How can I retrieve shared preferences onCreate? -

in preferences change preference view according unit type(imprial or metric). on create method checking last value of measurement_unit preference, return metric on app startup. have onsharedpreferencechangelistener changing view according user entry, working. how can saved preference when oncreate called? public class prefmainactivity extends preferenceactivity{ string tag="blueglucose"; @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); actionbar actionbar = getactionbar(); actionbar.setdisplayhomeasupenabled(true); actionbar.settitle(r.string.action_settings); this.init_view(); } @override public boolean onoptionsitemselected(menuitem item) { switch (item.getitemid()) { case android.r.id.home: finish(); return true; default: return super.onoptionsitemselected(item); } } sharedpr...

encoding - How to make MATLAB return char instead of ASCII? -

so, i'm using @ commands matlab return caller id, doesn't matter. everything working great except fact returns ascii numbers , have take time "translating" ascii code char can know saying. >> s = serial('com8'); >> fopen(s) >> fwrite(s, [65 84 43 67 82 67 61 49 13]) >> s serial port object : serial-com8 communication settings port: com8 baudrate: 9600 terminator: 'lf' communication state status: open recordstatus: off read/write state transferstatus: idle bytesavailable: 47 valuesreceived: 0 valuessent: 18 >> fread(s, 47) it returns me 47 ascii numbers this(note have deleted of returned code): ans = 65 84 43 67 82 67 61 49 13 i've tried following things: char(fread(s,47)) and z = fread(s,47) char(z) but neither of work...

spring - Format JodaTime LocalDate in SpringMvc JSON using formatter -

i have problem spring application. how can format localdate in json... problem when send json have send number, when spring generate json have: "data": { "weekyear": 1970, "weekofweekyear": 1, "chronology": { "zone": { "fixed": true, "id": "utc" } }, "monthofyear": 1, "yearofera": 1970, ...and lot more i have field annotation datetimeformat like: @datetimeformat(pattern="dd/mm/yyyy") private localdate data; and configurated format service in servlet-context.xml : <beans:bean id="conversionservice" class="org.springframework.format.support.formattingconversionservicefactorybean"> </beans:bean> but alone doesn't work, miss configure?

Best approach for adding IMAP Folder listeners from JavaMail API -

hi have imap client implemented javamail api. in javamail, each open folder, opens http connection imapserver (in case gmail). problem is, when add mailcountlistener each folder, folders need kept open result in multiple live connections imapserver. of time 'too many simultaneous connections' error imapserver. please clarify best approach keeping listeners imapfolders. in advanced. the listeners require connections open. if can't afford many open connections, might rid of listeners , go polling model open folder periodically, check new mail, , close when you're done.

What's the id generation strategy used in Grails unit test -

i have used default id generation strategy in app (with postgres), , have unique sequence table in db other tables, id has unique in table space. however, don't have same behavior in unit tests, because have same id in different tables, guess grails use different strategy in test? (a sequence per table?) thanks by default grails rollbacks db transactions in unit / integration tests. may explain odd behavior. you can try make unit tests non transactional explicitly stating in test class. static transactional = false

java - How to replace a value of an attribute in JS function on run time? -

i working on java application (besides other things) produces html. in html need change value of 1 attribute inside 1 js function every time run it. process this: 1. every time run html, application connect mysql database , retrieves needed values. 2. values parsed html , replacing keywords set purpose of replacing. i have done replacing text defining keyword datatext in html <p>datatext</p> and in java application, made replacing this: public void visitstringnode (text string) { ... else if (string.gettext().equals("datatext")){ string.settext(text); } } where text string retrieved database. wanted same replacing value of 1 attribute within js function setting keyword datavideo : function replacesrcc() { var elem = document.getelementsbytagname("embed")[0]; copy = elem.clonenode(); copy.src = datavideo; elem.parentnode.replacechild(copy, elem);...

java - How to customize the query string in Primefaces -

i newbee in primefaces. in application, there search form contains 5-10 field. implemented solution check variable null , variable have value. list of variable contains value included in sql query. is there feasible solution in primefaces can customize query string. customize query string means query string contains variable user fills(not blank one). this has nothing primefaces though, more java question. just check if variables empty or not, add them query string , finaly setting string querystring. eg: string s_query = "select * tbl1 "; if(!(searchfield1.equals(""))) { s_query = s_query + " searchfield1 = searchfield1"; } something should work

java - How opera mini can set the proxy -

it title said. dont how opera can set proxy using opera:config. want achieve same thing. making apps can set proxy , set url want. opera uses change proxy in android? know deprecated webview. , know is, have root , change iptables. how opera achieve it? dont know. are sure opera using standard webview?

knockout.js - setting tab index for children in knockout binding -

i have table data bound using knockout. here, have parent-child rows. e.g. <tr> <td> <select data-bind="value:required, enable:requiredactive, attr:{tabindex: 43 * ($index() + 1) }"> <option value="e">eligible</option> <option value="o">on</option> <option value="f">off</option> </select> </td> <td> <input data-bind="value:setuptime, attr: { title: tabindex: 44 * ($index() + 1) }"/> <input data-bind="value:closetime, attr: { title: tabindex: 45 * ($index() + 1) }" /> ...

PHP - MySQL "next" - "previous" link with ordering -

i have table this id | name | image | ordering ------+-------------+------------+-------------- 1 | name 1 | one.jpg | 5 ------+-------------+------------+-------------- 2 | name 2 | two.jpg | 2 ------+-------------+------------+-------------- 3 | name 3 | thr.jpg | 3 ------+-------------+------------+-------------- 4 | name 4 | for.jpg | 7 ------+-------------+------------+-------------- 5 | name 5 | fiv.jpg | 1 ------+-------------+------------+-------------- 6 | name 6 | six.jpg | 9 ------+-------------+------------+-------------- my requirement show first image in page according ordering. following query works me select * images order ordering asc limit 0,1 - row id 5 return next have show 2 links @ bottom "prev" , "next" ( since first page dont need show "prev" ) okey .. pressing on "next" have show next page ...

tfs - Connecting to Team Foundation Service with command line -

i trying connect tfs in cloud command line don't manage authenticate. i'm using "microsoft visual studio 11.0\common7\ide\tf.exe" i'm using alternate credentials described in https://tfs.visualstudio.com/en-us/home/news/2012/aug-27/ like : tf workspaces /computer:* /format:brief /collection:https://*****.visualstudio.com/defaultcollection /login:****,**** but ... tf30063: not authorized access https://*****.visualstudio.com/defaultcollection. am missing something? i have tested online tfs account able reproduce error got. steps i tried command connecting fine , got workspace info. i closed browsers vs , clear browser caches. open vs , connect through team explorer , provide wrong credentials close vs , try command got error tf30063 open vs , connected visualstudio.com tfs correct credentials , close vs tried command again , works tried command incorrect credentials still works :) conclusion i think credentials ...

python - Apply a series of functions to some arguments -

i'm after little more elegant this . what elegant way implement f such that: f(a,b,c,d,e) -> lambda args: a(b(c(d(e(*args))))) you want reduce : maybe like: reduce(lambda x, y: y(x), [a, b, c, d, e], initial_value)

iphone - UITableView Reuse issues -

this cellforrowatindexpath code: -(uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath{ static nsstring *cellidentifier = @"monthviewpopupcell"; uitableviewcell *cell = [tableview dequeuereusablecellwithidentifier:cellidentifier]; if (cell == nil) { nsarray *nibobjcet = [[nsbundle mainbundle] loadnibnamed:@"monthviewpopupcell" owner:self options:nil]; cell = [nibobjcet objectatindex:0]; celltitle.font = [uifont fontwithname:fontb size:size4]; cellsubtitle.font = [uifont fontwithname:fontr size:size4]; } if (indexpath.row == 0) { celltitle.text = @"11:03"; } return cell; } for reason don't understand, tableview reuses custom cell wrongly. thought code make first cell show 11:03 , rest show me 10:00 (as in xib file), other cells show 11:03 well, , position changing when scroll , down crazy... can show me i've done wrong? ...

function - Get category ID after creating a category - wordpress -

i creating 2 categories within functions.php file when wordpress theme activated so: /** * @desc create categories on theme activation **/ function create_my_cat () { if (file_exists (abspath.'/wp-admin/includes/taxonomy.php')) { require_once (abspath.'/wp-admin/includes/taxonomy.php'); if ( ! get_cat_id( 'work' ) ) { wp_create_category( 'work' ); } if ( ! get_cat_id( 'blog' ) ) { wp_create_category( 'blog' ); } } } add_action ( 'after_setup_theme', 'create_my_cat' ); if 2 categories work , blog not exist, create them if exist, nothing. how id's of 2 new categories when created/if exist? need store them 2 separate variables ($work & $blog) if possible can reuse them within same file. from wordpress manual wp_create_category( $cat_name, $parent ): returns 0 on failure, category id on success. if category exists, not duplicated. id of original existing ...

java - Error while trying to connect to cassandra through hector API -

i have written java code reading records cassandra. giving run-time error.. here java code:- import javax.naming.spi.dirstatefactory.result; import me.prettyprint.cassandra.serializers.stringserializer; import me.prettyprint.hector.api.*; import me.prettyprint.hector.api.cluster; import me.prettyprint.hector.api.keyspace; import me.prettyprint.hector.api.beans.hcolumn; import me.prettyprint.hector.api.factory.hfactory; import me.prettyprint.hector.api.mutation.mutator; import me.prettyprint.hector.api.query.columnquery; import me.prettyprint.hector.api.query.queryresult; public class hectorconnect { public static void main(string args[]){ try{ cluster c = hfactory.getorcreatecluster("test", "localhost:9160"); keyspace ko = hfactory.createkeyspace("myspace", c); stringserializer se = stringserializer.get(); columnquery<string, string> q = hfactory.createcolumnquery(ko, se, se); queryresult...

java - JUnit running test methods conditionally -

import static org.junit.assert.asserttrue; import org.junit.before; import org.junit.test; public class swifttest { swiftutil swiftutil = new swiftutil(); boolean result; @test public void checkinpathfolder() { result = swiftutil.checkinpathfolder(); asserttrue(result); } @test public void checkcustomobjectexists() { result=swiftutil.validatewfid(); asserttrue(result); } @test public void runswift() { result=swiftutil.runswiftbatch(); asserttrue(result); } @test public void checktreatedfolder() { result=swiftutil.checktreatedfolder(); asserttrue(result); } @test public void checkexceptionfolder() { result=swiftutil.checkexceptionfolder(); asserttrue(result); } } above test case. based on 2 cases want execute set of above test methods. eg: on condition x, checkinpathfolder(),checkcustomobjectexists(),runswift() sho...

Package arules in R: getting rules with only one item in the left-hand side -

i using package arules in r generate association rules. restrict rules in left-hand side there's 1 particular element, let's call "potatoe". if this: rules <- apriori(dtm.mat, parameter = list(sup = 0.4, conf = 0.9,target="rules"), appearance = list(lhs = c("potatoe"))) i "potatoe" on lhs, other kinds of things. how can force rules contain 1 element? parameter maxlen don't want, because, far can see, cannot specify maxlen apply elements on left. assuming you've generated rules ("rules", in question), here how subset it. basically, have coerce data data frame , subset it. #here original rules generated data created # categories "g", "t", "d", , "potatoe" > inspect(rules); lhs rhs support confidencelift 1 {} => {t} 0.3333333 0.3333333 1.0000000 2 {} => {g} 0.5000000 0.5000000 1.0000000 3 {} => {potatoe} 0.500000...

android - How to set coordinate of point other than default? -

i have semicircle sprite . default way set it's coordinates sprite.setx() , sprite.sety() . want set coordinate of point other default top left corner . namely , want set local coordinate of (0,getheight(piece)/2) coordinate of scene . now , can get coordinates of point :- final float[] endcoordinate = this.convertlocaltoscenecoordinates(0, mpiece1.getheight()); and use these coordinates other places in game. but , can't find anywhere on how set coordinate of point other top left corner coordinates . now know can setx(setingvaluex) , sety(setingvaluy - mpiece1.getheight()) , in situation need set other point explicitly .

github - Workflow for webapplication development without local development servers using git(hub) 1 coder + 1 webdesigner -

i programmer , in near future going work web/template designer on several projects. think development workflow setup? have optimization tips? setup 1 specific project the whole project hosted on github. the project complex webapplication running on linux os (it's impossible run on local development-server, neither on windows nor on mac). there 2 branches: dev , master. dev testing server , master productive server. besides main github repository there local repository on designer's computer, 1 on computer, 1 on testserver , 1 on production server. i develop locally (on windows). while developing there auto-sync script automatically uploads files edit via ftp testing server, can check instantly if changes work. the designer develops locally (on mac), have auto-sync script automatically uploads changes testserver via ftp, has access special "layout"-directory templates , static files (images, css, js, ...) located. needs check every few minutes if changes ...

jquery - JavaScript: how to build simple percentage increaser? -

how build increase value percentage without progress bar . i have built animator, need simple 1 show value 0% 100% without progress bar or anything. here code: $('.progress-bar').animate( {width:'83%'}, { duration:2000, step: function(now, fx) { if(fx.prop == 'width') { $(this).html(math.round(now * 100) / 100 + '%'); } } } ); progress bar not needed <p></p> only i know not way it, javascript knowledge low :( example fiddle for updated question you use interval: demo var value = 0, interval = setinterval(function(){ value = ((+value) + .1).tofixed(1); if(value == 80.5) clearinterval(interval); $('p').html(value+'%'); },2); first post is looking for? demo $('.progress-bar').animate( {width:'100%'}, { duration:2000, step: function(now, fx) { ...

css - IE9 / IE10 slightly larger font sizes? -

Image
black firefox, light blue /azure chrome (barely noticable against firefox), , dark purple ie10. their font sizes (11px) , font-family (helvetica) same, notice how larger ie10 renders font. it seems apply heavy anti-aliasing each character. i know part of 'challenge' creating site work across multiple browsers, has got solutions correct ie10's increased font size? i faced same problem, in ie parts on page broken. changed font-size unit px pt, have recalculate values(divide px value approx. 1.36367, 15/11 exactly). font rendered same size in ie8-10 , ff, no broken parts.

c# - How can I reference an List<string> object's position index without searching for first occurrence? -

i trying create xml document using linq , need reference index within list of each object. @ moment can find indexof(s) method returns first occurrence of s, rather position of s given. creates problem when list contains multiple copies of same value. var commands = listprocedure.items.cast<string>().tolist(); var xdoc = new xdocument( new xdeclaration("1.0", "utf-8", null), new xelement("commands", commands.select(s => new xelement("command", s, new xattribute("id", commands.indexof(s))) ))); try 1 var commands = listprocedure.items.cast<string>().tolist(); var xdoc = new xdocument( new xdeclaration("1.0", "utf-8", null), new xelement("commands", commands.select( (s, idx) => new xelement("command", s, new xattribute("id", idx)) )));

java - how to apply Next and previous button according to id -

public class androidjsonparsingactivity extends listactivity { // url make request private static string url = "http://api.androidhive.info/contacts/"; // json node names private static final string tag_contacts = "contacts"; private static final string tag_id = "id"; private static final string tag_name = "name"; private static final string tag_email = "email"; // contacts jsonarray jsonarray contacts = null; @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.main); // hashmap listview arraylist<hashmap<string, string>> contactlist = new arraylist<hashmap<string, string>>(); // creating json parser instance jsonparser jparser = new jsonparser(); // getting json string url jsonobject json = jparser.getjsonfromurl(url); ...

R lists: part of tag name -

i found out strange behaviour when using lists in r: > a$abc = 15 > a$abc [1] 15 > a$ab [1] 15 > a$a null > a$ab = null > a$ab [1] 15 is feature or bug? possible change behaviour? lot in advance! r performs partial matching when using $ , you'll abc when passing ab . matching not done single character. assignment: a$ab = null simply nothing, check object afterwards. null object added list, in r means nothing added.

oracle - Java JDBC exec procedure with sql statement -

i need execute sql code: exec procedure(param, param, param, param) select * bla_bla_table; commit; and resultlist query. i tried this: callablestatement stmt = connection.preparecall("{call procedure(param,param,param,param)}"); stmt.execute(); how can insert sql statement select * bla_bla_table; here before commit resultset. tried lot of ways that... nothing helps. did try this? connection.setautocommit(false); // disable auto commit callablestatement stmt = connection.preparecall("{call procedure(param,param,param,param)}"); stmt.execute(); statement stmt2 = connection.createstatement(); resultset rs = stmt2.executequery("select * bla_bla_table"); // result set query connection.commit();

intellij idea - How to disable inserting empty line on paste? -

each time paste line of code in intellij idea inserts empty line below inserted one, how disable this? thank you. that empty line isn't being added idea, it's included in selection. can avoid putting end point of selection @ last character , not below block you're selecting. figure: http://i.imgur.com/8digdkz.png

How to make jQuery form submission not refresh the page but add the content - AJAX like? -

in $('#my_form').submit(function() have code should add more information on selected song my_form form. able change content of info_table on each form submission (if different song marked). how can ? if leave return false; page won't reload anymore. <!doctype html> <html> <body> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js" ></script> <form id="my_form"> <table border='2' id="my_table"></table> <input type="submit" value="show song info" id="submit_button"> </form> <table border='2' id="info_table"></table> <script> var my_xml; $(document).ready(function() { $.get("songs_2.xml", function(d){ my_xml = d; //$('body').append("<table border='2'>"); var html = ""; var = 0; $(d...

php - RecursiveIteratorIterator callHasChildren() returning always true -

i use recursiveiteratoriterator class build menu. actually i'm using zend_navigation container build main menu , breadcrumbs, doesn't suit other needs, i'm using container iterator: $navigation = $this->view->navigation()->getcontainer(); $iterator = new recursiveiteratoriterator( $navigation, recursiveiteratoriterator::self_first); then know, 2 things - current level , if item has more children. first 1 can achieve getdepth() method , second 1 tried use callhaschildren() , 1 returning true, if item has not more children. foreach ($iterator $page) { echo $iterator->getdepth() . $iterator->callhaschildren()) . '<br />'; } any idea how use method?

linux - Is this an effective way to wait 10 seconds for an IP address? -

i have shell script creates vm use processing on. vm given random ip address obtain using vmwares vmrun utility. machine can take anywhere 10 - 20 seconds before gets assigned ip address not default windows apipa address. sometimes arithmetic error, , other times don't... whats wrong code? why intermittently work? ip=`vmrun -t ws readvariable my_vm guestvar ip` if [ ! -z `echo $ip | grep "169.254"` ] i=0 while [ ! -z `echo $ip | grep "169.254"` ] if [ $i -eq 10 ] echo "$ip has been unresponsive 10 seconds. quitting." exit 1 else sleep 1 i=$((i++)) # error occurs ip=`vmrun -t ws readvariable my_vm guestvar ip` fi done fi is there better way this? error message: arithmetic expression: expecting primary: "i++" the $ looks it's superfluous, can use ((i++)) without assignment increment variable.

javascript - while adding video with sencha give error Resource interpreted as Image but transferred with MIME type text/css -

i trying add sample using sencha getting error resource interpreted image transferred mime type text/css ext.define('myapp.view.newpage', { extend: 'ext.video', xtype: 'newpage', id:'newpage', config: { layout: { type: 'vbox', pack: 'center' }, items: [ { xtype: 'video', url: 'http://www.youtube.com/watch?v=9lzh1ky-l3u', width: '320', height: '70', loop:true, posterurl: 'resources/icons/itunesartwork.png' } ] } }); my code here don't know wrong. ext.video not container, can't have items. definition should this: ext.define('myapp.view.newpage', { extend: 'ext.video', xtype: 'newpage', id:'newpage', config: { url: 'http://www.youtube.com/watch?v=9lzh1ky...

javascript - How adjust scale of a table in a container on Html? -

Image
i have problem automatically adjust table in div if user adds collones or lines in matrix. if size exceeds, wish still full in "container div" setting smaller scale. possible resize table keeping size of container ? keeping table in center ? here css used: css .container{ background-image: url(image/block_surveillance_content.gif); background-position: bottom right; padding-bottom: 10px; width: 320px; height:400px; } .matrice{ height:100%; width:100%; } html <div id="block" class="container"> <table id="dataarray" class="matrice"> <tr> <td></td> <td> <asp:table runat="server" id="matrixcolumnlabel" ></asp:table> </td> </tr> <tr> <td> <asp:table runat="server" id="matrixlinelabel" style="position:rel...

emacs - Why does an elisp local variable keep its value in this case? -

could explain me what's going on in simple code snippet? (defun test-a () (let ((x '(nil))) (setcar x (cons 1 (car x))) x)) upon calling (test-a) first time, expected result: ((1)) . surprise, calling once more, ((1 1)) , ((1 1 1)) , on. why happening? wrong expect (test-a) return ((1)) ? note after re-evaluating definition of test-a , return result resets. also consider function works expect: (defun test-b () (let ((x '(nil))) (setq x (cons (cons 1 (car x)) (cdr x))))) (test-b) returns ((1)) . why aren't test-a , test-b equivalent? the bad test-a self-modifying code . extremely dangerous . while variable x disappears @ end of let form, initial value persists in function object, , value modifying. remember in lisp a function first class object , can passed around (just number or list), and, sometimes, modified . doing here: initial value x part of function object , modifying it. let see happening:...

linux - What signal number do pthread_cond_wait and pthread_cond_signal use internally? -

do pthread_cond_wait , pthread_cond_signal use sigwait , kill (from signal.h ), respectively, internally? if yes, signal number use, mean, value passed int kill(pid_t pid, int sig) sig ? in general implementation these don't need regular unix signals. instead, relies on atomic operations on shared memory location , couple of os primitives "sleep" , "wakeup".

python - Raw queries and custom sql queries what is the fastest? -

assuming file models.py in django application (webapp) following : from django.db import models django.db import connection class foo(models.model): name = models.charfield(...) surname = models.charfield(...) def dictfetchall(cursor): "returns rows cursor dict" desc = cursor.description return [ dict(zip([col[0] col in desc], row)) row in cursor.fetchall() ] def get_foo(): cursor = connection.cursor() cursor.execute('select * foo_table') rows = dictfetchall(cursor) return rows to access database content , have basicly 2 options : option 1 : from webapp.models import foo bar = foo.objects.raw('select * foo_table') option 2 : from application.models import get_foo bar = get_foo() which option fastest in execution ? there better way want ? there no direct , clear answer on approach better. using manager.raw() still keeps within orm layer , while returns model instances s...

How do I schedule an update query in PostgreSQL for Windows? -

is possible create sort of function or trigger in postgresql update columns field in regards time? for instance today want field equal 1, in 10 hours want equal 0. is possible? if value function of time can calculated @ query time. 0 or 1: select (extract(hour current_time) >= 12)::int * 1; ?column? ---------- 0 or added view: create view v select *, (extract(hour current_time) >= 12)::int * 1 t;

mysql - Counts where more than one column is true -

i have table 7 true/false columns, how can select rows have 2 or more of columns set true? here have far: select count(*), c1,c2,c3,c4,c5,c6,c7 members 1 in (c1,c2,c3,c4,c5,c6,c7); a true/false column 1 digit integer. unless have values other 0 , 1 stored or column nullable, can add columns , check whether result >= 2 select * members c1 + c2 + c3 + c4 + c5 + c6 + c7 >= 2 if there non-0 , non-1 entries, should correct beforehand. if can null, you'll need use where ifnull(c1, 0)...

java - How to draw markers inside a specific radius for google maps in android -

i have google map fragment on android application. i have markers drawn on map represent places of interest , have functionality draws circle on center radius defined user. what want markers contained inside circle shall displayed on map. using circle object, google maps shapes, draw circle. the problem that, although center of circle defined in latitude/longitude coordinates, it's radius defined in meters. how can calculate if position of place in latlng contained within radius defined in meters? thank you all need calculate if 2 latlngs closer each other radius. for can use location.distancebetween . see circle.contains function here example.

mysql - Extract specific data from full mysqldump backup -

i making regular backups of mysql database mysqldump. gives me .sql file create table , insert statements, allowing me restore database on demand. however, have yet find way extract specific data backup, e.g. extract rows table matching conditions. thus, current approach restore entire file new temporary database, extract data want new mysqldump call, delete temporary database , import extracted lines real database. is best way this? there sort of script can directly parse .sql file , extract relevant lines? don't think there easy solution grep , friends unfortunately, mysqldump generates insert statements insert many values per line. the solution ended being import whole file, extract data needed , drop database again.

javascript - Flexslider issue: imgs increase in size after switching -

view page here i've installed flexslider woothemes simple way have 3 rotating pictures. reason, when image switches next one, next image becomes huge momentarily resizes down. images height , width size of div shouldn't stretching image. my <*head> code <link rel="stylesheet" href="<?php bloginfo('template_url')?>/flexslider.css" type="text/css"> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script> <script src="<?php bloginfo('template_url')?>/jquery.flexslider.js"></script> <script type="text/javascript" charset="utf-8"> $(window).load(function() { $('.flexslider').flexslider(); }); </script> my html code <div class="flex-container"><div class="flexslider"> <ul class="slides"> <li> <img src="http://o...