Posts

Showing posts from April, 2011

android - Setting the menu background to be opaque -

i'm trying set background of menu pane opaque. after lot of searching , trying out things can working setting 'panelfullbackground', however, unwanted result of losing top edge of menu pane along shadow effect. i'm guessing setting color i'm losing additional styles associated 'panelfullbackground'. i've set application have custom style. style inherits theme.light. in style i'm setting 'panelfullbackground' custom color follows: in stylex.xml: <item name="android:panelfullbackground">@color/custom_theme_color</item> in colors.xml <color name="custom_theme_color">#ff00ffff</color> i've tried using panelcolorforeground|background not achieve want. it should mentioned tried use setmenubackground approach suggested elsewhere no avail. thanks in advance. you can change background of android menu options. in default manner. if want change , feel of them, consider build...

android - How to import-export application's data? -

i'm building application calculates fuel consumption of cars. datas saved in file, , i'm planning add support of import/export feature in app(i flash phone). how can make ? thank you. easiest write data sdcard since isn't touched when flash phone for sdcard io see: writing file sdcard

html5 - Problem using Appmobi XDK! -

plz can tell me how open our project @ appmobi xdk. facing problem have install not allow me open projects. when tried open project message comes unable open project. now need guys. thanks the first thing need go xdk.appmobi.com (in google chrome) , download/install our xdk. (need java installed also) during install need set default appmobi directory. app files stored. create new app within xdk. can click edit source code button in tool bar edit code. here can update file own code. you can check out video explains xdk @ http://www.youtube.com/watch?v=mwv8kojlgmc things might have changed visually current version of xdk, same. some things have changed/moved around screen since made video, functionally same. check out give tips/how to's using xdk. also, posting in our forums (forums.appmobi.com) questions answered sooner!

class - how to display items one after one in custom layout using Asynocronous task in android -

i creating 1 layout in code retrieve message string , image using webservices retrieve data in background process display data total views display 1 time , my intension getting 1 message string , 1 image getting after display custom layout next getting another(second) message string , image display add layout functionality running 1 one show messages , images xmlfile: <framelayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/framelayout1" android:layout_width="fill_parent" android:background="@android:color/white" android:layout_height="fill_parent"> <scrollview android:id="@+id/scrollview1" android:layout_height="wrap_content" android:layout_width="fill_parent"> </scrollview> </framelayout> code file : public void oncreate(bundle savedinstancestate) { super.oncreate(save...

build multiple targets in a makefile without all target -

i have list of targets calling msgfmt specific language. call them all, not want create huge all target. there other way tell make multiple targets should build? the all target not special in way. convention first, , default target. other phony target can take its' place. just create target, declare .phony , let msgfmt targets prerequisites of target, , make other first one. if have list of targets in variable, can use variable prerequisite list.

c# - How to raise an event on Property Change? -

when use dataset, there possiblity raise events on rowchanging, rowchanged, columnchanging, columnchanged, etc... how same entity entity framework ? entities implement propertychanged event since implement system.componentmodel.inotifypropertychanged . if want catch changes entieis, can subscribe that. also note entities support following 2 partial methods—the second of should give equivalent of "rowchanging"—that can override if you'd respond changes within class: protected override void onpropertychanged(string property) {} protected override void onpropertychanging(string property) {}

git - Undo last commit/merge -

i have messed git repo little. worked on feature in separate branch. after finishing work, switched master merge into, partner pushed few files came conflict mine. after merge, conflict , pushing new changes, saw committed older changes of partner too. now want redo commit/merge. tried git reset --soft head^ when wanted push, got error message merge remote changes before pushing again . can me? your feature branch still point work. not lose changes. as plaes said, can reset master 1 with git reset --hard head^ if want grab specific files branch without merging, can check them out: git checkout yourbranch -- file1 file2 etc if want files master before merge can check these out: git checkout master^ -- file3 file4 etc this not ideal needed sometimes. merge /may/ mean reject changes either side in merge. best way attain proper merge to: git merge --no-commit yourbranch from master, run git checkout commands above , commit: git add . -a git commit w...

calender control in asp.net opening in another form -

i using calender control in asp.net 2.0, , after clicking on button opening in form. using following js code open window: function openwindow(txtvalueid) { leftval = (3500 - screen.width) / 2; topval = (800 - screen.height) / 2; if (txtvalueid == 'ctl00$cph1$txthiredate') { var txtid = '<%=txthiredate.clientid %>'; } else { var txtid = '<%=txttermdate.clientid %>'; } var frmid = '<%=page.form.clientid %>'; var qs = "formname=" + frmid + "." + txtid; window.open('/calender.aspx?' + qs, 'calendar_window', 'fullscreen=no,toolbar=no,status=no,menubar=no,scrollbars=no,resizable=no,directories=no,location=no,width=230,height=240,left=' + leftval + ',top=' + topval + ',screenx=400,screeny=400') } function isnumeric(keycode) { return ((keycode >= 48 && ...

assigning mysql value to variable inline -

why doesn't work i'm trying previous , current value calculate percent change. both values correctly how can reuse them math operatio when try below command error 1054 (42s22): unknown column 'currentval' in 'field list' select ifnull(dvalue,0) currentval, (select ifnull(dvalue,0) ... where...) previousval, (currentval-previousval)/previousval ... ...; wrap query around have , calculate percentage there: select currentval, previousval, (currentval-previousval)/previousval percentchange (select ifnull(dvalue,0) currentval, (select ifnull(dvalue,0) ... where...) previousval ... ...) t

SQL Server - Permission on a per table basis? -

i have .net have read access sql server database. possible sql server give me write access 1 of tables in database, , restrict me read rest of database? use tsql script, if need: exec sp_addrolemember n'db_datareader', n'user1'; grant insert, update, select on mytable user1 --for multiples, it's user1,user2

c# - Use OrderBy in a LINQ predicate? -

in code need sort collection either price or rating.totalgrade , can see both linq querys same statement minor difference. i thinking using linq predicate instead can see the orderby main difference , found no sample using orderby in query. possible or there other ways shorten code, maybe there more conditions in future. if (currentdisplaymode == crschartrankinggraphdisplaymode.position) { this.collectioncompletesorted = new list<result>(from co in collection co.isvirtual == false orderby co.price, co.currentranking select co); } else if (currentdisplaymode == crschartrankinggraphdisplaymode.grade) { this.collectioncompletesorted = new list<result>(from co in collection co.isvirtual == false orderby co.rating.totalgrade, co.currentranking sel...

html - jQuery: How can I assign a variable back to a hidden element in the document? -

how can assign variable (button id clicked), jquery diaglog, hidden element (myhiddenid) in document later use? <table border="0" class="time_data"> <td><button type="button" id='001' class="del-fruit" > apple </td> <td><button type="button" id='002' class="del-fruit" > banana </td> <td><button type="button" id='003' class="del-fruit" > cantalope </td> </table> <div id='myhiddenid' style="display:none;"></div> <script type="text/javascript"> $("#dialog-form").dialog({ autoopen: false, height: 150, width: 350, modal: true, resizable: false, buttons: { 'yes': function() { var bvalid = true; allfields.removeclass('ui-state-error'); bvalid = bvalid if...

actionscript 3 - Adding elements in Flex using the presentation model -

i'm refactoring flex code written developer , i'm implementing presentationmodel approach, separate out actionscript mxml. 1 of problems i've found original actionscript code adds/removes elements mxml. what happens handler function checks model , if values correct either create or remove element view. best way presentation model ad elements view , still keep loose coupling i'm aiming for. i thinking of using simple events presentation model dispatches , view can list passing details of element add. there solution? thanks stephen if you're using presentation model, i'd assume have kind of data of needs happen. when items of sort being dynamically added/removed, make sure make data-driven easier manipulation. if want item added, add data model dataprovider of choice (list, combobox, datagroup, etc). by doing approach, you're abstracting logic presenter view. events should used way view know when presenter has accomplished something. ...

java - EJB Timer Service error -

i'm trying use ejb timer service, have class named timerbean carries methods schedule timer , handle timeout, implements timerbeanremote interface class. in session bean have following: timerbeanremote service = (timerbeanremote) new initialcontext().lookup("timerbean/remote"); when try run on server error: javax.naming.namingexception: lookup failed 'timerbean/remote' in serialcontext [root exception javax.naming.namenotfoundexception: timerbean] any ideas why can't find it? thanks! following comments -if trying access timerbeanremote within same container can inject @remote ejb in servlet or jsf backing bean else can locate ejb through jndi lookup. suppose timerbean is: com.mypackage.timer.timerbeanremote per explanation above can either inject or lookup: injection public class myservlet ...{ @ejb com.mypackage.timer.timerbeanremote timerbean; } jndi lookup: properties props = new properties(); props.setpro...

browser - fullscreen and no toolbars, scrollbars etc. with javascript. NOT window.open -

how make window standing in fullscreen , remove toolbars etc. ? what else saying: can't reliably. closest window.open controls described here shut off default in browsers. even if find way it, rest assured abused spammers , shut down down after-- it's significant security hole.

ios - Reordering UITableView without reorder control -

i need user able reorder uitableview way: touches cell predetermined period (e.g. 1 second), can drag , drop on other cells. i know how implement 'long touch' detection using gesture recognizer, best way implement drag , drop ability without using reorder control (the user should drag cell anywhere in cell, not reorder control)? i solved question of following steps: attach gesture recognizer uitableview. detect cell tapped "long touch". @ moment create snapshot of selected cell, put uiimageview , place on uitableview. uiimageview's coordinates should math selected cell relative uitableview (snapshot of selected cell should overlay selected cell). store index of selected cell, delete selected cell , reload uitableview. disable scrolling uitableview. need change frame of snapshot uiimageview when drag cell. can in touchesmoved method. create new cell , reload uitableview (you have stored index) when user finger leaves screen. remove snapshot ...

c# - Configuring the Date Popup on the WPF DatePicker Control -

Image
i have date picker control use data collection application. using mvvm data binding. when going through list of dates (see fig1) populate date picker correctly. whenever hit new, date pickers nulled out. when pull popup, selects month , year previous date set to. (fig 2) there anyway default pop show current month in current year? note : keep selected date null on new entry force validation. fig 1 fig 2 the following image show happens when set displaydatestart. (original answer horribly wrong, sorry that) okay, lets try again. have tried setting fallback today's date? selecteddate="{binding tehdate, fallbackvalue={x:static sys:datetime.now}}"

mysql - ERROR 1005 (HY000): Can't create table? -

i have read through billion times , cannot figure out... generated in workbench should work creates of tables except sections... create if remove relationship between section , instructor need relationship work.... appreciated! code below... can me! thanks! set @old_unique_checks=@@unique_checks, unique_checks=0; set @old_foreign_key_checks=@@foreign_key_checks, foreign_key_checks=0; set @old_sql_mode=@@sql_mode, sql_mode='traditional'; create schema if not exists `385_s11_turpinvp` default character set latin1 collate latin1_swedish_ci ; use `385_s11_turpinvp` ; -- ----------------------------------------------------- -- table `385_s11_turpinvp`.`tutors` -- ----------------------------------------------------- create table if not exists `385_s11_turpinvp`.`tutors` ( `name` varchar(45) not null , `banner_id` char(8) not null , `email` varchar(45) not null , `ssn` char(9) not null , `address` varchar(45) not null , `phone` int not null , primary key (`bann...

c# - Android anchor tags not working -

edit: tested on droid x running android version 2.2.1 i'm developing webpage designed run on mobile devices, android , ios. seems working on ios, i'm experiencing weird behavior on android. anchor tags seem not function. specifically, last anchor within div seems have trouble. there's nothing special these anchors: <div class="footer"> <a class="baselink" href="http://www.google.com"> having issues? try basic version</a> </div> nothing happens when link tapped. able open link after long-press, isn't acceptable solution. link should open when tapped. every other anchor on page functions expected. unfortunately, i'm unable share link external requests blocked our firewall. something refer to; may help: http://www.sencha.com/forum/showthread.php?112752-anchor-lt-a-gt-tags-not-working-on-android-%280.97%29

osx - Mac OS X Disk Image Verification -

does knows happens behind scenes when mac os x verifies disk image (.dmg) file? there way extend or customize procedure? edit: create disk image verifies should , nothing more. example, if distribute software manages passwords, malicious user modify package send passwords unwarranted third party. end user, functionality appear identical program, , never know package sabotaged. perform verification @ mount time. to knowledge, cannot modify procedure (unless system hacks don't recommend). believe compares internal checksum , makes sure disk's volume header ok. goes through of files see if of them corrupted.

oracle - GORM (Hibernate) Interceptor to run certain SQL before Hibernate runs it in the db in a Grails application? -

i have grails application in using gorm. works great. have requirement where, before sql called in database, has run stored procedure. so, there way can trigger method kicks off stored procedure before hibernate runs sql select, insert, update, delete etc. response appreciated. (p.s.- reason have run stored procedure change oracle workspace) it's not clear whether want run stored proc once before sql executed, or before every sql statement executed. here's suggestion both cases: once only call method invokes stored proc in bootrap.init() before every call method before* gorm event handlers

java - What synchronization method should I use for pausing a consumer queue thread? -

i have android application linkedblockingqueue i'm using run series of network jobs on separate thread (call network thread). when response network job need pause jobs user input dialog. i'd block network thread until user input complete, , unblock can continue process network jobs. concurrency mechanism makes sense here? edit: since pausing performed based on results of network job, pausing event comes network thread, edit: edit makes resolution bit easier. still need signaling can scratch complicated mess put in. can use simple reentrantlock , flag. maybe this boolean needstowaitforuserinput = false; final reentrantlock lock = new reentrantlock(); final condition waitingcondition = lock.newcondition(); private final runnable networkrunnable=new runnable(){ public void run(){ //get network information lock.lock(); needstowaitforuserinput = true; try{ while(needstowaitforuserinput ){ waitingcondi...

utf 8 - Java XMLReader not clearing multi-byte UTF-8 encoded attributes -

i've got strange situation sax contenthandler being handed bad attributes xmlreader. document being parsed utf-8 multi-byte characters inside xml attributes. appears happen these attributes being accumulated each time handler called. rather being passed in succession, concatenated onto previous node's value. here example demonstrates using public data (wikipedia). public class mycontenthandler extends org.xml.sax.helpers.defaulthandler { public static void main(string[] args) { try { org.xml.sax.xmlreader reader = org.xml.sax.helpers.xmlreaderfactory.createxmlreader(); reader.setcontenthandler(new mycontenthandler()); reader.parse("http://en.wikipedia.org/w/api.php?format=xml&action=query&list=allpages&apfilterredir=redirects&apdir=descending"); } catch (exception ex) { ex.printstacktrace(); } } public void startelement(string uri, string localname, string qn...

NHibernate: Modifying different fields of an entity from two sessions -

i have entity multiple fields. there 2 types of actions may performed on it: long one, initiated user, , short one, periodically run system. both of these update entity, touch different fields. there can't 2 concurrent long operations or 2 concurrent short operations. system may schedule short operation while long operation in progress, , 2 should execute concurrently. since touch different fields, believe should possible. i think nhibernate's change tracking should trick here - i.e., if 1 session loads entity , updates fields, , session loads same entity , updates different fields, 2 not collide. however, feel shouldn't relying on because sounds "optimization" or "implementation detail". tend think of change tracking optimization reduce database traffic, don't want functionality of system depend on it. also, if ever decide implement optimistic concurrency entity, risk getting staleobjectexception, though can guarantee there no actual collisi...

performance - I'm having troubles with Java sockets in a client/server type application when having to accept many connections -

first of all, reading. first time in stackoverflow user, although i've read , found useful solutions :d. way, sorry if i'm not clear enough explaining myself, know english isn't good. my socket based program having strange behaviour, , performance issues. client , server communicate each other reading/writing serialized objects object input , output streams, in multi-threaded way. let me show code basics. have simplified more readable , complete exception handling example intentionally ommited. server works this: server: // (...) public void serve() { if (serversocket == null) { try { serversocket = (sslserversocket) sslserversocketfactory .getdefault().createserversocket(port); serving = true; system.out.println("waiting clients..."); while (serving) { sslsocket clientsocket = (sslsocket) serversocket.accept(); system.out.prin...

Diff on XML with unicode using python -

i'm trying create web tool can visualize differences between 2 xmls. difflib working pretty in creating html differences, unicode text showed in xmls , resulting html contains html-encoded letters. is there other approach problem? i assume bothers 'html character entities', not numerical counterparts. may re-map them e.g. means of favorite cli tool supporting regexes (eg. sed) , tables unicode e-workers or reference . numerical entity encoding may used in html , xml files alike. best regards, carsten

sqlite3 table creation with java in android -

i'm working on creating checkbook app android using database record transactions. design i'd envisioned was/is allow user ability create different "accounts" (savings account, checking account, etc) under whatever name choose , use database table name. however, using preparedstatements doesn't work when try create table. i'm wondering if i'm going need sanitize input manually or if i'm missing something. first java/android database program , i've got no formal education in databases possible missed something. * *edited reflect more accurately meant account. on android device have no interest in multiuser setup. probably, don't need table each user. should revise database structure.

Using BinaryReader to read a midi file. (.net) -

how use binaryreader read midi file (specifications format here ) i'm using vb.net, i'm willing see other code (mostly c#, can convert it). i'm working on large project , comes bit of speedbump. here current code: private function convertchararraytostring(byval chars() char) string dim treturn string = "" each v char in chars treturn &= v next return treturn end function private sub button2_click(byval sender system.object, byval e system.eventargs) handles button2.click midistatus = "reading..." dim midistream new streamreader(midifile) dim nbr new binaryreader(midistream.basestream) midistatus = "validating midi file..." dim headera string = convertchararraytostring(nbr.readchars(4)) if not headera = "mthd" return dim headerb() byte = nbr.readbytes(4) 'get track type midistatus = "reading header data..." dim tracktype1 integer = nbr.readint...

Handling pointers within multiple functions in C -

i'm trying create functions out of existing code in order make cleaner, , i'm having problems: it used be: int foo(char * s, char * t, char ** out) { int val = strcmp(s, t); if (val == 0) { *out = strdup(s); return 1; } else { *out = strdup(t); return 5; } return 0; } now have: int foo(char * s, char * t, char ** out) { somefunction(s, t, out); printf("%s", *out); return 0; } int somefunction(char *s, char * t, char **out) { int val = strcmp(s, t); if (val == 0) { *out = strdup(s); return 1; } else { *out = strdup(t); return 5; } return 0; } and i'm getting segmentation faults when try printf. should somefunction expecting *out? guess i'm still confused. this code "correct" if understand intent. assume doing along lines of char *s = "foo"; char *t = "bar"; char *out; foo(s, t, out); when want char *s = "foo"; char *t = ...

iphone - UIView is shown displaced at the top of the screen -

ok, stupid question newbie... i have app used display fine base on xib files created in ui builder. .xib still displays fine using simulator direct uib when compiled , run, view displaced 40 or 50 pixels (about 1/3 width of nav bar) bar of white space @ bottom , half title text hidden on nav bar @ top. i have tried fiddling various parameters view , main window (eg layout wants full screen , resize view nib) nothing seems make difference. i tried upgrading xcode 3 4 no difference. any pointers gratefully received... i don't know specific scenario, layout problems boil down inappropriately specified autosizing parameters.

SQL 2008 R2 Row size limit exceeded -

i have sql 2008 r2 database. created table , when trying execute select statement (with order clause) against it, receive error "cannot create row of size 8870 greater allowable maximum row size of 8060." i able select data without order clause, order clause important , require it. have tried robust plan option still received same error. my table has 300+ columns data type text. have tried using varchar , nvarchar, have had no success. can please provide insight? update : thanks comments. agree. 300+ columns in 1 table not design. i'm trying bring excel tabs database data tables. tabs have 300+ columns. i first use create statement create table based on excel tab columns vary. various select, update, insert, etc statements on table after table created data. the structure of table follow patter: fkversionid, rownumber(autonumber), field1, field2, field3, etc... is there way around 8060 row size limit? you mentioned tried nvarchar , varchar ......

html - Strange Base64 encode/decode problem -

i'm using grails 1.3.7. have code uses built-in base64encode function , base64decode function. works fine in simple test cases encode binary data , decode resulting string , write new file. in case files identical. but wrote web service took base64 encoded data parameter in post call. although length of base64 data identical string passed function, contents of base64 data being modified. spend days debugging , wrote test controller passed data in base64 post , took name of local file correct base64 encoded data, in: data=aaa-base-64-data...&testfilename=/name/of/file/with/base64data within test function compared every byte in incoming data parameter appropriate byte in test file. found somehow every "+" character in input data parameter had been replaced " " (space, ordinal ascii 32). huh? have done that? to sure correct, added line said: data = data.replaceall(' ', '+') and sure enough data decoded right. tried arbitrarily lo...

xml - Format and combine output of xpath in bash -

i'm trying parse xml input using bash utility xpath : <?xml version="1.0" encoding="utf-8"?> <feed version="0.3" xmlns="http://purl.org/atom/ns#"> <entry> <title>title 1</title> <author>author 1</author> </entry> <entry> <title>title 2</title> <author>author 2</author> </entry> </feed> i need output in format: 1. title: title 1 author: author 1 2. title: title 2 author: author 2 i've fiddled around lot trying achieve in simple way (using single xpath command, or @ 3-4 commands), efforts have been in vain. please me out this? bash version #!/bin/bash count=1 input=input.xml while [ -n "$title" -o $count = 1 ] title=`cat $input | xpath //entry[$count]/title 2>/dev/null | sed s/\<title\>//g| sed s/\<\\\\/title\>//g` author=`cat $input | xpath ...

Stackoverflow kind of Answer/commenting app in Django -

i wondering if there pluggable application in django can use replica of stackoverflow kind answer , commenting. each post on web app have answers , answers can have comments discussing answer, so. does know such app or has been able modify django commenting app build this? http://www.osqa.net/ is written django.

ruby-prof "Wait" column in the results: what is it? -

the results ruby-prof output contains value "wait" column. however, i've never found description of value , in times i've used ruby-prof, i've never seen column ever take on value other 0. what value supposed represent? appreciated. thanks! the wait column tells how long thread had wait, aka how long spent waiting other threads. essentially thread wait resource being used thread. once thread done resource, notify other threads resource ready used. to read more on multi threading ruby, check out: http://www.ruby-doc.org/docs/programmingruby/html/tut_threads.html keep in mind, wait concept not ruby, huge concept in multi threading.

regex - Python Regular Expressions, find Email Domain in Address -

i know i'm idiot, can't pull domain out of email address: 'blahblah@gmail.com' my desired output: '@gmail.com' my current output: . (it's period character) here's code: import re test_string = 'blahblah@gmail.com' domain = re.search('@*?\.', test_string) print domain.group() here's think regular expression says ('@*?.', test_string): ' # begin define pattern i'm looking (also tell python string) @ # find patterns beginning @ symbol ("@") * # find characters after ampersand ? # find last character before period \ # breakout (don't use next character wild card, string character) . # find "." character ' # end definition of pattern i'm looking (also tell python string) , test string # run preceding search on variable "test_string," i.e., 'blahblah@gmail.com' i'm basing off definitions here: http://docs.activestate.com/k...

output redirection in Unix and C -

i trying run script inside c program using system() command. inside main() , run script , returns results. how can put result of script in string , check conditions? know can files wondering if possible put result string. sample like: main() { system("my_script_sh"); // how can result of my_script_sh } you can't use system command that. best thing use popen : file *stream; char buffer[150]; stream = popen("ls", "r"); while ( fgets(buffer, 150, stream) != null ){ // copy buffer output string etc. } pclose(stream);

c# - ASP .NET MVC Disable Client Side Validation at Per-Field Level -

i'm using asp .net mvc 3 data annotations , jquery validate plugin. is there way mark field (or data annotation) should validated server-side? i have phone number field masking plugin on it, , regular expression validator goes crazy on user's end. regex fail-safe (in case decides hack javascript validation), don't need run on client side. i'd still other validation run client side. i'm not sure if solution works on mvc3. surely works on mvc4: you can disable client side validation in razor view prior render field , re-enable client side validation after field has been rendered. example: <div class="editor-field"> @{ html.enableclientvalidation(false); } @html.textboxfor(m => m.batchid, new { @class = "k-textbox" }) @{ html.enableclientvalidation(true); } </div> here disable client side validation batchid field. also have developed little helper this: public static class ynnovahtmlhelper { ...

iphone - Is it necessary to receive a NSNotification when adding an observer? -

here's thing.. every time see example around web related iphone - ipad dev, see every time controller register notification, callback method like: -(void)mymethod:(nsnotification *)notification { //bla bla } the same buttons actions.. like: - (void)actionmethod:(id)sender { //bla bla } i make tests, , method called anyway or without parameter. necessary? reason? thanks !!! from nsnotificationcenter doc : notificationselector selector specifies message receiver sends notificationobserver notify of notification posting. method specified notificationselector must have one , one argument (an instance of nsnotification ). [emphasis mine.] you must provide selector correct signature; if don't, may work, may stop working when don't want to. the reason might want notification can pass along information, in form of userinfo dictionary can specify when post notification using notificationwithname:object:userinfo: . can ignore argu...

iphone - GestureRecognizers stop working after using presentModalViewController and dismissing -

i initializing gesture recognizers following code when initialize view. however, after multiple times of presenting view on top of 1 gesture recognizers , dismissing presentmodalviewcontroller , dismissmodelviewcontroller, gesture recognizers stop working on original view. i've tried manually releasing recognizers in view's dealloc function rather using autorelease, doesn't seem help. have ideas? thanks! also, should mention problem happens on device, , not simulator. -(void) initializegestures { recognizer = [[[uitapgesturerecognizer alloc] initwithtarget:self action:@selector(handletapgesture:)] autorelease]; //recognizer = [[uitapgesturerecognizer alloc] initwithtarget:self action:@selector(handletapgesture:)]; [(uitapgesturerecognizer *)recognizer setnumberoftouchesrequired:1]; [self.view addgesturerecognizer:recognizer]; recognizer.delegate = self; swipeleftgesture = [[[uiswipegesturerecognizer alloc] initwithtarget:self action:@selector(handleswipege...

Multiple java processes in Tomcat -

i working on web-based application deployed in tomcat server. in our local dev enviroemt, when start tomcat server spawns 1 java process keeps running. however, issue has been reported in production cpu usage java process has gone , there multiple java processes have been spawned. there no other java application running, must have been spawned tomcat itself. reason in our development enviroment there 1 java process while in production multiple java processes have been spawned tomcat , how correct it. regards, dev what see multiple threads version of top or ps shows on production box, while don't see them on local one. in production face higher workload, requests served in parallel, while on local box tomcat gets away less threads.

iphone - deleting image heavy custom uitableviewcells -

i have table made custom uitableviewcells contains downloaded images. ive found app crashes after many images displayed. how can best stop this? don't mind deleting first images, don't know of best way it. edit how write images device caching? post cellforrowatindexpath code. sounds have problem there. if you're not, when receive memory warning, release objects not need, , can loaded again if required. these objects may in other viewcontrollers not on screen or imageview objects displayed. best can unless post code. or read apple's memory management guide.

performance - "Fastest" hash function implemented in Java, comparing part of file -

i need compare 2 different files of instance "file" in java , want fast hash function. idea: - hashing 20 first lines in file 1 - hashing 20 first lines in file 2 - compare 2 hashes , return true if equal. i want use "fastest" hash function ever been implemented in java. 1 choose? if want speed, not hash! not cryptographic hash md5. these hashes designed impossible reverse, not fast calculate. should use checksum - see java.util.zip.checksum , 2 concrete implementations. adler32 extremely fast compute. any method based on checksums or hashes vulnerable collisions, can minimise risk using 2 different methods in way rsync does. the algorithm basically: check file sizes equal break files chunks of size n bytes compute checksum on each pair of matching blocks , compare. differences prove files not same. this allows detection of difference. can improve computing 2 checksums @ once different algorithms, or different block sizes. more bits i...

c++ - Compiler policies on destruction of temporaries -

i've been playing following piece of code. file_string returns temporary string should "live" until end of statement. in visual studio 2008, when use ptempfolder , contains rubbish expected. in linux though, intel compiler 11.0, ptempfolder still points valid string. compilers have different policies regarding destruction of temporaries, kind of eager (visual) versus lazy (intel)? or maybe coincidence? boost::filesystem wpathtempfolder("/tmp"); const wchar_t* const ptempfolder = wpathtempfolder.file_string().c_str(); // use ptempfolder btw, boost filesystem version 2. i've seen file_string being deprecated in boost filesystem version 3. , there new c_str method operates on string&, instead of on temporary string. /*filesystem 2*/ const string_type file_string() const; /*filesystem 3*/ const string_type& native() const; // native format, encoding const value_type* c_str() const; // native().c_str() likely, string still inv...

java - Clustering Weblogic JMS -

i have 8 instances of weblogic, dispatched on 4 machines. 8 instances grouped in cluster. 8 instances great ejb containers, have 8 instances of weblogic jms server. in consequence, jms messages dispatched on 8 instances... volume low need many jms servers. i'd have 1 jms weblogic instance machine. possible disable jms messaging on instance? i believe can target jms server individual wl server within cluster. see the theory , console help instructions. you dont need 8 jms servers, keep 1 , use migratable target takes care of failover you.

boolean - Algorithm for finding a formula that connects inputs and outputs -

i seem recall having learned method finding formula connects inputs , outputs table. example: a b c | r 1 1 0 | 0 0 1 1 | 1 1 1 1 | 1 where "r" result, , a, b , c inputs. method involved equations many unknowns , ended formula explained all. (this example not meaningful, since r = c, idea). however, can not remember details, , not enough keywords able find on web. subject teaching method included lot of boolean algebra. i know vague question, method finding formula table of values be? are referring karnaugh maps ?

multithreading - Singletons in multi threaded environment -

when using singletons, if class has instance fields should careful when several threads might using singleton? (and fields mutable , values can changed) i havn't tried in theory seems answer yes , need synchronization (or skip singleton) when access object (or same mutable data) multiple threads (or processes) need kind of synchronization. there no difference whether singleton or other "non-singleton" object. one additional question, in case of singletons creation of singleton though, if created first time used, first time might concurrently different threads, need synchronize singleton-creation well.

C# strange with DateTime -

i got strange result for: console.writeline(new datetime(1296346155).tostring()); result is: 01.01.0001 0:02:09 but not right! i parsed value 1296346155 file. said in utc; please explain;) thank help!))) datetime expects "a date , time expressed in number of 100-nanosecond intervals have elapsed since january 1, 0001 @ 00:00:00.000 in gregorian calendar." (from msdn ) this question shows how can convert unix timestamp datetime.

linux - Where can I find source code of ldconfig? -

i want peek implementation,where available? here how found out source code is, on system runs fedora distribution of linux. (for debian, ubuntu , similar distributions command(s) use different.) rpm -qfi `which ldconfig` (those `s backticks, not apostrophes.) this outputs following name : glibc relocations: (not relocatable) version : 2.13 vendor: fedora project release : 1 build date: thu 20 jan 2011 10:52:15 gmt install date: sun 13 mar 2011 11:42:50 gmt build host: x86-04.phx2.fedoraproject.org group : system environment/libraries source rpm: glibc-2.13-1.src.rpm size : 13616282 license: lgplv2+ , lgplv2+ exceptions , gplv2+ signature : rsa/sha256, thu 20 jan 2011 04:42:22 pm gmt, key id 421caddb97a1071f packager : fedora project url : http://www.gnu.org/software/glibc/ summary : gnu libc libraries descriptio...

Getting linux to buffer /dev/random -

i need reasonable supply of high-quality random data application i'm writing. linux provides /dev/random file purpose ideal; however, because server single-service virtual machine, has limited sources of entropy, meaning /dev/random becomes exhausted. i've noticed if read /dev/random, 16 or random bytes before device blocks while waits more entropy: [duke@poopz ~]# hexdump /dev/random 0000000 f4d3 8e1e 447a e0e3 d937 a595 1df9 d6c5 <process blocks...> if terminate process, go away hour , repeat command, again 16 or bytes of random data produced. however - if instead leave command running same amount of time, much, more random data collected. assume on course of given timeperiod, system produces plenty of entropy, linux utilises if reading /dev/random, , discards if not. if case, question is: is possible configure linux buffer /dev/random reading yields larger bursts of high-quality random data? it wouldn't difficult me buffer /dev/random part of progr...

jquery - How to make use of an ASP.Net MVC controller action using Ajax to return the difference between two dates in a form? -

i'm using mvc3 , have view used book leave employees. part of want display number of days taken based on 2 dates enter - i've done in rudimentary way using jquery want make use of controller action i've got return single value based on 2 dates (it takes account weekends , bank holidays). the question is, best way pass values of datefrom , dateto (the 2 inputs) controller , retrieve result using ajax? want value update whenever either of dates changed , without submitting whole form. i'm not sure of best practice sort of thing appreciated. the question is, best way pass values of datefrom , dateto (the 2 inputs) controller , retrieve result using ajax? you subscribe change event of textboxes , send ajax request: $(function() { $('#datefrom, #dateto').change(function() { // whenever user changes value send ajax request: $.ajax({ url: '@url.action("someaction", "somecontroller")', ...

c# - UrlRewriter.net exclusive regex rules -

i trying add rewrite rules using urlrewriter.net asp.net web app. problem regex newbie, , provided examples pretty elementary. my question is: how differentiate urls contain query parameters? i.e., if add rule: <rewrite url="~/([.+])" to="~/$1.aspx" /> it rewrite www.example.com/products www.example.com/products.aspx , rewrite www.example.com/products?id=1 www.example.com/products?id=1.aspx . problem happens when using login control, since creates url similar www.example.com/login?returnurl=/members , , not sure how rewrite it. what is: to rewrite www.ex.com/test www.ex.com/test.aspx , and to rewrite www.ex.com/test?page=dummy www.ex.com/test.aspx?page=dummy.aspx thanks lot! [edit] , btw still haven't figured how turn on console debugging urlrewriter. have added "register logger" section config file, vs output windows shows nothing. helpful, also. use following regex match: "~/([^\?]+)(.*)?" ...

c# - Why does compiling this code result in a syntax error? -

i wrote following code getting error mentioned can 1 tell protected void btngenerate_click(object sender, eventargs e) { datarow[] drow; datatable dt = new datatable(); foreach (gridviewrow grrow in grdach.rows) { checkbox chkitem = (checkbox)grrow.findcontrol("checkrec"); if (chkitem.checked) { chkitm = true; chkcnt++; strbanktypeid = ((label)grrow.findcontrol("lblbanktype")).text.tostring(); strbnkarray.append(strbanktypeid); strbnkarray.append(","); } } oempdeposits.getempdepositdetails(out local_ds, strfedtaxid, payperiodnumber, payrollyear, strpayfreqtype); (int = 0; < local_ds.tables[0].rows.count; i++) { string strtrim = strbnkarray.tostring().trimend(','); strtrim = "bankaccounttypeid='" + strtrim[i] + "'"; if (strtrim.contains("bankaccounttypeid=',...

rendering application class in Blackberry -

what purpose of rendering application class in blackberry? first, interface(@see http://www.blackberry.com/developers/docs/5.0.0api/net/rim/device/api/browser/field/renderingapplication.html ), can allow implement html rendering in variety of applications (@see http://www.blackberry.com/developers/docs/5.0.0api/net/rim/device/api/browser/field/browsercontent.html ) have used render rss html content display in typical field among other things. allows implement callback functionality gather resources html (images, etc) , render them appropriately (if desire). of course 5.0 , under version, have not been privileged have 6.0 user base cannot comment past 5.0 :) edit: oh yeah, allows handle http events (redirects, etc)

php - jQuery .keyup() function -

i'm not receiving output code. error. terminal.html <html> <head> <link href="/css/webterminal.css" rel="stylesheet" type="text/css" /> <script type="text/javascript" src="jquery-1.5.2.js"/> <script type="text/javascript"> function shell_execute(str) { $.ajax({ url: 'exec.php', datatype: 'text', data: { q: str }, success: function (response) { $('#txtout').append(response); }); } </script> </head <body"> <div class="container"> <h2>unix web based terminal 1.0</h2> <br /> <p><b>output</b></p> <form> <span id="user"></span>< <input type="text" id="txtcmd" onkeyup="shell_execute(this.value)" class="textbox" size="20" /> </form> <div...

python - how can I convert a char to variable? -

in detail: need formula work. string = str(z)+":1.0 "+str(z+1)+":0.0" z variable value. will able input formula dictionary value specific key. like dicto={'a': 'str(z)+":1.0 "+str(z+1)+":0.0"'} so when see key value 'a' should able use formula in dictionary as read question, wanted this: dicto = {'a': lambda x: "{0!s}:1.0 {1!s}:0.0".format(x, x + 1)} dicto['a'](2) # '2:1.0 3:0.0'

c# - WPF Child Window - Windows 7 Taskbar -

we have main application loads several plugins have own individual icons , child windows. problem in windows 7, icon in taskbar icon of main application, on child windows. however, alt+tab menu displays appropriate icon. i understand due pinning feature, , windows 7 uses icon of main exe handle this. is there way can change taskbar icon on our child windows? , possibly disabled pinning well? confusing able pin these child windows, wouldn't work properly. you can't pin child window - pinning works @ level of application. if pin/unpin child window, you're (un)pinning app whole. there's no way disable behaviour, since it's os-level functionality applies window in taskbar (though choose not display windows in taskbar). i'm not sure window icons, i'd imagine you're right when it's using application icon.

php - How to make a jquery tab contain an html form that redirects inside the tab? -

currently have section of page jquery tabs. tabs reference html pages, , each contain form enter details. on clicking submit button, ideally, details should submitted mysql database, , should redirected javascript form. i'm not bothered happens after that, there should happen inside tab. i've managed mysql submit working, , i've verified inserts data database. however, loads php submit form whole new page, rather staying in tabs. doesn't redirect, although may have mistyped something. i've got links work in tabs, in that, placed link in there , got load inside tab when clicked on it. can't seem work out part though :s for form submit, i'm using php page, contains php writing database, followed javascript redirect in tags. can help? thanks! awesome guys, loads! it's working. :) if anyone's interested, tutorial pretty helpful. http://www.ryancoughlin.com/2008/11/04/use-jquery-to-submit-form i think you're using regular sub...

asp.net - Custom error setting being ignored for locations denied in the web.config -

in asp.net 4 , mvc2 application have odd configuration error. the web.config looks this: <configuration> <location path="blockedpath"> <system.web> <authorization> <deny users="*" /> </authorization> </system.web> </location> <system.web> <customerrors mode="on" defaultredirect="~/error.aspx" /> </system.web> </configuration> visiting blocked location correctly denied, gives verbose error message iis don't want. why doesn't serve configured custom error? can control page serve when page access denied config? according this blog post, iis7 trying helpful , likes steal custom errors pages , replace them own. open error pages feature in iis , click edit feature settings on right hand menu. set detailed errors option have iis pass through whatever errors serve asp....

sorting - C++ how to sort vector<class *> with operator < -

i have class c1{ public: int number; c1() { number=rand()%10; } bool operator < (c1 *w) { return number < w->number; } }; vector<c1*> vec = { ... } sort(vec.begin(),vec.end()) why dosent sort ? but if had bool operator < (c1 w) { return number < w.number; } and vector<c1> vec = { ... } it have been sorted ! the straightforward approach define function bool c1_ptr_less( c1 const *lhs, c1 const *rhs ) { return lhs->something < rhs->something; } std::sort( vec.begin(), vec.end(), & c1_ptr_less ); what suggest generic functor take care of all pointer arrays struct pointer_less { template< typename t > bool operator()( t const *lhs, t const *rhs ) const { return * lhs < * rhs; } }; std::sort( vec.begin(), vec.end(), pointer_less() ); armed this, define usual c1::operator< ( const c1 & ) , likewise other classe...

c# - how to make a multiline textbox not accept Enter and Backspace -

i have multiline textbox shouldn't accept alphabets, numbers, newline(enter key) , backspace. in short, textbox.text shouldn't editable. want textbox accept 2 shortcut keys - control , control+r. 1 way can make textbox un-editable making read-only. textbox wont accept keystroke @ all. in short, shortcuts ( control , control+r) wont work( control + r) read-only method. can in regard. that's have do. one thing here not make textbox read-only , restrict characters(alphabets , digits) inputted in textbox. code: private void txtresult_keypress(object sender, keypresseventargs e) { // modifier keys, escape, enter, backspace etc accepted e.handled = !char.iscontrol(e.keychar); } private void txtresult_keydown(object sender, keyeventargs e) { if (e.control == true) { if (e.keycode == keys.r) { // } else { //do } ...

How can I disable the shadow dropping behind a sub-menu in GWT MenuBar? -

i created menubar collapsing sub-menus using googles gwt in example: gwt showcase menubar hovering on menuitem opens sub-menu if defined. sub-menu drops non-css3 shadow, doesn't fit ui design, because i'm using differently styled css3 box-shadow. at first sight 1 doesn't seem able disable shadow in property... have idea how to? the menubar popup 9-box - table 9 cells. boxes in table have style names matching pattern .menupopup[position] , .menupopup[position]inner , position is, example, topleft , bottomright , left , etc. if copied styles showcase should sufficient remove references cells not .menupopupmiddlecenter or .menupopupmiddlecenterinner remove drop shadow see.