Posts

Showing posts from August, 2014

java - Determine if an instance of a service is running and kill it -

i have android service, let's "service.java" i start instance , pass unique id each instance of service start (so don't have 2 service same uid running @ same time): intent intent = new intent(this, service.class); intent.putextra("key", uid); startservice(intent); say set variable in "service.java" uid: private string uid; @override public int onstartcommand(intent intent, int flags, final int startid) { super.onstartcommand(intent, flags, startid); if(intent != null) { bundle infobundle = intent.getextras(); this.uid = infobundle.getstring("key"); } ... } public string getuid() { return this.uid; } is there way somehow check if instance of "service.java" running given uid , kill it? i have list of key/value pairs want start instances of service @ specific times of day, if user "disables" time slot (key/value pair), want service stop. backstory: i have application

loops - Making sure values do not get overwritten in Matlab -

i modelling spread of disease , want make image plots first time infection occurs in pixel of matrix. so got this: for t=1:30 infected=calc_infected(susceptibles, disease, row, col); if t < 8 % infection occurs in first week in these pixels lm(find(infected > 0))= 2 elseif t>=8 && t<15 % infection occurs in second week in these pixels lm(find(infected > 0))= 3; elseif t>=15 && t<22 lm(find(infected > 0))= 4; elseif t>=22 && t<30 lm(find(infected > 0))= 5; end t time in days. lm map on plot data. infected matrix contains temporal evolution of infection. question is: want show time first infection occurs, how can make sure value pixel not overwritten when becomes infected second time, within time classification? e.g. if pixel has value of 2 because got infected

arrays - Optimum Way To Write Long Javascript Variables containing HTML -

hi guys i'm working on web app outputs heap of html , objects onto html page via javascript. its looking quite messy , made me wonder - optimum way write , why. this code var html_content = ''; html_content += "<div class='body-content'>"; html_content += "<h1>" + wowarr.name +"</h1><br />" + "<h2> arena titles (account wide)</h2>" + achievementz.join('<br />') + "<br /><br />" + "<h2>highest arena ratings</h2>" + "<span style='color: #ffffff;'>"+rating2v2.name+"</span>" + ": " + rating2v2.quantity + "<br/>" + "last reached on: " + gethighestdate(rating2v2) + "<br/><br/>" + "<span style='color: #ffffff;'>"+rating3v3.name+"</span>

python - Unable to install older wxPython within virtualenv (Cannot unpack file / Cannot determine archive format) -

within virtualenv built off python 2.6.6, i'm trying pip install 2.8.10.1 2.6 unicode dmg found here thus: pip install -iv http://sourceforge.net/projects/wxpython/files/wxpython/2.8.10.1/wxpython2.8-osx-unicode-2.8.10.1-universal-py2.6.dmg/download granted, url bit of guess. i (dividing log in two): macbook-pro-de-pyderman:pyderman$ pip install -iv http://sourceforge.net/projects/wxpython/files/wxpython/2.8.10.1/wxpython2.8-osx-unicode-2.8.10.1-universal-py2.6.dmg/download -u --trusted-host sourceforge.net collecting http://sourceforge.net/projects/wxpython/files/wxpython/2.8.10.1/wxpython2.8-osx-unicode-2.8.10.1-universal-py2.6.dmg/download starting new http connection (1): sourceforge.net "get /projects/wxpython/files/wxpython/2.8.10.1/wxpython2.8-osx-unicode-2.8.10.1-universal-py2.6.dmg/download http/1.1" 302 519 starting new http connection (1): downloads.sourceforge.net "get /project/wxpython/wxpython/2.8.10.1/wxpython2.8-osx-unicode-2.

ios - Admob is crashing but very rare -

Image
usually ios app works fine. crashes. attached screenshot. called functions show admob interstitial. crashed. not sure how debug , why crashed time. code works fine of time crashes. my app uses arc. it iphone open gl es 2.0 game admob , iad how debug it? steps should done? i not sure when see such crash next time. crashes happen not often. if remove components iad , test not know when crash , how many tests run ensure removed part coursing problem or not. i not wish submit app sometime crashes. may course bad reviews. update crashes @try/@catch not helping. delegate update not helping either. i got such crash again , have no idea can or coursing it. wrap call try/catch.

Put Special words and symbols into an element with jquery -

i have text combine persian language , html elements , english words. want engilsh words , other symbols like( <> ) inside paragraph not other element(like pre) placed span tag. how jquery? before: در این قسمت تمرکز ما بر linq objects است که در پرس و جوی مجموعه ای از اشیاء در کد شما که رابط ienumerable<t> را پیاده سازی می کنند مورد استفاده<imge src="wp/contet/image.png"> قرار می گیرد. after: در این قسمت تمرکز ما بر <span>linq objects</span> است که در پرس و جوی مجموعه ای از اشیاء در کد شما که رابط <span>ienumerable<t></span> را پیاده سازی می کنند مورد استفاده<imge src="wp/contet/image.png"> قرار می گیرد. i use code $("p").each(function (){ var current_element = $(this); var old_value = $(this).text(); old_value = old_value.replace(/([a-za-z]+)/g, "<span>$1</span>"); current_element.html(old_value);}); but image hidden!

angularjs - angular $http.get error, unexpected token -

i starting test simple api using code: $http.get('/api/products?limit=10').then(function (response) { console.log(response.status); }); and error: syntaxerror: unexpected token { @ object.parse (native) @ fromjson ( http://localhost:8000/bower_components/angular/angular.js:1271:14 ) @ defaulthttpresponsetransform ( http://localhost:8000/bower_components/angular/angular.js:9460:16 ) @ http://localhost:8000/bower_components/angular/angular.js:9551:12 @ foreach ( http://localhost:8000/bower_components/angular/angular.js:340:20 ) @ transformdata ( http://localhost:8000/bower_components/angular/angular.js:9550:3 ) @ transformresponse ( http://localhost:8000/bower_components/angular/angular.js:10319:21 ) @ processqueue ( http://localhost:8000/bower_components/angular/angular.js:14792:28 ) @ http://localhost:8000/bower_components/angular/angular.js:14808:27 @ scope.$eval ( http://localhost:8000/bower_compon

c# - [Content_Types].xml <Override> element missing -

i'm trying create 2007+ excel document (.xlsx), using nothing .net 4.0 built-in classes . can't use third party libraries . actually it's done part, problem i'm facing that, package i'm creating seems fail on creation of [content_types].xml file, mean lacks <override> elements, , <default> elements created. i'm pretty sure problem @ point create relationships between packages, don't know how make work, , documentation , examples on package , zippackage classes surprisingly scarce. maybe i'm missing step...does 1 has clue? please this similar code produces excactly same problem public void createpackage() { string dir = @"f:\proyectos\excel_stackoverflow\windowsformsapplication1\windowsformsapplication1\resources"; uri file1_abs = new uri(string.format(@"{0}\1.xml", dir), urikind.absolute); uri file1_rel = new uri(@"/oddcontent/file1.xml", urikind.rel

sql - How to convert columns data in comma separated list -

Image
i in little strange situation. third party application front end doesn't allow user procedures or udf/scalar functions called. only option write sql , below how data looks. first pic has mistake last pid suppose 1 , second last 2. what need this, this can done using udf/cursor in advantage database server 9 don't have choice. don't know if possible. in sybase there exist function called list sort of work not sure here. application allow call built in functions. declare @table table ( pid integer, medicine varchar(10) ) insert @table values (1, 'abc') insert @table values (2, 'abc') insert @table values (1, 'def') insert @table values (2, 'def') insert @table values (1, 'ghi') select distinct a.pid, medicine = stuff((select ',' + b.medicine @table b a.pid = b.pid xml

lwjgl - OpenGL/JOGL throwing GL_INVALID_OPERATION -

i coding level editor game developing. use jogl , seem have problem. used lwjgl opengl calls , adjusting core opengl little confusing since lwjgl seem have simplified lot of stuff. so problem created model holds vao id/name , vertex count , model loader creates model , renderer. renderer not batched @ moment. work on later. problem opengl throws gl_invalid_operation error. not sure causing it. else including basic triangle drew test environment works, there seems problem somewhere in loader or renderer. here's code: model: public class joglmodel { private int vaoid; private int vertexcount; public joglmodel(int vertexcount, int vaoid) { this.vertexcount = vertexcount; this.vaoid = vaoid; } public int getvertexcount() { return vertexcount; } public int getvaoid() { return vaoid; } } loader: public class modelloader { private gl2 gl; private list<int[]> vaos = new arraylist<int[]>(); private list<int[]> vbos = new arraylist<int

html - select box work as toggle button in internet explorere while in other browser its working perfect -

i working in wordpress.i have created 1 dropdown.its working fine in chrome , mozilla it's not working in internet explorer. my website link . you can check dropdown on where want? tab under order now . its browser issue how can resolve problem?

Loading an Image Folder using Javascript -

i creating image manipulation tool in browser, , want people able select image folder use directory work from, , images available editing , displaying in html canvas. how can have user select folder on computer , load images inside it? what handling dropbox, box, google drive file, folder , drag & drop. if interested take this: http://extract.autodesk.io/ - sample not work images, 2d/3d models, not different images, change change file filters accordingly. source code posted here: https://github.com/cyrillef/extract-view.and.data.api where start: install flow.js - https://github.com/flowjs/flow.js https://github.com/cyrillef/extract-view.and.data.api/blob/master/www/index.html#l195 html portion https://github.com/cyrillef/extract-view.and.data.api/tree/master/www/js upload-flow.js - using flow.js library local file loaders.js - handle dropbox, box, google driver, etc... https://github.com/cyrillef/extract-view.and.data.api/tree/master/server flow-n

c# - Model Binding to a List MVC 4 -

is there pattern bind ilist of items view. seem having issues httppost. know phil haack wrote nice article dated , said might have fix mvc 4. this how if need form displayed each item, , inputs various properties. depends on i'm trying though. viewmodel looks this: public class myviewmodel { public list<person> persons{get;set;} } view(with beginform of course): @model myviewmodel @for( int = 0; < model.persons.count(); ++i) { @html.hiddenfor(m => m.persons[i].personid) @html.editorfor(m => m.persons[i].firstname) @html.editorfor(m => m.persons[i].lastname) } action: [httppost]public viewresult(myviewmodel vm) { ... note on post properties had inputs available have values. i.e., if person had .ssn property, not available in post action because wasn't field in form. note way mvc's model binding works, consecutive id's. doing conditionally hide item cause not bind data after 5th item, because onc

css - Having trouble aligning checkboxes in an HTML table -

i can't checkboxes in first column of table aligned on right. <form> <div> <table> <th>trail</th> <th>year</th> <th>mileage</th> <th>direction</th> <tr> <td> <label for="at">at</label> <input type="checkbox" id="at" name="at" value="yes"> </td> i'm using css code of: input [type=checkbox] { text-align: right; } what trying <table> <th>trail</th> <th>year</th> <th>mileage</th> <th>direction</th> <tr> <td> <input type="checkbox" id="at" name="at" value="yes"/> <label for="at">at&l

jsp - How to host java application in AWS EC2 linuix machine? -

Image
i developed java web application using eclipse (jsp,servlet), end using mysql, hosting application created linux machine in ec2 instance. on ec2 machine installed tomcat7 , mysql (database), deployed application in tomcat. directory structure in tomcat7 jdbc jar file put inside web-inf/lib. when accessing application remotely able access jsp page login page, in login page in putting login id , password after request transferred servlet page in taking login id , password. after calling database method check userid , password ; if password , login id correct transferring request page after servlet not able call database method , it's showing following output: output:

Unable to loop through elements inside an HTML string using JQuery 2.1.4 -

i using jquery function retrieve string containing html code , process locally. string is: var return_data = '<div><tr><td>blah</td><td>more blah</td></tr><tr><td>blah</td><td>more blah</td></tr><tr><td>blah</td><td>more blah</td></tr><span id="morerows">1</span></div>'; (i understand <tr> should come inside <table> , not inside <div> how need input reason , should inconsequential issue @ hand.) need loop through each <tr> , output contents console. trying this: $(return_data).find("tr").each(function(){ var mydata = $(this).html(); console.log(mydata); }); but above nothing; no output on console. sure, changed console.log() input "hello" , turns out, control isn't entering loop. possibly causing this? you may need following. wrap tr s table , loop through tr s

javascript - Openlayers3 markers are not showing up on os map -

while ago had on setting project need mark random building in nyc , display info building, long story short, have displayed openstreetmap using openlayers3, view fix astoria(queens, nyc). popup working markers not displaying. i have tried experiment , change geometry geometry: new ol.geom.point(ol.proj.fromlonlat([-73.927870, 40.763633])) to ol.geom.point(ol.proj.transform([-73.920935,40.780229], 'epsg:4326', 'epsg:3857')), and use transform instead fromlonlat , didn't displayed them, next thing src in styleicon , have download standard openlayers3 marker , tried add image folder src: 'img/icon.png' , didn't work to. can please me understand going on, why mine markers not displaying on map? this jsfiddle project, see popup working no markers. this jsfiddle updated , working now, markers displaying properly. /* create map */ // elements make popup var container = document.getelementbyid('popup'); var content

php - Laravel JWT and socialite plugin -

Image
i using laravel's jwt plugin user login/authentication. works fine users table: when registers website, entering password, email etc. in jwt, checking email(which unique) , password. i implement laravel's socialite plugin, enable login using google/facebook etc, using oauth2 . could tell me how use both ? i have set authentication middleware , checks authentication token(generated jwt plugin). not sure how work if login using g+ etc if using jwtauth https://github.com/tymondesigns/jwt-auth , supports socialite login. after socialite returns authenticated user, can lookup db email or create if not exists. can generate token using $token = jwtauth::fromuser($user) .more discussions can found @ link https://laracasts.com/discuss/channels/laravel/how-would-one-use-jwt-json-web-tokens-with-laravel-socialite

android - How to send a push notification request using XHR (Ajax) -

this command make request terminal, curl. works! however, have no idea how make same request via xhr (ajax). appreciated. curl --header "authorization: key=abc123" --header "content-type: application/json" https://android.googleapis.com/gcm/send -d "{\"registration\_ids\":[\"dfg456\"]}" this php code (you need have installed php5-curl package): // curl.php $data = ["registration_ids" => ["dfg456"]]; $datastring = json_encode($data); $curl = curl_init('https://android.googleapis.com/gcm/send'); curl_setopt($curl, curlopt_customrequest, "post"); curl_setopt($curl, curlopt_postfields, $datastring); curl_setopt($curl, curlopt_returntransfer, true); curl_setopt($curl, curlopt_httpheader, [ 'content-type: application/json', 'authorization: key=abc123', 'content-length: ' . strlen($datastring) ]); $result = curl_exec($curl); print_r($result); and

oauth 2.0 - Using Google Oauth2 webflow from iOS + Bonjour (Yikes!) -

i'm building ios app requires user authorize google api's via oauth2 using server side web flow. open uiwebview start oauth2 flow. this works fine in simulator because i'm setting redirect uri http://localhost , have server running on local machine. however, i'd test on device while still connecting server running on desktop. in order this, i've gotten app discover desktop address (a local subnet ip or bonjour address http://foo.local. ) connect server. however, google oauth2 flow saying cannot use local uri's redirect url. is there way around this? i'd not have mess local network setup or proxy requests ios device if @ possible. i'd ideally able use bonjour service discover server because have team of developers , our app lets choose server on local network you'd connect to. options? updated 19/03/2013 if server must have middle man, recon easiest way grab domain name , make server go public. www.godaddy.com or domain name pr

sql server - Run long SQL script for each database -

i have long sql script i'd run each of databases on 1 server. what's best way that? i found in research: exec sp_msforeachdb " if '?' in ('lib1','lib2','lib3') begin use ?; exec 'my_sp_long_sql_script' end " i tried needed me create sp in each library, kind of defeats purpose of loop. or how automate creating sp each library? all want run long_sql_script each of databases. use qualified name of stored procedure instead of relative name, retrieve whereever defined. how sql server works.

arrays - wordpress/php get_attachment_url based on uid and post parent id -

still learning , feel few steps away, appreciate help! have multiple child posts should each return attachment url based on child post uploaded. using array gather attachments uploaded. have somehow managed working, returns uploaded user, when return recent upload user. use of 'max' accomplish seems kick out error. fifth line bottom trouble spot. using post_date try , accomplish this, think id suffice well. thank input can provide. $exclude = array(); $args = array( 'order' => 'asc', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'post_parent' => $pid, 'numberposts' => -1, 'post_status' => null, ); $attachments = get_posts($args); foreach($attachments $att) $exclude[] = $att->id; $args = array( 'order

MYSQL trigger error at line -

Image
i'm trying triggers in mysql, got error "you have sql syntax error @ line 3". here code used, use maas; create trigger dummy_trigger after insert on dummy each row begin declare cmd varchar(255); declare result integer(10); set cmd = concat('python /home/yogaraj/for_sql.py'); set result = sys_exec(cmd); end; here error get, error code: 1064. have error in sql syntax; check manual corresponds mysql server version right syntax use near '' @ line 3 p.s: i'm trying execute python file located in home directory. i'm using mysql workbench. if use sql editor code have specify delimiter inner commands of create trigger code don't parsed individual statements. however can use trigger pane in table editor create trigger without decoration: the blue dot left in gutter shows statement ok.

jquery - Carousel not displaying images on desktop -

i have carousel working fine. when try reduce height of carousel, whole image not being displayed in carousel (on desktop). on mobile works fine. i don't want carousel cover whole page. please see output in full screen. example: @import url('https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css'); @import url('https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/themes/smoothness/jquery-ui.css'); #carousel-example-generic .carousel-inner .item { padding-bottom: 50%; } #carousel-example-generic .carousel-inner .first-item { height: 100%; width: 100%; background: url('http://p1.pichost.me/i/13/1359503.jpg'); background-size: cover; background-position: center; } #carousel-example-generic .carousel-inner .second-item { height: 100%; width: 100%; background: url('http://all4desktop.com/data_images/1920%20x%201200/4211692-abstract-color-background-picture-8016.jpg'); background-size: cove

android - Google cloud messaging Limit -

i know exists similar questions on site, confused because http , xmpp have difference limit: this page differences between http , xmpp . first limit [ xmpp & http ]: up 4kb of data second limit is: http : you can send out message 1000 users @ time. ( ref ) xmpp : for each sender id, gcm allows 1000 connections in parallel. ( ref ) you can send out message 1000 users @ time. if have more users you'll have send message multiple times server different users each time ( ref ) third limit is: http : couldn't found limit in android developer: there limit on how many messages can stored without collapsing. limit 100. if limit reached, stored messages discarded. when device online, receives special message indicating limit reached. application can handle situation properly, typically requesting full sync. ( ref ) xmpp : every message sent ccs receives either ack or nack response. messages haven't received 1 of these responses considere

asp.net mvc - Moving a database to another server for MVC C# application -

Image
i need move database local server another. moved data through ssms tool database. in application have 2 connection strings , tried exchange them not know how well. local db connection string: connectionstring="metadata=res://*/models.biuromodel.csdl|res://*/models.biuromodel.ssdl|res://*/models.biuromodel.msl;provider=system.data.sqlclient;provider connection string=&quot;data source=komputer\sqlexpress;initial catalog=defaultconnection;integrated security=true;multipleactiveresultsets=true;app=entityframework&quot;" providername="system.data.entityclient" my second server connection string: data source=db-mssql;initial catalog=inzs9776;persist security info=true;user id=inzs9776;password=xxxxxxx my local connection string auto generated ado.net when try exchange these connections string errors like: entity framework connection strings wrap normal sql server connection string, replace appropriate part, observe: metadata=res://*/mod

javascript - JS return a link to the page with certain ID in it -

is there way javascript find page id on , return link page? for example, if had paragraph tag id="test" on page called test.html javascript variable set link test.html because has id="test" on it. i have explained badly wondering if possible. thanks. example of code on test.html <p id="test"></p> it not perfect have found way (kind of) this. html: <input id="tosearch" type="text"> <button id="search" type="button" onclick="getsearch()">search ids</button> <p id="searchout"></p> <script src="search.js"> </script> <p hidden id=".id">examplepage.html</p> <p hidden id=".id2">examplepage2.html</p> javascript: function getsearch() { var search = document.getelementbyid("tosearch").value; search = "." + search; var page = document.getelementbyi

Magento Magic __set() method acting weird -

Image
magento set function not working other columns except faq_question,faq_answer. primary key keep on incrementing data not inserting columns. no matter whatever name gave column names keep on showing null. weird thing if manually populate filed , use getfaqjugaad() works. can values database. not set please help. thanks config.xml <?xml version="1.0" encoding="utf-8"?> <config> <modules> <gagan_faq> <version>0.2.0</version> </gagan_faq> </modules> <frontend> <routers> <faq> <use>standard</use> <args> <module>gagan_faq</module> <frontname>faq</frontname> </args> </faq> </routers> <layout> <updates> <faq> <file>gaganfaq.xml</file>

On button click create dynamic form, autofill the data and post on url in Angularjs -

i using angularjs, trying implement payment gateway in web application , stuck @ step so, @ first step have json data , request method , url on need post data. json data sample : { "key1" : value1, "key" : value2 } request method : post url : mypaymentgatewayurl my requirement is : when click on button make payment , should create dynamic form , auto fill data have in json , and post form data on url . process should happen under hood , should redirect payment gateway page. js function proceedtopayemnt: function(lead_id){ var payment = this; var payment_provider = this.payment_provider; var selected_payment_provider = this.selected_payment_provider; var user_profile = userprofile.user_profile; var answer = selected_payment_provider[payment_provider.psp_id]; if(answer == 1){ var lead_id = 145282; payment.offlinepayment(lead_id); }else{ var lead_id = 145282;

okhttp3 - How to send post parameters dynamically (or in loop) in OKHTTP 3.x in android? -

i using okhttp 3.x version. want post multiple parameters , add params in loop. know in version 2.x , can use formencodingbuilder , add params in loop , create request body. in 3.x , class has been removed. here current code : requestbody formbody = new formbody.builder() .add("param1", value1) .add("param2", value2) .build(); request request = new request.builder() .url("url") .post(formbody) .build(); now want add 5 params in loop i.e create request body building formbody in loop. wrote above, know how in okhttp version 2.x using version 3.x. any or guidance appreciated. thanks in advance here's how it: formbody.builder formbuilder = new formbody.builder() .add("key", "123"); // dynamically add more parameter this: formbuilder.add("phone", "000000"); requestbody formbody = formbuilder.build(); request r

Run Android app in different devices -

i run application in 2 different android devices. first arnova 9 g2 tablet , second sony xperia p. in arnova tablet application executed successfully, in sony xperia p phone, logcat displays me following error: /data/data/com.example.androidjnetpcaptest/interfaces: open failed: eacces (permission denied) fatal exception: main java.lang.nullpointerexception @ com.example.androidjnetpcaptest.interfacesfragment.oncreateview(interfacesfragment.java:35) my manifest xml file is: <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.androidjnetpcaptest" android:versioncode="1" android:versionname="1.0" > <uses-sdk android:minsdkversion="14" android:targetsdkversion="19" /> <uses-permission android:name="android.permission.change_wifi_state" />

.net - How do I use F#'s "with" assignment keywords with list properties in records? -

i'm trying learn basics of f#, , stumbled on "with" keyword seems extremely elegant way of returning new instances modified copies of original object (or record). might have misunderstood, though, or i'm getting syntax wrong. the compilation errors snippet below are error fs0001: expression expected have type string here has type string list , error fs0001: expression expected have type string list here has type string let nokids = { name = "alex something"; age = 23; kids = [] } printfn "%a" nokids let married = { nokids name = "alex newname" }; printfn "%a" married let withkids = { married kids = married.kids :: "john"} why not create new record instance "kids" list containing "john"? your "with" syntax fine, list construction syntax not ;) let withkids = { married kids = "john" :: married.kids } left side new element, right

android - Adds permissions to my app make not compatible with a lot of devices -

Image
i add (app update) permissions google play app <uses-permission android:name="com.android.vending.billing" /> <uses-permission android:name="android.permission.system_alert_window" /> <uses-permission android:name="android.permission.camera" /> <uses-permission android:name="android.permission.rec" /> <uses-feature android:name="android.hardware.camera" /> <uses-feature android:name="android.hardware.camera.autofocus" /> <uses-feature android:name="android.hardware.camera.front" /> i have 6 physical devices test. test app in 6 devices in device debug mode, upload app play store update app version. now app updated in play store. download play store in devices. in 3/6 devices can´t download app because in play store error device not compatible. if run app in devices manually installing apk app works correctly. why can´t download app in devices, app work ok on them?

android - PYthon, Deleting my DCIM File -

hey using qpython3 , want delete dcim-file using python, still doesn´t work. using motorola moto g 2. android 4.4: here´s code have change? import os path = os.environ["sdcard"] + "/dcim" if os.path.exists(path) == true: print(path, "exists.") os.remove(path) print("file succesfully deleted.") else: print(path,"file not existing.") keyerror: b "sdcard" thank yuór answers.

ruby - Is there an inversish method for `Array#include?`? -

i've wondered if there inverse method include? . given: str = "a" ary = ["a", "b", "c"] i can check if string in array rather if array contains string. like: str.in?(ary) i can't think of situation necessary, think direction rather other way around. there no such method in ruby itself, there such method in rails - object#in

java - How to store a list of strings in a single ZooKeeper znode using Curator -

for example, there znode path a/b/c/d . i'd store list of strings on znode. obviously, use join list of strings single string , serialize byte array this: curator.create() .creatingparentcontainersifneeded() .forpath(path, value.getbytes(standardcharsets.utf_8)); but looks not convenient. there other approach? the easiest/best way use apacheutils: byte[] input = serializationutils.serialize(yourlist); curator.create() .creatingparentcontainersifneeded() .forpath(path, input); and out: byte[] output = curator.getdata().forpath(path); list<string> newlist = (list<string>)serializationutils.deserialize(output); this rather general aproach work java objects.

php - Magento quantity issues -

when update attributes of product simple product quantity 1000 , configure product quantity 0 .will possible recover old quantity only if have backup of database previous change.

ios - How can i use custom UITableViewCell and UITableView in same xib -

Image
i want use custom uitableviewcell uitableview in same xib without creating uitableviewcell class? as can see bellow set identifier uitableviewcell , used this: - (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath { static nsstring *cellidentifier = @"customidentifier"; uitableviewcell *cell = [tableview dequeuereusablecellwithidentifier:cellidentifier]; if (cell == nil) { cell = [[uitableviewcell alloc] initwithstyle:uitableviewcellstyledefault reuseidentifier:cellidentifier]; } } but not working? add uitableviewcell *customcell property view controller (for example, file showusers.h)... @property (nonatomic, strong) iboutlet uitableviewcell *customcell; and connect custom cell in xib. use following code in cellforrow (for example, file showusers.m) : if (cell == nil) { [[nsbundle mainbundle] loadnibnamed:@"nibname" owner:self options:nil]; cell = self.customce

SQLITE3 + execute Insert -

this question has answer here: sqlite parameter substitution problem 7 answers trying execute insert item coming list:` item=u'sunil goyal' c.execute('''insert bpersons(person_name) values (?)''',item)` is simple enough, returns incorrect number of bindings supplied. current statement uses 1, , there 11 supplied. clearly instead of reading item 1 element, reading characters. there no problem earlier code returns list: >>> if meta[7]:#bcoz list empty item in meta[7]: print item sunil goyal rehan yar khan khan kae capital ashish shankar karthik reddy feroze azeez len(meta[7]) 7 any idea going wrong? insert looking iterable (documentation) , succeeds because unicode string iterable, should put inside of tuple

c++ - OpenCV copy bounded text area to new image -

Image
i new opencv , using code bound text area in image. after filtering contours , putting bounded rectangle vector<rect> copy these new image. mat large = img1; mat rgb; // downsample , use processing pyrup(large, rgb); mat small; cvtcolor(rgb, small, cv_bgr2gray); // morphological gradient mat grad; mat morphkernel = getstructuringelement(morph_ellipse, size(2, 2)); morphologyex(small, grad, morph_gradient, morphkernel); // binarize mat bw; threshold(grad, bw, 0.0, 255.0, thresh_binary | thresh_otsu); // connect horizontally oriented regions mat connected; //morphkernel = getstructuringelement(morph_rect, size(7, 1)); //morphologyex(bw, connected, morph_close, morphkernel); // find contours connected = bw; mat mask = mat::zeros(bw.size(), cv_8uc1); mat mask2; mat mask3; vector<vector<point>> contours; vector<vec4i> hierarchy; findcontours(connected, contours, hierarchy, cv_retr_ccomp, cv_chain_approx_simple, point(0, 0)); /*drawcontours(mask2, contours,

eclipse - JBossEAP / Wildfly error renaming temporary file -

Image
for past several days i've been experiencing error, while publishing either jboss eap 6.3 or wildfly 8.2 eclipse. error renaming d:\servers\wildfly-8.2.0.final\standalone\tmp\tmp9064011157118650757.jar d:\servers\wildfly-8.2.0.final\standalone\deployments\businessservice.war\web-inf\lib\spring-web-4.2.3.release.jar. may caused incorrect file permissions, or server's temporary deploy directory may on different filesystem final destination. may adjust these settings in server editor. the problem occurs when "add , remove..." projects server, try publish them, server can start. i've experienced issue on 2 different machines (home (wildfly) , work (jboss eap)). i'm using: windows 7 / 10 eclipse mars / luna jboss tools plugin 4.3 / 4.2 jdk 1.8.0.66 / 1.8.0.65 maven building maven eclipse , command line makes no difference. server configured deploy projects compressed archives. on both machines user has administrator rights , has full rig