Posts

Showing posts from April, 2015

select - Sql statement question -

i have table, contains logs , has following scheme: user | date | log x x x ... now, want make one query retrieve every (user, date) pair, date latest user. i thinking (pseudo): select ... (table) ordered date, distinct user but i'm not sure if that's gonna work. is correct distinct take first possible dates in query, therefore yielding required result? or order of elements in distinct query undefined? if yes, how should solve problem (this case can't add new table, such users and, example, cache lastest dates there) ? now, want make 1 query retrieve every (user, date) pair, date latest user. select user, max(date) yourtable group user you might want add order user . since both user , date reserved words sql dbms, more run. select "user", max("date") "yourtable" group "user";

android - setting a default value to a column in SQLite -

i having sqlite table , wish set default value time being. how can that? below databasehelper class code: import android.content.context; import android.database.sqlite.sqlitedatabase; import android.database.sqlite.sqliteopenhelper; public class databasehelper extends sqliteopenhelper { private static final string database_name="ifall.db"; public static final string time="time"; //public static final string status="status"; //public static final string mines="loadmines"; //public static final string opentile="opentile"; public databasehelper(context context) { super(context,database_name,null,1); } @override public void oncreate(sqlitedatabase arg0) { // todo auto-generated method stub //create table minesweeper(_id integer primary key autoincrement,userid text arg0.execsql("create table finalp(_id integer primary key autoincrement,time text);"

jquery - IE9 Submit-time CSS Repainting -

we have animated spinner gif use spice submit button after user has submitted form. if validation passes on form, assign background via jquery's css() method, setting background image, positioning , color in one. ie9 not showing background image on submit, though continues seen in other browsers. this technique has worked fine in previous ie browsers, seems have broken in ie9, including in older "browser modes". i'm not sure if bug in ie9, has changed behavior , cannot trust ie7/8 modes behave expected because of this. it seems though maybe ie decides not more repainting after user has submitted form. if case i'm not sure i've got way around it, i'd think isn't case. ran previous problem technique in firefox, discovered firefox halts http requests besides form request itself, means if background image not in cache wouldn't work. because of we've taken preloading spinner on image object in memory. interestingly, if manually call met

documentation - Howto modify Sandcastle presentation style without changing the default installation files -

my project uses sandcastle , sandcastle file builder generate documentation. we're using customized version of script_manifold.js persists user's language preference across pages (the default version resets language preference each page). currently, script located in sandcastle\presentation\vs2005\scripts folder. is there way override script custom version, without having mess sandcastle installation? is, can have file checked source control along source code, , somehow have file used shfb instead of default sandcastle one? never mind, found answer! in shfb project explorer window, can create folder same name presentation style content wish override. works stock content, such html, css or js files. in situation, needed override script_manifold.js file lives in scripts folder of vs2005 presentation style. so needed create folder called scripts in shfb project, put script_manifold.js in folder. it works perfectly. excellent!

google app engine - upload csv/excel file to appengine (python) for processing -

i need able upload excel or csv file appengine server can process rows , create objects. can provide or point me example of how done? help. uploading blobstore after. reading data , processing csv module. you might want sending file google docs in case of excel (and other) formats reading rows via spreadsheets api

php - Pass a variable through a function parameter -

i'm trying insert output of "get_custom_field_value" id of wp_table function. my syntax must wrong, because isn't working. $menu = get_custom_field_value('menu-id', true); wp_table_reloaded_print_table( "id=$menu&use_tablesorter=true&print_name=false" ); try $menu = get_custom_field_value('menu-id', true); wp_table_reloaded_print_table( "id=" . $menu . "&use_tablesorter=true&print_name=false"); if doesn't work yet, try print_r($menu); to see, menu looks like.

Groovy Schwartzian Transform -

can suggest simpler, more elegant implementation of perl's schwartzian transform in groovy? def unsorted = [7, 3, 109, 22, 55] def sortcriterion = { + 1 } def sorted = unsorted.inject([:],{map, v -> map << [(v):sortcriterion(v)]}).sort{it.value}.collect{k,v->k} assert sorted == [ 3, 7, 22, 55, 109] there must better way keys sorted map, instance. here's take on it: def sorted = unsorted.groupby(sortcriterion).sort().values().flatten()

android image - Create video thumbnails from path -

i'm trying time create thumbnails video without success. in fact found several solutions on web none work on android versions. the method seems work, works using id of video. problem need use video path don't find way that. (no method works on versions of android.) i need solution works on versions greater 2.0 sufficient. could me? thank in advance! thumbnailutils.createvideothumbnail (string filepath, int kind) help?

parsing - Extract filepaths from an html file -

i have html file various file paths e.g. c:\windows\system32\calc.exe how extract of filepaths html file? preferably via command line (i on windows based system) this link might out. microsoft msdn .

debugging - WinDbg environmental variables -

when using windbg debug executable, there way specify batch script run before debugging starts set environmental variables debug session? i'm attempting mimic automated test environment executable run. variables contain information current build number is, results directory , 3rd party tools directory located. hard-code these application own testing, that's ugly :). this of course on windows os, , rather not use different debugger. if windbg doesn't support directly, best way achieve functionality? windbg's -o option causes automatically attach child processes, useful debugging program launched program. if run windbg -o cmd.exe /c myscript.bat , windbg debug cmd.exe (which can skip over) every child process spawned instance of cmd.exe . might annoying if batch file runs lot of other commands before running 1 want debug, sx* commands (e.g. sxn ibp ; sxe ld:mymodule ) ought able reduce annoyance. another approach use image file execution options r

android - UIThread is causing problems when I want to open a new Activity -

i have surfaceview in activity, , want open new activity when occurs in surfaceview(when run out of lives - lives == 0). i've tried different things, keep having problems it. if stop uithread first, of course won't keep running , won't able execute startactivity statement. if start activity, freezes on me , force closes - having uithread believe. has run problem before - , if so, have idea how might go achieving this. @ least, if can't open new activity, how close current activity (from inside surfaceview). public class boardview extends surfaceview implements surfaceholder.callback{ context mcontext; // thread initialization private boardthread thread; thread timer; thread timer2; // box variables bitmap box = (bitmapfactory.decoderesource (getresources(), r.drawable.box)); private int box_x = 140; private int box_y = 378; private int boxwidth = box.getwidth(); private int boxheight = box.getheight(); // storage private vector<blossom> b

mysql - mysql_fetch_array returns nothing while mysql_num_rows returns 4 in php -

i have code in php accesses mysql database in sorted order, prints out info in table. however, whenever calls mysql_fetch_array, function returns nothing, though mysql_num_rows 4. is, if $row=mysql_fetch_array($result);, $row['name'] "" though there name column in table. snippet of code below: <?php include_once("include.php"); $number=0; if(!isset($_get['scores'])) { $number=10; } else if((int )$_get['scores']>100) { $number=100; } else if((int) $_get['scores']<0) { $number=10; } else { $number=(int) $_get['scores']; } $con=mysql_connect($dbhost, $dbuser, $dbpass); mysql_select_db($dbname, $con); $result=mysql_query("select * ".$dbtable_scores." order score desc,date;", $con); $num=1; echo("<table>"); echo("<tr><td>position</td><td>name</td><td>score</td><td>date</td></tr>"); while($row=mysql_f

java - How can I code a web app p2p network? -

i wanted code web application, 1 user can choose file , other multiple users can download specified file off of that user's computer. that user have leave computer on , leave web page open. i dont want have big main server has handle traffic. that user's computer server, persay. understand i'll use torrent. all has done on website. will web socket work? please , thanks. this isn't possible variety of reasons: firewalls / nats dynamic ips no "server" running on user's machines permissions on user's machine what happens if user deletes file on machine? to make work you'd have to: convince user install app on machine (you'd need windows/linux/... exe) get user open port in firewall (or use library enable nat passthru) have user's pc ping server in event user's ip changes on server side, you'd have keep several database tables, here few can think of off top of head: a user's table (user i

multithreading - MP3 Playing modules that will run within a thread Python -

i'm trying write program play mp3's. program have gui. in order allow both happen simultaneously i'm implementing threading. however, i've run problem. whenever run program executes normally, except no sound comes out. no errors nothing. it's if command skipped. through process of elimination believe i've found problem caused when run music playing portion of program within thread ( self.mp.controls.play() ). is familiar other modules allow me play music within thread? or aware of may causing problem? code: import guithread guit # guithread interface made threading module, act if threading. win32com.client import dispatch class test : def __init__ (self) : self.dir = r'song.mp3' self.thread = guit.thread(self, func=self.play_song, loop=false) self.mp = dispatch('wmplayer.ocx') song = self.mp.newmedia(self.dir) self.mp.currentplaylist.appenditem(song) def start (self) : # starts

Reading a string echoed from PHP into java? -

i trying use following code retrieve response server echoed through php. string compare methods compareto() , (...).equals(..) not act when code executed. have tried sorts of options , i'm convinced in spite of appearing convert response string format, "responsetext" not have typical string properties. if have 3 string literal statements, 1 of echoed finduser.php. how can read java in way allow me determine contents of string trying here? have found lot of discussion needing create bufferedreader object, not understand how implement that. if please lay out steps me, appreciative. try { httpclient httpclient = new defaulthttpclient(); httppost httppost = new httppost(".../finduser.php"); httppost.setentity(new urlencodedformentity(namevaluepairs)); httpresponse response = httpclient.execute(httppost); final string responsetext = entityutils.tostring(response.getentity()); if(responsetext.compareto(&q

lync extension development -

could please send me urls or code samples develop extension lync 2010. i mean development tools can integrated lync 2010 extension. add menu or button lync 2010, when click menu or button, customerized tool popup. thanks lot. you've got 4 options: 1 - add custom menu item either main lync window or conversation window. 2 - create conversation window extension host custom functionality. silverlight or html application can hosted inside conversation window. note, can applied conversation window, , not main lync window. 3 - create silverlight or wpf application contains custom functionality, , automate lync application 4 - bit extreme depending on you're trying achieve, run lync in ui suppression mode , , create custom functionality in application uses lync communication related tasks - in case, you'll have provide communication ui (e.g. conversation windows) yourself. the lync sdk can downloaded here - contains sample code , walkthroughs, , shou

Parsing a latex file in Perl -

apologies basic question! i want read in latex file (so text basically) , output (say) theorems, in format \begin{theorem} lines of latex \end{theorem} i kind of figured perl right language this! of course, know basic programming in c++ , java, , virtually no perl. nonetheless can read in text file, , process line line. it seems basic way is: ($string =~ /pattern/) i started getting confused reading control codes ?,*+,$, etc. any simple references or links me started? (i put on here , not tex site, useful reading text files, , not latex!) if you're on unix-y machine (this includes macs), task small should reach sed first: $ sed -ne '/^\\begin{theorem}$/,/^\\end{theorem}$/p' doc.tex if you're on windows, though, don't sed bundled os, , perl rather easier install aiui, here's equivalent: > perl -ne 'print if /^\\begin\{theorem\}$/.../^\\end\{theorem\}$/;' doc.tex you may notice distinct resemblance between the

junit - How to unit test a method that runs into an infinite loop for some input? -

this question occurred mind , want ask here. the case intentional, write loop runs infinitely. how go unit testing it? i ask because, situation may occur anywhere in code. method delegates several other methods, , want know how ran infinite loop what set of input caused it call method (from method) has caused this i have no code written this. question purely knowledge sake if situation arises in future. please respond. how unit test method runs infinite loop input? you can test opposite: " how unit test method method not run longer xxxx milliseconds input". if test fails may have found candidate infinite loop. nunit 2.5 has timeoutattribute makes test fail if test takes longer given amount of milliseconds.

mysql - Join two identical tables on rows with different values -

i have 2 identical tables, 1 current values rows, , 1 new values. trying select rows new values table column in new values table has different value column in old values table. query using looks like: select `new`.`item_id` `new_items` `new` join `items` `old` new.item_id = old.item_id , (new.price != old.price || new.description != old.description || new.description_long != old.description_long || new.image_small != old.image_small || new.image_large != old.image_large || new.image_logo1 != old.image_logo1 ) however, query takes way long execute. mysql have better way or know more efficient query? use: select n.item_id new_items n exists (select null old_items o o.item_id = n.item_id , (o.price <> n.price or o.description <> n.description or o.description_long <> n.description_long

sql server 2005 - What are the ways in which we can cascade data to multiple catalogs? -

i have 10 sql servers. on every server there catalog master_data. catalog has table called employees. whenever there changes in employee info gets updated on central server in master_data catalog. now have cascade changes in employees table master_data catalogs on servers. after this, same changes needs cascaded other catalogs (other master_data catalog) on servers. i have following options this ssis packages replication plain old tsql queries what best way this? also, there other ways same? based on information have provided, , assuming "catalog" mean "database", seems ideal use-case transactional replication . your central.master_data database publisher; other databases subscribers. it's not clear description why second tier of duplication required - i.e. why each non-master_data database requires own copy of employees table - there reason not have queries refer local master_data copy of data? use synonym in non-master_data datab

php - finding files in a dir -

i have directory lot of files inside: pic_1_79879879879879879.jpg pic_1_89798798789798789.jpg pic_1_45646545646545646.jpg pic_2_12345678213145646.jpg pic_3_78974565646465645.jpg etc... i need list pic_1_ files. idea how can do? in advance. the opend dir function you $dir ="your path here"; $filetoread ="pic_1_"; if (is_dir($dir)) { if ($dh = opendir($dir)) { while (($file = readdir($dh)) !== false) { if (strpos($file,$filetoread) !== false) echo "filename: $file : filetype: " . filetype($dir . $file) . "\n"; } closedir($dh); } } good luck see php.net opendir

FileCopy of NSIS installer not working in Windows 7 but working in Windows XP -

i using filecopy of nsis installer copy folder along subfiles source destination. works on xp not on windows 7. when run installer on windows 7 , filecopy dialog doesn't appears, skipped out. in windows xp, shows dialog box of "copying files" , succeeds. what's problem? please help. !define filecopy `!insertmacro filecopy` !macro filecopy filepath targetdir createdirectory `${targetdir}` copyfiles `${filepath}` `${targetdir}` !macroend ${filecopy} 'c:\accbk\*.*' '$instdir\accbk\' to make sure installer runs admin, use code: requestexecutionlevel admin ;require admin rights on nt6+ (when uac turned on) !include logiclib.nsh function .oninit userinfo::getaccounttype pop $0 ${if} $0 != "admin" ;require admin rights on nt4+ messagebox mb_iconstop "administrator rights required!" seterrorlevel 740 ;error_elevation_required quit ${endif} functionend if problem, means broken on xp (any version of nt

Android Camera RTSP/RTP Stream? -

how can send android camera video using rtp/rtsp , play in pc(using vlc or other player). i googled , found 2 answers: 1) using mediarecorder ( http://sipdroid.org/ using videocamera.java) how work tried no result :( 2) using previewcallback() - onpreviewframe(data, camera) method. by using sipdroid's (rtppacket,rtpsocket,sipdroidsocket) able send rtp packets containing each frame data , able catch via wireshark. but not able play packets in vlc :( this code: mcamera.setpreviewcallback(new previewcallback() { public void onpreviewframe(byte[] data, camera camera) { int width= 320; int height=240; eth=getinterfaces(); log.v("connected ","ethernet"+eth); if(eth!=null){ try{ inetaddress serveraddr = inetaddress.getbyname("ip address of pc"); log.v("trying ","connect wi

django - showing all fields in a Dojo Data Grid with dojo.store.JsonRest -

i have dojo data grid displaying contact information showing values 2 columns: "model" , "pk". other columns blank, because json response server puts other name/value pairs inside of "fields": [{"pk": 1, "model": "accounting.contacts", "fields": {"mail_name": "andy", "city": "grand rapids", "zip": "49546", "country": "us", "state": "mi"}}] what best way fields show in grid? here's relevant view in django: def contacts(request): json_serializer = serializers.get_serializer("json")() json_contacts = json_serializer.serialize(contacts.objects.all(), ensure_ascii=false) return httpresponse(json_contacts, mimetype="application/json") and here's dojo page: <script src="http://ajax.googleapis.com/ajax/libs/dojo/1.6/dojo/dojo.xd.js" data-dojo

django language translation -

hiii have statement.i want translate info message should do.its under httpresponseredirect.. return httpresponseredirect('/info?info=you have not logged in yet').. i want translate german have not logged in yet german stuff.i knw have update po files.. but if use ('/info?info=you have not logged in yet')::::error if use ('/info?info= (you have not logged in yet')) ::::error . please help!!!!!! in advance you need use string builder format it: from django.utils.translation import ugettext _ return httpresponseredirect('/info?info=%s' % (_('you have not logged in yet'),))

progressdialog - progress dialog not showing in android? -

when progress dialog not show in android? want know circumstances when above can happen: in case progress dialog not showing in case: func{ progressdialog.show(); .... ..... anotherfunction(); listview.setadapter(); progressdialog.dismiss(); } what general rule of thumb dialog boxes? thank in advance. edit when .show() command executed progress dialog should show. when otherfucntion() called, previous command of progressdialog show stop? seems need use asynctask ui (including progressdialog) not update if ui thread still busy. there many examples in that. and rule of thumb - if need progress dialog - need asynctask . it not command stops, if execute sequence of methods on ui thread, ui not updated until sequence over, after progressdialog.dismiss() , progressdialog should not displayed anymore.

objective c - How to extend NSTextStorage? -

according documentation, try subclass nstextstorage , use in text view: /* nstextstorage semi-abstract subclass of nsmutableattributedstring. implements change management (beginediting/endediting), verification of attributes, delegate handling, , layout management notification. 1 aspect not implement actual attributed string storage --- left subclassers, need override 2 nsmutableattributedstring primitives: - (void)replacecharactersinrange:(nsrange)range withstring:(nsstring *)str; - (void)setattributes:(nsdictionary *)attrs range:(nsrange)range; */ so try use delegate, handle needed events same functionality: @implementation mytextstorage - (id) init { self = [super init]; if (self != nil) { storage = [[nsmutableattributedstring alloc] init]; } return self; } - (void) dealloc { [storage release]; [super dealloc]; } - (nsstring *) string { return [storage string]; } - (void) replacecharactersinrange:(nsrange)range withstring

jquery - .each() method not working in IE -

in success method unable loop through xml response. webmethod is: public shared function gettypes(byval typeid integer) string dim db new dbmanager dim ds new dataset db.addparameter("@typeid", typeid) ds = db.executedataset("gettypes") ds.tables(0).tablename = "types" dim jsser new system.web.script.serialization.javascriptserializer return jsser.serialize(ds.getxml()) end function success method is successmethod: function (response, that) { $(response).find('type').each(function (index) { alert("called"); }) }); xml response is: <typeid>12</typeid> <recordid>5</recordid> <createdon>2011-04-24t09:00:00+05:00</createdon> <type>here type.</type> <typeid>22</typeid> <recordid>5</recordid> <createdon>2011-05-08t09:30:00+05:00</createdon> <type>here type.</type>

Facebook access token, session key, sig, and uid -

i'm new facebook api apologies basic. how find access token, session key, sig, , uid? also, when refer 'secret' mean api's secret key? thank you in html page, include following code fb.init({ appid : 'yourappid', status : true, cookie : true, xfbml : true }); once add code. facebook sets cookie on domain. name of cookie fbs_yourappid . you can read cookie , access token, session key, sig, , uid. alternately can use method provided facebook api connect.js file feed if user logged in. fb.api(). please refer http://developers.facebook.com/docs/reference/javascript/fb.api/ know more method. do not forget add facebook connect.js file secret , app secret different. hope info helps. happy coding :)

How to find checked event in a checkbox using jquery? -

i trying execute function on clicking check box. using following code not working can find whats problem code? $('#selectall').click(function(){ alert("hi"); }); html <th><input type="checkbox" name="selectl" value="on" id="selectall"/></th> $(function(){ $('#selectall').change(function(){ alert("value changed"); }); }); see working demo .

codeigniter include css or js file -

why can't include views if inside application folder? it fine when include in main dir: this works: <link rel="stylesheet" type="text/css" href="{ci_base_url}css/site.css" /> but not work: <link rel="stylesheet" type="text/css" href="{ci_base_url}application/css/site.css" /> why?? thanks in advance only content in called "main dir" directly accessible via http requests. that's security reasons. dir named "public"

how to protect files -

i using bat file protect files. requires user key in password make folder visible. but in c# program want open file seems can't find file when hidden bat file ( if (file.exists(ls_path)) returns false). is related bat file? i tested in normal hide @ window program still able read out path. cls @echo off title folder locker if exist "control panel.{21ec2020-3aea-1069-a2dd-08002b30309d}" goto unlock if not exist locker goto mdlocker :confirm echo sure u want lock folder(y/n) set/p "cho=>" if %cho%==y goto lock if %cho%==y goto lock if %cho%==n goto end if %cho%==n goto end echo invalid choice. goto confirm :lock ren locker "control panel.{21ec2020-3aea-1069-a2dd-08002b30309d}" attrib +h +s "control panel.{21ec2020-3aea-1069-a2dd-08002b30309d}" echo folder locked goto end :unlock echo enter password unlock folder set/p "pass=>" if not %pass%==123 goto fail attrib -h -s "control panel.{21ec2020-3aea-1069-a2dd-

jquery - How to call a function of the caller's namespace with this? -

goal: i'm trying shorten how call function of same namespace in function using "this" instead of namespace string. apparently "this" wouldn't work function, works variable. wish know if it's due misusage, or call function namespace string way. another beginner's question: i'm calling function of same namespace caller's. googled , said calling: this.myfunction work, doesn't. ideas? thanks. i'm calling: singleentry.editcontent.accept(tinymce.get('editcontentta').getcontent()); from: index.fragment.singleentry.editcontent.load i've tried as: this.accept, firebug says this.accept not function... index.fragment.singleentry.editcontent.load = (function(singleentry) { return function() { // prepare edit dialog $("#editcontentdiv").dialog({ autoopen : false, height : 500, width : 600, modal : true, buttons : { "ok" : function() {

ios - App crashes on scrolling when trying to use UITableViewDataSource -

just playing around sample code , hit on unexpected problem uitableviewdatasource. my test app basic "navigation bar" iphone template, display list. i've added nsobject subclass implement uitableviewdatasource, embedded class rootviewcontroller.xib , connected tableview's datasource outlet. the app starts ok. datasource gets initialised , table view populated first 10 rows. log: 2011-05-11 10:20:03.367 justalist[10562:207] jalmainviewdatasource init 2011-05-11 10:20:03.375 justalist[10562:207] cellforrowatindexpath <jalmainviewdatasource: 0x5d23730> 2011-05-11 10:20:03.378 justalist[10562:207] cellforrowatindexpath <jalmainviewdatasource: 0x5d23730> 2011-05-11 10:20:03.380 justalist[10562:207] cellforrowatindexpath <jalmainviewdatasource: 0x5d23730> 2011-05-11 10:20:03.381 justalist[10562:207] cellforrowatindexpath <jalmainviewdatasource: 0x5d23730> 2011-05-11 10:20:03.383 justalist[10562:207] cellforrowatindexpath <jalmainviewdata

inheritance - Is it possible to call the constructor of a super class, two classes away from the current class in C++ -

i have 3 classes inherit follows: class_a class_b : public class_a class_c : public class_b class_a contains constructor: public: class_a(const char *name, int kind); class_b not contain constructor. in class_c wish invoke constructor of class_a. like: class_c(const char *name, int kind) : class_a::class_a(name,kind) { } the problem cannot add intermediate constructor class_b , because class_b generated code regenerates every time make clean. cannot make lasting changes class_b . needless say, above line of constructor in class_c gives error: "type 'class_a' not direct base of ' class_c '". is there way may invoke constructor of class_a in subclass class_c , without requiring same type of constructor in class_b ? if can't change code generates b , out of luck, afaik. if a class contains such constructor, maybe can away adding simple member function sets 2 variables , call inside c constructor? may not efficient get

How can I use qmake to copy files recursively -

in source tree have bunch of resources, want copy them make install defined target path. since resource tree has many, many subdirectories, want qmake find files recursively. i tried: resources.path = /target/path resources.files += `find /path/to/resources` installs += resources and: resources.path = /target/path resources.files += /path/to/resources/* resources.files += /path/to/resources/*/* resources.files += /path/to/resources/*/*/* resources.files += /path/to/resources/*/*/*/* installs += resources both don't have result hoping for. i have done this: res.path = $$out_pwd/targetfolder res.files = sourcefolder installs += res this copy "wherever qmake script is"/sourcefolder buildfolder/"same sub folder on build dir"/targetfolder so have targetfolder/sourcefolder/"all other subfolders , files..." example: #(my .pro file's dir) $$pwd = /mysources/ #(my build dir) $$out_pwd

Android - How to track the memory usage of an any running app on device programmatically? -

how check how memory(ram) getting consumed of running app on device? thanks. look @ activitymanager . getrunningappprocesses list of pids, , getprocessmemoryinfo give memory details them. see following thread complete, in-depth answer: how discover memory usage of application in android? .

f# - Raise Unit of Measure type to specificed power -

is possible somehow create pow function measure types? pow function in f# takes int parameter, , pow function in math class takes float - dosent allow float<cm> . i first thought that: let rec mypow(x:float<cm>,y:int) = if y = 0 x else mypow(x*x, y - 1) might work out, obvious each time come across else line change return type. any suggestions? ankur correct - cannot (without resorting hacks break units). maybe clearer description of problem type of pow function depend on value of argument , f# doesn't allow this. imagine work if using literals second argument, become tricky if used expressions: pow 3 // assuming = 1.0<cm>, return type float<cm ^ 3> pow n // assuming = 1.0<cm>, return type float<cm ^ n> in second case value n have appear in type! you can use nasty tricks (inspired haskell article ), becomes bit crazy. instead of using numeric literals, you'd use s(s(s(n))) represent number 3 . way,

No "www" in front of our URL in Google listing? -

basically our website listed in google url has "ourdomain.com" whereas we'd have "www.ourdomain.com". is there way inform google spiders of this? meta tag? setting in our httpd? or dns host setting we'll need contact our hosting provider about? this can controlled google's webmaster tools. you'll have go through site verification process first, once it's set up, can apply preference how domain displays in search result listings.

perl - Why is a 'use' statement executed first in a BEGIN block? -

when execute following code, can't locate somepackage.pm in @inc ... . begin { die; use somepackage; } why use executed before die ? use somepackage equivalent begin { require somepackage; somepackage->import } a begin code block executed possible, is, moment completely defined . second begin (which implied use ) defined first, , executed first.

regex - Regular expression in eclipse -

new here. have 4300 instances of: <c:out value="${crane_error.aac}" /> i want replace ${crane_error.aac} not sure how format in find/replace box in eclipse thanx search expression should this: <c:out value="\$\{crane_error.aac\}" /> replace expression should this: \$\{crane_error.aac\} edit: match variable can use following expression: <c:out value="(\$\{[^\}]+\})" /> and replace with: $1

c - What is the rule of thumb for incrementing reference counts? -

when sending reference counted objects other threads, better better rule of thumb increment count before launching thread or within thread? in more general sense, should (as function) assume parameters passed me accounted or not? incrementing count within new thread pass object wrong. arbitrary amount of code in "parent" thread may run before new "child" thread gets run @ all, in case function in "parent" might return, other stuff, decrement reference count 0, , free object. new thread touch invalid memory, invoking undefined behavior, , hell break lose. further note such bugs go undetected long time, since it's statistically unusual new thread not run immediately. in fact customers/clients see bug first... :-)

wcf - Generating Client code using svcutil -

i trying generate client proxy code using svcutil.exe tool. , throwing follwong error. i using following command. svcutil /namespace:http://www.starstandard.org/star/5,* /out:starcontract.cs /noconfig sendorderorder.wsdl sendorderordertype.xsd --------------------output ---------------------- error: there error verifying xml schemas generated during export: 'http://www.starstandard.org/star/5:sendorder' element not declared. error: cannot import wsdl:porttype detail: exception thrown while running wsdl import extension: system.servicemodel.descripti on.xmlserializermessagecontractimporter error: element 'http://www.starstandard.org/star/5:sendorder' missing. xpath error source: //wsdl:definitions[@targetnamespace='http://www.starstandards.org/webservices /2005/10/transport/bindings']/wsdl:porttype[@name='startransportporttypes'] error: cannot import wsdl:binding detail: there error importing wsdl:porttype wsdl:binding dependent on. xpath

Blackberry - ButtonField Controls Paint method -

i extending buttonfield , overriding paint method show buttons in differnet color. painting whole button width. part of button stil shows gray when there no focus , blue when on focus. can please me resolve issue? thanks, ramesh you'll have override protected void applytheme() disable painting going on.

perl - Does PHP have autovivification? -

searching php.net autovivification gives no results. @ time of writing, wikipedia claims perl has it. there no definitive results when searching google "php autovivification". this php code runs fine: $test['a'][4][6]['b'] = "hello world"; var_dump($test); array 'a' => array 4 => array 'b' => array ... can provide canonical answer (preferably references) php have feature, , details such version introduced in, quirks, shortcuts etc? yes, php have autovivification (and has had long time), although isn't referenced terminology. php.net states: an existing array can modified explicitly setting values in it. this done assigning values array, specifying key in brackets. key can omitted, resulting in empty pair of brackets ([]). $arr[key] = value; $arr[] = value; // key may integer or string // value may value of type

Spring, Hibernate, MySQL - How Transactions work - Conclusion/Questions** -

i work spring framework 3.0.5, hibernate 3.6 , mysql server 5.1. ive got questions regarding transaction management in general. use declarative transaction management spring. great if answer questions yes/no (or correct/incorrect) , maybe, if necessary, give short explanations. nice if several people answer in case there different opinions. thank :-) 1) sentences correct: dbms responsible implementation of transactions , behaviour. 1) b) maybe better say: dbms responsible implementation of transactions , behaviour of database (for example when transaction rolled back). 2) hibernate uses database connection. needs transactions, doesnt configurate any(!) settings regarding transactions , behaviour. 3) but: work transactions, hibernate needs know, transactions start, commited , need rolled back. 4) hibernate need know in case of roll happens? think no, because should defined in dbms. (that means: tables shall locked, database operations shall made undone, , on, correct?

database - datagrid use data of auto selectedIndex - data race - Flex -

i have datagrid loads contnet database. once data has been loaded have function has selectedindex=0; right after call function tries display selected item across couple of labels. the problem nothing loads in labels unless run functions twice. i'm guessing sort of data race problem item hasn't been selected time function displays items in labels runs. so whats workaround how can item selected before next function runs. put next function call in calllater(); selectedindex = 0; calllater(function():void { //nextfunction() });

javascript - Onload event not working with Internet Explorer -

i've written simple code on internet explorer 8 , don't understand why nothing happens when open page ie (why text 'test' doesn't appear on page). i've tried on firefox , chrome , works perfectly. my code : <html> <head> <meta http-equiv="content-type" content="text/html; charset=iso 8859-1" /> <script type="text/javascript"> function display() { output.innerhtml+='test'; } </script> </head> <body onload="display()"> <div id="output"> </div> </body> </html> edit : let ie change setting, don't hand or gets weird :-)) document.getelementbyid('output').innerhtml += 'test';

mysql - Using case when count() is zero? -

i'm trying list of articles sorted number of comments. i've made similar process list sorted aticle's votes don't know why don't work. select a.*,cc.params catparams,cc.title cattitle,u.username, case when char_length(a.alias) concat_ws(":", a.id, a.alias) else a.id end slug, case when char_length(cc.alias) concat_ws(":", cc.id, cc.alias) else cc.id end catslug, case when (count(rs.id)=0) 0 else count(rs.id) end total_comments jos_content inner join table_users u on u.id = a.created_by inner join table_categories cc on cc.id = a.catid left join table__comments rs on rs.id = a.id this code return results if article has @ least 1 entry in comments table; want list of articles , if there no entry in comments table return 0 total_comments. i've tried inner join, left join , right join. any appreciated! i think need sub select select a.*, cc.params catparams, cc.title cattitle, u.username, case

cocoa touch - facebook iphone sdk logout issue! -

ive been searching solution seems simple problem while have had no luck. login code follows. - (bool)application:(uiapplication *)application handleopenurl:(nsurl *)url { return [facebook handleopenurl:url]; } - (void)applicationdidbecomeactive:(uiapplication *)application { nsuserdefaults *prefs = [nsuserdefaults standarduserdefaults]; nsstring *accesstoken = [prefs stringforkey:@"facebook-accesstoken"]; nsdate *expirationdate = [prefs objectforkey:@"facebook-expirationdate"]; facebook.accesstoken = accesstoken; facebook.expirationdate = expirationdate; if ([facebook issessionvalid]) { nslog(@"valid session"); } else { nslog(@"not valid"); [facebook authorize:nil delegate:self]; } } - (void)fbdidlogin { nslog(@"delegate method"); nsstring *accesstoken = facebook.accesstoken; nsdate *expirationdate = facebook.expirationdate; nsuserdefaults *prefs = [nsuserdefaults standard

sql server 2005 - Putting getdate()'s data into a string -

in sqlserver 2005, using query: select getdate() or print getdate() i want use returned date string access to: the month the year(last 2 digits) date (eg: 01) time (eg: 5:12) i want concatenate data. should in string format. first of all: all formatting should done on client. got out of way convert , datepart functions. convert offers lots of styles can use, while datepart returns part of date integer can convert varchar. just note there lot of functions these on web searching wouldn't bad idea.

iphone - Memorymanagement when getting a NSMutableArray from NSObject class to UIViewController class -

i have problem following code leaking memory... @property (nonatomic, retain) nsmutablearray *childrensarray; -(void)connectiondidfinishloading:(nsurlconnection *)connection { nslog(@"connection finished loading."); // dismiss network indicator when connection finished loading [uiapplication sharedapplication].networkactivityindicatorvisible = no; // parse responsedata of json objects retrieved service sbjson *parser = [[sbjson alloc] init]; nsstring *jsonstring = [[nsstring alloc] initwithdata:responsedata encoding:nsutf8stringencoding]; nsdictionary *jsondata = [parser objectwithstring:jsonstring error:nil]; childrensarray = [jsondata objectforkey:@"children"]; // callback attendancereportviewcontroller responsedata finished loading [attendancereportviewcontroller loadchildren]; [connection release]; [responsedata release]; [jsonstring release]; [parser release]; } in viewcontroller following leaks memory... @property (nonatomic, retain) nsmu

javascript - Why do I keep getting an "undefined" error with this JSONP feed? -

i using following code retrieve data in jsonp format. need use if no data returned, can flag error. using jquery's ajax(), returns 404 pages being successful, need use jquery-jsonp jquery plug-in on google code error handling. i borrowed code example on jquery ajax (jsonp) ignores timeout , doesn't fire error event , cannot seem work json, being sent mime type "application/json" other server. $(function(){ var jsonfeed = "http://othersite.com/feed.json"; $.jsonp({ url: jsonfeed, datatype: "jsonp", timeout: 5000, success: function(data, status){ $.each(data.items, function(i,item){ console.log("title: " + item.title); if (i == 9) return false; }); }, error: function(xhr, textstatus, errorthrown){ console.log("error status: " + textstatus); console.log("error thrown: " + error

Android Cross-compiling ffmpeg -

is there option compile ffmpeg under arm (android ndk) dynamically? (i found articles static compiling) , second question: when building ffmpeg can not find files makefile.am. can somehow it? i chose toolchain more commonly used 4.4.0 of gcc when compiling arm linux products use can change liking, don't know if work substitutions please don't ask. ran ./configure command hundreds of times before got succssful build. therefore sharing worked maybe you. using ubuntu 32-bit 10.04.03 in virtuabox guest / host machine vista 64 change <username> linux users name mkdir /home/<username>/applications cd /home/<username>/applications wget http://dl.google.com/android/ndk/android-ndk-r5b-linux-x86.tar.bz2 wget http://ffmpeg.org/releases/ffmpeg-0.8.7.tar.bz2 tar -xjf android-ndk-r5b-linux-x86.tar.bz2 tar -xjf ffmpeg-0.8.7.tar.bz2 mv ffmpeg-0.8.7 ffmpeg ndk=/home/<username>/applications/android-ndk-r5b $ndk/build/tools/make-standalone-toolchain.s

ruby - How can I tell if a method is read-write, read-only, or write-only, via introspection? -

i coming java, , want know if can 'set' instance variable object using introspection. for example, if have following class declaration, 2 instance variables, first_attribute , second_attribute : class someclass attr_accessor :first_attribute attr_reader :second_attribute def initialize() # ... end end i want able instance methods, presumably calling someclass.instance_methods , know of instance methods read/write vs. read-only. in java can by: propertydescriptor[] properties = propertyutils.getpropertydescriptors(someclass); (prop : properties) { if (prop.getwritemethod() != null) { // can set one! } } how do in ruby? there's not built-in java property stuff, can pretty this: self.class.instance_methods.grep(/\w=$/) which return names of setter methods on class.

java - Can't Lookup Weblogic11 -

i using weblogic 11g, ejb3.0. i trying simple 1 deployment in same machine. no success. this code: in 1 deployment target class: @callbyreference @stateless (mappedname = "ejb/syncoperatorsbean") @local ({syncoperatorsbeanlocal.class}) @remote ({syncoperatorsbeanremote.class}) @jndiname("ejb/syncoperatorsbean") //added public class syncoperatorsbean implements syncoperatorsbeanlocal,syncoperatorsbeanremote ... now in second deployment, how lookup in order reach first deployment: syncoperatorsbeanremote syncoperatorsbean = (syncoperatorsbeanremote) context .lookup("ejb/syncoperatorsbean#com.mirs.sbngenerate.beans.syncoperatorsbeanremote"); syncoperatorsbean.executesyncoperation(); that's exception: javax.naming.namenotfoundexception: while trying lookup 'ejb.syncoperatorsbean#com.mirs.sbngenerate.beans.syncoperatorsbeanremote' didn't find subcontext 'syncoperato