Posts

Showing posts from 2011

android - getDeviceList returns devices that are no longer connected -

i have galaxy nexus (running android 4.2.2) connected computer via usb. device connected in device mode usb debugging enabled. there no devices connected handset. when run debugger, 1 device shows connected, not have devices connected. device that's showing not connected computer. when phone rebooted, getdevicelist() reports no connected devices, correct. is known bug? there way refresh device list ensure it's reporting devices connected?

php - Roundcube install, getting MYSQL_ATTR_FOUND_ROWS fatal error -

i'm installing roundcube 0.9.0 on shared host server. i have php 5.3.8 pdo activated when i'm installing roundcube, response get: check db config fatal error: undefined class constant 'mysql_attr_found_rows' in /home/neuas/domains/anthonysalvador.info/public_html/webmail/program/lib/roundcube/rcube_db_mysql.php on line 127 i have contacted host, turned me away. contacted roundcube, turned me away. there overlooking? here pdo section of code including faulty line: 102 protected function dsn_options($dsn) 103 { 104 $result = array(); 105 106 if (!empty($dsn['key'])) { 107 $result[pdo::mysql_attr_key] = $dsn['key']; 108 } 109 110 if (!empty($dsn['cipher'])) { 111 $result[pdo::mysql_attr_cipher] = $dsn['cipher']; 112 } 113 114 if (!empty($dsn['cert'])) { 115 $result[pdo::mysql_attr_ssl_cert] = $dsn['cert']; 116 } 117 118 if (!empty($dsn['capath'])) { 119

c++ - identifier "ostream" is undefined error -

i need implement number class support operator << output. have error: "identifier "ostream" undefined" reason eventhough included , try here header file: number.h #ifndef number_h #define number_h #include <iostream> class number{ public: //an output method (for type inheritance number): virtual void show()=0; //an output operator: friend ostream& operator << (ostream &os, const number &f); }; #endif why compiler isnt recognize ostream in friend function? you need qualify name ostream name of namespace class lives in: std::ostream // ^^^^^ so operator declaration should become: friend std::ostream& operator << (std::ostream &os, const number &f); // ^^^^^ ^^^^^ alternatively, have using declaration before unqualified name ostream appears: using std::ostream; this allow write ostream name without full qualification, in current version of program.

objective c - Specify floating point number accuracy in NSString -

i'm trying specify accuracy of floating pointer number in nsstring keep on getting error: format specifies type 'double' argument has type 'nsstring *' here code: nsstring *tmplabel = [tmp description]; temp.text = [nsstring stringwithformat: @"%.fº", tmplabel]; what doing wrong? your tmplabel nsstring , should double . if sure tmplabel holds number can parsed simple double, can use doublevalue on it. otherwise might have more elaborate conversion error handling etc. here's down-to-earth simple way it: temp.text = [nsstring stringwithformat: @"%.fº", [tmplabel doublevalue]]; the doublevalue method (and close relatives integervalue , , similar) interprets string's content , if beginning of string can read number, convert , return appropriate primitive type. in case primitive type double . you can not make type cast object (anything ns*) primitive type, have go through sort of interpretation or progra

insert - Mysql commit sometimes takes minutes to finish -

ive been having problem on 1 week now. ive allready gone though similar problems other people had here on stackoverflow. im running mysql 5.6.10. "query end" step long @ random times update statements in "query end state" lots of "query end" states in mysql, connections used in matter of minutes it happends randomly. every 5 minutes or so, commit takes very long time. , size of transation insert around 1-2000 rows. ive been changing settings much, ive kind of lost decided create questions here. my inserts/updates sqlfiles have been generated program. have windows service runs every 1,5 minutes processing files. build string of many sql files in transaction mode. works 4 out of 5 time smooth, 1 out of 5 jams. it happends on same table, , of times regarding inserts happends on updates. doubt has structure of tables never know until solved :) this table structure create table `int_links_root_1` ( `intlinksrootid` bigint(20) not null au

matlab - Green component after setting Y,Cb and Cr to zero -

i setting y, cb , cr 0 , converting rgb using matlab. don't understand why getting red , blue component 0 in rgb color space while green component has value 132? edit: (code comment): i1 = imread('img.jpg'); img = rgb2ycbcr(i1); lumin = img; lumin(:,:,1) =0; lumin(:,:,2) =0; lumin(:,:,3)=0; figure,imshow(lumin); rgn = ycbcr2rgb(lumin); figure,imshow(rgn); conversion formulas between rgb , ycbcr involve offsets. if zeros in 1 domain not zeros in other domain. if directly use formula convert 0 ycbcr domain matrix rgb positive green values , negative red , blue values. these negative values thresholded 0 seeing. the wikipedia page http://en.wikipedia.org/wiki/ycbcr , matlab color space conversion block reference page @ http://www.mathworks.com/help/vision/ref/colorspaceconversion.html shows formulas used.

javascript - google maps remove one polygon of multiple polygons -

i have google maps v3 multi polygons on map , want remove 1 of them. added reference id geo.objinfo , want add remove polygon reference id. here code: <!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <script type="text/javascript" src="http://code.jquery.com/jquery-1.9.1.js"></script> <script type="text/javascript" src="http://www.google.com/jsapi"></script> <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script> <script> var data = [{"id":"206671","parentid":"205781","level":"2","name":"gelderland","continentcode":"","countrycode":"nl","regioncode

r - Use a factor column in "by" and do not drop empty factors -

suppose have data.table: x <- data.table(x=runif(3), group=factor(c('a','b','a'), levels=c('a','b','c'))) i want know how many rows in x exist each group : x[, .n, by="group"] # group n # 1: 2 # 2: b 1 question: there way force above by="group" consider levels of factor group ? notice how since don't have rows of group 'c' in table, don't row c. desired output: x[, .n, by="group", ???] # somehow use levels in `group` # group n # 1: 2 # 2: b 1 # 3: c 0 if willing run through factor levels enumerating them in i (rather setting by="group" ), hoped results. setkey(x, "group") x[levels(group), .n, by=.eachi] # group n # 1: 2 # 2: b 1 # 3: c 0

html - Tips on creating a mega menu using css and javascript -

so looking menu 5 content tabs , inside of each of tabs 7 items. each of these items need have potential of having submenu of own. i looking best way structure able read , updated using css, javascript(no jquery), , html. must compatible ie 8 (a pita me). thank tips or suggestions. jsfiddle.net/nwxry/2/ http://i.imgur.com/9nlc88w.png <- image of looking do the code didn't work because wrapped in onload (on left side of fiddle). i made small css solution it, can build upon here. hope suits needs. under "change request" > "infrastructure service" can find another, css-based submenu under first item. jsfiddle i added following #t4: <div class="mnuitem" id="chginfrastructuremnu"> <img src="arr1.pngx" style="margin:-35px 0px 0px -10px;position:absolute"/> <div class="mnusubitem"><a href="#">item</a> <!-- part added --> <d

sass - Sublime Text: Reindent SCSS files? -

i've got scss files who's indentation has somehow managed pretty jacked up. i've tried doing edit > line > reindent , changing various indentation settings, none seem work properly. is there consistent way re-indent scss file? example of i'm seeing: [role="main"] { margin: 0 auto; padding: 30px; h1 { text-align: center; font-family: 'exo'; font-weight: 200; font-size: 3.5em; margin: 8px 0 20px 0; } } .hidden { display: none; } .button, button { @include button; &.red { @include button($red); } } and that's happening across thousands of lines of scss...which i'd rather not have go , manually correctly indent. select everything, , hit ctrl - [ (unindent) several times remove of original indentation. then, use edit -> line -> reindent , should work nicely. sample code produced me: [role="main"] { margin: 0 auto; padding: 30px; h1 { text-align: center;

bundle - Installing Teambox on Ubuntu. Failing on Gherkin 2.3.3 installation -

i haven't found teambox's support forum i'm asking here. note new linux , commandline syntax please understand. :) anyway, followed this guide , managed install prerequisites needed. after cloning git repository, invoked command: bundle install the script proceeded install different apps stopped gcc compile error when installing gherkin 2.3.3. is there way tell "bundle" "install" latest gherkin instead of 2.3.3? you need tell bundle pass "ignore warning error" parameter gem. this, execute following command before calling bundle install : bundle config build.gherkin --with-cflags=-w if won't work, try this: bundle config gherkin --with-cflags=-w reading 2 entries helped me solve problem: troubleshooting installing gherkin 2.1.5 how can pass parameter gem installation when run bundle install?

java - How to set up multiple "environments" with CloudBees? -

i read cloudbees developer docs , surprised didn't see setting multiple environments deployment pipeline. i plan on running app locally, promote code qa machine inside network, , there nice deploy code changes "demo" environment on cloudbees cloud, clients review/acceptance test changes before set them live. so ask: how 1 set both demo , production environment on cloudbees? ideally, i'd have demo environment demo.myapp.example.com , production environment myapp.example.com . in advance! you sure can deploy exact same binary multiple environment, , each of them configured distinct resources , parameters. common pattern. need use cloudbees sdk fine-grain setup both environments. both run.cloudbees.com web console , jenkins cloudbees deployer offer limited options.

java - maven pass command argument at build time to overwrite property -

in our application, have system whitelabel. in application.properties there setting theme=default this setting injected spring managed bean, manipulation of app through framework, adding correct css, etc what able do, @ build time (war creation), specify theme, eg mvn clean install -theme:some-theme . update application.properties , , modify theme , if run mvn clean install theme=default or unmodified is possible? the proper way set property via command-line using -d : mvn -dproperty=value clean package it overwrite property defined in pom.xml . so if have in pom.xml : <properties> <theme>mydefaulttheme</theme> </properties> mvn -dtheme=halloween clean package overwrite theme s value during execution, having effect if had: <properties> <theme>halloween</theme> </properties>

android how to add marker on image? -

i need add marker on specific pixel on image how can ideas , need make action when clicked on image read article didn't know how start it @override public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate) { svg svg; switch (mnum) { case 1: svg = svgparser.getsvgfromresource(getresources(), r.raw.t1); break; case 2: svg = svgparser.getsvgfromresource(getresources(), r.raw.t2); break; case 3: svg = svgparser.getsvgfromresource(getresources(), r.raw.t3); break; case 4: svg = svgparser.getsvgfromresource(getresources(), r.raw.t4); break; default: svg = svgparser.getsvgfromresource(getresources(), r.raw.android); } view v = inflater.inflate(r.layout.hello_world, container, false); view tv = v.findviewbyid(r.id.text)

java - sort List<CrExcessMaster> by opendate property in bean class -

my method is public filtereduiexcesslist getcustomerexcesses(long cif,string primaryco) throws exception { if (cif != null && !cif.equals(0l)) { list<crexcessmaster> crexcessmasterlist = getexcessdbservice() .getexcessesforcustomer(cif); } excessuibean class has opendate property public class excessuibean implements comparable<excessuibean>{ private boolean notifydaholder; private string davalueforuser; private string excessid; private string excessda; private string status; private string product; private string measure; private string currency; private string limitatexcess; private string excessamount; private string excessdate; private string maxriskamount; private string maxriskdate; private string comments; private string predefinedcomments; private string opendate; public string getopendate() { return opendate; } public void setopend

Liferay auto assign users to an organization on register -

how auto assign user organization when register liferay portal. thanks , regards, s.ponraj you can automatically assign new users sites, roles , user groups, not organizations. anyway, there surely many ways achieve want few lines of code. for example, can develop hook plugin overrides adduserwithworkflow method of userlocalservice service, can add new organization id organizationids parameter before calling super.adduserwithworkflow(...) . hope helps!

Store several text_field strings to array Rails 3 -

i'm trying store strings couple of text_fields have array, , save db. have column named "opening_hours" wich i've tried separate 2 different attributes using virtual attributes this: model class venue < activerecord::base attr_accessible :opening_hours, :start_time, :end_time attr_writer :start_time, :end_time def start_time @start_time.nil? ? @start_time : opening_hours.to_s.split("-").first end def end_time @end_time.nil? ? @end_time : opening_hours.to_s.split("-").last end end the idea type in start_time , end_time this: view <%= form_for @venue |v| %> <p><%= v.label "monday" %><%= v.text_field :start_time %>-<%= v.text_field :end_time %><p/> <p><%= v.label "tuesday" %><%= v.text_field :start_time %>-<%= v.text_field :end_time %><p/> <p><%= v.label "wednesday" %><%

iphone - UIPickerView in UITableViewCell:issue in showing the value at particular cell -

i using uipickerview in uitableview picking integer value. not getting how set value label in particular cell. below code: -(uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath { static nsstring *cellidentifier = @"cell"; uitableviewcell *cell; cell = [self.mtickettable dequeuereusablecellwithidentifier:cellidentifier]; if (cell == nil) { cell = [[uitableviewcell alloc] initwithstyle:uitableviewcellstyledefault reuseidentifier:cellidentifier]; } else{ cell = [[uitableviewcell alloc] initwithstyle:uitableviewcellstyledefault reuseidentifier:cellidentifier]; } cell.backgroundview = [[uiimageview alloc]initwithimage:[uiimage imagenamed:@"cell.bg.png"]]; cell.selectionstyle = uitableviewcellselectionstylenone; lbltype = [[uilabel alloc]initwithframe:cgrectmake(10, 15, 90, 30)]; lblprice = [[uilabel alloc]initwithframe:cgrectmake(140, 15, 90, 30)]; lblseat = [[uilabel alloc]initwithframe:cgrectmake(232, 21,

iphone - OCUnit testing problems in UINavigationController -

Image
i create single view application 1) story board 2) arc , 3) unit testing. in view controller drag on uibutton. , viewcontrller embedded navigation controller (using interface). run fine in when run application, when run application test case target aries problem. vc viewcontroller object declare in .h file. , createpdfbtn object of uibutton. which thing missing? you trying call createpdfbtn on view controller ( self.vc ). since not have method name error message: unrecognized selector sent instance three possible problems , solutions: you may calling method on wrong object - vc right object? vc correct not have createpdfbtn method implemented - implement method. you have implementet createpdfbtn in vc object - public or private method? in .h file ?

http - Generate thumbnail from remote jpeg without downloading -

i want load exif thumbnail preview stored in jpeg image located on remote server, without having download whole image. server not support resuming. is possible? in detail, can assume thumbnail image data alway before full image data have download maximum of (e.g.) 100kb can parse thumbnail data? i asking same question , found greasemonkey script adds thumbnail images apache auto index page. https://userscripts.org/scripts/review/5390 for each jpeg image link issues range request jpeg / jfif header, parses thumbnail offset , thumbnail length tag issues further range request thumbnail, creates data uri , assigns new img object. unfortunately works jpeg file formats.

linux - awk create a bulk MySQL insert from csv -

i have huge csv file data, i'm trying generate mysql bulk insert statement. data presented follows in csv 90927597|1356976813998|1356976814177|1356976817457|17756249959|17756249959|18663111085|17753220005|1090917|1775624995900|a 90927599|1356976813098|1356976814797|1356976823738|12562175250|12562175250|12566502514|12565207040|1890362|1256217525000|a 90927602|1356976813098|1356976814797|1356976823738|12562175250|12562175250|12566502514|12565207040|1890362|1256217525000|a 90927603|1356976813098|1356976814797|1356976823738|12562175250|12562175250|12566502514|12565207040|1890362|1256217525000|a i'm looking create bulk insert combine every 2 rows single insert statement mysql statement desired output insert data (90927597,1356976813998,1356976814177,1356976817457,17756249959,17756249959,18663111085,17753220005,1090917,1775624995900,a,90927599,1356976813098,1356976814797,1356976823738,12562175250,12562175250,12566502514,12565207040,1890362,1256217525000,a); insert data

python - PyQt - displaying widget on top of widget -

i'm making application shows map of area , i'm trying draw nodes on top of can represent information. i made work, did making 1 custom widget showed , printing again , again everytime information changed. couldn't 'connect' nodes listeners, because images in original widget. this made me want reform gui , i'm trying make every class custom widget! there's problem, mapnodes aren't showing anymore. i searched stackoverflow , found helpful thread: how set absolute position of widgets in qt so have give mapnodes parent, , parent = widget being shown (?) anyway, here throw @ it, pasting relevant code here. hint @ stuff might go horrible wrong: inits app = qtgui.qapplication(list()) mutexbranch = lock() mutexnode = lock() def exec(): return app.exec_() #singleton pattern: wanneer en object aan iets moet kunnen # waar het inherent door de structuur niet aankon # wordt dit via dit singleton opgelost class

android - how to make json metadata database for vuforia cloud recognition -

i using vuforia cloud recognition sample android. wanted change target image , augmentation object (3d model, video streaming, images). understand i'll have create json metadata , or kind of database on remote server provide me augmentation object, same way samplebook1.json in cloudreco sample. can please clarify me , point me in right direction? how create json metadata? how create database? how integrate application? i found discussion : https://developer.vuforia.com/forum/cloud-recognition/time-update-metadata&sort=1

python - How do I get started with PyWin32 -

i looking resources started pywin32. haven’t found in way of tutorials, books or blogs talk it. i’d able use python automate of common repetitive microsoft excel , word tasks (such open word doc , search , replace data spreadsheet). i have found lot of references pywin32 (on google , stackoverflow), it’s @ more advanced level. i’d find documented resources me speed can use other posts found. what can recommend if okay buying book this guide . the documentation (can found in installation of pywin32) , active state's doc (with list of objects , modules) should rest.

java - Maintain SortedMap by value -

as know that, sortedmap maintains entries sorted keys. read many threads in forum , saw lots of example sorts sortedmap, values. however, know when put item default sortedmap not sort map again put new entry supposed be. for example, sortedmap<string,person> sortedmap = new treemap(); person p1 = new person("john",38); sortedmap.put(p1.getname(), p1); person p2 = new person("tom",34); sortedmap.put(p2.getname(), p2); // not sort, maintains sorted set comparing other values person p3 = new person("susan",21); sortedmap.put(p3.getname(), p3); // not sort, maintains sorted set comparing other values in many threads in forum, saw many many code sorts sortedmap values calling sort method like: sortedmap.sort(sortedmap.entries()); this or else method being called values sorted. but, need map implementation keeps values sorted without calling sort method explained in above. example, in above code can call firstkey() method; instead need c

audio recording - Record MIC sound into byte array in android -

i'm trying record mic direcly short array. the goal not write file audio track, save within short array. if've tried several methods , best i've found recording audiorecord , play audiotrack. i've found class here: android: need record mic input this class makes need, have modify achieve desired result, but...i don't well, i'm missing something... here's modification (not working @ all): private class audio extends thread { private boolean stopped = false; /** * give thread high priority it's not canceled unexpectedly, , start */ private audio() { android.os.process.setthreadpriority(android.os.process.thread_priority_urgent_audio); start(); } @override public void run() { log.i("audio", "running audio thread"); audiorecord recorder = null; audiotrack track = null;

Comparing directories and making changes according to last modified time in PowerShell -

am trying learn powershell in order write script have been unable learn fast enough. need script in powershell following: compare 2 directories, copy on missing files or subdirectories. during compare, copy recent file(by last modified time) reference object. this script should lead 2 duplicate directories on different servers, both date last modified files , sub dirs. here little of have come with. compares 2 dirs , determines missing each. pretty basic , no near needs be. pointers appreciated if me along way. thanks. $test1 = get-childitem -recurse -path c:\test1 $test2 = get-childitem -recurse -path c:\test2 compare-object -referenceobject $test -differenceobject $test2 for requirements use straight robocopy. can call powershell ampersand (call) operator: & robocopy "c:\test1" "c:\test2" /e /dcopy:t here link examples: robocopy

sql - How to loop through stored procedure recordset? -

i have select statement declare @t table (percentage float) declare @acc int set @acc = 1 declare @max int select @max = max(hireid) newhire while (@acc <= @max) begin if (@acc in (select hireid newhire)) begin try insert @t select cast((select count(*) hire_response hireid = @acc , (hireresponse = 0 or hireresponse = 1)) float) / cast((select count(*) hire_response hireid = @acc) float) end try begin catch insert @t select 0.0 end catch set @acc = @acc + 1 end select * @t in code, looping through newhire records id, 1 highest one. realized not want anymore. have stored procedure called sp_selectnewhire2sql gets newhire table in specific way. want call it, , aquire returning recordset, , loop through top bottom. note: doing loop id 1 highest wont work anymore, because order of id's mixed u

php - user id which initiated script -

i'm developing website on wordpress platform. have strange issues caused user id. user initiated script: global $user_id; what mean is, when go page, , php executes, need know user id in php when code executes. reasons, sometime id not right. also when php script executing , if do: global $user_id = get_current_user_id(); then have user id initiated script ? the issue in strpos(), not smart function, not able find substring: strpos($text,'{"user":"'.$user_id.'","status":"2"}'); but substr_count() worked. , not first time when strpos() fault... no more use it.

language agnostic - Is writing as many tests as possible at once a good practice for TDD? -

i'm beginner tdd; i've read tdd example , can't seem stop writing code in tdd fashion. i've noticed lot of time i'm writing test, see fail, correct it, , refactor. , after tests see there better way write interface all-along leads me want change of previous tests. it makes lot of code write waste of time, i'm wondering if practice write of tests @ once (or @ least try to) in-order save time? i'm asking because know it's not standard way, wrong? the real question "do more finished code done in given length of time?" doesn't matter how many times write , throw away if more in end. as use tests more, better figuring out whether test or not. ask question, "does test code somehow?" document how use code? check code didn't modified incorrectly when refactoring? test code works right on "happy path" , kinds of failures common? i write 1 test , 1 bit of code. have decide how "one unit" of code yo

iphone - Interactive / social app content and apple app aproval -

i near finish building first app , parts of app social allows user create , share content has images , text. i tried researching on interactive content , apple approval criteria couldn't find anything. hoping guide me bit. 1) have make picture approval process images uploaded users otherwise app wouldn't approved? 2) have filter profanity in text shared users otherwise app wouldn't approved? where uploading them firstly? if facebook or twitter using social framework don't need this.

Java Past Paper - Is it just me or wording of this switch statement q is making it unsolvable? -

Image
i have been revising exam , have found question in 1 of past papers (at least me) seem unsolvable. have attach picture because has been scanned , saved set of images. you can't tell output of code when taking consideration values sub questions because no actual parameter being passed method , switch statement. understanding correct, or missing something? i agree - without knowing value of num is, can't decide output is. maybe there typo , method supposed be: public static void compute(int value) { switch(value) {...} } in case answer should take account fact if change value in 1 of case statements, original value used decide if other case statements should executed (in other words, 1 case statement can executed).

emacs - Elisp function return value -

i'm having (probably) dumb problem elisp. want function return t or nil depending on when condition. code: (defun tmr-active-timer-p "returns t or nil depending of if there's active timer" (progn (if (not (file-exists-p tmr-file)) nil ; (... more code) ) ) ) but i'm having error. i'm not sure how make function return value... i've read function return last expression result value in case, wan't make (php mess warning): // code if ($condition) { return false; } // more code... maybe i'm missing point , functional programming doesn't allow approach? first , need argument list after tmr-active-timer-p ; defun syntax is (defun function-name (arg1 arg2 ...) code...) second , not need wrap body in progn . third , return value last form evaluated. if case can write (defun tmr-active-timer-p () "returns t or nil depending of if there's active timer." (when (file-exis