Posts

Showing posts from January, 2015

javascript - WebGL performance issues with retina Macbook Pro -

i have webgl application developing , have run against pretty serious performance concerns retina display macbook pros. testing on 15 inch macbook intel iris pro gpu, rendering @ full resolution, gives me canvas resolution of 3810x2030 full screen chrome window. application renders 100k vertices per frame. now, when set application run device pixel ratio of 1 (meaning no retina scaling), performance of application solid, never falls below 60 fps, image quality unacceptable. when switch retina's device pixel ratio 2, image quality dramatically improves, framerate plummets around 20-30 fps. now, i'm no stranger gpu programming, reasons why happening obvious me. wondering is, has out there found workarounds or ways optimize webgl drawing ultra high resolution displays bad gpus retina macbook pro? there non-obvious tips or tricks people have found through trial , error resolve issue or @ least make better? any appreciated. thanks. edit: small update interesting...

ios - UIViewController: adjust contraints of xib -

Image
in project defined xib , viewcontroller contain xib. class feeddetailviewcontroller: uiviewcontroller, feeddetaildelegate { var feeddetail: feeddetail! override func viewdidload() { super.viewdidload() feeddetail = (nsbundle.mainbundle().loadnibnamed("feeddetail", owner: self, options: nil)[0] as? uiview)! as! feeddetail feeddetail.delegate = self; self.view.addsubview(feeddetail) self.adjustcontraints() } func adjustcontraints() { feeddetail.sizethatfits(self.view.frame.size) var constraint = nslayoutconstraint(item: feeddetail, attribute: nslayoutattribute.bottom, relatedby: nslayoutrelation.equal, toitem: view, attribute: nslayoutattribute.bottom, multiplier: 1, constant: 0) view.addconstraint(constraint) constraint = nslayoutconstraint(item: feeddetail, attribute: nslayoutattribute.top, relatedby: nslayoutrelation.equal, toitem: view, attribute: nslayoutattribute.top, multiplier: 1, constant: 0) v...

android - NullPointerException: Google Spreadsheet, doInBackground -

i nullpointerexception , can't figure out what's wrong. i've tried bring necessary code. have 3 classes: mainactivity, googlecommunicator , customadapter. error caused following in customadapter: mactivity.updatebought(position, "1"); the errors line 283 , 277 are: 283: url listfeedurl = mworksheet.getlistfeedurl(); 277: private class updatebought extends asynctask<void, void, string> the logcat: 3011-3026/com.example.andb.apop_l6_google_communicator_app e/androidruntime﹕ fatal exception: asynctask #1 process: com.example.andb.apop_l6_google_communicator_app, pid: 3011 java.lang.runtimeexception: error occured while executing doinbackground() @ android.os.asynctask$3.done(asynctask.java:300) @ java.util.concurrent.futuretask.finishcompletion(futuretask.java:355) @ java.util.concurrent.futuretask.setexception(futuretask.java:222) @ java.util.concurrent.futuretask.run(futuretask.java:242) @ android.os.asyn...

sql update - How to get number of locks acquired by my `MySQL` Query? -

how number of locks acquired mysql update query? example query : update employees set store_id = 0 store_id = 1; finally, able number of locks acquired following set of mysql statements. begin; update employees set store_id = 0 store_id = 1; show engine innodb status\g commit; edit : we can lock details using following query current transaction. select * information_schema.innodb_locks;

How to convert array to this pointing array in Perl? -

i trying use package normalize , have data in arrays ( @x ), not in pointing arrays package requires normalization. wanted data format in pointing array hash my %xx = ('1' => 22.595451, '2' => 20.089094, '3' => 17.380813); current data format my @x = qw/22.595451 20.089094 17.380813/; i.e. ('22.595451', '20.089094', '17.380813') . how can convert data pointing data-structure? you can pass array reference instead of using hash. this use strict; use warnings; use normalize; @x = qw/ 22.595451 20.089094 17.380813 /; $norm = normalize->new(round_to => 1e-16); $norm->normalize_to_max(\@x); print "$_\n" @x; which normalize contents of @x in place

How to check which App's scopes have been granted access and which not -

this working scenario: have created , published app on google apps marketplace / chrome web store. let's users did install app on own domains , using app. when installed app on domains granted data access scopes declared app, example scopes , b. now let's went on improving our app adding new feature , released it. new feature requires add scope c app configuration. let's add scope c , save new configuration. for users have installed app, scope c "new" , needs granted access, while , b granted. now need find way notify users need grant access newly added scope before going on using app (otherwise end users may incur in issues). the question is: is there way programmatically detect specific domain installation of our app scopes have been granted access , ones not? assuming have access token can use oauth2.tokeninfo() determine scopes given token for.

python - Exporting plain text header and image to Excel -

i new python, i'm getting stuck trying pass image file header during dataframe.to_excel() portion of file. basically want picture in first cell of excel table, followed couple of rows (5 exact) of text include date (probably datetime.date.today().ctime() if possible). i have code output table portion as: mydataframe.to_excel(my_path_name, sheet_name= my_sheet_name, index=false, startrow=7,startcol=0) is there way output image , text portion directly python? update: for clarity, mydataframe exporting meat , potatoes of worksheet (data rows , columns). have starting on row 7 of worksheet in excel. header portion trouble spot. i found solution , of help. the simple answer use xlsxwriter package engine. in other words assume image saved @ path /image.png . code insert data excel file image located @ top of data be: # importing packages , storing string image file import pandas pd import xlsxwriter import numpy np image_file = '/image.png' # cr...

sequelize.js - How to insert from select in sequelize -

we use sequelize on node js have resourse file. file has attribute userid. need: copy same files (by filesid) user. if use sql need do: insert files (name, link, userid) select name, link, 5 files id in (1,2,3,4,10) but how on sequelize not have ideas... custom sql query. try this: file.findall({ where: {id: {$in: [1,2,3,4,10]}} }).then(function(filesseq)){ //make file objects userid=5 var files = filesseq.map(function(fileseq){ var file = fileseq.tojson(); file['userid'] = 5; return file; }); return file.bulkcreate(files) }).then(function(files){ //do created files });

c# - Check the type of a class -

i have following c# classes: public class reply<t> { } public class ok<t> : reply<t> { } public class badrequest<t> : reply<t> { } and on method receives reply need check type ok or badrequest or ... like: public static string evaluate(reply<t> reply) { switch (typeof(reply)) { case typeof(ok<t>): // break; // other cases } } but error type or namespace name 'reply' not found (are missing using directive or assembly reference?) any idea how test type of reply? well, typeof() works on types (as in typeof(int) ), not variables , need reply.gettype() instead. but you'll find case expressions require literal values, you'll need convert if-else block: public static string evaluate<t>(reply<t> reply) { if(reply.gettype() == typeof(ok<t>)) { // } else { // other cases } } or if(reply ok<t>) { // } ...

ios - Is there a way to save an array within an array using swift? -

is possible save array of names within array? example, lets have 2 car companies, toyota , honda. , lets want create array within car company array of cars make. example... var arraywithinarray = ["toyota, "sienna", "camry"", "honda, "odyssey", "civic""] how using swift? in such situation, can create dictionary of arrays this: var listdata = [ "toyota": ["sienna", "camry"], "honda": ["odyssey", "civic"] ] to access particular model, ("sienna" here) let model = listdata["toyota"]?.first ?? "car not found" model contain sienna and if want iterate on models for model in listdata["toyota"] ?? [] { println(model) }

multithreading - C++ shared_ptr and direct buffer enqueueing. How? -

i need make small code refactoring queueing/dequeueing operation in multi-thread application. current implementation is: enqueueing function called argument: enqueue(obj_ptr item) where obj_ptr pointer class obj created using shared_ptr . then, given items (type obj_ptr) enqueued in std list list<obj_ptr> and dequeued using front() , pop_front() , sent further. works fine in implementation. what want is: enqueue items in special list using api: a_enqueue(void *buffer) so need direct address buffer. i thinking use: item->get() which returns type obj dequeue obj , not obj_ptr expected next operations after dequeueing (+ loose information class references , destroy multi-thread app) i thinking provide list pointer obj_ref item : a_enqueue(&item) but item created in function long time ago , put argument many times (not pointer) , not possible find direct address it. the best way me enqueue buffer obj (item->get()), dequeue ...

ios - Is using the Keychain from Apple a type of encryption? -

i on point upload binary approved (or not, never know). have done couple of times no big deal, time little bit different. on last page ask encryption stuff. answer no, time have implemented keychain apple. not same methods, https://developer.apple.com/library/mac/documentation/security/conceptual/keychainservconcepts/iphonetasks/iphonetasks.html so now, little confused in if using encryption or not? use above, no other encryption or whatever.

angularjs - Nothing happens when Angular Href is clicked -

i using angular routing webapi 2 controller. although default path loads correct data, when click on item in list containing link details page, no data loaded. the browser shows believe correct url ( http://localhost:xxxxx/#/details/2 ) detailscontroller script file not called , no method on webapi2 controller called. here main page : <div class="jumbotron"> <h1>movies example</h1> </div> @section scripts { <script src="~/scripts/angular.js"></script> <script src="~/scripts/angular-route.js"></script> <script src="~/client/scripts/atthemovies.js"></script> <script src="~/client/scripts/listcontroller.js"></script> <script src="~/client/scripts/detailscontroller.js"></script> } <div ng-app="atthemovies"> <ng-view></ng-view> </div> here list partial : <div ng-contr...

search - Return all INSTR or LOCATE instances in MySQL -

i have text column containing large amount of text (for arguments sake let's assume it's novel). need use mysql locate words or phrases within novel. using instr or locate find word or phrase , return position (which ideal), returns first instance, need return instances. there way of doing this?

OpenStack Sahara installation over DevStack Juno -

i trying install openstack sahara on juno devstack. have followed instructions here . installation successful getting errors while try hit sahara followed. 2015-05-15 15:29:26.392 14677 debug keystonemiddleware.auth_token [-] removing headers request environment: x-service-catalog,x-identity-status,x-service-identity-status,x-roles,x-service-roles,x-domain-name,x-service-domain-name,x-project-id,x-service-project-id,x-project-domain-name,x-service-project-domain-name,x-user-id,x-service-user-id,x-user-name,x-service-user-name,x-project-name,x-service-project-name,x-user-domain-id,x-service-user-domain-id,x-domain-id,x-service-domain-id,x-user-domain-name,x-service-user-domain-name,x-project-domain-id,x-service-project-domain-id,x-role,x-user,x-tenant-name,x-tenant-id,x-tenant _remove_auth_headers /home/arijit/openstack/sahara/sahara-venv/local/lib/python2.7/site-packages/keystonemiddleware/auth_token/__init__.py:677 2015-05-15 15:29:26.393 14677 debug keystonemiddleware.auth_t...

java - Complexity of a query in the Google datastore -

i have android app users able send private messages each other. (for instance: sends message b , c , 3 of them may comment message) i use google app engine , google datastore java. (framework objectify) have created member entity , message entity contains arraylist<string> field, representing recipients'ids list. (that key field of member entity) in order user messages 1 of recipients, planning on loading each message entity on datastore , select them checking if arraylist<string> field contains user's id. however, considering there may hundred of thousands messages stored, wondering if possible , if wouldn't take time? the time fetch results datastore relates number of entities retrieved, not total number of entities stored because every query must use index. that's makes datastore scalable. you have limit number of messages retrieved per call , use cursor fetch next batch. can send cursor on android client converting websafe strin...

How to compare array with find() in mongoDB meteor App -

for array templates, want compare elements mongodb entries. templates=[a,b,c] for(templates) { template.displayproduct.pendingproducts = products.find({"template_name": <compare here, doubt>}, { "price": 1, "brand": 1, "productid": 1, _id: 0 }); } assuming there name field on templates, can use foreach , put in template's name directly templates.foreach(function (temp) { template.displayproduct.pendingproducts = products.find({"template_name": temp.name}, { "price": 1, "brand": 1, "productid": 1, _id: 0 }); }); but code, end results latest loop cycle in template.displayproduct.pendingproducts .

casting - Why downcast and then assign to base-class in C++? -

i have stumbled upon following code structure , i'm wondering whether intentional or poor understanding of casting mechanisms: struct abstractbase{ virtual void dothis(){ //basic implementation here. }; virtual void dothat()=0; }; struct deriveda: public abstractbase{ virtual void dothis(){ //other implementation here. }; virtual void dothat(){ // stuff here. }; }; // more derived classes similar structure.... // dubious stuff happening here: void strangestuff(abstractbase* pabstract, int switcher){ abstractbase* = null; switch(switcher){ case type_derived_a: // why use abstract base pointer here??? = dynamic_cast<deriveda*>(pabstract); a->dothis(); a->dothat(); break; // similar case statement other derived classes... } } // "main" deriveda* pderiveda = new deriveda; strangestuff( pderiveda, type_derived_a ...

gwt - Is elemental json is not compitable with google gson? -

my application's vaadin version upgraded 7.3.6 7.4.6 , json code wherever using gson starting break. i did googling same found similar issue mentioned in stackoverflowpost so should conclude elemental.json not compatible gson , org.json compatible gson. gson not gwt compatible, makes sense since requires reflection work. likewise, org.json meant used on normal jvm. on other hand, gwt knows running in browser, doesn't need implement own json parser, since browser has one. there several ways use json in gwt, , gson, org.json, , built-in json parser of browser speak same json. all compatible each other, though can't use elemental on server or gson on client, or reuse same server types on client. what 'starting break'? errors get, , data trying send like? (also worth noting, of 'json' in linked post uses ' quotes properties , strings, not legal json , should not work in first place proper json parser.)

Switch easily between maven-2 and maven-3 builds on Windows -

i have following use case: using maven-3 build of projects, have projects built maven-2 too. because on windows, annoying edit m2_home system variable point maven-2 or maven-3 installation dir depending on maven have use in order build project. is there better way of switching between maven-2 , maven-3 on windows? it turned out have declared m2_home variable under system variables. post http://maven.40175.n5.nabble.com/why-does-maven-3-still-use-the-m2-home-variable-td4611146.html helped me understand can use maven_home pointing maven-3 installation dir, , refer maven-2 specifying path bin dir better solution switching between maven-2 , maven-3 in environments variables section

c# - default values for IEnumerable collection when length is zero -

i have ienumerable collection: public ienumerable<config> getconfig(string cid, string name) { var raw = db.ap_getinfo(cid, name); foreach (var item in raw.tolist().where(x => x.name!= null)) { var x = raw.count(); yield return new config { name = item.name.tostring(), value = item.value.tostring(), }; } } the problem facing if return length of 0 unable set attributes else, if have response of length 1 attributes set database, length 0 want set dfault value name , value . a linq solution - returns default if there no items in enumerable using defaultifempty : public ienumerable<config> getconfig(string cid, string name) { return db.ap_getinfo(cid, name) .where(x => !string.isnullorempty(x.name)) .select(x => new config { name = x.name.tostring(), ...

domain driven design - Size of a bounded context -

i've started learning principles of ddd , i'm trying grasp of concept of bounded context. in particular, how decide how big (or small) has be? yeah, know, small possible , big necessary (according vaughn vernon). let's model blog. go , there 3 bounded contexts involved: 1) front page (featuring recent articles, no comments shown) 2) discussion (a single article including comments) 3) article composer (where compose article). however, doesn't feel right (the ubiquitous language same of them), seems if i'm coming front end point of view , still thinking in terms of view models or something. could please point me in right direction? try @ whole domain different perspectives, editor of article, use sentences creating draft of article, publishing article, article reader in example read article , comment on it. alongside building domain language identify entities , behaviour, of them appear in 1 perspective, appear in both, distinct them behaviour. doma...

c++ - std::string and data alignment -

i'm planning use std::string generic data buffer (instead of roll own). need pack kinds of pod it, including user defined structs, memory buffer allocated std::string aligned such purpose ? if it's unspecified in c++ standard, what's situation in libstdc++ ? the host cpu x86_64. first of all, std::string not best container use if want store arbitrary data. i'd suggest using std::vector instead. second, alignment of allocations made container controlled allocator (the second template parameter, defaults std::allocator<t> ). default allocator align allocations on size of largest standard type, long long or long double , respectively 8 , 16 bytes on machine, size of these types not mandated standard. if want specific alignment should either check compiler aligns on, or ask alignment explicitly, supplying own allocator or using std::aligned_storage .

c# - When I run the program It does not give me an expected output on the console window -

i want create clock class uses delegates notify potential subscribers whenever local time changes value 1 second. when run program. not give me output this. output this, depending on time when run program: current time: 14:53:56 logging file: 14:53:56 current time: 14:53:57 logging file: 14:53:57 current time: 14:53:58 logging file: 14:53:58 can please me solve problem? here code: using system; using system.collections.generic; using system.linq; using system.text; using system.threading; using system.threading.tasks; namespace clock_events_delegates { // eventargs base class event data. inherits methods object. // eventargs class empty bucket can use supply information want // event. class hold information event public class timeinfoeventargs : eventargs { public int hour; public int minute; public int second; public timeinfoeventargs(int hour, int minute, int second) { this.hour = hour; th...

Losing Unified Memory support in CUDA 7.0 under Windows 10 -

recently updated cuda 6.0 cuda 7.0, , cuda programs unified memory allocation stopped working (other programs without unified memory still work, , cuda 7.0 template in visual studio 2013 still works). following what canonical way check errors using cuda runtime api? , found out cudamallocmanaged() returns “operation not supported” error. behavior started happening since update. my graphics card geforce gtx 780m compute capability 3.0. programs compiled visual studio 2013 targeting 64-bit platform, arch/code pair being compute_30,sm_30 . using windows 10 pro insider preview evaluation copy build 10074. geforce driver version 349.90. the cuda 7.0 unifiedmemorystreams sample outputs: gpu device 0: "geforce gtx 780m" compute capability 3.0 unified memory not supported on device the cuda 7.0 devicequery sample outputs: cuda device query (runtime api) version (cudart static linking) detected 1 cuda capable device(s) device 0: "geforce gtx 780m" cuda d...

objective c - WKInterfaceButton response time -

my watch app contains number pad created wkinterfacebuttons . quite basic, every button represents digit (0-9) , has ibaction updates 1 wkinterfacelabel . ibactions don’t contain heavy work (no web service calls or core data updates), concatenation of selected digit entered number , updating label's text. now if quickly press same button twice or more times button don’t respond next press (it feels touch down still active , button not responding yet). understand interaction watch requires round-trip communication between watch , iphone, still working slower other watch apps have seen implements similar number pad. ideas how can improve button’s response time? you can't improve response time. watchkit ui interactions sent via bluetooth app's extension. extension provides ui feedback apple watch. therefore, delay dependent on connection between apple watch , phone, , never able control it.

google app engine - Dispatch.yaml routing to a specific module version? -

if there way route custom subdomain (something.mydomain.com) specific version of module? this mean can use following: www.mydomain.com - production site dev.mydomain.com - testing site i tried using following in dispatch.yaml, got error when trying update it - url: "dev.mydomain.com/*" module: dev.app the error was: error parsing yaml file: unable assign value 'dev.app' attribute 'module': value 'dev.app' module not match expression '^(?:^(?!-)[a-z\d-]{0,62}[a-z\d]$)$' in ".\dispatch.yaml", line 15, column 13 i know can target versions in queue.yaml, , cron (i think) why not dispatch? if read error closely, notice complaining module name dev.app... rename module dev-app , try again.

scala - how can I format DateTime using Anorm? -

i "time" mysql , need render fe, "time" in form of timestamp , want displayed yyyy-mm-dd hh:mm:ss, how can in server code follows? object jditem { val jditem = { get[long]("id") ~ get[string]("name") ~ get[string]("url") ~ get[double]("price") ~ get[int]("commentnum") ~ get[int]("likerate") ~ get[datetime]("time") ~ get[string]("category") map { case id ~ name ~ url ~price~ commentnum~likerate~time~category => jditem(id,name,url,price, commentnum,likerate,time,category) } } implicit val jditemwrites: writes[jditem] = ( (jspath \ "id").write[long] , (jspath \ "name").write[string] , (jspath \ "url").write[string] , (jspath \ "price").write[double] , (jspath \ "commentnum").write[int] , (jspath \ "likerate").write[int] , ...

openid - Restore admin access to gerrit -

i have gerrit server h2db , google openid access. google disabled openid service , can't auth on gerrit's web ui. 1) how can restore access gerrit web ui? 2) possible make user list permissions on gerrit server , access via login/password? please ask 1 question. you should able configure authentication allow log in account: [auth] type = development_become_any_account in etc/gerrit.config . this way, expect can add accounts existed before administrator group.

javascript - How to close one modal popup when another one is active -

i trying modal popup window modal popup window. when click link first popup window, second popup window opening, first 1 not getting closed. how can this? jquery: $(".get-me-license").click(function(){ $("#license").modal('show'); }); $(".confirm-my-license").click(function(){ $("#confirm-license").modal('show'); }); html: <div id="license" class="modal fade"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-body"> <img class="modal-cont" src="images/license-popup.png"> <table class="get-license-confirm"> <tr> <td><a href="#" class="btn btn-warning confirm-my-license">get license</a></td> ...

android - Not able to click on a Iframe button– Java- Appium -

i trying click on button present inside iframe. test showing successful not clicking on button. writing scripts using java. please find below code. first switched webview native app using driver.context("webview_0"); after switch iframe using driver.switchto().frame("iframe_a"); thread.sleep(10000); webelement playicon = driver.findelement(by.xpath("//div[@class='plt-playbtnforipad']")); playicon.click(); but playicon not clicking. not showing error. can please me regarding this. thanks, tariful islam

cPanel Could not determine the nameserver IP addresses for -

i'm using cpanel , when add ip, system report following message: could not determine nameserver ip addresses “filesharingz.org”. please make sure domain registered valid domain registrar. the domain name valid registered. not sure error, pls me. thank you. i have found solution here: 1) whm: go whm >> server configuration >> tweak settings >> all check following option “allow unregistered domains” might “off” on settings. change “on” if want add unregistered domains addons. 2) command line: edit cpanel config file. vi /var/cpanel/cpanel.config allowunregistereddomains=0 change above allowunregistereddomains=1 that’s it, able add new unregistered domains. http://www.ayyolinux.com/could-not-determine-the-nameserver-ip-addresses-for-domain-com-please-make-sure-that-the-domain-is-registered-with-a-valid-domain-registrar-error-adding-addon-domain-cpanel/

java - Hibernate 3.6 customize the setter of one to many mapping -

i have simple @onetomany mapping: public class member(){ .... @onetomany(fetch = fetchtype.lazy, mappedby="member", orphanremoval=true) private list<user> users; @transient private user firstuser; ... public setusers(list<user> users){ //if(users.size() > 0) this.firstuser = users.get(0); this.users = users; } } public class user(){ ..... @manytoone @joincolumn(name = "user_id") private member member; } here i'd set this.firstuser = users.get(0) if mapped users length greater 0. doesn't work if put code directly setter method commented line in member , example, read member object users size 5, tried print firstuser , firstuser still null, expected result should users.get(0) . any idea? you try following: public class member(){ .... @onetomany(fetch = fetchtype.eager, mappedby="member", orphanremoval=true) private list<user> use...

caching - Where get data to compare cache algorithms -

i wan`t compare cache algorithms lru, slru, lfu etc on real data. that`s why need method generate real-like data compare cache algorithms or data application. i think cachegrind , 1 of tools in valgrind suite, might you're looking for. haven't used myself, glance @ page, produces output file cachegrind.out.<pid> human-readable information cache accesses. not sure if detailed need (maybe it's summary), worth look.

Python Pandas: How to groupby and count and select a portion of counts? -

i have df this: new_org old_org asn cc 0 85736 pcizzi 85736 - pcizzi s .a 23201 py 1 001 001 host 40244 2 85736 blah 85736 - whatevs 23201 py 3 001 001 complex 55734 in 4 001 hospedagem 001 hospedagem ltda 36351 5 001web action.us.001web.net 36351 and groupby df based on 'asn' column , select groups have more 1 row. how doing not sure if correct: df.groupby('asn').apply(lambda x:x.count()>1) can help? you can filter group . try df.groupby('asn').filter(lambda x: len(x) > 1) return dataframe . group again further if necessary.

java - Using Calendar to reset counted steps every midnight -

i building android app counts user's steps. purpose count steps midnight of previous day midnight of each day. how set calendar object. java question really. calendar cal = calendar.getinstance(); date = new date(); cal.settime(now); long endtime = cal.gettimeinmillis(); cal.add(calendar.day_of_week, -1); long starttime = cal.gettimeinmillis(); simpledateformat dateformat = new simpledateformat(date_format); log.i(tag, "range start: " + dateformat.format(starttime)); log.i(tag, "range end: " + dateformat.format(endtime)); and outpup range start: 2015.05.14 09:25:13 range end: 2015.05.15 09:25:13 so can see output. count steps between period. if enter few minutes later,the date format like range start: 2015.05.14 09:27:07 range end: 2015.05.15 09:27:07 i want range start: 2015.05.14 00:00:00 range end: 2015.05.15 00:00:00 thanks. first have today's date: calendar date = new gregoriancalendar();...

sql - What are the consequences/side effects of deleting STALE records from Oracle DB with Large Data? -

this may sound silly questions. however, 1 of easiest solutions keep data consistent delete stale records db table. table has millions of row. can please tell me consequences/side-effects of deleting data db. this db heavy read , medium writes. any predictions or 2 cents here before learn hard way on production website? thereby unwanted side-effects caused inserts & deletes? [update] one of plausible solutions have in mind is: have have options of adding column determine if data stale or not. however, solution, need keep track of variable. an event fired indicates single row in table stale. plan delete row when event fired. so have hand-written chache? cache may expose 2 kinds of inconsistencies: there rows in cache shouldn't there there rows missing in cache should there the latter not seem problem worry about. deleting rows cache in order fix first issue not problem. however, how know when delete them. need keep track of whether cache dir...

sockets - Python multiprocessing queue generating strange data behavior -

i'm working little project 1 rpi2 distributing data 4 rpi1. done via socket, , every client connects rpi2 gets own process. there 1 process capturing images , 1 waiting new clients(on rpi2). capture process sends four(at most) vectors "client processes" , send (ecery) rpi1:s via socket. my problem is: when run more 1 client, there seem kind of communication fault, ether in ipc or socket. because data supposed sent rpi1_a ends on rpi1_b. can have queue going between processes aren't in parent-child relation? some snippets code: # create list of queues main_queue = [queue(ipc_queue_size)]*max_number_of_connections #creation of camera process: camera_process = process(target=camera_capture, args=(main_queue,client_update_queue, )) #wait client snippet: conn, addr = s.accept() p.append((process(target=clientthread, args=(conn , main_queue[nr_of_clients] ,client_update_queue, sock_lock, )),addr[0],addr[1])) p[len(p)-1][0].start() nr_of_clients = nr_of_client...

java - Is there a way to match in Mockito by reference and equals at the same time? -

mockito's matchers has eq() uses equals , same() uses == operator. is there way use both when comparing objects in mockito ? let's have list list1 = new arraylist(); list list2 = new arraylist(); system.out.println(list1.equals(list2)); //true system.out.println(list1 == list2); //false /* , want check references same, , list contents haven't changed */ so great have operator both checking == , .equals() this come in handy if want check return same list, , list contents same without doing 2 assertions. also, may classic example of 4 card problem. https://en.wikipedia.org/wiki/wason_selection_task .equals() can true if objects don't have same reference. so .equals() being true doesn't mean == return true , not substitute. the equals implementation should == check. if doesn´t expect bug. doing both not necessary. if let eclipse generate equals first test == check example. the same applies list, equals of ...

Expanding UserCreationForm for customized Django registration -

i trying understand how expand creationform library utilize custom fields have in model. basically, in model, have field called codeid , goal have user type in integer , have store database register. know i'm on right track, there flawed logic behind current code. forms.py from django import forms django.contrib.auth.models import user # fill in custom user info save django.contrib.auth.forms import usercreationform .models import address, job class myregistrationform(usercreationform): username = forms.charfield(required = true) #udid = forms.charfield(required = true) class meta: model = address fields = ('username', 'codeid', ) def save(self,commit = true): user = super(myregistrationform, self).save(commit = false) user.codeid = self.cleaned_data['codeid'] if commit: user.save() return views.py from django.shortcuts import rende...

ios - Swift, nested dictionary with different type -

i need have data this, can return nsdictionary ?, please refer code below { "aaa": "a1", //value: string type "bbb": "b1", "ccc": "c1", "ddd": "d1", "dict2": { "zzz": "z2", //string type, nil "ttt": "t2", "kkk": null, "sss": null, } } code: let dict2info = ["zzz":z1, "ttt":t1, "ccc":c1, "kkk":null, "sss":null] var dict1 = dictionary<string, anyobject>() dict["aaa"] = a1 dict["bbb"] = b1 dict["ccc"] = c1 dict["dict2"] = dict2info as? anyobject println("\(dict1)") return dict1 //return parameter type "nsdictionary?" // result: [aaa: a1, bbb: b1, ccc: c1] problem: dict2 missing (i have checked key in dictionary...

cpu architecture - x86 segment descriptor layout - why is it weird? -

Image
why did intel choose split base , limit of segment different parts in segment descriptor rather using contiguous bits? see figure 5-3 of http://css.csail.mit.edu/6.858/2014/readings/i386/s05_01.htm why did not store base address in bits 0 through 31, limit in bits 32 through 51 , use remaining position other bits (or similar layout)? raymond chen answered question in comments: for compatibility 80286. 80286 had maximum segment size of 2^16 , maximum base of 2^24. therefore, base , limit fields 16 , 24 bits wide. when size , base expanded 32 bits, had placed somewhere else because places taken. here scan of segment descriptor (of code or data type) intel 80286 programmer's reference manual: for comparison, here screenshot intel® 64 , ia-32 architectures software developer’s manual (volume 3a): the format same, save use of reserved bits. base extended 24 32 bits, segment limit extended 16 20 bits, , additional flags added. (the "accessed"...

ember.js - Observe Ember Data store changes in component -

i have component creates record specific model this: export default ember.component.extend({ store: ember.inject.service(), addrecord(account) { this.get('store').createrecord('update', { authuid: account.get('authuid'), service: account.get('platform') }); } }); i have component needs observe changes done particular model (i.e. if records added or deleted), , show them in component. export default ember.component.extend({ store: ember.inject.service(), observestorechanges: /*what should write every time `addrecord` pushes record in store, function executed in component*/ }); if you're fan of observer pattern: // store.js export default ds.store.extend(ember.evented, { createrecord() { const record = this._super.apply(this, arguments); this.trigger('recordcreated', record); return record; } }); // component.js export default ember.compone...

Sorting using comparator and crieria from map using java 8 -

let's consider java class parent 20 attributes (attrib1, attrib2 .. attrib20) , corresponding getters , setters. list<parent> list contains n parent objects. now want sort list based on mutliple criteria. use comparator interface build sorting criteria. the sorting arrtibutes stored map. map< attributename, ascending/decending> so want iterate through map , bulid comparator interface each key. how can iterate through map , build comparator interface each key , connect these comparator interfaces. i accept pure java 8 code solve problem. unless use reflection, it's not possible achieve this. furthermore, if don't use linkedhashmap or attributes' names not chained in lexicographical or other defined order ensure chain them in correct order, it'll not possible retrieve 1 want chain first. to honest, using reflection seems more hack. think improve design. what suggest create linkedhashmap<string, comparator<parent>...

javascript - CKEditor + Protractor: Testing with Protractor can't find CKEditor instance -

i using protractor non-angular page , wanting find ckeditor instance on page set data for. can in chrome console via: ckeditor.instances.html_editor.setdata("hello") in test page, have code below: it('should enter text in editor successfully', function() { var composerpage = new composerpage(); browser.executescript('return window.ckeditor'); window.ckeditor.instances.html_editor.setdata( 'hello' ); }); however, error returned is: error: failed: cannot read property 'instances' of undefined i've had @ stack overflow question here: protractor: how access global variables have inside our application? didn't me unstuck. any suggestions how can define ckeditor instance , set data helpful! use browser.executescript() set editor's data: var value = 'hello'; browser.executescript(function (arguments) { window.ckeditor.instances.html_editor.setdata(arguments[0]); }...

python - raise child_exception , OSError: [Errno 2] No such file or directory -

import sys,os import subprocess import pdb pdb.set_trace() findcmd = 'find . -name "pcapdump0"' print os.getcwd() print findcmd out = subprocess.popen(findcmd,stdout=subprocess.pipe) (stdout, stderr) = out.communicate() filelist = stdout.decode().split() print filelist i getting error traceback (most recent call last): file "generatepcap.py", line 10, in <module> out = subprocess.popen(findcmd,stdout=subprocess.pipe) file "/usr/lib/python2.7/subprocess.py", line 679, in __init__ errread, errwrite) file "/usr/lib/python2.7/subprocess.py", line 1249, in _execute_child raise child_exception oserror: [errno 2] no such file or directory simply means says: popen can't find command specified, because did not split string.

Incremental search in android using Volley library? -

i have somehow implemented incremental search in android using asynctask. in incremental search api called each character entered in edit text suggestions server. example, user types -> api called. user types ab -> api called. user types abc -> api called. this makes 3 api calls a, ab , abc respectively. if user still typing previous requests (e.g. requests of , ab) cancelled , last request (abc) served avoid delays. now want implement using volley library better performance. me how can achieve functionality using volley specially mechanism of cancelling previous request , serve last request suggestions server. note: couldn't find regarding that's why posting here. please guide me because new android , in need of answer. first need implement textwatcher listen change in edit text. depending on requirement of changed text, cancel , add request queue. private requestqueue queue = volleyutils.getrequestqueue(); private static final string voll...

java - Unallocated amount in item line -

i have question regarding how allocate given amount line of items. basic have kind of simple code. how reconcile each line item balance amount 0 if paid amount sufficient. if not, last item has balance pay. suggestion or algorithm on this? thanks. output in comment. public static void main(string[] args) { bigdecimal paidamount = bigdecimal.valueof(200); list<item> items = initializeitems(); calculateitembalanceamount(paidamount, items); displayitems(items); } private static void calculateitembalanceamount(bigdecimal paidamount, list<item> items) { (item item : items) { if (paidamount.compareto(item.gettotalowed()) > 0) { item.settotalpaid(item.gettotalowed()); item.setbalance(item.gettotalowed().subtract(item.gettotalpaid())); } else { item.settotalpaid(paidamount); item.setbalance(paidamount.subtract(item.gettotalowed())); break; // ugly } } } protecte...

javascript - Select drop-down value using Jquery -

please find below code, have drop down selected value dynamically not getting it. <div class='box' id='dispositions'> <div class='header'>dispositions</div> <form> <select name='rebuttal'> <option value=''>---rebuttals count---</option> <option value='0'>0</option> <option value='2-3'>2-3</option> <option value='3 or greater'>3 or greater</option> </select> </form> </div> to achieve using below code not giving expected result. no alert getting below:- $(document).ready(function(){ $('#cc-panel-disposition form [name=rebuttal]').change(function() { alert($("#cc-panel-disposition form [name=rebuttal] option:selected").text()); }); }); in below code getting 'rebval' instead of selected valu...

Multi-tenant setup for Jenkins -

i want setup multi-tenant support our jenkins. let, have 5 jobs 2 users (github user) in jenkins , 5 jobs in single server. user_1 has j1, j2, j3 jobs , user_2 has j4, j5 jobs. now, user_1 can see j1, j2 , j3 jobs (don't see j4 or j5) , user_2 can see j4 , j5 jobs when come in jenkins. how can setup jenkins multi-tenant support? for quickest approach accomplish describing, follow these steps: go "configure global security" , navigate "authorization" tab use "role based strategy" give desired access users provide desired job level access users you can utilize type of manning convention jobs , can use regular expression provide access set of jobs. another option check out of authentication/authorization plugins available jenkins. popular plugin in realm matrix authorization strategy plugin (often combined active directory), though have not used this.

Preventing Matlab from truncating timestamp when importing from excel -

i importing excel file of timestamps matlab. seems whenever have timestamp @ turn of midnight i.e. '13/5/2015 12:00 pm', matlab read '13/5/2015' only. excel samples '13/5/2015 12:00 pm' '13/5/2015 12:01 pm' imported matlab using [na1, na2, raw] = xlsread('excel.xls'); raw = { '13/5/2015'; '13/5/2015 12:01 pm'} this prevents me using datenum of same formatin. how go preventing matlab truncating timestamp when import excel? you add in time finding entries don't end in letter , add 12:00 am @ end of string. can used datenum . that, can use regular expressions , search cells don't have letters @ end, each of these cells, add 12:00 am @ end. something this: ind = ~cellfun(@isempty, regexp(raw, '\d*$')); strings = raw(ind); padded_strings = cellfun(@(x) [x ' 12:00 am'], strings, 'uni', 0); raw(ind) = padded_strings; the first line of code bit obfuscated, easy explain. let...