Posts

Showing posts from April, 2012

I am not able to debug Home sample application in android -

Image
i trying debug home sample application(to change theme of home) provided in android sdk. not able so. no error shown no breakpoints encountered either.i confused.can suggest something? launching home sample using debug > android application in eclipse doesn't attach debugger process automatically. because home screen not shown right away normal android application. however can manually attach eclipse debugger com.example.android.home process selecting devices view , clicking on debug button. if don't see devices view in eclipse use: window > show view > others... > android > devices

Java Server reply is not printed as expected -

i building simple client-server program , have in main : ftpclient ftp = new ftpclient("www.kernel.org"); ftp.getreply(); ftp.sendcommand("user " + "anonymous"); ftp.getreply(); ftp.sendcommand("pass " + "anonymous"); ftp.getreply(); string com=""; while (!com.equalsignorecase("quit")){ system.out.println("enter commands . or enter quit"); bufferedreader keyboard = new bufferedreader(new inputstreamreader(system.in)); com = keyboard.readline(); ftp.sendcommand((com)); ftp.getreply(); system.out.println("==============="); } ftp.close(); the problem in getreply() function, function : public void getreply() throws ioexception { string line=""; while (br.ready()) { line = br.readline(); system.out.println(line); system.out.flush(); } } br bufferedreader. now problem when program starts doesn't show welcome mess

javascript - jquery: how to decode the stringized utf-8 character? -

my python server uses json.dumps() dump json object string, converts binary utf-8 code not ascii, stringized thing, "\u4e2d". client see string, there api convert "\u4e2d" utf-8 character? in jquery can use $.parsejson decode json-formatted object. includes decoding encoded characters. using datatype: 'json' $.ajax (or $.post ) or using $.getjson if trying make ajax requests.

asp.net - Problem with application path in IIS7 -

i trying add application live server. site in plain html. there 2 links go 2 application. go siteapp , go main app. in wwwroot have added site folder name(lets saye mywebsite) , configured in iis7 dns ip address. works fine. then added 2 more subfolder (siteapp & mainapp) 2 application written in vs 2008 , conver them application. so when go www.mywebsite.com/mainapp/default.aspx - works fine if click button(forget password) in default.aspx- tries access www.mywebsite.com/forgetpass.aspx , fail. suppose go www.mywebsite.com/mainapp/forgetpass.aspx goes root reason. if click normal href="www.mywebsite.com" link goes http://www.mywebsite.com/mainapp/www.mywebsite.com i have tried catch in global.asax page no luck code in globacl.asax application("apppath") = configurationsettings.appsettings("applicationurl") if application("apppath") = "/" application("apppath") = system

android - Get Path of image from ACTION_IMAGE_CAPTURE Intent -

hi using action_image_capture capturing image using intent follows: intent cameraintent = new intent(mediastore.action_image_capture); cameraintent.putextra( mediastore.extra_output, (new file(environment.getexternalstoragedirectory(), string.valueof(system.currenttimemillis()) + ".jpg")) ); startactivityforresult(cameraintent, 0); i need store image in sdcard , retrieve path of image using onactivityresult method. don't know how image path of captured image. if 1 knows please help. thanks this how works on 2.2 (different on previous versions). when starting intent string filename = "temp.jpg"; contentvalues values = new contentvalues(); values.put(mediastore.images.media.title, filename); mcapturedimageuri = getcontentresolver().insert(mediastore.images.media.external_content_uri, values); intent intent = new intent(mediastore.action_image_capture); intent.putextra(mediastore.e

asp.net - Mailbox unavailable. The server response was <firstname.lastname@domain.com> No such user here -

recently we've upgraded clients website our iis6 server our new iis7 server , receiving following error on occassion when sending out emails: mailbox unavailable. server response <firstname.lastname@domain.com> no such user here the client has confirmed email address sending valid , exists. what other reasons there error?

Tool to measure quality of javadoc with no source at hand -

i'm looking tool can rank javadoc have bytecode. tool give interface without javadoc comments rank of 0, whereas doc:ed interface rank 100. cheers niklas look javadocminer tool ninus khamis

Is there any way to do color transforms on bitmaps using HTML5 / CSS / Javascript? -

possible duplicate: getpixel html canvas? i've looked around quite bit answer question. kind of surprised have not found definitive answer. is there way color transforms on bitmaps in modern browsers using either javascript, css or of webkit css effects? examples being able desaturate jepg, or adjust r,g , b values...i know there new hsla attribute color property in css3, doesn't seem work on bitmaps. pixastic great project (as mistabell mentions). if want more simpler or customized effects read on canvas tag , js api.

css - Diagonal Gradient in Internet Explorer -

i want use diagonal gradient in background. i have read this , , found has horizontal gradient , vertical gradient in ie. is possible make gradient in ie show in diagonal firefox? you can using css, it's kind of hacked solution involving 2 layers. can read details of here .

reorder results of mysql query php -

i run mysql query gets specific results table. want print these results in 2 html tables. first ordered 1 column done putting order mysql query. want print results ordered different column. however, don't want run mysql query again slow. so sum up: there way reorder results of mysql query? (sorry if question unclear, first time using site.) php has great sorting functions. make user-defined sorting function , use result set: http://php.net/manual/en/function.usort.php sorting php fast. faster 2nd query if result set not large.

jquery - Cancel an onBlur event in JavaScript? -

i want set onblur event input element validates value and, if invalid, "cancels" blur , refocusses input. returning false onblur not cancel onblur way onclick . there solution (perhaps using jquery?) i don't know of reliable cross-browser way this. setting small timeout in onblur event , calling focus() when timer fires works. for example: document.getelementbyid('your_input_id').onblur = function() { var self = this; settimeout(function() { self.focus(); }, 10); }

Merge xml in PHP DOM -

i want merge php domdocument in another.. //this creates dom imported function element_index(..) { $skrit=new domdocument(); $skrit->loadxml('<krits:kriti xmlns:krits="http://test.de/krits">..</krits:kriti>'); return $skrit; } function crawl_xml($element) { //thats line result , merge $skrit=element_index(..); $temp3=$skrit->documentelement->clonenode(true); $element->appendchild($xpin->importnode($temp3)); } //thats how start recurisve walking through nodes $xpin = new domdocument(); crawl_xml($xpin->firstchild); the input/output should this: <!--input--> <all><one/></all> <!--input new add--> <krits:kriti xmlns:krits="http://test.de/krits">..</krits:kriti> <!--ouput--> <all><krits:kriti xmlns:krits="http://test.de/krits">..</krits:kriti><one><krits:kriti xmlns:krits="http://test.de/krits">..</krits:kriti>

python - Django running wrong version -

although running "python" shell runs python v2.7, django loading files python2.4, shown in error when load django site: mod_python error: "pythonhandler django.core.handlers.modpython" traceback (most recent call last): file "/usr/lib/python2.4/site-packages/mod_python/apache.py", line 287, in handlerdispatch log=debug) file "/usr/lib/python2.4/site-packages/mod_python/apache.py", line 461, in import_module f, p, d = imp.find_module(parts[i], path) importerror: no module named django i think django installed version 2.7 , that's why bottom says "no module named django" this first django install (it's on mediatemple dv server) wouldn't surprised if i'm doing stupid. thanks! mod_python built 2.4, django installed 2.7. either build mod_python 2.7, install django under 2.4, or put local copy of django project version of python doesn't matter.

sql - How to count common neighbors of two users and calculate similarity? -

the monthly_connections table contains columns calling_party, called_party, common_neighbors, neighborhood_overlap so table describes users connected. 1 of measures user similarity neighborhood overlap defined following: neighborhood_overlap = (number of nodes neighbors of both calling_party , called_party)/(number of nodes neighbors of @ least 1 of calling_party or called_party) trying calculate number of common neighbors 2 users wrote following query: select count (*) (select t1.neighbora ( select called_party neighbora monthly_connections calling_party = '9f7334bcf9000cd68d40302dc4801e60c027a7d1' union select calling_party neighbora monthly_connections called_party = '9f7334bcf9000cd68d40302dc4801e60c027a7d1') t1 inner join (select called_party neighborb monthly_connections calling_party = '10d149a4356e1aa3a8af604bd992bba141db53d2&#

Append parameter to url during ajax call with jQuery -

i need append parameter in url called ajax call. i need this: jquery(document).ajaxstart(functionthatappendsparametertourl); i think want use ajaxsend rather ajaxstart . function called event, request , settings parameters. if understand correctly you're trying do, should able modify settings include parameter.

actionscript - Dropdown list in Flash Banner -

i building flash banner ad contains dropdown list of states. once list clicked want pass state code onto end of url ad. i used ok actionscript several years ago, , i'm wondering if possible have ad grab url parent <a href> , tack state code onto it. assume how clicktags work? on (release) { if (clicktag.substr(0,5) == "http:") { geturl(clicktag, "_top"); } } can offer tips on how best this? i'm fine building actual ad, i'm not sure if need hard code 50 urls dropdown? seems bad way of doing things, , i'm sure theres better way? many thanks. clicktag string url has been put parameter in embed code, , url click through to. since, it's string, can add whatever need programmatically. i way: say want add argument end of url ?state=ny on (release) { if (clicktag.substr(0,5) == "http:") { var url:string; url = clicktag + dropdownmenu.getcurrentstatecode() // i'm not sure how drop dow

file io - help for solving a problem with java I/O -

i have created class named animal implements serializable. each object of animal class has name , type. in main method of program, create object of type animal , assign name , type it. want write object file , after read read file animal object. aim have created following mthods: animal anim=new animal(); animal anim2 = new animal(); //writing file private void writeonfile() { try{ fileoutputstream fout = new fileoutputstream("c:\\animal.ser"); objectoutputstream oos = new objectoutputstream(fout); oos.writeobject(anim); oos.close(); system.out.println("done"); }catch(exception ex){ ex.printstacktrace(); } } // reading file private animal readfromfile() { try{ fileinputstream fin = new fileinputstream("c:\\animal.ser"); objectinputstream ois = new objectinputstream(fin); anim = (animal) ois.readobject(); ois.close(); return anim; }catch(exception e

asp.net - The Ghost of a Renamed Table -

i have renamed table in sql server 2008 database, el_coursestepusernotes stepusernotes. renamed table using ssma. the table used in asp.net 4.0 app. use linq sql crud. problem following code: dbdatacontext db = new dbdatacontext(); var k = (from c in db.stepusernotes ((c.coursestepfk == q.coursestepfk) && (c.userfk == q.userfk)) select c).firstordefault(); try { db.stepusernotes.insertonsubmit(q); db.submitchanges(); } catch { } fails on db.submitchanges line, saying: sqlexception caught. invalid object name 'el_coursestepusernotes'. ie, old name table has come haunt me. i have deleted old linq sql dbml file , created new one. have searched through source code strings contain old table name. nothing. code compiles... where else can look? the error coming sql server, , using utility listing foreign keys in sql server database shown in question: sql:need change constraint

tcl - how do i make a variable unique -

how make variable unique in tcl? example: exec echo $msgbody - /tmp/alert_notify_work.$$ exec cat /home/hci/alert.txt -- /tmp/alert_notify_work.$$ this not work; trying make variable alert_notify_work unique. it's best use pre-existing library this. tcllib has fileutil package implements tempfiles: set filename [fileutil::tempfile alert_notify_work.]

unit testing - how do you stub a local variable in an rspec controller test -

i've implemented omniauth (using ryan bates' screencast http://asciicasts.com/episodes/235-omniauth-part-1 ) , writing rspec tests functionality , have ran trouble testing authentifications#create action. i'm @ quite loss how test 1 -- in particular how stub local variable omniauth. no matter try keep can't tests work. taking cut down version of action, how test new called on user example #cut down version of authentifications controller code attempting test def create omniauth = request.env["omniauth.auth"] authentification = authentification.find_by_provider_and_uid(omniauth['provider'], omniauth['uid']) .... user = user.new .... end #example test "should create new user" subject.stub_chain(:request,:env) {{"omniauth.auth" => {'provider' =>1, 'uid' => 2}}} user.should_receive(:new) post :create end i d

reporting services - chart in Report Builder 2.0 does not show all Category Fields in x-axis -

Image
i have chart in report builder 2.0 multiple series values (the fields added box along top side of chart) , no series fields (box on right side of chart) or category fields (box along bottom side of chart). different values belong different categories there no 1 field splits these values between categories, cannot put particular field in category fields segment of chart. however, in series properties window chart, can set category field property arbitrary string. trying set category field property differently in different series, first category field value shows along x-axis in chart. have edited axis properties have interval of 1, still see first category field. beyond that, different values clumped on x-axis no space between them, , first category field value centered under bars, making if have same category field. how can change this? see screenshot below. the red circled series values have same value set category field, while other series values have different values se

iphone - Custom Cells in UITable randomly blank -

i have uitable custom uitablecell. when table displays of items blank except disclosure triangle. scroll , down cells randomly turn on , off, @ given moment, blank. additional information: 1) "right cell". when click on disclosure, goes right place. 2) used exact same code in table , works fine. (yes, changed variables including cell identifier. 3) have disabled reuse of cells, problem still there. 4) have used dummy strings in cell, problem still there 5) cell created nib. here code in question (version shown doesn't use reuse cells , has dummy text in variables. - (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath { static nsstring *announcementcellidentifier = @"announcementcellidentifier"; nsarray *nib = [[nsbundle mainbundle] loadnibnamed:@"announcementcell" owner:self options:nil]; announcementcell *cell = [nib objectatindex:0]; nsuinteger row = [indexpath row]; nsarray *keylist = [

sql server - After Large Delete from Table? -

after perform large delete on table steps should take ensure space taken rows reallocated sql server? run statistics on table, etc? maybe don't need anything, wondering if there follow steps. thanks, s the space automatically go sql server. don't have anything. now, database size same plus growth of log file due logging transactions. however, internally, sql server knows still has space play with. beyond you'll want update statistics , rebuild indexes necessary. however, should part of normal nightly maintenance plan. update: wanted add 1 more thing. people shrink databases in order reclaim space after big delete. don't unless have no other choice. besides time takes , server overhead, problem if database has grow again sql server has reallocate space. action time consuming sql server. if know size database needs, allocate front , leave alone.

VBScript Anonymous Associative Arrays? (like in Javascript) -

those of proficient in javascript , php know how use object constructor reference amounts anonymous associative array this: myfunction({ "param1" : "value1", "param2" : "value2" }); the benefit not having name each parameter of target function , being able set defaults. know how build statements in vbscript? looking dictionary class, don't think i'll have firm grasp on how use advantage here until see example. thanks, the dictionary object you're looking for. i've used multi-language skinning of sites. it's not difficult use. see: http://www.devguru.com/technologies/vbscript/13992.asp

Access Network Information through an Android emulator -

i have android emulator. develop application measure signal strength (rssi) acess point. poll signal strength , update metric signal strength. i using wifimanager . run application, following output, wifi status:ssid<none>,bssid:<none>,mac:<none>.. is possible develop such application. regards chandra

Make WCF 4 WSDL look like Web Service WSDL? -

i have ancient web service client needs talk wcf 4.0 service. client large old system in company not going change. have new clients needs wcf functionality, have it, more work needed support old client. i have decorated several parts of wcf service attributes, , lot of emitted wsdl looks web service ancient client used call. have few more parts don't legacy stuff. can make new server old? the old (web service) system has: <wsdl:porttype name="queueservicesoap"> <wsdl:operation name="submitrequest"> <wsdl:input message="tns:submitrequestsoapin"/> <wsdl:output message="tns:submitrequestsoapout"/> </wsdl:operation> </wsdl:porttype> the new (wcf service) system has: <wsdl:porttype name="queueservicesoap"> <wsdl:operation name="submitrequest"> <wsdl:input wsaw:action="https://test.com/submitrequest" message="tns:queueservicesoap_submitrequest_inputm

Waiting for a command to return in a bash script -

what trying do: my bash shell script contains modprobe -a $modulename . loading module fails , modprobe statement gets stuck. never returns , hence, script stuck too. what want this: call modprobe -a $modulename , wait 20 secs , if command not return , script remains stuck 20 secs, call failure , exit ! i looking @ possible options that. know timeout one, allow me timeout after time. thinking : timeout -t 10 modprobe -a $modulename if [ "$?" -gt 0 ]; then echo "error" exit fi but problem $? can > 0 , not because of timeout, because of error while loading module , want handle 2 cases differently. any ideas using timeout , without using timeout welcome. according timeout(1), timeout exits specific code (124 in case) if command times out. it's highly unlikely modprobe exit code, check changing condition: ... ret="$?"; if [[ "$ret" = "124" ]]; echo timeout; other command; elif [[

datetime - Is there a comprehensive library/module for ISO 8601 in ruby? -

is there implementation of date, time, duration , interval usage of iso 8601 standard in ruby? mean class can set , details like, year, month, day, day_of_the_week, week, hour, minutes, is_duration?, has_recurrence? , on can set , exported string? require 'time' time = time.iso8601 time.now.iso8601 # iso8601 <--> string time.year # => year of date time.month # => month of date (1 12) time.day # => day of date (1 31 ) time.wday # => 0: day of week: 0 sunday time.yday # => 365: day of year time.hour # => 23: 24-hour clock time.min # => 59 time.sec # => 59 time.usec # => 999999: microseconds time.zone # => "utc": timezone name have @ time . has lot of stuff in it. unfortunately ruby's built-in date-time functions not seem thought through (comparing .net example), other functionality need use gems. good thing using gems feel it's built-into ruby implementation. most useful

why eclipse doesn't come with bundled svn client -

eclipse deployed cvs client plugin default. why there no svn source control clients bundled default? there's discussion sheds light on potential problems integrating various svn plug-ins exist eclipse. from tigris' status of eclipse svn proposal : one final factor in decision [to withdraw proposal] licensing. subversion plug-in going depend on either subversion's javahl library or svnkit pure java library. svnkit's license rejected eclipse, , in case of subversion planning review code before allowing use library. subversion has dependencies on libraries neon , bdb have licenses not typically accepted eclipse. had question whether able include javahl or svnkit our plug-in. again, maybe turn out not issue subversive. so various licensing problems appears crux of including existing svn plug-in default.

Two id's for javascript function -

i have javascript function goes this: function change_one() { var 1 = document.getelementbyid("one").value; document.getelementbyid("tag").value=one; } it works fine until there 2 elements same id. i'm using php fetch stuff mysql , while it's looping thru, it's echoing input tags have same id value. how javascript code apply of input tags have id equal "one"? "it works fine until there 2 elements same id." that's invalid. best solution change php code use classes, or way distinguish. may find helpful use javascript library find elements matching class. edit: using jquery, tag , one classes: function change_one() { $(".tag").val($(".one").val()); }

python - How can I store my atom data so my IRC bot can access it? Should I use SQL at all? -

i want add feeds such ajaxian, smashingmagazine , store feeds starting today on server, in order can push new items irc bot can echo them in channel. i atom data service: http://superfeedr.com/subscriber .. i'm wondering of nosql storage mechanisms ideal storing atom data? the atom data xml, documents, perhaps couchdb suitable? or mongodb/cassandra/redis? i'm aware there different kinds of no sql databases such document oriented vs key/store, don't have experience i'd appreciate insight way more experienced. thanks. additional things consider these won't displayed on website, or publically viewable url. the way view them either a) wait bot post new ones every hour or b) manually query bot , give time range or 0,20 , 20,40 through pm on irc. i won't need scale, have 15-20 people in irc chat room , 1-3 people on average query bot @ given hour. the bot spit out new links every hour. bot never spit out old links. i have use database co

xslt - Count the number of elements returned by <call-template> -

i have following xsl stylesheet: <xsl:stylesheet xmlns="http://www.w3.org/1999/xhtml" xmlns:xsl="http://www.w3.org/1999/xsl/transform"> <xsl:output method="xml" encoding="utf-8"/> <xsl:template match="/"> <xsl:variable name="elements"> <xsl:call-template name="get-some-nodes"/> </xsl:variable> <root> <values> <xsl:copy-of select="$elements"/> </values> <count> <xsl:value-of select="count($elements)"/> </count> </root> </xsl:template> <xsl:template name="get-some-nodes"> <node>1</node> <node>2</node> <node>3</node> </xsl:template> </xsl:stylesheet> (it shouldn't matter xml apply to, generates own data). the result of of (using xsltproc) is: <

c# - Why tooltip doesn't update it's content when binding changes? -

i have written following xaml code: <window x:class="wpfapplication3.mainwindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" title="mainwindow" height="200" width="200"> <stackpanel> <listbox name="listbox"> <listboxitem content="item1" /> <listboxitem content="item2" /> <listboxitem content="item3" /> </listbox> <textblock datacontext="{binding elementname=listbox, path=selecteditem}" text="{binding content}" tooltip="{binding content}" /> <textblock datacontext="{binding elementname=listbox, path=selecteditem}" text="{binding content}"> <textblock.tooltip> <tooltip

python - wxReactor Problem -

i developing program uses twisted , wxreactor. everytime try exit application, hangs, , have force quit it. wxpython onclose() event call reactor.stop(), knowledge should fix issue. in quest answer, i've come across ticket: www.twistedmatrix.com/trac/ticket/3948. i've tried patch listed on page, no luck. i've been @ problem 2 weeks now, , pretty desperate :). to give background on project: freeware client uses sockets connect multiplayer game server (currently plays monopoly , uno). if run it, notice there no graphics. because client provides audio feedback through speech synthesis , sound effects. target audience of project visually impaired gamers. to test issue, run python rsg.py (which can found in src folder. in case need know, use python 2.6.5). in terminal, see output program produces (which server sends our client). once see line "connection made" (which should print shortly after running), try closing program (by clicking x). client hang few sec

amazon ec2 - EC2 performance inconsistancy? -

we launched large 64-bit instance , performance severely lacking. commands ls, less, , cat take absurd amount of time, 10 seconds. top revealed load on 2 when in fact nothing running on our shell, @ least nothing had run. when launched second instance, performance quick expected. wondering if other people have experienced type of performance variance. how occur? exploring using ec2 compute cluster , variance quite inconvenient if happens often. yes, i've experienced couple of times - 2 or 3 times @ least. we open threads on aws support forum , response. i'm not sure how aws monitors forums, etc. think unless don't report issues, don't fixed. the usual fix terminate instance , launch another.

objective c - Ideas for programming a scrolling tag cloud on iPhone? -

Image
given collection of word objects, want display scrollable tag cloud similar shown below. word class has properties name , rank determine sorting , weighting of fonts. each word should selectable object (for invoking event). since collection can contain thousands of objects, need manage words presented in view (i.e., scroll off bottom or top of screen, no longer care them). how approach this? put html-formatted text uiwebview javascript scrolls on timed basis. might able handle touch events on elements via javascript bridge. failing that, you'll need bunch of uilabel elements of various sizes, , layout manager positions them appropriately, lot more work.

file upload - Uploading with multipart/form-data using OpenRasta and IMultipartHttpEntity -

i'm trying post files using openrasta. i've gotten far getting handler called, appearances stream in entity empty. here's handler: public operationresult post( ienumerable<imultiparthttpentity> entities) { var foo = entities.tolist(); foreach (var entity in foo) { if (entity.stream != null && entity.contenttype != null) { var memorystream = new memorystream(); entity.stream.copyto(memorystream); } } return new operationresult.created(); } each time through loop memorystream has length of 0. doing wrong? nothing posting on stackoverflow make answer obvious. apparently 1 enumeration of entities in order grab stream. had added "foo" variable above make debugging easier, causing streaming fail. stored stream database, had failed reset memorystream beginning before writing it. fixing these 2 issues got file upload correctly.

.net - Assembly binding error - fusion log and dependency browser mismatch -

i'm chasing down assembly loading/binding error has popped recently. during investigation i've found confusing contradiction (assuming i'm parsing fusion log correctly). the exception thrown application @ startup states: {"could not load file or assembly 'microsoft.practices.compositeui, version=1.0.51205.0, culture=neutral, publickeytoken=31bf3856ad364e35' or 1 of dependencies. located assembly's manifest definition not match assembly reference. (exception hresult: 0x80131040)":"microsoft.practices.compositeui, version=1.0.51205.0, culture=neutral, publickeytoken=31bf3856ad364e35"} some recent project changes made should not require named assembly "microsoft.practices.compositeui". after confirming solution projects indeed referencing unsigned assemblies fired dependency browser make sure wasn't missing anything. checked out , confirmed didn't have "old" references old assemblies. of course cle

android - Query only the first data from a table -

i'm trying query first data table. cursor img_cursor = db.query( image_url_table_name, new string[]{"small_img_url" , "large_img_url"}, null", null, null, null, null); could tell me how implement query first data retrieved table? solution i think solved answer: cursor img_cursor = db.query( image_url_table_name, new string[]{"small_img_url" , "large_img_url"}, null", null, null, null, null , "1"); i used limit 1 first, application crashed. if pass number string work. query has 8 parameters while we're using limit parameter. limit 1 from documentation: public cursor query (boolean distinct, string table, string[] columns, string selection, string[] selectionargs, string groupby, string having, string orderby, string limit) so, put

parsing - Is there a Python module to get next runtime from a crontab-style time definition? -

i'm writing dashboard application , need way figure out how long item "valid", i.e. when should have been superseded new value (it's possible have error such next value never arrives). since know schedules processes producing data, can define valid "until next time process should have ran". i thought crontab format specifying schedules compact (i.e. easy store in database), , easy understand. finally question: there python module, when given current time , crontab spec (e.g. "25 5 * * *"), returns datetime giving next runtime? i ran issues using code (from http://www.koders.com/python/fida55a9db55093a78dd26b55c606b267b2c5063a79.aspx?s=config ) , , have fixed of them. used break going 1 month next. next_run works fine, prev_run gets stuck going 1 month previous (instead of failing gets caught in loop) here git repository i've set continue working on it: https://github.com/rfdaemoniac/crontab_parser

Haskell Curl Help -

ok, i'm trying wrap head around io in haskell, , figured i'd write short little app dealing web pages it. snippet i'm getting tripped @ (with apologies bobince , though fair, i'm not trying parse html here, extract 1 or 2 values): titlefromurl url = (_, page) <- curlgetstring url [curltimeout 60] matchregex (mkregexwithopts "<title>(.*?)</title>" false true) page the above should take url in string form, scan page points matchregex , , return either nothing or just [a] , a matched (possibly multi-line) string. frustrating thing when try doing prelude> (_, page) <- curlgetstring url [curltimeout 60] prelude> matchregex (mkregexwithopts "<title>(.*?)</title>" false true) page in interpreter, precisely want to. when try load same expression, , associated imports file, gives me type inference error stating couldn't match expected type 'io b' against inferred type 'maybe [strin

hibernate - @ManyToMany inconsistent data on both side problem -

i have blog-like scenario , 2 java classes : post , tag , @manytomany relationship , post_tag association table , here simplified definitions: public class post { @manytomany(fetch=fetchtype.lazy) @fetch(fetchmode.select) @jointable(name = "post_tag" , joincolumns = @joincolumn(name="post_id") , inversejoincolumns = @joincolumn(name="tag_id") ) private set<posttag> tags = new hashset<posttag>(); } public class tag { @manytomany(mappedby="tags" , fetch=fetchtype.lazy) private set<post> comments = new hashset<post>(); } it seems ok , fails in following testing scenario : create tag , tag1 create 1st post , post1 create 2nd post , post2 add tag1 post1.gettags() , post2.gettags() update post1 , post2 list list = dao.getpostbytag(tag1) assert list.size() == 2 , failed here test code : public void testgetcommentsbytag() { tag tag1 = tagdao.save(new tag("tag1"));

jQuery Textarea focus -

when click button want textarea in li element focus. <li class="commentblock" id="commentbox-79" style="display: list-item;"> <div> <div class="grid userimageblocks"> <div class="imgsmall"> <img width="35" height="35" alt="image" src="/bakasura1/files/images/small/1288170363aca595cabb50.jpg"> </div> </div> <div class="grid usercontentblocks alpha omega"> <form accept-charset="utf-8" action="/bakasura1/account/savecomment" method="post"> <div style="display: none;"> <input type="hidden" value="post" name="_method"> </div> <input type="hidden" id="statusmessagereplypid" value="79" name="data[statusmessagereply][pid]">

WPF C# - Editing a listbox from another thread -

i realize i'm doing pretty silly, i'm in middle of learning wpf , know how this. i have window listbox on it. listbox being used deliver status messages program while it's running. example "server started" "new connection @ ip #" etc. wanted updating in background, spawned new thread handling updating this, when made call add item error message "the calling thread cannot access object because different thread owns it." any idea how can update listbox thread? or in background, etc. update if using c# 5 , .net 4.5 or above can avoid getting on thread in first place using async , await , e.g.: private async task<string> simlongrunningprocessasync() { await task.delay(2000); return "success"; } private void button_click(object sender, routedeventargs e) { button.content = "running..."; var result = await simlongrunningprocessasync(); button.content = result; } easy: dispat

PHP buffer ob_flush() vs. flush() -

what's difference between ob_flush() , flush() , why must call both? the ob_flush() reference says: this function send contents of output buffer (if any). the flush() reference says: flushes write buffers of php , whatever backend php using (cgi, web server, etc). however, continues say: [it] may not able override buffering scheme of web server… so, seems me use ob_flush() of time. however, strange results when that. explain in simple terms what's going on here? ob_flush sends application-initiated buffer. there may multiple nested ob_start() 's in php script. ob_flush passes current content upper layer. php might (at own discretion) buffer output. depends on back-end. fastcgi has socket buffer on own. therefore flush() needs invoked send current content web server. and web server might implement buffering scheme ( mod_deflate or content filter), have no influence over. seldom, needs configured specifically. anyway,

outlook vba - Create CSV from array in VBA -

i'm novice programmer trying automate repetitive workplace tasks should done clever script instead of humans. i've done vba , java, basic stuff. we have data generated validated online form gets emailed mailbox, , filter in mail client (outlook 2010) puts particular folder. intention write vba when triggered check contents of folder, , each mail item, message body text string, create array, , write array contents .csv file. i'll have app (imacros firefox) read csv , interact in-house corporate webapp rest. i think can of except write array contents csv. i work best looking @ code examples (i try understand ms object model documentation), best can find writing vba array csv like: 'save file open sfilename output #7 n = 0 ubound(myarray, 1) print #7, format(myarray(n, 0), "0.000000e+00") next n close #7 i think vb , not vba, general idea here valid? or if else has code sample me started or other pointers i'd grateful. ps have se

selenium rc - How to access var in PHP -

Image
i'm using selenium-rc php. want show in test value of classname. how can present var? tried $this['drivers']['classname'] not working me. (this debug) thank you! looks should be: $this->drivers[0]->classname

Visual Studio Gallery - MVC Project Template Failing to Upload -

i've created visual studio 2010 asp.net mvc project template vsix package i'd upload visual studio gallery, every time try tells me path long... locally, installs , works without issue... the structure of project (zipped t.zip try , reduce length) standard mvc structured project, caveat needs (well, doesn't need makes sense there) installs web sub-folder under c# language, path inside vsix package projecttemplate\csharp\web . is there way around limitation, or doing wrong? there check when upload vs gallery see if path length might end being long when installed on users machine. check includes not files directly in vsix, files embedded inside zip file. (this because templates unzipped on disk before used instantiating new project.) unfortunately, think option shorten-up paths of files in template itself.

unicode - Guidelines for changing the default encoding of a Django site -

django comes unicode support out of box , supports utf-8 default. have developed, debugged , tested site bunch of django apps in utf-8. steps required painless migration different encoding, latin-1 ? wish need setting default_charset = 'latin-1' , changing encoding of database somehow doubt simple. for sake of discussion can ignore migration of stored utf-8 data in database; i'm interested in required checks , changes in django code database , web server configuration. you shouldn't need make significant changes django codebase. though working characterset utf-8, data stored in database using database's chosen encoding. do have really reason moving utf-8 latin-1? if you're concerned character encoding of output, want deal using referenced setting, rather @ database level may lose data. there's more info here: http://docs.djangoproject.com/en/dev/ref/unicode/

Query to get all items in a list including items in the sub folders in SharePoint -

i have document library list. created folders in list , uploaded files sub folders. how these files in sub-folders in document library list using spquery ? if want query folders , sub folders of list or document library, have define query options. if working object model have set viewattributes property of spquery object follows: qry.viewattributes = "scope='recursive'";

applet - performance concerns in using Java Advanced Imaging APIs -

in our project use jai showing parts of image, rotating image , basic zooming in applet. observe applet takes lot of time load - around 20 seconds first time. subsequently, takes 3 seconds (which quite high). jai development seems have frozen since 2007.atleast not find download post 2007 on java website. has encountered loading issues , solved them in context of jai ? there performant alternative jai ? images using in tiff format , can have multiple images in 1 physical file. any pointers appreciated. the first application startup (cold startup) require lot of time, need load tons of libraries including jai. second , next application startups (warm startup) faster runtime classes cached in classes.jsa . then, image processing require cpu , in order paint it, graphics card. modern computers image processing (basic operations!) , handling (zoom, pan) trivial , fast jai. we have developed , image reviewing application jai + image i/o , zoom , panning extremely f

c++ - a good-design approach for making a geometry library (regarding using union or not)? -

i making geometry library , confused, should return type of function calculates intersection of segment segment. returned value point , segment (overlap case) , empty set. per thinking there 3 ways tackle per follows: 1. return union (segment, null, point) 2. return segment first point == second point when intersection single point , both points nan when intersection empty set 3. return vector (with 0 elements empty set, 1 element pnt , 2 elements segment) please let me know if there alternates possible , pros , cons of each of design. design supposed design , why. interested in making robust architecture lets single pipe-lining , no rewriting of code scalable (in terms of adding functionality , handling edge cases) following code reference (whose return type vector) vector<pnt> seg::inter(seg z){ vector<pnt> ans; if(p1==p2){if(z.doesinter(p1)){ans.pb(p1);}} else if(z.p1==z.p2){ if(doesinter(z.p1)) ans.pb(z.p1);} else{ pnt p1p2=(p2-p1); pnt q1=p1p2*pnt(0,1); long

language agnostic - Does there exist an open-source distributed logging library? -

i'm talking library allow me log events different machines , align these events on "global" time axis sufficiently high precision. actually, i'm asking because i've written such thing myself in course of cluster computing project, found terrifically useful, , surprised couldn't find analogues. therefore, point whether exists (and better contribute it) or nothing exists (and better write open-source analogue of solution). here features i'd expect such library: independence on clock offset between different machines timing precision on order of @ least milliseconds, preferably microseconds scalability thousands of concurrent logging processes, @ least several megabytes of aggregated logs per second soft real-time operation (t.i. don't want collect 200 big logs 200 machines , compute clock offsets , merge them - want see happens "live", perhaps small lag 10s) facebook's contribution in matter called ' scribe &#

Django and SQL Server 2005 - Zombie status? -

i'm using django 1.2 , django-mssql . while performing following for unicorn in unicorn.objects.all(): print unicorn.color i'm getting following error @ around 100th iteration: com_error: (-2147352567, 'exception occurred.', (0, u'microsoft sql server nativ e client 10.0', u'the object in zombie state. object may enter zombie state when either itransaction::commit or itransaction::abort called, or when storage object created , not yet released.', none, 0, -2147418113), non e) any idea? bugging me... starting hate whole windows server world... :( i had similar problem , resolved forcing full queryset retrieved before using in loop. so, try this: for unicorn in list(unicorn.objects.all()): print unicorn.color

Does Android support 'Receiver' mode for playing audio files? -

i have requirement need play audio file in receiver mode(earpiece).i not sure whether higher versions of android sdk supports receiver mode.i went through links said 1.5/1.6 having changes in these audio apis , hence not sure. :( can please help? thanks. i believe long play audio file using mediaplayer , direct audio proper place (i.e. use ear piece output if headset connected etc.). could you're looking setspeakerphoneon(true) function in audiomanager class: sets speakerphone on or off. this method should used applications replace platform-wide management of audio settings or main telephony application.

css - how to disable dragging of an html element (especially "img")? -

i have image don't want drag-able or selectable no drag other places on page. how done? it impossible prevent store image (or other resources) on computer others have mentioned. but trick make harder (impossible inexperienced people guess) use css , background images: <div style='background: url("myimage.gif");'></div> the image on background of <div> block , cannot dragged or right clicked in order save it. using coding knowledge possible ind out myimage.gif part, can added after base url in order download image , save it. example if html page @ http://www.example.com/mypage.html image found @ http://www.example.com/myimage.gif as mentioned still possible save image, inexperienced people lot harder. note : in example image put in html tag, proper use of css file, harder find inexperienced people.

Declare a C++ class without defining it in the current translation unit -

it possible declare class without defining (forward declaration) long defined later on within translation unit. in case of functions, 1 can declare function without defining within translation unit, , linker link definition in different translation unit. possible same class declarations? (if not possible, there any use forwardly declared class without definition in current tl, or error?) something this, except doesn't compile: mymain.cpp: class myclass; // declare without defining myclass::myclass(); void myclass::barf(); int main() { myclass *m = new myclass(); m->barf(); return 0; } myclass.cpp: #include <iostream> class myclass { // define implementation public: myclass(); void barf(); }; myclass::myclass() { } //empty constructor void myclass::barf() { std::cout << "barfing\n"; } it possible forward-declare class, pointers , references forward-declared classes can used. can't use actual object of forwa

ruby on rails - Rearranging Formtastic layout -

Image
i'm new formtastic , pretty unexperienced when comes css , stylesheets. i'm trying rearrange layout bottom of picture: can see managed make dropdowns align nicely, not fee/consultant hours. this .erb file; <div id="defaults"> <% semantic_form_for <more stuff goes here> %> ...... <div id="customer-details"> <%= form.input :fee %> <%= form.input :consultant_hours %> <%= form.input :automatic_prolonging, :as => :radio, :collection => [[("yes"), "true" ]] + [[("no"), 'false']], :wrapper_html => { :class => "compact" } %> <%= form.input :customer_segment, :as => :radio, :collection => [[("industry"), "industry" ]] +[[("bank/finance"), "bank/finance" ]] + [[("products/services"), 'products/services']]+ [[("organization"), 'organ

ruby on rails - Create a new URL path for each user in RoR -

how can create in real-time new url path in ruby on rails? for example: want users have name.xxx.com or xxx.com/name. fyi i'm hosting code on heroku. have @ subdomain-fu plugin. https://github.com/mbleigh/subdomain-fu

Finding the files that make up a Ruby class -

in ruby, there way determine files loaded , defined/modified particular class? i don't think there's easy way correctly, approximation in 1.9 find source_location methods in class: class class def source_files methods.collect { |method_name| method(method_name).source_location[0] # filename, not line number } | instance_methods.collect { |method_name| instance_method(method_name).source_location[0] } end end this give files defining methods inherited superclass or included modules, i'm not sure whether want. there ways modify class besides defining methods in it, doesn't detect them, it's not perfect.

working with an .aspx page with in asp.net mvc 2 -

i'm new asp.net mvc. i created default asp.net mvc project in vs , can see when make call controller's action this: "http://localhost:2528/home/about" home controller has action method "about" returning about.aspx view. seeing not seeing .aspx extension in browser's url. , when try browse "http://localhost:2528/home/about.aspx" 404 error. i have requirement need create .aspx page passed arguement via url this: "http://... /myaspxpagehere.aspx?argname=myarg" i'm not sure how asp.net mvc. and/or code examples appreciated. thanks asp.net mvc not use .aspx extension in client-facing urls. if want accept arguments querystring, should add parameters action methods.

svn - Looking for a way to store versions in a binary compiled from git repo -

i'm looking tips implement binary --version provide information version compiled from. the project using autotools build system, , stored in git repo acts svn frontend. what have inside binary is: compilation time svn commit acts base last git commit id , time if possible last commit affects specific binary you'll want write source code use #defined constant version string. can pass in through build -dmy_version=... option. that'll let embed default value in code, too, wrapped in #ifndef , in case! #ifndef my_version #define my_version 0.0.1-alpha #endif print_version() { printf("my product: %s\n", my_version); } a nice way handle on build process side make intermediate build product makefile snippet my_version = "..." . again adds redundancy letting distribute project version file created, build doesn't have depend on presence of scm. you can create version string like, example: echo -n 'my_version = "

c# - How to translate shutter speed values into usable data? -

i'm gathering light statistics of exif data large collection of photos , i'm trying find simplest way (i.e. performance doesn't matter) of translating exposure time values to/from usable data . there (as far can find) no standard values camera manufacturers might use i.e. can't scan web random images , hard-code map. here sample set of values i've encountered ( " indicates seconds): 279", 30", 5", 3.2", 1.6", 1.3", 1", 1/1.3, 1/1.6, 1/2, 1/2.5, 1/3, 1/4, 1/5, 1/8, 1/13, 1/8000, 1/16000 also take consideration i'd find average (mean) ... should 1 of actual shutter speeds collected , not arbitrary number. edit: usable data mean sort of creative? numbering system can convert to/from performing calculations. thought multiplying 1,000,000 except fractions when divided quite exotic. edit #2: clarify, i'm using exposuretime instead of shutterspeed because contains photographer friendly values e.g. 1/50.

matlab - Smoothing edges in a colormap image -

i have square matrix of size 'n' made of numbers (1 n) irregular clustered.for example 7's together, 10's together, etc, irregularly. using "image , colormap" command matrix each cluster colored differently square edges.. want ruffle edges there smooth boundary between each color. need ramps in place of steps! beginner in matlab. pl help........... you can convolve array kind of low-pass (i.e. smoothing) filter. if want ramps straight lines, can use average filter; if want ramps sigmoidal, can use gaussian filter. size of filter window determines width of ramp. for example, use 3x3 average filter (which give ramps of width 3 pixel), you'd following: %# pad image twice replicating borders avoid border effects %# use padarray instead if have image processing toolbox tmp = img([1 1 1:end end end],[1 1 1:end end end]); %# apply convolution. normalize filter sum %# of pixels in filter 1, , use 'valid' option %# automatically discar