Posts

Showing posts from February, 2011

android - Memory leak by AttachInfo.mRootCallbacks reported by LeakCanary -

i'm using leakcanary library troubleshoot memory leak of activity. after fixing several issues got logcat output : com.mypackage.activities.myactivity has leaked: gc root com.mypackage.myview.mattachinfo references android.view.view$attachinfo.mrootcallbacks references android.view.viewrootimpl.mcontext leaks com.mypackage.activities.myactivity instance i have no idea reference mean. view keeping reference activity prevents being gced? when , how should handle it? i used eclipse memory analyze tool tool , found there no instances of activity alive. make sense? also opened issue canary. edit 1 : relevant implementation : public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate) { myview.interactioncallbacks interactioncallback = new interactioncallbackimplementation( mnewview = new myview(getactivity().getapplicationcontext(), layoutinflater li = (layoutinflater) getactivity().getapp

sql - Alternative to case statement -

i need suggestions on writing sql query other using case statement in oracle.i have table named system_specs following data customer_id disk_space_allocated c001 44g c002 1300g c003 1503g c004 1780g i wrote following sql query using oracle case statement count of customer_id based on ranges disk_space_allocated select case when to_number(substr(disk_space_allocated,0,length(disk_space_allocated) -1 )) <= 300 '1-300' when to_number(substr(disk_space_allocated,0,length(disk_space_allocated) -1 )) <= 500 '300-500' when to_number(substr(disk_space_allocated,0,length(disk_space_allocated) -1 )) <= 700 '500-700' when to_number(substr(disk_space_allocated,0,length(disk_space_allocated) -1 )) <= 900 '700-900' else '900+' end diskallocated, count(*) number_of_customers system_specs group

ubuntu - java.lang.SecurityException: Expecting a sun.rmi.server.UnicastRef2 remote reference in stub -

Image
i trying connect remote java process running on different machine using jconsole tool on ubuntu machine. this how running java program in remote machine: sudo java -dcom.sun.management.jmxremote.port=51082 -dcom.sun.management.jmxremote.authenticate=false -dcom.sun.management.jmxremote.ssl=false -jar myfile.jar i running jconsole command on machine this: jconsole -debug -j-djava.util.logging.config.file=logging.properties this logging.properties file: handlers = java.util.logging.consolehandler sun.rmi.level=finest .level = info java.util.logging.consolehandler.level = finest java.util.logging.consolehandler.formatter = \ java.util.logging.simpleformatter // use finer or finest javax.management.remote.level - finest // verbose... javax.management.level = finest javax.management.remote.level = finer now on jconsle ui have given below properties: when click on connect button getting exception saying: finer: [javax.management.remote.rmi.rmic

apache spark - How to move 1000 files to RDD's? -

i new in apache spark , need help. i have python script reading 6 tdms files (tdms() function) , building graph numerical data of each of them (graph() function). loop. want load 1000 such files , run script in parallels each one. want create rdd's files , apply function each file? how can it? can define number of nodes in spark? have tried making python list includes files need read, , run in loop read data file, create rdd, run graph function, , guess save it? or make file list rdd, , run map, lambda(for graph), each. if care parallel run, can keep loading data , make 1 big rdd, , call sc.parallelize. can either decide spark it, or can specify number want use calling sc.parallelize(data, ).

mysql - Changed phpmyadmin password on mac using AMPPs and now Can not login into phpmyadmin -

i've changed password of localhost user of ampps stack , can not log phpmyadmin shows pink message : access denied... , have tried restoring default configuration have same problem. i've checked config.inc file , it's content : <?php /* servers configuration */ $i = 0; /* server: localhost [1] */ $i++; $cfg['servers'][$i]['verbose'] = ''; $cfg['servers'][$i]['host'] = '127.0.0.1'; $cfg['servers'][$i]['port'] = ''; $cfg['servers'][$i]['socket'] = ''; $cfg['servers'][$i]['connect_type'] = 'tcp'; $cfg['servers'][$i]['extension'] = 'mysqli'; $cfg['servers'][$i]['auth_type'] = 'config'; $cfg['servers'][$i]['user'] = 'root'; $cfg['servers'][$i]['password'] = file_get_contents('/applications/ampps/ampps/data/my.conf'); $cfg['servers'][$i]['hide

how to measure distance and centroid of moving object with Matlab stereo computer vision? -

which matlab functions or examples should used (1) track distance moving object stereo (binocular) cameras, , (2) track centroid (x,y,z) of moving objects, ideally in range of 0.6m 6m. cameras? i've used matlab example uses peopledetector function, becomes inaccurate when person within 2m. because begins clipping heads , legs. the first thing need deal with, in how detect object of interest (i suppose have resolved issue). there lot of approaches of how detect moving objects. if cameras stand in fix position can work 1 camera , use background subtraction objects appear in scene (some info here ). if cameras are moving, think best approach work optical flow of 2 cameras (instead use previous frame flow map, stereo pair images used optical flow map in each fame). in matlab, there option called disparity computation , try detect objects in scene, after need add stage extract objects of interest, can use thresholds. once have desired objects, need put them in binary ma

Add static field to grouped data in Mongodb -

how add static field result using group operation in mongodb. query looks like: db.sales.aggregate({ $group : { _id: { year: { $year: '$date' }, }, amount: { $sum: 1 } } }); than result: { "result" : [ { "_id" : { "year" : 2013 }, "amount" : 43433 }, ... ] "ok" : 1 } i need add field called type value 'year' in each object of result. i need add project operation literal 'year'. query looks like: db.sales.aggregate([ { $group : { _id: { year: { $year: '$registrationdate' } }, amount: { $sum: 1 } }, }, { $project: { type: { $literal: 'year' }, } } ]);

MySQL/MariaDB TRIGGER -

i error when try create below trigger on mysql/mariadb create trigger `abc` before insert on `table1` each row begin declare lcl_var integer; set lcl_lcl_var = new.a - new.b; set new.d= v; end; error create trigger q_dur_calc before insert on task_q_swh each row begin declare lcl_q_dur integer; mysql said: documentation 1064 - have error in sql syntax; check manual corresponds mariadb server version right syntax use near '' @ line 3 i've got couple other triggers used build one. can't figure out wrong syntactically this. can please request spot problem this? when write trigger must specify delimiter mysql explicitly executes trigger block within specified delimiter. if delimiter not provided when encounters ; within trigger statement try execute command till block , hence may errors. if using user interface tools generating trigger may check if there option set delimiter in phpmyadmin. in cli trigger needs having delimi

c# - Border like classic window with dropshadow in WPF -

Image
does know how border following window in wpf? believe borderless , has drop shadow effect around border. tried following code, doesn't seem work. <border x:name="myborder" background="{dynamicresource {x:static systemcolors.controlbrushkey}}" cornerradius="0"> <border.effect> <dropshadoweffect shadowdepth="2" opacity="1" direction="320" /> </border.effect>

java - Is there any difference while executing SWF in AWS , in normal AWS project and Maven project? -

while executing swf in maven project getting following error, can u please me how resolve error error execute, failure processing activity task taskid=6, workflowgenerationid=mainworkflowpcompress, activity={name: activity.downloadfroms3,version: 22.0}, activityinstanceid=1 com.amazonaws.services.simpleworkflow.flow.activityfailureexception: com.amazonaws.amazonwebservicerequest.copyprivaterequestparameters()ljava/util/map; : ["java.lang.nosuchmethoderror",{"cause":null,"stacktrace":[{"methodname":"invoke","filename":"amazons3client.java","linenumber":3651,"classname":"com.amazonaws.services.s3.amazons3client","nativemethod":false},{"methodname":"getobject","filename":"amazons3client.java","linenumber":1160,"classname":"com.amazonaws.services.s3.amazons3client","nativemethod":false},{"m

Copy SAP HANA project from Amazon Web Service -

i have hana project hosted on amazon web service. have trial instance of hana. how can copy or export project amazon trial instance using hana studio? importing , exporting in hana done through delivery units , packages. you need create delivery unit in aws instance, add project delivery unit package. export delivery unit. on trial instance, import delivery unit. creating delivery unit importing delivery unit maintaining delivery unit

javascript - How to set selected value into p:selectOneMenu? -

i have p:selectonemenu : <p:selectonemenu styleclass="categorylist" filter="true" id="parentcategorylist" style="width: 200px" effect="fade" panelstyleclass="categorylistpanel" converter="#{categoryconverter}" widgetvar="categorylistwv" value="#{categoryservice.category}"> <p:ajax event="change" update="@this" /> <f:selectitem itemlabel="no parent" /> <f:selectitems var="currcateg" value="#{categoryservice.categories}" itemlabel="#{currcateg.name}" itemvalue="#{currcateg}" /> </p:selectonemenu> i need set value via javascript. in web found solution: widgetvar.selectvalue(val

javascript - Iterate through IEnumerable Model without loop - ASP.NET-MVC5 -

Image
i have typed ienumerable of 2 records passing view controller. have maximum 2 records. need print these 2 record in separate form i.e. html beginform. my question how can print ienumerable model data without using @for or @foreach loop??? can use kind of index read object in model , data based on index??? get data record public list<emergencycontact> getemergencycontactbystudentid(int _studentid) { try { using (var _uow = new studentprofile_unitofwork()) { var _record = (from _emergencycontact in _uow.emergencycontact_repository.getall() join _student in _uow.student_repository.getall() on _emergencycontact.studentid equals _student.studentid _emergencycontact.studentid == _studentid select _emergencycontact).tolist(); return _record; } } catch { return null; } } contr

Accessing Rails 4.2.3 with Ruby 1.9.3 gives Byebug error -

i've been trying use ruby 1.9.3 , set rails since i've been having error deploying rails when using ruby versions >= 2.0. now, i've been running bundle install in cmd , gives me error: gem::installerror: byebug requires ruby version >= 2.0.0. error occurred while installing byebug (5.0.0), , bundler cannot continue. make sure 'gem install byebug -v '5.0.0'' succeeds before bundling. i've manually installed , doesn't work well. i've been typing rails commands including rails -v , i've been getting error not find byebug. how work around problem since i'm using ruby 1.9.3? there way me make ruby versions >= 2 work in windows 8? since byebug supports v2.0.0 default you can use older version of debugger tool rails debugger gem install debugger should suffice.

Mapping views.py in Django (Python) -

i need mapping views in django. app pretty simple -- it's status page listing of our environments , corresponding apps. far have env's listed so: env_1 env_2 env_3 but want is: (where [app*] app_list in environment class -- see below) env_1 [app1] [app2] [app3] ... env_2 [app1] [app2] [app3] ... env_3 [app1] [app2] [app3] ... here's models.py (app_list = app1, app2, etc.) - - update - - from django.db import models class environment(models.model): name = models.charfield(max_length=128, unique=true) app_list = models.charfield(max_length=128, blank=true) def __str__(self): return self.name def format(self): app_list = self.app_list or "" return (" ".join(["[%s] " % in app_list.split(',')])) and views.py: from django.shortcuts import render dashboard.models import environment, page def index(request): environment_list = environment.objects.order_by('name')

android - Trouble in adding a search widget in actionbar -

i add search function in action bar following this guide still got these errors. 07-02 13:36:05.175 21813-21813/com.example.fieldbookv2 e/androidruntime﹕ fatal exception: main process: com.example.fieldbookv2, pid: 21813 java.lang.nullpointerexception: attempt invoke virtual method 'void android.widget.searchview.setsearchableinfo(android.app.searchableinfo)' on null object reference @ com.example.fieldbookv2.loginactivity.oncreateoptionsmenu(loginactivity.java:1621) @ android.app.activity.oncreatepanelmenu(activity.java:2823) @ android.support.v4.app.fragmentactivity.oncreatepanelmenu(fragmentactivity.java:277) @ android.support.v7.internal.view.windowcallbackwrapper.oncreatepanelmenu(windowcallbackwrapper.java:84) @ android.support.v7.app.appcompatdelegateimplbase$appcompatwindowcallbackbase.oncreatepanelmenu(appcompatdelegateimplbase.java:273) @ android.support.v7.app.appcompatdelegat

java - Spring @Value adding Validation less than -

i using following property value injection. how can add less validation operation. mean want set validation user.maxpassiveday property value has not less 100 lets say. @value("${user.maxpassiveday}") int maxpassiveday; using spring 3.1.1 version you can use @value on setter method: int maxpassiveday; @value("${user.maxpassiveday}") public void setmaxpassiveday(final string maxpassiveday) { int tmp = integer.parseint(maxpassiveday); if (tmp < 100) { this.maxpassiveday = tmp; } }

oracle - Different queries or One? Which one is feasible? -

i have following queries want delete 3 employees in admin department. delete employee_tbl emp_id = 123 , emp_dep = 'admin'; delete employee_tbl emp_id = 456 , emp_dep = 'admin'; delete employee_tbl emp_id = 789 , emp_dep = 'admin'; i thinking write single query like- delete employee_tbl emp_id in (123, 456, 789) , emp_dep = 'admin'; is correct way write query in case of performance , all? confused. any explanation appreciated. both queries have pros , cons 1) multiple selects. i rather rewrite query using bind variables. delete employee_tbl emp_id = :l_emp_id , emp_dep = :l_emp_dep; and run multiple times. this way, oracle don't hard parse query every time, , oracle re-uses explain plan reducing latch activity in shared global area(sga) minimizing cpu usage. more details bind variables - key application performance but 1 glitch here is, every execution of query actually, needs switch client sql engine process.(con

how to draw a text on a circle in SWIFT -

Image
i have no clue how start , not have code. research far pointed out, there no standard functionality , has coded our self ? any hint or confirmation ? update using coretextarcview, suggested ashish. thanks helping. sample project suggested works me. can see blue circle text on it. integrating project, have problems. did following i added files "coretextarcview.h" , "coretextarcview.m" project. can see them in explorer left. in bridgingheader.h added import : #import "coretextarcview.h" i added codesample : var arctext : coretextarcview = coretextarcview(frame: cgrectmake(50, 50, 200, 200), font: uifont.systemfontofsize(15), text: "hello radious arc text", radius: 85, arcsize: 130.0, color: uicolor.redcolor()) arctext.backgroundcolor = uicolor.clearcolor() self.view.addsubview(arctext) -> compile errors in coretextarcview.m : /users/user/desktop/prototypes/coretextarcview.m /users/user/desktop/prototypes/coretextarcvie

css - Image responsive in bootstrap to fill column -

i have bootstrap column defined follows: <div class="col-md-4 limit"> <img id="myimage" src="" class="img-responsive"/> </div> <style> .limit { max-height:500px; overflow:hidden; } </style> the source of image obtained programatically not know in advance height or width of image. want image in column height limited appear inside of div. img-responsive class have achieved image horizontally fill column, however, class sets height auto, of time causes image overflow , hidden. not want image overflow in way. so, lets column measures: width: 300px (defined bootstrap) height: 500px (.limit) and image dimensions are: width: 600px height: 1500px the current configuration makes image shrink 300px x 750px. container set 500px, causes last 250px lost inside overflow. image instead resized 200px x 500px in order containing div how can this? thanks! try this: &

jquery - On dataTable scroll data should load from server side and append to existing records -

using node js , bootstrap developing web application . have table implemented using data table . performing search , sort using server side code . fetching 50 records. these working fine. now want load data (next 50 records ) server side when scroll reached bottom. currently code , $('#table-goal').datatable({ "fninitcomplete" : function() { $('.datatables_scrollbody').mcustomscrollbar({ theme : "dark-3", callbacks : { whilescrolling : function() { //alert("scroll"); if (this.mcs.toppct == 100) { // need load data using same ajax , append data previous 50 records. } } } }); }, "scrolly" : "230px", "scrollcollapse" : true, "paging" : false,

Print JSON output into table - PHP -

i need print json output in table { "response_code":200, "pnr":"6642876935", "train_num":"12792", "train_name":"pnbe sc exp", "doj":" 6- 7-2015", "from_station": { "code":"pnbe" }, "to_station": { "code":"sc" }, "reservation_upto": { "code":"sc" }, "boarding_point": { "code":"pnbe" }, "class":"sl", "no_of_passengers":"1", "chart_prepared":"n", "passengers":[ { "sr":"1", "booking_status":"w\/l 43, gnwl","current_status": "rac 19" } ], "noms":1, "error":null

c# - ASP.NET MVC How to use PartialView in Layout? -

i need render menu in layout using partial view (if there better approach, please let me know). i'm doing way (in layout): @if (user.isinrole("admin")) { @html.partial("adminmenu") } and how call in controller: public actionresult adminmenu() { var = _amr.getadminmenu(); return partialview(am); } so here partial view: @model ienumerable<digitalhubonlinestore.viewmodels.adminmenuviewmodel> <div class="dropdown"> <button class="btn btn-default dropdown-toggle" type="button" id="dropdownmenu1" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true"> admin menu <span class="caret"></span> </button> <ul class="dropdown-menu" aria-labelledby="dropdownmenu1"> @foreach (var item in model) { <li><a href="@html.

css - Container overlapping to header -

Image
i have problem container, overlapping header, how adjust in css? should under header little margin between header , container. see screenshot here #myheader { position: fixed; top: 0; left: 0; width: 100%; z-index: 100; background-color: yellow; box-shadow: 0px 2px 3px #888888; height: 150px; opacity:0.95; filter:alpha(opacity=10); } #mycontent { padding-top: 10px; } #mycontent .row { background-color: #fff; } #mycontent h1{ margin-top: 0; } <section id="mycontent"> <div class="container"> <div class="row"> <div class="col-sm-8 col-md-8 col-lg-8"> <div> <br /> <?php if ($breadcrumb): ?> <div id="breadcrumb"><?php print $breadcrumb; ?></div>

symfony - Get a message from swiftmailer about registration -

i use fosuserbundle registration. want after registration send email message success. config.yml looks like. fos_user: db_driver: orm firewall_name: main user_class: games\modelbundle\entity\users registration: confirmation: enabled: true from_email: address: registration@trololo.com sender_name: registration service: mailer: fos_user.mailer.twig_swift resetting: email: template: corebundle:email:resetting.email.html.twig swiftmailer: transport: "%mailer_transport%" host: "%mailer_host%" username: "%mailer_user%" password: "%mailer_password%" spool: { type: memory } my question is: how check if message sent? i'm guessing first want test locally if code works intended. try "profiler" after registering, should hold emails. or if write functional test it, should idea: http://symfony.com/doc/current/cookbook/email/testin

java - Change if-else statement into switch statement -

i having trouble on how can handle condition. have 5 items filtered , planning add more, add items increases possible combination such 1*2*3*4*5 combinations 5 when have 10 items , 3 million combinations. on current thread recommend me use switch no idea how perform reduce possible combination. can change if-statement switch or there other way can handle these combinations. here's program // filter selected for(int subloop=0; subloop<sspecialty[loop].length; subloop++) { if (sreg[loop].equalsignorecase(thisfilter[0]) && sadmin[loop].equalsignorecase(thisfilter[1]) && sambience[loop].equalsignorecase(thisfilter[3]) && amounttf >= thetuitionfee && sspecialty[loop][subloop].equalsignorecase(thisfilter[4])) { list.add(slist[loop]); // regaffil } else if (sreg[loop].equalsignorecase(thisfilter[0]) && t

ruby on rails - Grape Gem encoding in reponse -

in api response, there html entities. please can make return decoded entities. {"success_message":"record found","result":[{"category":"health \u0026 safety"}]} should be {"success_message":"record found","result":[{"category":"health & safety"}]} i using grape gem api , try # default_format :json format :json content_type :json, "application/json;charset=iso-8859-1" in api still working.

scala - Shapeless HList type checking -

i using shapeless , have following method compute difference between 2 hlists: def diff[h <: hlist](lst1: h, lst2:h):list[string] = (lst1, lst2) match { case (hnil, hnil) => list() case (h1::t1, h2::t2) if h1 != h2 => s"$h1 -> $h2" :: diff(t1, t2) case (h1::t1, h2::t2) => diff(t1, t2) case _ => throw new runtimeexception("something went wrong") } since both parameters method take h , expect hlists of different types not compile here. example: diff("a" :: hnil, 1 :: 2 :: hnil) shouldn't compile does, , produces runtime error: java.lang.runtimeexception: went wrong . there can type parameters make method accept 2 sides identical types? unfortunately, base hlist trait unparameterized, , in method call h resolved hlist (which indeed supertype of hlist irrespective of concrete element types). fix have change definition somewhat, , rely inste

indexing - How to Create an index of a key in a map or item in a list in MongoDB -

the following questions refer example. how create index ids in idsandnames map? i want search these numbers: 7065362, 7064458, 7065003, 7064286... how create index strings in subtargets list? i want search these strings: all, action, drama... my example : { "_id" : objectid("sdfsdfsdfsdfsdfsd910d41ad9"), "targets" : { "superheroes" : { "idsandnames" : { "7065362" : "doctor strange", "7064458" : "dr. manhattan", "7065003" : "captain atom", "7064286" : "hulk" }, "subtargets" : [ "all", "action", "drama" ] } "bestsuperheroes" : { "idsandnames" : { "7065362" :

python - Using subdomains in django -

please tell me whether possible (if so, how) use pages each user subdomains. example, have url of form: http://hostname.com/user/1 need http://username.hostname.com/ you have number of options depending on how in-depth want go. one option handle routing @ web server level. capture subdomain part of url , rewrite different location within server. for example http://username1.local.host/signin captured webserver , internally routed resource such /username1/signin . end user subdomains code handle url parts none wiser has happened. your urls.py handle normal request. url_pattern = [ ... url(r'(?p<subdomain>[a-z]+)/sigin/$', 'view'), ] for nginx need "subdomain subdirectory re-writing". i use option have stated in question. whilst method little more tricky setup (keep @ until works). lot easier maintain , work in long run. use option have stated in question. the other option handle subdomains @ django level using package su

java - GcmListenerService.onMessageReceived() not called -

i'm working on implementing gcm notifications app. the problem i'm having onmessagereceived() method gcmlistenerservice implementation isn't called. receive data gcm servers fine, since automatically generates notification (i wish replace own notification using onmessagereceived() method) after none of log calls printed in log. json sent server gcm server { "notification" : { "title" : "title", "text" : "message", "icon" : "@drawable\/ic_notification", "click_action" : "open_main_activity" }, "registration_ids":[ "xxxx", "xxxx", "xxxx", "etc" ] } androidmanifest.xml (gcm part only) <!-- gcm start --> <receiver android:name="com.google.android.gms.gcm.gcmreceiver" android:exported="true" android:permission=&qu

PHP exact match between input and regex pattern -

i'm trying build check reliably evaluates whether input ($f_username) mac address via regex 'cause there different syntax take. upon finding match. should transferred lowercase without deliminators. the function works fine in matching , transforming input, wrongly match longer input... e.g. 11-22-33-44-55-66-77-88 transferred 11-22-33-44-55-66 , $match set true... this should cause function go "else branch" is not exact match of pattern... contains match... have idea how match ? thanks taking time read , in advance answers :) function username_check($f_username) { global $match; if (preg_match_all("/([0-9a-fa-f]{2})[^0-9a-fa-f]?([0-9a-fa-f]{2})[^0-9a-fa-f]?([0-9a-fa-f]{2})[^0-9a-fa-f]?([0-9a-fa-f]{2})[^0-9a-fa-f]?([0-9a-fa-f]{2})[^0-9a-fa-f]?([0-9a-fa-f]{2})/", $f_username, $output, preg_pattern_order)) { ($i = 1; $i <= 6; $i++) { $new_username .= strtolower($output[$i][0]); } $match = true; $new_username = "'