Posts

Showing posts from April, 2012

Regex operations on Javascript functions -

i'm trying find function names in javascript , insert following code var functionname = arguments.callee.tostring().substr('function '.length); functionname = functionname .substr(0,functionname .indexof('(')); console.log(functionname); this write name of function console it's called. not having luck this. i've been trying variants of sed.exe: sed "{/function/ s/$/\var ownname = arguments.callee.tostring().substr('function '.length);ownname = ownname.substr(0,ownname.indexof('('));console.log(ownname);/}" *.js this in format sed "/elephant/ s/$/\&castle" *.js anyone have idea how can send i'm appending next line, rather on same line function? also, how can imlement following (but in sed.exe) avoid anonymous function , eval functions?? grep -eho "^s*function w+" *.js | sort thanks help. adding \n replacement string works gnu sed. changed regex have grep ^[[:blank:]]*function...

Getting Action name in View (ASP.NET MVC2) -

i want current action name in master page, can find "current" page link , mark "current". here view code snippet master page: <ul> <li> <a href="<%= url.action("index", "admin")%>" class="main current">index</a> </li> <li> <a href="<%= url.action("show", "admin")%>" class="main">show</a> </li> <li> <a href="<%= url.action("delete", "admin")%>" class="main">delete</a> </li> </ul> as can see, index hyperlink has class of "current", makes highlighted via css files. i want check action user visiting, , make hyperlink "current" respect that. have searched through web, , wondering best solution that? also, appreciate if guys have other suggestions accomplishing task. thanks in advance, sadullah ...

What's the easiest way to detect the user's operating system in Rails 3? -

simple rails app, scaffolding. want detect whether user using android or iphone access app. what's easiest way that? if request.env['http_user_agent'].downcase.match(/android|iphone/) puts "yup, mobile" end

iphone - How to know when UIimageView finished loading? -

in view controller, how can know when uiimageview has finished loading (large jpeg documents directory)? need know can swap placeholder low-res imageview hi-res imageview. need create custom callback know this? way fine. by way, here snippet of code load image: nsstring *filename = [nsstring stringwithformat:@"hires_%i.jpg", currentpage]; nsstring *filepath = [nsstring stringwithformat:@"%@/bookimage/%@", [self documentsdirectory], filename]; hiresimageview.image = [[[uiimage alloc] initwithcontentsoffile:filepath] autorelease]; uiimageview isn't doing loading @ all. loading being done [[uiimage alloc] initwithcontentsoffile:filepath] , , thread blocked while file loaded (so load complete time call returns). what want this: - (void)loadimage:(nsstring *)filepath { [self performselectorinbackground:@selector(loadimageinbackground:) withobject:filepath]; } - (void)loadimageinbackground:(nsstring *)filepath { nsautoreleasepool *pool = ...

regular language - Using Closure Properties to prove Regularity -

here's homework problem: is l_4 regular? let l_4 = l*, l={0^i1^i | i>=1}. i know l non-regular , know kleene star closed operation, assumption l_4 non-regular. however professor provided example of above in l = {0^p | p prime} , said regular proving l* equal l(000* + e) saying each subset of 1 (e in case means empty word). so method involved forming regex of 0^p , how can when have 1 already? regular languages closed under kleene star. is, if language r regular, r*. but reasoning doesn't work in other direction: there nonregular languages p p* regular. you mentioned 1 such p in question: set of strings 0^p p prime. it easy use pumping lemmas regular , context-free languages show p @ least context-sensitive. however, p* equivalent language 0^q, q sum of 0 or more primes. true q=0 (the empty string) , q>=2, p* can recognized 3-state dfa, though p not regular. so l being context-free has no bearing on whether l_4 = l* regular or not. if can...

.net - Saving file using SaveFileDialog in C# -

i wondering if me please. i'm using savefile , tried reading docs on msdn i'm new , honest find them unclear. here needing do. save file default c:\ , can done save main directory if it's renamed different, on machine main drive labelled f:\ , how direct save if renamed ? is there option set, file can saved binary? , no other type? the savefiledialog control won't saving @ all. providing convenient interface display windows' default file save dialog. 1) set property initialdirectory drive you'd show other default. think of other computers might have different layout. default windows save directory used last time , present again. 2) handled outside control. you'll have check dialog's results , saving (e.g. write text or binary file). just quick example (there alternative ways it). savefile control of type savefiledialog savefiledialog savefile = new savefiledialog(); // set default file name savefile.filename = "unknow...

flash - Error 1009 after gotoAndStop - stage instance never gets added -

i've been through forums hours (days?) searching on 1009 errors, remain stumped on this. seems mysterious , love if have ideas. i have single .swf 7 frames long - each frame represents different "page" , can switch pages through menu widget in top right corner. menu widget calls gotoandplay( "frame" ). everything works fine except when switch 1 particular frame another. then, during initialization of new frame (setting visible properties on various items, in actionscript), dreaded 1009 error on specific stage instance, dynamic text instance i_word. here's i've tried far: made sure actionscript new frame starts stop() statement before starting initialization - no dice tried changing i_word movie_clip instead of dynamic text, made sure exported actionscript - no difference. (i have 2 other dynamic text instances on same page don't seem cause problem) added enter_frame listener when new frame loaded, in case problem timing issue. put...

networking - Adding host name to /etc/hosts in Linux -

question: there easy way add dhcp issued ip address , hostname of linux machine in /etc/hosts @ system startup automatically? background: linux machine has hostname in /etc/hostname , won't resolve when ping. manually added hostname , ip address in /etc/hosts 1 network related java programs work. thanks, dhcpcd has -c/--script option run external script anytime configures or brings interface. can use manually update hosts file configured hostname.

c# - Passing multiple parameters to Crystal Report -

i'm working on visual studio 2008 , sql server 2008, language c# i want pass multiple parameters crystal report in asp.net. have 2 parameters @accountnumber , @customerid . can pass 1 parameter report in code below. crystalreportviewer1.logoninfo[0].connectioninfo.servername = "cj-pc"; crystalreportviewer1.logoninfo[0].connectioninfo.userid = "sa"; crystalreportviewer1.logoninfo[0].connectioninfo.password = "***"; crystalreportviewer1.logoninfo[0].connectioninfo.databasename = "online"; string accountnumber = "acc001"; string customerid = "cus001"; parameterfield paramfield = new parameterfield(); parameterfields paramfields = new parameterfields(); parameterdiscretevalue paramdiscretevalue = new parameterdiscretevalue(); paramfield.name = "@account_number"; paramdiscretevalue.value = accountnumber; paramfield.currentvalues.add(paramdiscretevalue); paramfields.add(paramfield); crystalreportviewer1.par...

c# - Why is the query operator 'ElementAt' is not supported in LINQ to SQL? -

in linq sql, exception " the query operator 'elementat' not supported. " when trying use elementat extension method on iqueryable returned linq sql query. here stack trace: at system.data.linq.sqlclient.queryconverter.visitsequenceoperatorcall(methodcallexpression mc) @ system.data.linq.sqlclient.queryconverter.visitmethodcall(methodcallexpression mc) @ system.data.linq.sqlclient.queryconverter.visitinner(expression node) @ system.data.linq.sqlclient.queryconverter.convertouter(expression node) @ system.data.linq.sqlclient.sqlprovider.buildquery(expression query, sqlnodeannotations annotations) @ system.data.linq.sqlclient.sqlprovider.system.data.linq.provider.iprovider.execute(expression query) @ system.data.linq.table`1.system.linq.iqueryprovider.execute[tresult](expression expression) @ system.linq.queryable.elementat[tsource](iqueryable`1 source, int32 index) now realize rid of exception , use elementat call '.tolist()' befor...

Android Screen Orientation Problem -

hi have problem like, have chronometer shows recording time if press record button of live video streaming, both dynamic. once clicked record recording takes place in server side, no problem problem after clicking record button when recording timer starts, if changed mobile orientation automatically starts again oncreate , chronometer , button not visible, video continuing. should continue both button , timer along video after orientation done. have tried adding android:configchanges="orientation" , in class file onconfigurationchanged() not working.... can u please me you can disable rotaion adding android:screenorientation="portrait" (or landscape) element in manifest.

java - IntelliJ is too smart for me -

i'd implement simple jpa named queries intellij idea using final strings defined parameters. inspector do't , told me 'unexpected token' ':' on end of first part of query. how can suppress inspection or how can convince inspection accept that. @namedqueries({ @namedquery(name = taxonentity.selectbytaxonid, query = "select t taxonentity t t.taxonid =:" + taxonentity.taxon_id) }) @entity public class taxonentity { static public final string selectbytaxonid = "taxonentity.selectbytaxonid"; static public final string taxon_id = "taxonid"; .... } thanks in advance, medrod update: intellij idea accept query if after constant string appended. @namedqueries({ @namedquery(name = taxonentity.selectbytaxonid, query = "select t taxonentity t t.taxonid =:"+taxonentity.taxon_id+"") }) try instead @namedqueries({ @namedquery(name = taxonentity.selectbytaxonid, query = "select t taxonentit...

pinvoke - How do you pronounce P/Invoke? -

i said pee-invoke. i have colleague says pin-voke. i know it's moot point since both understand each other, wanted general feel programmer crowd in general. pin-voke quicker say, may start saying too... thought people pee-invoke. like you, pee-invoke. guess feels more natural me, since short platform-invoke , i'd rather keep saying invoke part properly.

css - jQuery - How to brighten an image -

hi in jquery, can use code below, make image darkly. in opposite, how can bright image? $(this).hover(function() { $(this).stop().animate({ opacity: 0.5 }, 500); }, function() { $(this).stop().animate({ opacity: 1.0 }, 500); }); i'd use pixastic this. has jquery bindings if want take route. you can lighten or darken image this: var img = new image(); img.onload = function() { pixastic.process(img, "lighten", {amount:0.5}); } document.body.appendchild(img); img.src = "myimage.jpg"; you fake effect changing opacity of image, making sure background behind image white.

Disable clipboard prompt in Excel VBA on workbook close -

i have excel workbook, using vba code opens workbook, copies data original, closes second workbook. when close second workbook (using application.close ), prompt for: do want save clipboard. is there command in vba bypass prompt? i can offer 2 options direct copy based on description i'm guessing doing set wb2 = application.workbooks.open("yourfile.xls") wb2.sheets("yoursheet").[<yourrange>].copy thisworkbook.sheets("somesheet").paste wb2.close if case, don't need copy via clipboard. method copies source destination directly. no data in clipboard = no prompt set wb2 = application.workbooks.open("yourfile.xls") wb2.sheets("yoursheet").[<yourrange>].copy thisworkbook.sheets("somesheet").cells(<yourcell") wb2.close suppress prompt you can prevent alert pop-ups setting application.displayalerts = false [edit] to copy values only : don't use copy/pas...

java - grouping / comparing the similar news stories together which are gathered from different sources -

grouping / comparing similar news stories gathered different sources using rss feeds. are there api / code available this. please help. regards, gourav you're not find specific, there nlp libraries have nlp capabilities can design app around. see nlp programming tools using php? accepted solr recommended solution. you'll have more luck if relax language constraints: more nlp of nature written in java (e.g. stanford javanlp ), c/c++ , or lisp .

java - can i put the form-login-page html in a library for a webapp? -

i trying create app login page authentication. , same added <form-login-page> web.xml (as shown below). i jar'ed logon.html , logonerror.html , , added them library along .war webapp file. (under web-inf/lib/logon.jar) . but when deploying app , getting error 404 , logon.html not found error. pointers why ? cant keep logon files (htmls,js,css files) in library ? <?xml version="1.0" encoding="utf-8" standalone="no"?> <web-app xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee"> <filter> <filter-name>myfilter</filter-name> <filter-class>myfilter</filter-class> <init-param> <param-name>domainname</param-name> <param-value></param...

android - How to do 'fastScrollEnabled' like ListView in ScrollView? -

i need fast scroll thumb in scrollview (which can scroll dragging thumb, in fastscrollenabled listview). problem detail: list rows composed different typeface , alignment. row 1: textview1 (typeface:a & leftaligned) textview2 (typeface:b & rightaligned) row 2: textview3 (typeface:a & leftaligned) textview4 (typeface:b & rightaligned) . . . second requirement: need alerted when view scrolled, including new scroll position - implemented overriding onscrollchanged method of scrollview. so use scrollview cause though impossible implement using listview. suggestion? scrollview doesn't support fast scroll (unless of course.) however, describing can achieved listview. listview lets use several types of views list items.

javascript - String replace not working? -

i've been trying replace following string using following... var r = response.replace('var s = getservice().getvalue(\"join\")', 'null'); however, string remains un changed , can't understand why. string takes following format.. {"r":[],"c":true,"c":{"tags": [],"":3023,"s":".src.util.s@6f4e9e57","class":"class src.util.dtos.dto","type":"public","c":"m","s":0,"de fault":false,"id":544,"d":"","n":4,"na":"s","tagstring":"","pages":5},"results":[],"q":"","msg":"var s = getservice().getvalue(\"join\") the actual string little longer hope idea abstract. if your var s = getservice().getvalue(\"join\") part javascript code inside json...

proxy - In Delphi 7, how can I retrieve Internet Connection names list? -

earlier ask how can set internet proxy in windows connection . but problem if want set connections, must list connection names list. search on net can't find answer this. you're looking rasenumentries function. delphi doesn't have ras api functions declared, easy if you've got jvcl. tjvras32 component has phonebook tstrings property in available connections populated. below d2007 test code (no error checking): const ras_maxentryname = 256; rasbase = 600; error_buffer_too_small = rasbase + 3; error_invalid_size = rasbase + 32; type prasentryname = ^trasentryname; trasentryname = record dwsize: longint; szentryname: array [0..ras_maxentryname] of char; end; function rasenumentriesa(reserved: pchar; lpszphonebook: pchar; lprasentryname: prasentryname; var lpcb: dword; var lpcentries: dword): dword; stdcall; external 'rasapi32.dll'; procedure getrasentries(list: tstrings); var rasentrynames: array ...

c++ - Cannot compile when trying to utilize boost::asio::signal_set -

i'm using mingw 4.5.1 compiling client application (c++, windows xp) utilizing newest version of boost 1_47. reason can't seem determine, when go compile using boost::asio::signal_set type compile error ( boost::asio::signal_set not define type), , when trying explicitly include either of associated signal_set headers, complaints of no file can found (despite file indeed being expected). have tried including files within same level of directory tree without issue, seems hang on signal_set.hpp file (although no complaints when using full header asio.hpp has include). same behavior when trying use boost 1_46_1 well. might have insights going on? the issue had was not including boost headers thought was. have boost installation in directory on hard drive, c:\boost\some_boost_version. whereas thought pointing new boost version's includes @ c:\boost\boost-1_47\boost, there not level inside directory tree \boost, in c:\boost\boost-1_47. adding new director...

python - Retrieve same column data from two different rows with one sqlite3 query? -

i have table profiles containing people primary key login_hash , bunch of other fields (for example, age ). table, msgs , contains src , dest fields, both of foreign keys login_hash profiles table. how retrieve ages of src , dests in 1 sqlite3 (from python) query? you can use 2 inner joins: select m.*, p1.*, p2.* msgs m inner join profiles p1 on m.src = p1.login_hash inner join profiles p2 on m.dest = p2.login_hash

c# - Data Binding a Generic Object to WPF TreeView? -

i have xml file deserialized object, , want display object in wpf treeview. have been looking in data bindings wpf treeview have not been able find looking for. is there way have wpf treeview display object , it's children without knowing in advance object structure looks like? assuming object looks like: entity entity b entity c entity c entity b entity d create hierarchical data template each non leaf entity , data template each leaf entity. i've found easy accommodate type of mixed hierarchy if have in objects observablecollection (called items) @ each level contains children of type below it. with setup, templates like: <!-- entity a--> <hierarchicaldatatemplate datatype="{x:type local:entitya}" itemssource="{binding items, mode=oneway}"> <stackpanel> <!-- content > </stackpanel> </hiera...

javascript - calling function from within same function -

i'm converting javascript code jquery , have come halt, heres code... html: <div id="text"></div> javascript: keywords = [ "one", "two", "three"] var allowed = true; function changetext ( ) { if(allowed) { var keyword = keywords[ math.floor( math.random() * keywords.length ) ] document.getelementbyid( "text" ).innerhtml = keyword; } settimeout( "changetext()", switchtime ); } changetext(); jquery: var changeallowed = true; $(document).ready(function changetext() { if(changeallowed) { $("#text").fadeout(500); var keyword = keywords[ math.floor( math.random() * keywords.length ) ]; $("#text").text(keyword).fadein(1000); }; settimeout( "changetext()", 2000 ); }); changetext(); what should fade text out in new string (which on refresh) every 2 seconds or so, jquery effects working, seems settimeout() or i've no...

Android emulator sdcard suddenly read-only(failing to mount?) -

i've been using android emulator mounted sdcard couple weeks no problem. today start app , crashes nullpointerexception when activity tries access /mnt/sdcard. check ddms file explorer , /mnt/sdcard seems empty. try push file onto it's read-only, permissions d---------. there these 2 lines @ beginning of logcat output: d/vold ( 29): volume sdcard state changing -1 (initializing) -> 0 (no-media) d/vold ( 29): volume sdcard state changing 0 (no-media) -> 1 (idle-unmounted) so take mean sdcard.img failing mount reason. ideas why be? open shell emulator adb shell then type following command: mount -o remount,rw /sdcard does work now?

windows - How can I configure Module::Build to NOT install files as read-only? -

i've encountered scenario i'm building perl module part of build system on windows machine. use --install_base option of module::build specify temporary directory put module files until overall build system can use them. unfortunately, other build system has problem if of files depends on read - tries delete generated files before rebuilding them, , can't clean read-only files (it tries delete it, , it's read only, gives error.) default, module::build installs libraries read-only bit enabled. one option make new step in build process removes read-only bit installed files, due nature of build tool require second temporary directory...ugh. is possible configure module::build based installer not enable read-only bit when files installed --install_base directory? if so, how? no, it's not configurable option. it's done in copy_if_modified method in module::build::base : # mode read-only + (executable if source executable) $mode = oct(444) ...

java - Netbeans libraries contains different jar/class than directed to -

i have been trying follow getting started jax-ws web services . had lot of trouble because jdk 6 has jax-ws 2.1 metro has jax-ws 2.2 . lot of searching found out called " endorsed " exists. try work apache , found out jax-ws clash (see ps2 hyperlink 3). have endorsed folder 2 .jar files in it: "c:\program files\java\jdk1.6.0_21\jre\lib\endorsed" containing "jaxb-api.jar" , "jaxws-api.jar". , seemed work, unfortunately 'server-application'. after lot of searching , copying different files endorsed folder , again , again... ...i started think wrong netbeans instead of me being stupid. downloaded java decompiler (see ps2 hyperlink 4), , looked in jar-files in endorsed folder. btw, errors recievin in netbeans javax.xml.ws.service not contain following constructor: protected service(url wsdldocumentlocation, qname servicename, webservicefeature[] features) but following constructor: protected service(url wsdldocumentlocation, qname s...

Pointers to parallel apps using azure -

if knows resources/sample code understand parallel processing on azure, please post link. want analyse personal project purposes. thanks you try: the new daytona project microsoft - http://research.microsoft.com/en-us/downloads/cecba376-3d3f-4eaf-bf01-20983857c2b1/default.aspx lokad's cloud platform - http://code.google.com/p/lokad-cloud/ azure grid - http://azuregrid.codeplex.com/ azure affinity grid - http://affinitygrid.codeplex.com/ (not date)

iphone - Tap pressure strength detection using accelerometer -

yesterday, in presentation new garageband ipad 2, apple demoed interesting feature: detection of tap pressure using accelerometer. (see drums section on garageband page .) i'm wondering how that's supposed work if ipad lays flat on table. no movement, no measurable acceleration, no? some answers. here's working code. implemented subclass of uigesturerecognizer can drop in , attach uiview or uibutton. once triggered, have "pressure" set float between 0.0f , 2.0f. can optionally set minimum , maximum pressures required recognize. enjoy. // // cpbpressuretouchgesturerecognizer.h // pressuresensitivebutton // // created anthony picciano on 3/21/11. // copyright 2011 anthony picciano. rights reserved. // // redistribution , use in source , binary forms, or without // modification, permitted provided following conditions // met: // 1. redistributions of source code must retain above copyright // notice, list of conditions , following disclai...

java - Session logout/ timeout -

to make short, here scenario: the browser button must functional (i'm using jsf 2.0, working) after logout, if user clicks button, app must redirect him/her login page (not working, user able view protected pages, although expired. can´t include meta tags disable browser caching because button stops working) if user invokes action, clicking button, on 1 of expired pages should redirect him/her login or error page (not working, app throws error , shows blank page. exceptionhandlerwrapper implementation detects exception , using navigationhandler change viewid , render response ("facesexception" mapping on faces-config points login.jsf), app not behaving expected) can please me solve problem? the browser button must functional (i'm using jsf 2.0, working) after logout, if user clicks button, app must redirect him/her login page (not working, user able view protected pages, although expired. can´t include meta tags disable browser caching be...

wordpress - Comment not being posted with xml-rpc wp.newComment php -

i have code this. <?php include('ixr_library.php'); $client = new ixr_client('http://127.0.0.1/wordpress/xmlrpc.php'); $data = array( 'comment_post_id' => 1, 'comment_author' => 'test_author', 'comment_author_email' => 'test@gmail.com', 'comment_author_url' => 'http://test.limewebs.com', 'comment_content' => 'test content', 'comment_type' => '', 'comment_parent' => 0, 'user_id' => 1, 'comment_author_ip' => '127.0.0.1', 'comment_agent' => 'mozilla/5.0 (windows; u; windows nt 5.1; en-us; rv:1.9.0.10) gecko/2009042316 firefox/3.0.10 (.net clr 3.5.30729)', 'comment_date' => $time, 'comment_approved' => 1, ); if (!$client->query('wp.newcomment','', 'username','password','12',$data)) { die('an error occurred - '.$client->geter...

email - Will I have problems if i implement a newsletter using PHP $mail? -

i mean, i'n long term, when have many accounts (10,000+), send them all? or better find 3rd party open script this? thanks! as far know, if send lot of email @ same moment, can blacklisted mail hosters spammer. 1 solution heard delay , send 1 smaller batch every hour or so, honnestly don't think efficient ;) using external partner useful, maybe try mail chimp, free limit of 2k users, guess it's worth giving try. if go on 2k can consider getting paying service or not !

How can I find out the frame rate of a flash (.FLV) video from JavaScript? -

i have limited experience using flash javascript api observe , manipulate swf files. observe , manipulate flv videos javascript. api familar ( play() , totalframes() , tcurrentframe() , gotoframe() , etc.) operates in frames, whereas want operate in seconds. so either need flash javascript api based on time, or need way find out frame rate of flv javascript, can translate frames seconds , vice versa. note not have control on generation of flv files. looks question 4 years old, needed know how find frame rate of flv file tonight, because needing strip files flv container , repackage files in mp4 container without doing actual converting. followed tutorial on youtube showed me how using 2 apps "flv extract v1.6.4" , "yamb-2.1.0.0_beta2". problem yamb needed know frame rate repackage , did not know if should use 25, 30, etc... noticed guy in youtube tutorial had app in folder called "mediainfo" did not talk about, googled , gave try> , sho...

c++ - Partial evaluation/specialization with LLVM-gcc or gcc -

i interestent in (partial) compile-time evaluation c/c++ (not template parameters in c++). lets consider following case (taken [1]): double mypower(double x, int n) { int i; double ret = x; (i = 1; < n; i++) { ret *= x; } return ret; } then call function somewhere in code with: mypower(x,3); // y varies time, then compiler optimize (e.g. loop unrolling). used function use benefit optimization (tested creating specialized function manually). presentation [1] descibes process function searched , replaced specialised version of function. seems work. not seem universal, code needs written functions should replaced. the presentation seems 2008, not find substantial more information in source. has improved since then? prefer kind of automatism, same function possibly controlled attribute syntax (e.g. __attribute__(peval) ...). further same work object-oriented code, creating specialized classes different objects ([2] seems suggest not possible). additionally...

android - Anyway to append to the activity stack without doing a StartActivity? -

i'm parsing huge xml display list of titles in listview in activity a. same xml has details list item needs shown in different view (like list mail subjects/view mail details scenario). on click event of list dont want load new activity bundle, parse same xml , show detailed view, while have required data in activity itself. i figured out way hide show layouts in xml required, handling button issue. can capturing button action, want know whether there better solution this. like broadcasting intent (from itself) , somehow managing add activity stack. excuse if there duplicate question, couldnt find 1 when searched. btw, dont want solution database caching. i handling press. use flag within activity tells in view (so within detailed view shows overview view). another way save values in applicationcontext. easier way database usage. take @ answer here: how declare global variables in android? but go handling presses. have solution similar use same listview ...

android - View disappear while using relativelayout's "toLeftof" -

i'm using android's relativelayout, trying make 2 buttons align side side. but, when use layout_toleftof, button02 disappear. it's fine if use layout_torightof. knows why? <button android:id="@+id/button01" android:layout_alignparentleft="true" android:layout_height="wrap_content" android:layout_width="wrap_content" android:text="@+id/button01"> </button> <button android:id="@+id/button02" android:layout_height="wrap_content" android:layout_width="wrap_content" android:text="@+id/button02" android:layout_toleftof="@+id/button01" android:layout_aligntop="@+id/button01" android:layout_alignbottom="@+id/button01" > </button> that's because first 1 aligned left; if put second button left of first one, outside screen. so, if change android:layout_...

uitableview - iPhone: how many objects should I bring back from webservice? -

i using rails webservice , wondering how many json objects should bring on first call? options: bring 200 webservice show 25 in uitableview w/ load more feature? bring 25 , on clicking load more fetch 25 webservice? ???? without empirical data it's hard say, guess overall, dealing smaller datasets , more calls little better user. reason being users tend "hurry , wait". tap something, , when tap want 5 seconds ago (hurry up). once see data, want @ bit before request new data (wait). this argument background loading user playing around things, if can load other info invisibly before ask better snappy ui, may wasting bandwidth on server, , battery. brings needing metrics. make work , people's hands, see how feels, go there real ux feedback.

ssl - Couldn't able to connect to APNS Sandbox server -

i trying connect apple apns server following observations: 1)port 2195 open 2)with valid key passphrase apns_sslcertificate_key.pem 3)entrust certificate (2048) downloaded https://www.entrust.net/downloads/binary/entrust_ssl_ca.cer 4)with successful telnet response below : $ telnet gateway.sandbox.push.apple.com 2195 trying 17.172.232.226... connected gateway.sandbox.push-apple.com.akadns.net. escape character '^]'. but when run following openssl command in server test apns connectivity : openssl s_client -connect gateway.sandbox.push.apple.com:2195 -cert apns_sslcertificate_key.pem -debug -showcerts -cafile server-ca-cert.pem i getting error follows: unable load certificate 57013:error:0906d06c:pem routines:pem_read_bio:no start line:/sourcecache/openssl098/openssl098-35/src/crypto/pem/pem_lib.c:650:expecting: trusted certificate so please suggest how resolve problem thanks in advance ...... i ran same issue; resolved error re...

sql server - How to generate a csv file using select query in SQL -

possible duplicate: how export data csv format sql server using sqlcmd? i want generate csv file using select query in sql-server. the code below working correctly in mysql: select * outfile 'd:/report.csv' fields terminated ',' tablename; it generated csv file. does know how can create csv file using select query in sql-server? will work sqlcmd -s server -u loginid -p password -d dbname -q "select * tablename" -o output.csv edit: use -i options if want execute sql script -i sql_script_filename.sql

sql server ce - Creating SQL compact database from Oracle database -

we have oracle database , need create client sql compact, need synchronize data between them in future. how can create sql compact database oracle database(maybe somehow exporting schema etc.) ? you use sql server migration assistant move sql server, , use export2sqlce create schema (or schema , data) - http://exportsqlce.codeplex.com

parser generator - Good BNF grammar tutorial / introduction for a beginner? -

what's tip introduction bnf grammar (and how use them in practice)? something concise many examples great. have been googling found enormously long artcles unclear examples far :/ (in particular case, i'm trying parse galaxy toolconfig syntax , includes if/else statements etc.) i've found abnf rfc when regarding these issues: http://www.ietf.org/rfc/rfc2234.txt

How to detect edges of image ( coin )in android? -

in application , capturing image of coins on table , immidiatley ned detect edges of coins . can 1 me how solve ? regards, srinivas the're number of edge detecting algorithms , have used sobel edge detector before.

c++ - Two way communication with (static) library -

i writing program, bulk of platform independent code compiled static library. writing program using specific platform apis linked static library. calling functions in library actual program easy, unsure of best way (most efficient / cleanest implementation) of communicating program library. i have looked signals / slots method worried performance (ideally draw calls go through this). otherwise other method can think of form of callbacks using functors implementation, should quicker best design? edit: main aims / requirements performance , implementable. library written in c++ , uses boost boost signals possibility, performance acceptable? here options (roughly) flexible least: signals & slots several signals , slots implementations listed here (notably boost.signal). these useful implement observer design pattern more 1 object interested in receiving notifications. boost.function you can register boost::function callback. boost::function wrapper around ...

php - jquery Post problem -

i have code in sending values form php page query lies , sending values using $.post of jquery going good. resulting table , button want button work , 1 of table column has radio button list want button take radio id of perticular row on click button not working please guide me how can code here my javascript function function searchdetail(searchname) { var textname = searchname + "text"; var inputtext = $('#' + textname).val(); var formname = searchname + "form"; if (inputtext === "") { $('#' + textname).css("border", "2px solid red").fadein(4000); } else { $('#' + textname).css("border", "1px solid #8dd7f6").show(2000); $('#searchbox').fadein(1000); $.post('../search/delete' + searchname + '.php', $('#' + formname).serialize(), function(result) { $('#searchbox').html(result); ...

android - Error in gallery activity imageLoader -

i keep getting these errors force closing activity. runs on regular devices on tablet these errors? 07-21 19:34:45.472: error/androidruntime(409): @ android.os.strictmode$androidblockguardpolicy.onnetwork(strictmode.java:1077) 07-21 19:34:45.472: error/androidruntime(409): @ java.net.inetaddress.lookuphostbyname(inetaddress.java:477) 07-21 19:34:45.472: error/androidruntime(409): @ android.widget.relativelayout.measurechildhorizontal(relativelayout.java:581) 07-21 19:34:45.472: error/androidruntime(409): @ com.you.mainmenu$imageadapter.getview(mainmenu.java:242) 07-21 19:34:45.472: error/androidruntime(409): @ android.view.view.measure(view.java:10828) 07-21 19:34:45.472: error/androidruntime(409): @ android.view.viewgroup.measurechildwithmargins(viewgroup.java:4351) its pointing me here: } @override protected void onpostexecute(void notused){ ((gallery) findviewbyid(r.id.gallery)) ...

ruby on rails - OAuth signature verification fails -

i'm having problem setting oauth provider two-legged authentication. i'm using oauth-plugin gem , oauth gem, works fine except "update" requests. signature verification process keeps failing. here i'm doing: in client, i'm using oauth = oauth::accesstoken.new(oauth::consumer.new(app_key, app_secret, :site => @api_endpoint)) oauth.get("http://localhost/api/v1/users/1") oauth.post("http://localhost/api/v1/users", {:email => "testemail@mysite.com"}) oauth.put("http://localhost/api/v1/users", {:tags => ["some", "new", "tags"]}) oauth.delete("http://localhost/api/v1/users/1") get, post , delete go through authentication fine, update fails. on server side, have clientapplication class set def self.verify_request(request, options = {}, &block) begin signature = oauth::signature.build(request, options, &block) return false unless oauthn...

python - Grouping CheckboxSelectMultiple Options in Django -

in django app have following model: class supercategory(models.model): name = models.charfield(max_length=100,) slug = models.slugfield(unique=true,) class category(models.model): name = models.charfield(max_length=100,) slug = models.slugfield(unique=true,) super_category = models.foreignkey(supercategory) what i'm trying accomplish in django's admin interface rendering of category using widget checkboxselectmultiple category somehow grouped supercategory , this: category: sports: <- item of supercategory [ ] soccer <- item of category [ ] baseball <- item of category [ ] ... politics: <- item of supercategory [ ] latin america [ ] north america [ ] ... does have nice suggestion on how this? many thanks. after struggle, here got. first, make modeladmin call modelform: class optionadmin(admin.modeladmin): form = forms.optionform then, in form, use u...

Macros in c & C++ -

is possible define or undefine macros during runtime. no. macros preprocessor mechanism, , resolved before compiler executes. their purpose alter source code compiler sees, don't exist @ runtime (let alone permit modification).

git - How do I set up NetBeans 7 to download the contents of a GitHub repository? -

Image
apologies newbishness of question. connect , download contents of github repository, specifically: https://github.com/residual/residual (with repository uri being: https://github.com/residual/residual.git ). i have initialized root path repository created, , fed in uri, when click fetch, is: ==[ide]== 21-jul-2011 23:02:51 connecting ==[ide]== 21-jul-2011 23:02:51 connecting finished. ==[ide]== 21-jul-2011 23:05:29 fetching... git fetch https://github.com/residual/residual.git +refs/heads/master:refs/remotes/origin/master no update ==[ide]== 21-jul-2011 23:05:30 fetching... finished. which sounds promising except in netbeans repository looks (i.e. apparently empty): how files repository (i want edit them locally, have latest version available -- not commit anything) , use them in c++ project? again, apologies newb question. can't seem find guides getting , running, despite having had no problems running svn , sourcesafe version control in past. thanks. wh...

asp.net - IISHandler error does not implement interface member 'System.Web.IHttpHandler.IsReusable', -

how fix error error 3 'fmmadminmodule.iishandler1' not implement interface member 'system.web.ihttphandler.isreusable', error 4 'fmmadminmodule.iishandler1' not implement interface member 'system.web.ihttphandler.processrequest(system.web.httpcontext)' here handler `using system; using system.web; using system.data; using system.data.sqlclient; using system.web.sessionstate; namespace fmmadminmodule { public class iishandler1 : ihttphandler { /// <summary> /// need configure handler in web.config file of /// web , register iis before being able use it. more information /// see following link: http://go.microsoft.com/?linkid=8101007 datatable dt; int key; byte[] imageout; public void processrequest(httpcontext context) { httpresponse response = context.response; httprequest request = context.r...

java - Pattern to initialize base class in derived class constructor (or factory) -

imagine have derived class, base class cannot modify. base class has lot of state (many non-constant private members) , many constructors, varying numbers of arguments initialize subset of state (the size of subset varies constructor, of course). now derived class lightweight wrapper on base class. let's assume adds no state of own, , modifies behavior of couple methods (perhaps doing additional logging around super.originalmethod() call). the issue have want take object of base class, , create "copy" of it, same state, instance of derived class. this proving difficult. can't call "most complete" constructor of base class, passing state source calling getters, since depending on how base class constructed, of state values may rejected constructor. example, can create default object 0-arg ctor, many values null. not, however, legal pass null values in ctor allows specify these values. furthermore, method above fragile because if modification...

c++ - Pointer class member and deleting responsibilities -

if class has pointer of sort can set class clients, how should deal deletion? example: class { }; class b { public: void seta(a* a) { this->a = a; } private: a* a; }; how should destructor of class b ? should delete a ? see, there 2 way user can set pointer: ... // assume b object b being created elsewhere aobj; a* aptr = new a(); b.seta(&aobj); // not ok use delete, , class member // point invalid memory location once aobj goes out // of scope b.seta(aptr); // using new make pointer available after // block of code ... so right way of deleting b? should perform new in set method? how should destructor of class b? should delete a? you , author of class, decides of semantics. don't think in terms of pointers, references, , delete s. think in terms of design: what's relation between a , b ? b needs a for? two common types of relation delegation , composition. delegation mean...

asp.net - RadGrid1.Items is null -

enter code here protected void btnshortlist_click(object sender, eventargs e) { foreach (griddataitem item in rg_results.items) { checkbox chkselected = (checkbox)item.findcontrol("chkselected"); if (chkselected.checked == true) { applicant_status(item.cells[3].text.trim(), 1, 0); } } } rg_results.items null , cannot enter in foreach loops note:i'm not using rad grid need data source event because conflict javascripts please me? use rg_results.mastertableview.items instead of rg_results.items

objective c - how to handle key events in iphone -

hi working on iphone application , want handle keyboard events in iphone. in mac, there class nsevent handles both keyboard , mouse events, , in ios (iphone/ipad) counterpart of nsevent uievent handles touch events. know ios api not provide functionality, how can handle key events in iphone??? tutorial or sth, started... you cant directly code keyboad;s key , there no mouse in case of device. you can make logics different kind of charectersets or can make logics in textfield delgate methods or textview delegates method textview delegate - (bool)textview:(uitextview *)textview shouldchangetextinrange:(nsrange)range replacementtext:(nsstring *)text textfield delegate - (bool)textfield:(uitextfield *)textfield shouldchangecharactersinrange:(nsrange)range replacementstring:(nsstring *)string you can use notification textfield , textview. for textfield use this call register method in viewdidload -(void)registerfortextfieldnotifications { nsnotificationce...

css - IE7, 8 and 9 won't show border corners -

check out http://jugheads.co/home.html slider looks great in chrome, safari , firefox, in ie7, 8 , 9 border messed up, , margins off small pixel amounts. is there i'm doing wrong here? i've been looking on internet hours, , i've been trying debug hours. -got nothin' thanks guys, rob i can't see describe, page running in quirks mode, display can mess up. remove xml header, maybe sufficient.