Posts

Showing posts from May, 2013

python - Flask - A blueprint's name collision occurred -

i met issue. console said blueprint's name collision occurred think it's not belong flask-bootsrap problem. believe have config or unknown let me met issue. traceback (most recent call last): file "manage.py", line 10, in <module> app = create_app() file "d:\tony\github\private-home-flask-cuisine\db-example\app\__init__.py", line 79, in create_app init_extensions(app) file "d:\tony\github\private-home-flask-cuisine\db-example\app\__init__.py", line 46, in init_extensions extension.init_app(app=app) file "d:\tony\github\private-home-flask-cuisine\db-example\env\lib\site-packages\flask_bootstrap\__init__.py", line 137, in init_app app.register_blueprint(blueprint) file "d:\tony\github\private-home-flask-cuisine\db-example\env\lib\site-packages\flask\app.py", line 62, in wrapper_func return f(self, *args, **kwargs) file "d:\tony\github\private-home-flask-cuisine\db-example\env\lib\s...

reporting services - Automatically check Null checkbox in SSRS report -

Image
i working on ssrs report, below have set allow null value date selection. it's working fine while running on report builder not web page. have idea can issue? i wanted check null checkbox if there no value in date selection. please help!! found answer. need manually check report properties reporting service.

webstorm - JSDOC and Revealing Module Pattern -

i have functions return objects. wish put jsdoc definitions see property , methods on webstorm intellisense. how have write jsdoc of below functions? function myotherfunc() { return { a:'for eg string', b:12 } } function myfunc() { var prop = myotherfunc(); function mymethod() { alert( 'my method' ); } function myothermethod() { alert( 'my other method' ); } // explicitly return public methods when object instantiated return { somemethod : mymethod, someothermethod : myothermethod }; } this exact case handled in webstorm without jsdoc too, may use closure compiler type syntax this: /** * @return {{a: string, b: number}} */ function myotherfunc() { return { a:'for eg string', b:12 } }

ios - Download dSYM fails "Missing App Version" -

when try download dsym organizer, gives me error : missing app version app record “co.**” found matching version “1.0.3” build “10” not. i have enabled bitcode. it's swift app swift , objective-c pods. xcode version 7.2 (7c68) when right click on archive , @ it's package contents in finder, see dsyms folder. zipped , uplaoded crashlytics, still shows dsyms missing builds. has app.dsym dsyms uuids , others pods. is xcode bug? i see somene has posted similar question tvos on apple developer forum there no answers there. not allowed ask question there reason :p i haven't added build itunesconnect yet, necessary download dsyms? xcode download dsym from? have fact bundleid of form co.somestring , not co.somestring.someotherstring? guess not, i'm looking anything. is disabling bitcode way able dsym me? sounds dsym file doesn't match application binary , if app version number , build number correct. every time build (archive) app, new , differen...

encryption - What are the most effective ways to encrypt and protect my VBScript and VBA code? -

i need able run scripts , macros on client's system without revealing code. understand .vbe wouldn't much. there way around creating .exe? again, macros still exposed. obfuscate code? would moving python program soon, until then... right click vbaproject , click 'project properties' select protection tab , check 'lock project viewing' , set password. if wants view vba files need password first.

codeigniter not recognizing some validation -

so have simple registration form , weird reason, of validation works , doesn't. defined separate language folder language in conern i.e. arabic. works username, password , password confirmation, not rest of fields. going wrong? public function registration() { $this->form_validation->set_rules('fullname', 'الاسم الكامل', 'isset | required | alpha'); $this->form_validation->set_rules('username', 'اسم المستخدم', 'required'); $this->form_validation->set_rules('password', 'كلمة السر', 'required'); $this->form_validation->set_rules('passconf', 'إعادة كلمة السر', 'required'); $this->form_validation->set_rules('email', 'الايميل', 'required |email'); $this->form_validation->set_rules('city', 'المدينة', 'required'); ...

Python 3.5.1 reading from a file -

i have written maths quiz school , final task requires me take scores file , order them in various ways. performing thought simple task of writing file turned out not work. can please tell me what's missing this. with open("class a.txt", "r") f: list(f) how this: >>> open("class a.txt", "r") f: ... content = f.read() ... content_list = content.split('\n') # split on space/comma/... read content , split using whichever delimiter have used, whether enter (\n), comma or else.

rust - error: can't find crate -

i'm trying use this library . but, cargo build says this: compiling test v0.1.0 (file:///c:/path/to/project/test) src\main.rs:1:1: 1:28 error: can't find crate `jvm_assembler` [e0463] src\main.rs:1 extern crate jvm_assembler; ^~~~~~~~~~~~~~~~~~~~~~~~~~~ error: aborting due previous error not compile `test`. learn more, run command again --verbose. my cargo.toml this: [package] name = "test" version = "0.1.0" authors = ["yomizu_rai"] [dependencies] jvm-assembler = "*" src/main.rs this, , there no other sourcefiles. extern crate jvm_assembler; use jvm_assembler::*; fn main() {} i think cargo.toml not wrong, , src/main.rs has no room mistake. why can not rustc find jvm-assembler? how resolve? cargo can find crates name if on crates.io. in case need specify git url, see section on dependencies in cargo documentation.

javascript - Set up a mocha tests with sinon mocks, with mysql and bluebird promises -

i have project following setup: javascript es6 (transpiled babel), mocha tests, mysql access node-mysql , bluebird promises. maybe using bluebird babel/es6 first issue, let's explain situation , problem: my dbrepository object: let xdate = require('xdate'), _ = require('lodash'); const promise = require("bluebird"); const debug = require('debug')('dbrepository'); class dbrepository { constructor(mysqlmock) { "use strict"; this.mysql = mysqlmock; if( this.mysql == undefined) { debug('init mysql'); this.mysql = require("mysql"); promise.promisifyall(this.mysql); promise.promisifyall(require("mysql/lib/connection").prototype); promise.promisifyall(require("mysql/lib/pool").prototype); } this.config = { connectionlimit: 10, driver: 'pdo_mysql', host: 'my_sql_container', port: 3306, user...

html - CSS Selector only selects the first row -

i parsing html page , have long css selector (i can't figure out shorter one, because page stupid). should select tr in table, selects 2nd row... missing? the selector: body > table:nth-child(1) > tbody:nth-child(1) > tr:nth-child(2) > td:nth-child(1) > table:nth-child(1) > tbody:nth-child(1) > tr:nth-child(3) > td:nth-child(1) > table:nth-child(1) > tbody:nth-child(1) > tr:nth-child(8) > td:nth-child(1) > table:nth-child(4) > tbody:nth-child(1) > tr:nth-child(2) > td:nth-child(1) > table:nth-child(1) > tbody:nth-child(1) tr:not(:first-child) the page has multiple tables inside each other, first 90% not matter, after selecting table want work with, follow " [space]tr:not(...) ", should select descending rows, shouldn't it? example html page (cannot link it, need login access it): http://pastebin.com/gprxtvzz after selector selects table want (in selector ...> tbody:nth-child(1) tr:not(:first-child)...

Guice injection not working with Dropwizard -

i new dropwizard , guice, followed tutorial : dropwizard , guice integration . when executing main method, i've got error: default configuration has error: * message can not found (was null) so guess guice injection did not work. have exact same code tutorial, except don't have plugins part in pom.xml , , have line in main method: new serviceapplication().run(new string[] {"server"}); instead of: new serviceapplication().run(args); am missing something? there must add? thanks. yes, have missed important bit. article gives following command running dropwizard app (please note string after server option, points file configuration options): $ java -jar target/dropwizardguice-1.0-snapshot.jar server config.yml also earlier in article there description of relation between configuration .yml file , guice : now need bit of glue code takes message configuration file make available guice. by changing code in main method to: ...

windows - Qt link static built lib -

i have project targeted lib , 1 app . first project builds static , dynamic (shared) lib. second project links dynamic lib, can't link static one. many error messages lnk2001: unresolved external symbol appear. app.pro: template = app config += static link_prl ordered defines += qt_nodll qt += core gui network xml ... # --- link quazip lib shared --- #libs += -l$$quote(c:/qt/quazip/build-quazip-0.5.1-qt_4_8_3_shared-debug/quazip/debug) -lquazip #pre_targetdeps += $$quote(c:/qt/quazip/build-quazip-0.5.1-qt_4_8_3_shared-debug/quazip/debug/quazip.lib) # --- link quazip lib static --- libs += -l$$quote(c:/qt/quazip/build-quazip-0.5.1-qt_4_8_3_static-release/quazip/release) -lquazip pre_targetdeps += $$quote(c:/qt/quazip/build-quazip-0.5.1-qt_4_8_3_static-release/quazip/release/quazip.lib) directories content: directory of c:\qt\quazip\build-quazip-0.5.1-qt_4_8_3_shared-debug\quazip\debug 04.04.2013 11:01 <dir> . ...

python - Django - Celery Worker won't start; finds multiple errors in apps -

so i've been working on django project months now, , while set test installation of celery worked fine. since time, i've done few things, upgraded third-party apps , django 1.9. today wanted implement celery again , couldn't start. it's throwing multiple errors in apps django isn't complaining about. it's ignoring apps i've overriden. my file structure src/ apps/ core/ settings/ production.py development.py __init__.py apps.py celery.py wsgi.py ... app1/ app2/ ... manage.py my celery.py from celery import celery os.environ.setdefault('django_settings_module', 'core.settings.development') django.conf import settings app = celery('core') app.config_from_object('django.conf:settings') app.autodiscover_tasks(lambda: settings.installed_apps) using command: celery --app=core worker --loglevel=info i...

javafx - Get resource path from another java lib res and itself res -

(ive done already(almost) code looks shiet) i'm trying path lib(my core) res so basicly in lib(my core) write createwindow(null, "login", "view/login.fxml", "view/core.css"); this load files in res -> view (so working) and in other jar uses lib(my core) createwindow(getclass(), "login", "login.fxml", "core.css"); this load files in src -> us.cweye.example (where main file is) that trigger function private boolean isself = false; public void createwindow(class<?> clazz, string windowid, string fxmlpath, string stylepath) { try { if(clazz == null) isself = true; parent root = fxmlloader.load((clazz == null) ? classloader.getsystemresource("res/" + fxmlpath) : clazz.getresource(fxmlpath)); scene = new scene(root); if(stylepath != null) { scene.getstylesheets().add((isself == false) ? clazz.getresource(stylepath).toexternalform()...

python - Get attribute is None in BeautifulSoup -

i'm trying api key website below, having issues locating key within html. api_key below comes null every time run code, though i've followed other examples explicitly. issue parser i'm using? site_url = "https://developer.forecast.io/" site_html = urllib2.urlopen(site_url).read() site_soup = beautifulsoup(site_html,"html.parser") api_key = site_soup.find("input",{"id":"api_key"}) edit: html i'm looking at: <div class="row"> <div class="span10" id="api_keys"> <div class="well"> <h2>api key</h2> <span class="input-append"> <input id="api_key" type="text" value="47580427a2916a5059085b6a65fc3990"

MS Access "Online Meeting" "Unknown Network error." When Opening -

Image
so have msaccess db scheduled open , run every 3 minutes. when opens, dialog window pops shown . through task manager , services windows, able see being thrown msaccess . online find 2 references issue, unfortunately answer blocked unless subscribe. ref 1 ref 2 . process continue hit "ok", defeats reason automating it. know and/or how stop this? edit: should note looked through of msaccess menu's , settings , not find appeared related this. <event xmlns="http://schemas.microsoft.com/win/2004/08/events/event"> <system> <provider name="microsoft office 14 alerts" /> <eventid qualifiers="0">300</eventid> <level>4</level> <task>0</task> <keywords>0x80000000000000</keywords> <timecreated systemtime="2016-02-05t14:53:52.000000000z" /> <eventrecordid>1654</eventrecordid> <channel>oalerts</channel> <computer>opti-780-ljs2...

pycharm - why does my function is returning data type None??: Python datatype None -

this python code printing absolute number. function returning type none . not getting have done wrong. please me. def n(num): if num<0: return (num*-1) no = input("enter number: ") print "absolute value is: " print n(no) def n(num): if num<0: return (num*-1) else: return num no = input("enter number: ") print "absolute value is: " print n(no) writing else statement return num >= 0 thank :)

c - epoll: What is appropriate behavior, when I get EPOLLOUT and EPOLLHUP in the same event? -

first time epoll() user. i'm using epoll write simple http client, connect nginx web server on host control. here sequence of events looking at i shutdown (server) host i start client, socket() , epoll_create1() , epoll_ctl() , connect() , epoll_wait(epollout) believe correct i startup host once web server starts up, epoll_wait() completes , returns 1 event. usually, event returned epoll_wait() epollout . however, every 5th try or so, epollout|epollhup . , i'm not sure do. is proper nginx ? epollout|epollhup make sense? should ignore epollhup , , send() data , check return value? feels strange ignore hup ... new epoll , know stuff happens time. all want client do, send plain ole http request, , recv response. thanks! edit completely rewrote question since initial posting. if not so-approved, apologies.

sql server - SQL summing a substring? -

i'm trying write sql statement take first letter of location(as aisle) , sum capacity letter another issue i'm joining table each location lists multiple times each piece of stock in location. edit... ok seems need sum capacity on distinct locations? (not distinct capacity) sql far select substring(table_loc.location,1,1) 'aisle', sum(table_loc.capacity) 'aisle capacity', sum(table_stock.locationqty) 'units in aisle' table_loc inner join table_stock on table_loc.location = table_stock.location group substring(table_loc.location,1,1) table_loc location capacity a001 3 a002 2 b001 2 b002 2 table_stock item location locationqty shirta a001 1 shirtb a001 1 pantsa a002 1 pantsb a002 1 widgeta b001 1 widgetb b001 1 hata b002 1 hatb b002 ...

jquery - Javascript - Dynamic .filter() - Json File -

i need hint. i'm not programmer, take chances automating processes, excuse me if question basic. i'm working google maps api , , @ point need accomplish filter target content of infowindow . i have map various filters, apply markers , should extend content of infowindow . i have json contents of infowindow , , applying filter way: (ards = json file) var as=$(ards).filter(function (i,n){ return n.erb===marker.gettitle(); }); (var i=0;i<as.length;i++) { .... } ok, works, need add more variables filter. i own these markers filters. var cluster = $( "#cluster-select" ).val(); var client = $('#cli_re-select').val(); var type_cli = $('#type_cli-select').val(); var type_recla = $('#type_recla-select').val(); i put 4 exemplify, has around 10 filters. the filters independent, can select 1 @ time. i made way: var combine = []; combine = []; if(cluster !== '0') { combine.push('&& n.desc_cluster =...

php - PayPal IPN Listener failing on postback -

first time here , stumped after days of trying resolve problem. here's background problem... i have paypal ipn listener script. in fact have 2 versions of because first didn't work tried didn't work either. both of ipn listener scripts obtained paypal... paypal_notifya.php from... developer . paypal . com /docs/classic/ipn/gs_ipn/ the script stops at... fputs($fp, $header . $req); <?php require_once("../lib/phpmailer/phpmailerautoload.php"); ?> <?php // paypal ipn // send empty http 200 ok response acknowledge receipt of notification header('http/1.1 200 ok'); // assign payment notification values local variables $invoiceid = $_post['invoice']; $paymentstatus = $_post['payment_status']; $productid = $_post['item_number']; $paymentamount = $_post['mc_gross']; $paymentcurrency = $_post['mc_currency']; $txnid = $_post['txn_id']; $receiverem...

ios - SKMaps and ViaPoints/WayPoints -

i have questions regarding skmap sdk functionality. after creating route , starting navigation process, there anyway of capturing waypoint / viapoint directed towards? after calculating route, seems routeinformation.viapointsonroute empty. calculateroute(route) automatically generate list of viapoints ? in sknavigationdelegate protocol reference see following event functions : – routingservice:didenterviapointarea: – routingservice:didreachviapointwithindex: – routingservice:didexitviapointarea: however, these methods never seem called. not sure if called if viapoints programmatically added. also when routeservice fires currentadvice , nextadvice methods, skrouteavice location appear empty well. is there anyway provide me simple example of how create , capture current waypoint position , next waypoint position while in navigation? essentially, trying calculate direction current location next waypoint . below rough example of route , navigation initiation code: ...

Formal Languages - Grammar -

i taking formal languages , computability class , having little trouble understanding concept of grammar. 1 of assignment questions this: take ∑ = {a,b}, , let n a (w) , n b (w) denote number of a's , b's in string w, respectively. grammar g productions: s -> ss s -> λ s -> asb s -> bsa generates language l = {w: n a (w) = n b (w)}. 1) language in example contains empty string. modify given grammar generates l - {λ}. i thinking should modify condition of l, like: l = {w: n a (w) = n b (w), n a , n b > 0} that way, indicate string never empty. 2) modify grammar in example generate l ∪ {a n b n+1 : n >= 0}. i not sure on how one. should mean make 1 more condition in grammar, adding s -> asbb? any explanation these 2 questions appreciated. i'm still trying figure these grammar stuff out not sure answers. 1) question modifying grammar obtain new language; don't modify directly language… your grammar generates emp...

python - Not able to identify AWSAccessKey while creating HIT -

i trying create amazon mechanical turk hit using python script , following issue. verified registeration in amt requester account , seems fine. let me know how proceed. following error : raise mturkrequesterror(response.status, response.reason, body) boto.mturk.connection.mturkrequesterror: mturkrequesterror: 200 ok <?xml version="1.0"?> <createhitresponse><operationrequest><requestid>aec5b15f-0ba9-413f-9443-1555152315c7</requestid><errors><error><code>aws.notauthorized</code> <message>the identity contained in request not authorized use awsaccesskeyid (1454688645360 s)</message></error></errors></operationrequest></createhitresponse> it access key. check following cases make sure correct: a. 1 of common errors have different username , password mturk , aws accounts. check here more information. important amazon mechanical turk requester account must created ...

Defining correctly Nginx server block for two django apps and no server_name -

i have been following digital ocean tutorial how serve django applications uwsgi , nginx on ubuntu 14.04 , later can deploy own django application using nginx+uwsgi. in tutorial create 2 basic django apps later served nginx. have tested apps working using django server , uwsgi alone. when passed nignx part ran problem, dont have server_name have ip work with, , tried differentiate between django apps using port number. the default nginx server (xxx.xxx.xxx.xxx:80) responding correctly, when try access django apps using (xxx.xxx.xxx.xxx:8080 or xxx.xxx.xxx.xxx:8081) 502 bad gateway. i think have problem in way or logic defining listen inside server block. correct way of doing this, or might doing incorrectly. this server blocks (in sites-enabled): firstsite app server { listen xxx.xxx.xxx.xxx:8080; #server_name _; location = /favicon.ico { access_log off; log_not_found off; } location /static/ { root /root/firstsite; } location / { ...

android - How can I make a listview transparent, but the items opaque? -

i have listview transparent, however, want items opaque, how can acheive that? here's listview. <linearlayout android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="0.29" android:alpha="0.7" android:background="@drawable/icon_list_left_border"> <listview android:id="@+id/product_info_list_colors" android:layout_margintop="48dp" android:layout_marginbottom="16dp" android:layout_width="match_parent" android:layout_height="match_parent" android:scrollbars="vertical" android:smoothscrollbar="true" android:cachecolorhint="#00000000" android:divider="@android:color/transparent" android:dividerheight="20dp"> </listview> </linearlayout> edit : can't set background ...

javascript - Set the ID of View and TextView in titanium appacelerator -

i'm creating create randomly textareas need know textarea pressed user. is there way enter unique id each textarea? how create textview: var txtarea = ti.ui.createtextarea({ color : '#000', backgroundcolor : 'transparent', font: { fontsize : 28, fontweight : 'normal', }, editable : false, textalign : 'left', value : a[i], textalign : 'center', top : '30%', width : '100%', height : '100%' }); i tried put "id : i", textareas returned same id. it's not suggested add custom properties titanium proxies. here (based on guess of try achieve): for(var = 0; < 10; i++){ var txtarea = ti.ui.createtextarea({ value : "test n " + i, textalign : 'left', textalign : 'center', top : '30%', width : '100%', height : '100%' }); (function(){ var id = i; ...

Rails 4 Koala: Webhook when publish in Facebook -

im building social network, users can connect accounts facebook , tweeter, should able select option: "synchronize publications" if select option need synchronize publications facebook, when publish in facebook should published in app. think can achieved through web hook, can't find useful in web... any idea? facebook has entire section dedicated webhooks: https://developers.facebook.com/docs/graph-api/webhooks adding subscriptions: https://developers.facebook.com/docs/graph-api/reference/v2.6/app/subscriptions and viewing subscribed apps: https://developers.facebook.com/docs/graph-api/reference/page/subscribed_apps

jquery - Display json array from given url -

im new json , ask question after couple of days of searching without result. have url contain json array, know how display table prepered keys. e.g: username , password , email first table row , need fill data. im use jquery due lack of knowlage in ajax. when don't alert here, request failed. why there .fail() method: $.getjson( "test.js", { name: "john", time: "2pm" } ) .done(function( json ) { console.log( "json data: " + json.users[3].name ); }) .fail(function( jqxhr, textstatus, error ) { var err = textstatus + ', ' + error; console.log( "request failed: " + err); }); take @ documentation . when want retrieve json data post, cannot use $.getjson : load json-encoded data server using http request. try instead : $.post( "justaurl") .done(function( data ) { var json = json.parse(data); alert( json.users[3].firstname ); }) .fail(function( jqxhr, textstatus, error ) {...

Can't add custom field from registration form in AngularJS + Stormpath -

i want add custom field during new user registration shows error message: not configured registration field. but documentation on page https://docs.stormpath.com/angularjs/sdk/#/api/stormpath.spregistrationform:spregistrationform states: any form fields supply not 1 of default fields (first name, last name) automatically placed new account's customa data object. the code use: <form ng-submit="submit()"> <div class="form-group"> <input type="text" class="form-control" placeholder="first name" ng-model="formmodel.givenname" required="" ng-disabled="creating"> </div> <div class="form-group"> <input type="text" class="form-control" placeholder="last name" ng-model="formmodel.surname" required="" ng-disabled="creating"> </div> <div class="form-gro...

php - CakePHP: Filter view on multiple criteria only returns one result -

i'm trying build rudimentary search feature cakephp application. there 2 fields need searchable. have code in controller take 2 search values form: $options = array('model.id' => $this->request->data['model']['id'], 'model.field2' => $this->request->data['model']['field2']); $this->set('views', $this->paginator->paginate('model', $options)); both of these inputs come dropdown lists , both required. right now, when run search, returns 1 result, first selectable option in field2 dropdown, so: id field2 1 value1 or id field2 2 value1 if search other value in field2, no result. if comment out dropdown field2 , search id, rows id (around 500, expected). why result set empty when search on id , value other value1 in second dropdown? the $options array passed argument paginate can contain multiple keys, similar ones used model->find() first build $conditi...

timeline - Using SPDY large value stalled/bloccking in chrome dev tools -

Image
why when using spdy connection server google chrome timeline indicates huge part of request being spent stalled/blocking ? i thought possible multiple requests processed on single spdy connection, , time stalled should much, less result: connection time should practically zero.

python - reading and writing files for a food processing company -

i working on python project food processing company trying calculate total sales year. python has read text file divided categories split commas. first category type of product, can cereal, chocolate candy etc produced company. second category brand of said product, example, kaptain krunch cereal or coco jam chocolate. third category sales last fiscal year(2014) , last category sales fiscal year(2015). note sales fiscal year 2015 calculated. 2014 has no use in program there. here how text file looks like. name product.txt cereal,magic balls,2200,2344 cereal,kaptain krunch,3300,3123 cereal,coco bongo,1800,2100 cereal,sugar munch,4355,6500 cereal,oats n barley,3299,5400 sugar candy,pop rocks,546,982 sugar candy,lollipop,1233,1544 sugar candy,gingerbud,2344,2211 sugar candy,respur,1245,2211 chocolate,coco jam,3322,4300 chocolate,larkspur,1600,2200 chocolate,mighty milk,1234,2235 chocolate,almond berry,998,12...

android - App name not shown -

i've set name of app this <application android:allowbackup="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:supportsrtl="true" android:theme="@style/apptheme"> <activity android:name=".mainactivity" android:label="@string/title_activity_main" android:theme="@style/apptheme.noactionbar"> <intent-filter> <action android:name="android.intent.action.main" /> <category android:name="android.intent.category.launcher" /> </intent-filter> </activity> </application> and value off string it's correct name app shown name of main activity... mainactivity instead of app name see line in activity declaration remove line if don't want ...

opencv - Kinect + Python - Fill depth for shadows -

the kinect camera returns depth image whole view. due way image captured, small areas invisible camera. areas 2047 returned. i want fill areas value left of them - value area. have depth numpy uint16 array. trivial solution be: for x in xrange(depth.shape[1]): y in xrange(depth.shape[0]): if depth[y,x] == 2047 , x > 0: depth[y,x] = depth[y,x-1] this takes around 16 seconds execute (raspberry 2) per 640 x 480 frame. i came solution using indexes: w = numpy.where(depth == 2047) w = zip(w[0], w[1]) index in w: if depth[index] == 2047 , index[1] > 0: depth[index] = depth[index[0],index[1] - 1] this takes around 0.6 seconds execute test frame. faster still far perfect. index computation , zip take 0.04 seconds, main performance killer loop. i reduced 0.3 seconds using item(): for index in w: if depth.item(index) == 2047 , index[1] > 0: depth.itemset(index, depth.item(index[0],index[1] - 1)) can improved further using python (+numpy/open...

python - Strange overlap bug using matplotlib's plot_trisurf -

Image
i have got trisurf plot using matplotlib in python script. outside surface z array contains nan. min= np.nanmin(z) max= np.nanmax(z) fig = plt.figure(figsize=(16, 16)) yax = fig.add_subplot(1,1,1, projection='3d') yax.set_xlabel(...) yax.set_ylabel(...) yax.set_zlabel(...) ysurf = yax.plot_trisurf(x, y, z, vmin=min, vmax=max, linewidth=0.1, cmap=plt.cm.jet, alpha=0.5, antialiased=true) yax.set_zlim([min, max]) fig.tight_layout() i discovered bug overlapping of surface: strange overlapping when rotate 3d-plot surface seems displayed correctly: rotated i can't figure out, wrong here? i'm using matplotlib 1.5.1.

=+ Python operator is syntactically correct -

i accidentally wrote: total_acc =+ accuracy instead of: total_acc += accuracy i searched net , not find anything . happened, why python think mean typing? computers trust much. :) this same if total_acc = -accuracy , except positive instead of negative. same total_acc = accuracy though, adding + before value not change it. this called unary operator there 1 argument (ex: +a ) instead of 2 (ex: a+b ). this link explains little more.

ios - - (void)applicationWillEnterForeground: -

maybe assist me. when app launched first time uialertcontroller message appears , asks user if need goto settings app. using following code. dispatch_async(dispatch_get_main_queue(), ^{ [[uiapplication sharedapplication] openurl:[nsurl urlwithstring:@"prefs:root=wi-fi"]]; }); upon return app same uialertcontroller message appears, using code in viewdidload: -(void)viewdidload { if (launched == no) { launched = yes; defaults = [nsuserdefaults standarduserdefaults]; [defaults setbool:launched forkey:@"boolkey"]; [defaults synchronize]; code uialertcontroller. } else if (launched == yes) { [self dosomething]; } } it appears bool value not being saved when settings in info.plist application not run in background: set yes, if application not run in background: set no else statement executed. not because app suspended , when launched again need original message appear , not, app restored last state. ...

regex - Python Comparing two Strings and Determining 'Uniqueness' -

the title mess bear me while explain question in more detail (or really, it's set of semi-related questions). i'm compiling list of words large text file , storing them in dictionary keys respective occurrences (integers) value. want apply several processes consolidate dictionary 'related' words lumped together. first operation plurals. see no reason have 'cat' , 'cats' key in dictionary. same car vs. cars , book vs. books , on. want write function (upon seeing new word not in dictionary) checks see if new word plural form of key in dict (and vice versa). if new_word ends s -> check dict key matches new_word[:-1] else if new_word not end in s -> check dict new_word + 's' is there better way approach problem? (i have handle edge cases plurals...this general @ point) on same topic, if want determine if words similar consulting database of known suffixes , prefixes , seeing if new_word seen word suffix or prefix attached. i use n...

aggregation framework - mongodb string to number -

i have document in mongodb 2.6.11 including array of string i.e. { cpu: [ '0', '2', '4', '0', '0', '2', '0', '4', '0' ], con: [ '232', '2396', '17082', '339', '5', '1738', '503', '4', '0' ] } how convert them numbers without saving in actual collection can use them in $project (aggregation) , later use in $group calculate $avg? db.checkpointstest3.aggregate([ {$unwind: "$cpu"}]) i have correct $group , works on numbers not strings currently aggregation pipeline not allow type conversion, see jira ticket. if changing type of field not option, either have fall on map reduce query or write own aggregation using foreach .

javascript - Trying to pull table values from a selected check box correctly -

i trying pull columns table if checkbox selected. here table contains checkbox called 'selectedsched' <tbody style="overflow-y: scroll; "> <c:foreach var="row" items="${updresults}"> <c:set var="sched" value="${row.getschedule_number()}" /> <c:set var="eftyear" value="${row.geteft_contract_year()}" /> <c:set var="eftstatus" value="${row.getstatus()}" /> <c:set var="schedcombo" value="${sched}${eftyear}" /> <fmt:formatnumber var="schedtotl" value="${row.gettotal_amount()}" pattern="$##,###,##0.00"/> <tr> <td align="center"> <input style="width:50px;" type=...

groovy - Gradle Thrift Plugin by Example -

please note: although question calls out gradle thrift plugin , believe general gradle question battle-weary gradle veteran me with. i new apache thrift , quasi-familiar gradle (2.4.x). trying gradle thrift plugin work , encountering few issues gaps in gradle knowledge. here sample project: thrifty if clone , run ./gradlew compilethrift , you'll see gradle thrift readme says do. generates source under build/generated-sources/thrift/* . i compile , build source. java source generates, i'd produce jar library... so what's best way this? should copy, say, build/generated-sources/thrift/gen-java/* src/main/java , , run build ? so, should able add following build script compilethrift { outputdir = file('src/generated/thrift') } sourcesets { main.java.srcdirs += 'src/generated/thrift/gen-java' } so thrift plugin generate folder under src (i prefer this, source code being in build) and can add these sources directories jav...