Posts

Showing posts from September, 2015

node.js - StackOverflow API not returning JSON -

i using node.js script gather data stackoverflow. know responses gzipped, put code in should take care of that. script follows: var request = require('request'); var zlib = require('zlib'); function getstackoverflowresponse(url, callback){ request(url, {encoding: null}, function(err, response, body){ if(response.headers['content-encoding'] == 'gzip'){ zlib.gunzip(body, function(err, dezipped) { callback(dezipped); }); } else { callback(body); } }); } var url = "https://api.stackexchange.com/docs/questions#pagesize=2&order=desc&min=2014-01-04&max=2014-02-02&sort=activity&tagged=apigee&filter=default&site=stackoverflow&run=true"; getstackoverflowresponse(url, function(questions) { console.log(questions); }); instead of getting json output, i'm getting following response: buffer 0d 0a 0d 0a 0d 0a 0d 0a 3c 21 44 4f 43 54 59 50 45 20 48

ios - Apple Push Notifications + TestFlight + Enterprise wildcard provisioning profile -

i work in organization have apple enterprise provisioning profile. developing ios application makes use of apple push notifications, , use testflight distribute many users in organizations without having register device ids in testflight. can use enterprise wildcard provisioning profile distribute via testflight application uses apple push notifications? or can use explicit provisioning profile distribute app via testflight without having register employees devices in testflight beforehand? thanks in advance, ido it should work! what enterprise apps? if registered apple's enterprise program , making enterprise apps, no worries...testflight works too. testflight supports enterprise apps , works ad hoc apps distribution. upload enterprise signed app , distribute team , approved members of team have access application installation. source: http://help.testflightapp.com/customer/portal/articles/402851-testflight-faq

linked list - Move value to end of queue in C -

i'm new c , i'm trying use function move value end of queue. works first 2 times, third time goes wrong regarding while loop , i'm not sure what's causing it. @ appreciated. :) void enqueue(queue q, int value) { if (q == null) { return; } // create new node node * newnode = (node *)malloc(sizeof(node)); if (newnode == null) { return; } // add node end of queue newnode->value = value; if (q->head == null) { newnode->next = q->head; q->head = newnode; } else { node * head = q->head; while (head->next != null) { head = head->next; } // update queue pointer head->next = newnode; } } if q->head non-null, never set newnode->next , leaving uninitialised. next code walk list follow uninitialised pointer, leading undefined behaviour , crash. to fix this, need initialis

android - Drag and drop in ScrollView -

Image
i have imageviews inside horizontalscrollview. i able drag , drop imageviews somewhere else, still maintain scrolling capability. dragging should activated when user starts vertical motion finger. for now, have drag , drop activate on long-press, not solution. to illustrate: i had well. after reading http://techin-android.blogspot.in/2011/11/swipe-event-in-android-scrollview.html adapted code follows: class myontouchlistener implements view.ontouchlistener { static final int min_distance_y = 40; private float downy, upy; @override public boolean ontouch(view view, motionevent event) { switch (event.getaction()) { case motionevent.action_down: { downy = event.gety(); return true; } case motionevent.action_move: { upy = event.gety(); float deltay = downy - upy; // swipe vertical? if (math.abs(deltay) > min

select - Joining the Column Outputs of Two or More Columns from a MySQL Query -

i trying join outputs of 2 or more mysql queries. if query 1 has n columns , query 2 has m columns, output should have n+m columns. example: select * (select 1,2,3) x, (select 4,5) y; the output here : 1 2 3 4 5 now issue second query may produce no results. case results in no output @ all: select * (select * table_0) x, (select * table_1) y; if table_1 returns no matches, combined output returns no rows. still entries of first table returned. while have workaround, involves individual queries each of m columns. not want create temporary tables , join them. a left join should it: select * (select * table_0) x left join (select * table_1) y on 1;

c++ - OpenCV findContours

i have c++ project using qt 5.1.1 , opencv 2.4.6. image processing algorithm runs in separate thread. works fine if call opencv function findcontours() program crashes stack overflow message (right in first time function called, not called several times before) "unhandled exception @ 0x56ec9a47 in sara.exe: 0xc00000fd: stack overflow." i found same problem in case matter of changing project visual studio 2010...but in case, project in vs2010. the algoritm runs fine if create separate console project, calls image processing algorithm, same code inside thread in qt project show stack overflow! if remove findcontours() function, woks should. in both projects use same libs , debug dlls (versioned xxx246d.dll), , compiling program debug. i tried make stack larger changing properties -> configuration properties -> linker -> system -> stack reserve size option, program still crashes, different message, saying "unhandled exception @ 0x76e5c41f in sara.

android - Passing current location to Marker -

i writing application opens maps app , able add marker object @ current location when opens. application correctly opens maps app , shows blue dot current location, having difficulty using current location in order create marker . here source code: import com.google.android.gms.common.connectionresult; import com.google.android.gms.common.googleplayservicesclient; import com.google.android.gms.common.googleplayservicesutil; import com.google.android.gms.location.locationclient; import com.google.android.gms.location.locationlistener; import com.google.android.gms.location.locationrequest; import com.google.android.gms.maps.cameraupdate; import com.google.android.gms.maps.cameraupdatefactory; import com.google.android.gms.maps.googlemap; import com.google.android.gms.maps.model.latlng; import com.google.android.gms.maps.model.markeroptions; import com.google.android.gms.maps.mapfragment; import com.google.android.gms.maps.supportmapfragment; import android.location.location; im

c# - A straightforward answer to using session variables in MVC Views? -

i having difficulties utilizing session variables in mvc views. in example below, if condition in view not met when set isloggedin session variable true via controller. note: trimmed of irrelevant code easier reading. in advance! controller: public actionresult index(int id = 0) { jobsummarymodelhelper jobdetails = new jobsummarymodelhelper(); jobdetails.id = id; jobdetails.jdata = ..... return view(jobdetails); } public actionresult authenticate() { ..... int usercount = db.jobboardusers.where(u => u.userid.equals(un) && u.passcode.equals(pc)).select(u => new accountmodel() { uid = u.id }).count(); if (usercount > 0) { httpcontext.session["issignedin"].equals(true); } return redirecttoaction("index", jobdetails); view: ..... @if (convert.toboolean(session["issignedin"])) { <fie

Invalid tag nesting configuration in ColdFusion 10? -

how around coldfusion error? i'm following this coldfusion tutorial. when tried implement code in coldfusion 10 got following error: invalid tag nesting configuration. query driven queryloop tag nested inside queryloop tag has query attribute. not allowed. nesting these tags implies want use grouped processing. however, top-level tag can specify query drives processing. the error occurred in line 76 74 : </cfloop> 75 : </tr> 76 : <cfoutput query="data" startrow="2"> 77 : <tr> 78 : <cfloop index="c" list="#collist here code: <cfset showform = true> <cfif structkeyexists(form, "xlsfile") , len(form.xlsfile)> <!--- destination outside of web root ---> <cfset dest = gettempdirectory()> <cffile action="upload" destination="#dest#" filefield="xlsfile" result="upload" nameconflic

iphone - Client-side database in Actionscript 3 (built into the client, not read from a server database) -

i'm looking create way store items game i'm making using flash. there's going many items in game , want store them in database built client , doesn't require connecting server. i know write parser , import spreadsheet file game, i'd not reinvent wheel if don't have to. is there way or library that's created reading client side database? guess i'm looking way use database style system on client side without having build ground up. look @ sharedobjects : var savedata:sharedobject = sharedobject.getlocal("gamename"); savedata.data.test = 5; savedata.flush(); // ... restart application , then: trace(savedata.data.test); // 5

wso2 - API manager, upgrade from 1.4.0 to 1.60 -

we're running wso2 api manager 1.4 , upgrade latest version 1.6. can go directly 1.6 or have upgrade 1.5 first? i'm concerned regarding db migration, these scripts seem relevant single version increments. https://svn.wso2.org/repos/wso2/carbon/platform/branches/turing/products/apimgt/1.6.0/modules/distribution/resources/ thanks. as said, databases migrations, can execute migration-1.4.0_to_1.5.0 , migration-1.5.0_to_1.6.0 sqls sequentially. it's important note api manager 1.4.0 based carbon 4.1.x , api manager 1.6.0 based on carbon 4.2.0. see release matrix wso2 products . this means underlying clustering, registry , user-mgt have major changes. api manager related configurations has changed. therefore advice follows. backup existing database , api manager 1.4.0 deployment. migrate databases in incremental manner. re-do configurations in api manager 1.6.0 instances. i.e. direct migration 1.4.0 1.6.0. may compare api manager 1.4.0 repository/conf

c - Working on a Fibonnaci/mysequence code -

i working on code suppose calculate sequence: a(n+2)=-2(n+1)+3a(n) a(0)=2 a(1)= -1 unfortunately cannot figure out. i'm new @ (about month) , i'm going try best on own, need help. thank whoever decides me. #include <stdio.h> int mysequence(int n) { if (n==0) return 2; if (n==1) return -1; if (n==2) return 8; return (2 * mysequence(n+1) + mysequence(n+2))/3; } int main() { int n; printf("enter n = "); scanf("%d", &n); printf("%d\n",mysequence(n)); return 0; } look @ line return (2 * mysequence(n+1) + mysequence(n+2))/3 , compare know sequence: a(n+2)=-2(n+1)+3a(n) . they have nothing in common. what want return (-2*mysequence(n-1) + 3*mysequence(n-2)) . why, coefficients should clear enough, copied definition. reason call next level of recursion n-1 , n-2 quite simple, observe: a(n+2)=-2(n+1)+3a(n) -> substitute n n-2 -> a(n)=-2(n-1)+3a(n-2) .

c# - Image compression is not working -

i have operation on site takes crops image, resultant, cropped image coming out larger in terms of file size (original 24k , cropped image 650k). found need apply compression image before saving it. came following: public static system.drawing.image cropimage(system.drawing.image image, rectangle croprectangle, imageformat format) { var croppedimage = new bitmap(croprectangle.width, croprectangle.height); using (var g = graphics.fromimage(croppedimage)) { g.interpolationmode = interpolationmode.highqualitybicubic; g.drawimage( image, new rectangle(new point(0,0), new size(croprectangle.width, croprectangle.height)), croprectangle, graphicsunit.pixel); return compressimage(croppedimage, format); } } public static system.drawing.image compressimage(system.drawing.image image, imageformat imageformat) { var bmp = new bitmap(image); var codecinfo = encoderfactory.getencoderinfo(imagef

jquery - PHP: Need advice on form validation on a server with PHP v5.1.3 -

i'm trying learn how server-side validation on web form using php. have client-side validation working through jquery. during studies read native validation filters added php v5.2 of grunt work form validation. unfortunately, learned office server running php v5.1.3. ouch! make long story short, can not upgrade php version. end of discussion. as newbie of this, are there other readily available functions out there me validate form input data older versions of php of job? read html_quickform2, have form built in html5 (using polyfill older browsers ie8 validate html5 forms). again, new , looking nudged right direction can form validated possible. as starter, suggest html5 -- default, have (very) basic validation field types ( email , tel , date ...). next, php's preg_match ; match inputs strings. first step start reading few articles on php validation. here's introductory article on subject. source, requires time , effort, go straight source @ php.net .

ruby on rails - Connect to Host MySQL Server on Vagrant -

it's possible connect host's mysql server inside vagrant box? i'm running ror vagrant box, need connect host database server. any help? there 2 thread 1 on stack overflow , on superuser might out doing this. links below. how connect host postgresql vagrant virtualbox machine https://superuser.com/questions/310697/connect-to-the-host-machine-from-a-virtualbox-guest-os/310745#310745 it possible trying achieve if settings correct.

javascript - Jasmine fixtures not cleaned up, tests not independent -

i'm using jasmine unit test table column sorting functionality. issue came noticed columns in wrong order (z-a instead of a-z) after first click. used browser's debugger examine html , confirm column in fact mis-sorted. test of independence, added click end of preceding it-block, , surprisingly fixed issue. reordering tests avoid other's click worked. this disproves the assertion "fixtures container automatically cleaned-up between tests". can verify bug or explain i'm misunderstanding? describe('gem bootstrap_sortable_rails', function() { var header; beforeeach(function() { setfixtures('<table class="sortable"><thead><tr><th data-sortkey="0">name</th></tr></thead>' + '<tbody><tr><td data-value="harrow baptist church"><a href="/organizations/1">harrow baptist church</td></tr>' + '<

c++ - Run doesn't work in Eclipse with Cygwin toolchain -

i trying configure eclipse use cygwin toolchain. wrote simple c++ program check have setup things correctly. #include <fstream> using namespace std; int main() { ofstream fout("output.txt"); fout << "hi" << endl; fout.close(); return 0; } the build button compiles program , generates executable , can run it. however when click on run button in eclipse doesn't run program. rather confused since debug button runs program correctly (so issue should not not finding cygwin1.dll). the run button works if set toolchain mingw. i using eclipse kepler service release 1 , cygwin date. i search bit couldn't find answer how fix this. suggestion might cause of problem? the following solved problem me: add cygwin path in environment, e.g. c:\cygwin\bin\ add path mapping cygwin drives in window -> preferences -> c/c++ -> debug -> source lookup path , e.g. map \cygdrive\c c:\ .

Use Heroku config vars with PHP? -

i've been able find information on how use config vars in heroku python, node.js, , other languages, not php. can use them php, or not supported? this article shows how python, java, , ruby, not php. config vars on heroku manifest environment variables, should able access them php other environment variable, eg. using getenv . first, set variable console: heroku config:set my_var=somevalue then, access code: $my_env_var = getenv('my_var');

html - anchor tag div name -

i'm running trouble here, appreciated. i'm trying link section on page. i'm having trouble. check code: <a href="#h2">consulting</a> that's link, here's block i'm wanting link to: <div class="space" name="h2"> <h1 class="h2">consulting</h1> <p class="paragraph">blah</p> </div> now think have wrong, i'm trying not keep messy. have <a name="h2">blah</a> to make work, or can doing, , missing something? with url fragments want target id, not class. change to: <div class="space" name="h2"> <h1 id="h2" class="h2">consulting</h1> <p class="paragraph">blah</p> </div> per mdn: a url fragment name preceded hash mark (#), specifies internal target location ( an id ) within current document. see also: http://ww

finding line number of file using grep command Linux -

i have find 250th line of txt file not have comma using grep command. file has more 250 lines, have find 250th line not. example: imagine had 10 line file , looking 3rd line did not contain comma lines 1 , 2 not have comma lines 3-7 have comma line 8 not contain comma answer file line 8. i used command : grep -vn "," test.txt and looked 250th line, did following command see if line numbers same, , were. grep -n "this text 250th line" test.txt i don't think should case because 250th line of file without comma should not same line 250th line of regular file because regular file has many lines commas in them, line number should less. what wrong here? thank you. unfortunately, posix disagrees: $ man grep # ... -n, --line-number prefix each line of output 1-based line number within input file. (-n specified posix.) # ... what toss awk on: $ grep -v , text.txt | awk '{ if (nr == 250) { print } }'

Android MediaPlayer cannot play files that contain '#' character in the file name using Uri.parse("...#.mp3") -

my media player works playing other file names have tried except file names have '#' in them mediaplayer m_mediaplayer; ... m_mediaplayer = mediaplayer.create(this, uri.parse(musicfile)); where musicfile string filename = "/storage/emulated/0/music/asot 643 (2013-12-12) (inspiron)/31 geert huinink & mike van fabio - kingdom [future favorite #641].mp3" m_mediaplayer returns null...if remove '#' file name works other songs. seems uri.parse(musicfile) gets confused hashtag seems. any appreciated in solving this. you're passing uri. # in uri anchor tag. uri.parse thinks filename ends @ #, , rest fragment. basically, can't use uri.parse. i'd @ using uri.fromfile instead edit: found better method fromparts- fromfile

PHP OOP - MySQL connection from within a class -

i'm sorry if wrong place, seems questions rather conceptual, it's harder browse related opened topics. anyway, here's issue: own small e-commerce company (in brazil) , need track shipments in 1 place , want aware of possible delays , other events take place products company ships, according own criteria. the post office provides api , have managed retrieve information each event related shipment. i have created database in have, among others, 2 tables: 1 shipment (tracking code, destination , other stuff) , events take place. i have created 2 classes, corresponds these 2 tables: 1 called shipments other events (obviously). believe there's no need create second table, everytime load page events loaded post office website, however, , first question, believe script run lot faster if doen't need retrieve data internet everytime, right? besides that, figured using database makes easier process data using mysql queries. make sense? the third , important ques

Wordpress Loop get_the_id() -

i tried following functions in header.php, footer.php, single.php etc. var_dump(in_the_loop()); var_dump(get_the_id()); the first function gives false (meaning not in loop) , second function gives post id every single time. description of get_the_id() wordpress : retrieve numeric id of current post. tag must within loop. i want simple explanation hell going on why post id if call function out of loop !? must little strong get_the_id() ... delivers evil eye wordpress . it works in header , non-loop (confirmed). please note post/page interchangeable in conversation. think of wp way -> have post id in way, time, every page, unless weird stuff or talk non-page edge cases. when @ install root (such site.com/) there posts being called, has displayed. there other settings impact post/page such static front page settings. on category listing, if there pages, got first id returned before loop. on post/pages page id (more or less0 set before loop. result o

c - Store 8 Ascii Values in unsigned int -

i have query. have string of ascii value . reading hex file. consider string "0004eb9c" . copied in unsigned char buffer. unsigned char buff[8] = {'0','0','0','4','e','b','9','c'} unsigned int j = 0; now string or information has transmitted through uart communication. consider represents ram address execution. need store 8 byte ascii value in in unsigned int . not finding way can 1 please focus on this. output after copying/converting string should like printf("%x",j); this should print output : 0x0004eb9c thanks in advance!! set answer 0 each character left-shift answer 4 if character between '0' , '9' inclusive subtract '0' else subtract 'a' , add 10 bitwise-or answer

LLVM: how to pass a name to ConstantInt -

using llvm's c++ api, i'm calling constantint->setname("name") on constantint->getname() doesn't show up. empty string. constantint not supposed have name? you cannot assign names constants (and neither can assign names void values). unfortunately indeed poorly-documented, can see in the source code of value::setname . makes sense when consider how constants in textual representation of ir. what can instead create global variable , mark constant - can named.

sql - How to query list of unique records from many to one relationship data structure? -

i having trouble finding suitable query in sql server. have department(table a) having many clients(table b) data structure. looking query retrieve 1 client(first occurrence) of each department client status active. help? try select * table1 t1 exists ( select * table2 t2 t1.column1 = t2.column1 , column2 = 1 ) , exists ( select * table2 t2 t1.column1 = t2.column1 , column2 = 2 );

html - placeholder always align left in safari -

placeholder text gets aligned left in safari browser. working in other browser. html: <input type="text" class="form-input" placeholder="email address" /> css: .form-input { width: 235px; height: 15px; border: solid 5px #fff; text-align: center; padding: 10px 0px 10px 0px; font-family: 'helvetica-bold'; } please see demo in fiddle i want align placeholder @ center of input box. how this? try it's working code: input { text-align:center; } ::-webkit-input-placeholder { text-align:center; } :-moz-placeholder { /* firefox 18- */ text-align:center; } ::-moz-placeholder { /* firefox 19+ */ text-align:center; } :-ms-input-placeholder { text-align:center; } will work in safari 6 placeholder text-align property not working in safari 5.1 or older version see support table here http://blog.ajcw.com/2011/02/styling-the-html5-placeholder/

C++ Extract int from string using stringstream -

i trying write short line gets string using getline , checks int using stringstream. having trouble how check if part of string being checked int. i've looked how this, seem throw exceptions - need keep going until hits int. later adjust account string doesn't contain ints, ideas on how past part? (for now, i'm inputting test string rather use getline each time.) int main() { std::stringstream ss; std::string input = "a b c 4 e"; ss.str(""); ss.clear(); ss << input; int found; std::string temp = ""; while(!ss.eof()) { ss >> temp; // if temp not int ss >> temp; // keep iterating } else { found = std::stoi(temp); // convert int } } std::cout << found << std::endl; return 0; } you make of validity of stringstream int conversion: int main() { std::stringstream

centos - Spawning background process under different user in bash -

i know can run command spawn background process , pid: pid=`$script > /dev/null 2>&1 & echo $!` and run command under different user: su - $user -c "$command" i don't want script run root , can't quite figure out how combine 2 , pid of spawned process. thanks! i think want runuser command. general syntax: runuser -l usernamehere -c 'command' i suspect if set $script variable above (with appropriate changes), first command want.

java - what happens to static block when we create multiple objects? -

i have class has static members non-static members : public class staticclassobjectcreations { public static void dosomething() { // todo implementations static } public void nonstaticmethod() { // todo implementations non static } public static void main(string[] args) { staticclassobjectcreations obj = new staticclassobjectcreations(); staticclassobjectcreations obj1 = new staticclassobjectcreations(); } } as can see number of object creation not restricted , non-static methods can accessed of objects created new keyword. the static methods or member variables available each instance , can accessed out creating objects also. now question : how jvm maintains instances static block of code or in other words happens these static blocks when creating objects new keyword. thanks. static blocks/variable/methods belong class, not instances of class. initialized when class loaded. there won't effect t

javascript - Let prototype function have sub functions with inherited environment -

having prototype object various functions, canvas. typically this: function canvaspain() { ... } canvaspaint.prototype.drawfoo = function(x, y) { this.ctx.moveto(x, y); ... }; i have functions paintgrid() have sub functions – being property based objects. (not sure how word this.) example: canvaspaint.prototype.grid = function() { this.paint = function() { this.ctx.moveto(0, 0); // here this.rows should property of canvaspaint.prototype.grid() // , not canvaspaint() (var = 0; < this.rows; ++i) { ... paint lines } }; }; and being able example: var cp = new cp(); // , in function: this.grid.rows = 10; this.grid.cols = 10; this.grid.paint(); reason make code cleaner. of use this: function canvaspain(arg) { ... this.properties = {}; this.properties.fig1 = {a:123, b:111}; this.properties.grid = { rows = arg.rows; cols = arg.cols;

jquery - How to get mysql search query to select all row contains url variables? -

i trying search query takes url variables , match against table1. issue if don't have exact name in search field not return search value. example if search word "basket" not return value if search word "basketball" basketball 1 of table1.column2 value. select * table1 join table2 on table1.colname = table2.colname table1.colname2 %s have tried having clause instead of clause in select statement ? try it select * table1 join table2 on table1.colname = table2.colname having table1.colname2 '%s%'

python - Using environment variables in Fabric -

assuming: export test=/somewhere i want run command /somewhere/program using: with cd('$test'): run('program') however, doesn't work because $ gets escaped. is there way use environment variable in fabric cd() call? following suggestion @andrewwalker, here more compact solution worked me (and knowledge, result same): with cd(run("echo $test")): run("program") but decided go (very slightly) more concise yet readable solution: run('cd $test && program') this second solution, if correct, produces same result.

c# - simple way to read xml data using linq -

i have xml structure this. can simple linq function read xml structure.the itementry node repeats according data. tried read xml using method below,but getting no records in list. method here correct way details... list<cx_itemlist> slist = (from e in xdocument.load(param.filename).root.elements("itementry") select new cx_itemlist { title = (string)e.element("title"), year = (string)e.element("year"), itemname = (string)e.element("itemname"), catrylist = ( p in e.elements("categorylist").elements("categories") select new catlist { idtype = (string)p.element("categoryid"), idnumber = (string)p.element("categoryname") }).tolist() }).tolist(); <itemslist> <iteminformation> <itemdate>01/23/2014</itemdate> <itemcount&

iphone - crashed while dismissing uitextview in iOS 6 -

i have implemented uitextview, when dismiss done button. got crashed in ios 6 error -[uitextview setselectable:]: unrecognized selector sent but working fine in ios 7. -(bool)textviewshouldendediting:(uitextview *)textview1 { [textview resignfirstresponder]; } i unable find issue. please me out if has idea regarding issue. thanks in advance. you must have return type this.. -(bool)textviewshouldendediting:(uitextview *)textview1 { [textview1 resignfirstresponder]; return yes; // put line in code....... }

mysql - ALTER TABLE tbl AUTO_INCREMENT = 123 as codeigniter active records query? -

how execute alter table tblname auto_increment = 123 as codeigniter active records query? there called dbforge->modify_column() in codeigniter , have use that, if how? $this->db->query('alter table tbl_name auto_increment 1'); working me.

android - Navigation Drawer with expandable list inside doesn't work -

after several researching , resembling of codes, expandable list inside navigation drawer doesnt work. there of guys have tried doing this.i appreciate if can me this. im striving 3 days.please me. am miss on code? heres code: mainactivity public class mainactivity extends activity { expandablelistadapter listadapter; expandablelistview explistview; public drawerlayout drawer; private linearlayout linear; button btn; hashmap<string, list<string>> listdatachild; list<string> listdataheader; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); btn = (button)findviewbyid(r.id.button1); linear = (linearlayout)findviewbyid(r.id.linear); explistview = (expandablelistview) findviewbyid(r.id.lvexp); drawer = (drawerlayout)findviewbyid(r.id.drawer_layout); preparelistdata(); btn.setonclicklistener(new view.onclicklistener() { @overr

python - how to retrieve string from a large file -

i have written code in "ids.txt" tab deliminated text file contains id in manner given below in first column represent id second starting index , third column ending index. ids.txt------- "complete.txt" the script have write given bellow retrieve string fragment according "ids.txt" it's not working please changes should make correct code with open("\users\zebrafish\desktop\ids.txt") f: # input text line in f: c = line.split("\t") i, x in enumerate(c): #passing values start , end variables if == 1: start = x elif == 2: end = x elif == 0: gene_name = x infile = open("/users/zebrafish/desktop/complete.txt") #file large string data seq in infile: seqnew = seq.split("\t") # data single line retrived = seqnew

java - how can skip a test in same class- selenium web driver -

Image
currently working on selenium webdriver , using java .. test run in firefox 26.0 .. in eclipse using testng frame work.. if i'm running test name test.java . in have many filter section combination drop down values date picker , multi select box shown in image. based upon filter section have written code follows: log.info("clicking on visualization dropdown"); javascriptexecutor executor = (javascriptexecutor)driver; executor.executescript("document.getelementbyid('visualizationid').style.display='block';"); select select = new select(driver.findelement(by.id("visualizationid"))); select.selectbyvisibletext("week"); thread.sleep(6000); log.info("clicking on period dropdown"); javascriptexecutor executor1 = (javascriptexecutor)driver; executor1.executescript("document.getelementbyid('periodid').style.display='block';"); select select1 = new select(driver.findelement(by.i

javascript - Change the url and reload on change of dropdown value which is in common header -

i new yii , want change url , reload current view page on change of dropdown value in admin's common header field. dropdown echo $form->dropdownlist($siteid, 'selectedsiteid', $data,$htmloptions, array('class' => "form-control")); the current urls may following 1. http://localhost/zyntegra_commoditylifev2/admin/sitetag/viewtags/sid/6 2. http://localhost/zyntegra_commoditylifev2/admin/category/viewcategory/sid/ 3.http://localhost/zyntegra_commoditylifev2/admin/site/index suppose current changed dropdown value 10 , if current url (1) 1 need change url this http://localhost/zyntegra_commoditylifev2/admin/sitetag/viewtags/sid/10 if current url (2) 1 http://localhost/zyntegra_commoditylifev2/admin/category/viewcategory/sid/10 , if it's (3) 1 there no need of reload. plz me solve problem. thanks in advance try like, var tagsurl='http://localhost/zyntegra_commoditylifev2/admin/sitetag/viewtags/sid/'; var catur

How does one convert a grayscale image to RGB in OpenCV (Python) for visualizing contours after processing an image in binary? -

i learning image processing using opencv realtime application. did thresholding on image , want label contours in green, aren't showing in green because image in black , white. early in program used gray = cv2.cvtcolor(frame, cv2.color_bgr2gray) convert rgb grayscale, go confused, , function backtorgb = cv2.cvtcolor(gray,cv2.cv_gray2rgb) giving attributeerror: 'module' object has no attribute 'cv_gray2rgb'. the code below not appear drawing contours in green - because it's greyscale image? if so, can convert grayscale image rgb visualize contours in green? import numpy np import cv2 import time cap = cv2.videocapture(0) while(cap.isopened()): ret, frame = cap.read() gray = cv2.cvtcolor(frame, cv2.color_bgr2gray) ret, gb = cv2.threshold(gray,128,255,cv2.thresh_binary) gb = cv2.bitwise_not(gb) contour,hier = cv2.findcontours(gb,cv2.retr_ccomp,cv2.chain_approx_simple) cnt in contour: cv2.drawcontours(gb,[cnt],0,25

iOS - Push Notification SSL Certificate Validity -

would know whether official apple reference available validity period of development , production push ssl certifications. thanks bunch. this tech note apple mentions 1 year validity period: these certificates valid 1 year production apns certificates can renewed @ time. i can't find documentation mentions how long development certificate lasts. however, generated new 1 , can confirm valid one year .

mysql - how to get or insert data in mysq rds amazon from iphone application -

i working app in want app should connect mysql rds on amazon problem when use simpple db have there api , other things connect db , domain how connect sql data base tables in ios app have search , found dynamicdb mysql under dynamic db , access use dynamic db api. you going want intermediary web service via database interactions made. without this, need make database have no access restrictions , embed db credentials in app. extremely foolish.

HTML / Javascript - Trouble changing text when clicked -

so have html code here: <body> <b style="font-size: 26px;">how game works</b> <u id="howtoplay_hideshow" style="color: #9ff;">[hide]</u><br> </body> and used javascript turn hide text show , , show hide when clicked on. <script> var howgameworks_hidden = false; document.getelementbyid("howtoplay_hideshow").onclick = function () { if (howgameworks_hidden == false) { document.getelementbyid("howtoplay_hideshow").innerhtml = "[show]"; howgameworks_hidden = true; } if (howgameworks_hidden == true) { document.getelementbyid("howtoplay_hideshow").innerhtml = "[hide]"; howgameworks_hidden = false; } } </script> this, however, not seem work. clicking on hide , show text has no effect @ all. tried removing piece of code: if(howgameworks_hidden == true) { document.getelementbyid("howtoplay

javascript - How to find closest <i>? -

my html code follow : <div class="listitems"> user1@mail.com <a style="float: right;vertical-align: top;" data-recom-user="3" data-recom-mile="4"> <i class="icon-eye-open"></i> </a> <i style="float: right;vertical-align: top;" data-irecom-done="false" data-irecom-user="3" data-irecom-mile="4" class="icon-hand-up" title="recommend user"></i> </div> i have trigger click event on <a> in event handler function want access closest <a> i tried $(this).closest("<i>") in got <i class="icon-eye-open"></i> how can <i style="float: right;vertical-align: top;" data-irecom-done="false" data-irecom-user="3" data-irecom-mile="4" class="icon-hand-up" ></i> element can change some attrib

java ee - No Persistence provider for EntityManager named EmpDb -

i'm getting error: exception in thread "main" javax.persistence.persistenceexception: no persistence provider entitymanager named employeedb @ javax.persistence.persistence.createentitymanagerfactory(persistence.java:85) @ javax.persistence.persistence.createentitymanagerfactory(persistence.java:54) @ staffmanagement.test.testharness.main(testharness.java:14) but can't understand why - did identical thing on home pc , had no issues. here code test file: public class testharness { public static void main(string[] args) { entitymanagerfactory emf = persistence.createentitymanagerfactory("empdb"); entitymanager em = emf.createentitymanager(); entitytransaction tx = em.gettransaction(); tx.begin(); employee employee1 = new employee("brad", "pitt", "actor", 10000); em.persist(employee1); tx.commit(); em.close(); } } and persistence.xml file: <persisten

notepad++ - Notepad ++ Moving one line to the start of the next line -

i have thousands of lines in notepad++ person's title , initials in 1 line , surname in next. trying 1 line. there other info on lines inbetween can't merge every 2nd line. looks like: mrs m b xxxxx i need mrs m b xxxxx. is there way can search "mrs" , move line start of next line? you do: find what: (mrs.*?)\r replace with: $1 \r stands line break.

ios - Cocoapods : spec.prefix_header_contents does not work -

here podspec : pod::spec.new |s| s.name = "mycbdlumberjack" s.version = "0.0.1" s.source = { :git => 'https://me@bitbucket.org/me/mycbdlumberjack.git', :tag => "#{s.version}" } s.source_files = 'mycbdlumberjack/my lumberjack/**/*.{h,m}' s.public_header_files = 'mycbdlumberjack/**/initializationcocoalumberjack.h' s.resource = "mycbdlumberjack/help_mycbdlumberjack.rtfd" s.ios.platform = :ios, '5.0' s.osx.platform = :osx, '10.7' s.requires_arc = true s.osx.framework = 'appkit' s.ios.framework = 'uikit' s.prefix_header_contents = '#import "ddlog.h"' s.dependency 'cocoalumberjack', '~>1.8' end but, don't see result it. #import "ddlog.h" not appear in pods-mycbdlumberjack-prefix.pch . am looking @ wrong place? ps: seems line included when linting not includ

ios - When to release a CCSpriteBatchNode once the animation is finsihed[Solved] -

i playing animation , want remove batch node parent (cclayer) animation finishes playing. running ccsequence have function named animationfinished called when finishes playing. can't remove batch node parent in function released , don't have other retain. game crashes, still being used engine. so @ event can release batch node. if don't , added again , again cclayer.please see code below void gamelayer::playanimation(const animationfileandtypeinfo &powerfileinfo,float placeatscreenwidthratio,float placeatscreenheightratio){ std::string firstframe,framename,plist,plistpng; plist=powerfileinfo.animfileinfo.plist; plistpng=powerfileinfo.animfileinfo.plistpng; firstframe=powerfileinfo.animfileinfo.firstframe; framename=powerfileinfo.animfileinfo.framename; // generic animation play code ccspriteframecache *animcache = ccspriteframecache::sharedspriteframecache(); animcache->addspriteframeswithfile(plist.c_str()); _animpl

android - hide activity name from action bar just in time of creation -

just in time of creation , 1 second or less action bar shows name of activity declared in manifest. there way avoid this? of course when activity created change programmatically title.the manifest: <activity android:name="com.abc.homeactivity" android:screenorientation="portrait" android:label="home" android:icon="@drawable/x_logo"> </activity> and code fragment shown activity. change title of action bar based on fragment shown. ((actionbaractivity) getactivity()).getsupportactionbar().settitle("variable name"); from activity: super.oncreate(savedinstancestate); getsupportactionbar().settitle(""); if hiding activity name means avoiding text, call following in oncreate of activity : getactionbar().settitle(null); //if using actionbar theme settitle(null); //if using standard theme update @override protected void oncreate(bundl