Posts

Showing posts from July, 2010

admob - can I choose the ads I want to appear in my android app? -

if use admob in android app. can choose ads appear in app? i dont want topics or products advertised in app, such (alcohol, adult content, ads countries ... etc ) there filter settings on admob's developer console. check them out @ admob's developer console.

Is Continue in Delphi 6? -

i'm getting error when i'm trying replace goto in while loop continue, whenever error reading "statement expected, expression of type 'boolean' found". continue keyword not in delphi 6? error message mean else? thanks. it in delphi 5, assume in delphi 6. there must else going on in code, without posting it, it's impossible tell.

Retrieving an xml string more than 65536 Characters in length via mssql_execute in PHP from a remote server -

i'm working on linux server (opensuse // apache 2 // php5) connects mssql db on windows server , executes stored procedure retrieve xml string passed linux server part of array. it works part, i'm seeing issues 1 or 2 rows xml more 65536 characters in length - seem being curtailed - issue can fixed in php.ini or problem set of mssql server? i may not have given enough information please ask away , i'll provide as can. thanks rather storing values text, store them in blob (or other binary format), , compress them first (http://us3.php.net/manual/en/function.gzcompress.php) the blob doesn't have max length, wont run issues, , you'll save on , forth compressing data.

java - Need Help Programming Battleship Location Selector/Checker -

i trying develop 1-sided battleship game , have set up. need incorporate array holds @ time, 5, ships objects. class created each ship called ships.java. earlier having problems initializing array has been settled. the problem arises when try pull in length of ship (2, 3, 4 or 5) index in array. i'm not sure how conceptually go placing ships. i feel i've tried every combination of do-whiles, loops , if statements. tried switch-case. the goal have computer select positions 5 ships , set each cell in grid (rowsxcols) equal nc_ship (not clicked, plus ship). problem making check positions of cells adjacent random location on grid. has check if ship in question fit (pulling ships[i].getshiplength()). here code have far: int shipsplaced = 0; (int = 0; < ships.length; i++) { boolean shipplaced = false; { int randomrow = (int)(math.random()*rows); int randomcol = (int)(math.random()*cols); i...

objective c - Obj C - UITextViewDelegate incompatible type warning -

warning on line journalcomment.delegate = self: assigning 'id' incompatible type 'journalentryviewcontroller*' journalcomment textview. i'm not sure warning about, should - warning: "newb @ keyboard, go take obj c classes." thank help. - (id)initwithnibname:(nsstring *)nibnameornil bundle:(nsbundle *)nibbundleornil { self = [super initwithnibname:nibnameornil bundle:nibbundleornil]; if (self) { // custom initialization // hide keyboard when done key pressed // define area , location uitextview cgrect tfframe = cgrectmake(0, 0, 320, 460); journalcomment = [[uitextview alloc] initwithframe:tfframe]; // make sure editable journalcomment.editable = yes; // add controller delegate journalcomment.delegate = self; } return self; } your class must conform uitextviewdelegate protocol, in .h file make like @interface journalentryviewcontroller : nsview...

sendmail - Receiving PDF File in Outlook -

in current project, have create pdf file on fly , attach mail attachment , send. works fine, file generate , send email provided. when send microsoft outlook or windows live account, pdf has attached can't open file pdf, gives , error saying, damaged. gmail , yahoo works fine. have solution this. below code $dompdf = new dompdf(); $dompdf->load_html($message); $dompdf->set_paper("a4", "landscape"); $dompdf->render(); // next call store entire pdf string in $pdf $pdf = $dompdf->output(); // can write $pdf disk, store in database or stream client. file_put_contents("pdfs/invoice.pdf", $pdf); $fileatt = "pdfs/invoice.pdf"; // path file $fileatt_type = "pdf"; // file type $fileatt_name = "invoice.pdf"; // filename used file attachment $fp = fopen($fileatt, "rb"); $file = fread($fp, filesize($fileatt)); $file = chunk_split(base64_encode($file...

windows phone 7 - WP7 - POST form with an image -

i need send image windows phone 7 e-mail addresses. use class submit text values php script, wich parses data , sends formatted e-mail addresses. problem can't figure out how send image script, attach image e-mail. php script can changed in way. if have image object, how can change class allow sending images? public class postsubmitter { public string url { get; set; } public dictionary<string, string> parameters { get; set; } public postsubmitter() { } public void submit() { // prepare web request... httpwebrequest myrequest = (httpwebrequest)webrequest.create(url); myrequest.method = "post"; myrequest.contenttype = "application/x-www-form-urlencoded"; myrequest.begingetrequeststream(new asynccallback(getrequeststreamcallback), myrequest); } private void getrequeststreamcallback(iasyncresult asynchronousresult) { httpwebrequest request = (httpwebrequest)asynchronousr...

python - Window close does not close program, even with a function calling sys.exit() bound to the window's close_event. What might cause this? -

the program below sets graph , displays blue box each time user clicks. user can make more boxes using right-click popup menu. when implemented popup menu (thus allowing multiple blue boxes) program stopped closing on window close. connected deleteall() method canvas force sys.exit() on close, program still stays open. doing wrong? #**************************************************************************# # set graph. click creates blue box. more blue boxes can made # choosing "make new box" right/click menu. #**************************************************************************# import wx import matplotlib matplotlib.use('wx') import matplotlib.pyplot plt import matplotlib.patches patches matplotlib.figure import figure matplotlib.backends.backend_wxagg import figurecanvaswxagg figcanv pylab import * #**************************************************************************# class maincanvas(wx.frame): """ class set graph ...

MS Access trigger? -

Image
i have 2 tables named [insert_record] , [delete_record] in ms access. both tables have same fields 1 table has records whereas table has no record. question: want, whenever delete record table [insert_record] entire record should automatically insert table, i.e: [delete record]. how can accomplish this? access 2010 introduced event-driven data macros similar triggers. process described in question can done after delete data macro on [insert_record] table:

winforms - How to get value from combobox in c#? -

i can't value combobox in winforms using c#. i have combobox populated list of values , have set valuemember , displaymember . now, have find value of selected combobox item , select matched item in ui. here mean:- i loaded combobox :- var list = (from l in db.loc orderby l.lname ascending select l).tolist(); list.insert(0, new loc { id = "-1", name = "--select--" }); cmb1.bindingcontext = new bindingcontext(); cmb1.datasource = list; cmb1.displaymember = "name"; cmb1.valuemember = "id"; now on event, trying match value ( id ) , select item. it's easy if match text property: cmb1.text = data.name; but how match value? something this:- cmb1.value = data.id; this should work: cmb1.selectedvalue = data.id;

bluetooth - How to create programmatically an A2DP connection or how can I emulate an Android phone to be an A2DP sink? -

i have 2 android phones (samsung galaxy tab , htc desire). both 2.2. galaxy tab should a2dp sink , desire source. aim route sound of desire galaxy. saw in api possible establish rfcomm connection. want establish a2dp connection. requirements solution none of phones should rooted. i found in source code bluetooth uuid class. , tried open a2dp connection uuids. this code of server side: private class acceptthread extends thread { public acceptthread() { try { bluetoothserversocket mmserversocket = btadapter.listenusingrfcommwithservicerecord("audio sink", uuid.fromstring("0000110b-0000-1000-8000-00805f9b34fb")); // uuid of audio sink mmserversocket = btadapter.listenusingrfcommwithservicerecord( "avcrp controller", uuid.fromstring("0000110e-0000-1000-8000-00805f9b34fb")); // uuid of avcrp controller } catch (ioexception e) { } } public void run() { // keep listening until exception ...

android - LocationManager in Service - need to stop if no fix in 1 minute -

i have regular service start using alarms every 5 minutes. service implements locationlistener gps fix , save sqlite database. i give service 1 minute best fix possible. if accuracy <20 before - better. all works fine. have code checks if gps disabled exit service. what want is: if there no fix within 1 minute - want exit service. since logic (time checks, etc) in onlocationchanged - never have chance because never location. is there timer or can use? i'm new java, example nice. see this: on start create timer callback , in callback function cleanup , shutdown. i'm not sure if there going implications possible onlocationchanged running? can possibly disable timer onlocationchanged? use android.os.handler : handler timeouthandler = new handler(); timeouthandler.postdelayed(new runnable() { public void run() { stopself(); } }, 60 * 1000);

asp.net - ItemUpdating NewValues Missing Parameter -

i have formview several data items works except single parameter not update rest of them. formview's datasource updateparameter set nothing can handle update in codebehind. every item works fine, except 1 parameter ("salesprice") missing in oldvalues , newvalues argument of itemupdating event of formview. data pull in textbox should, formatted , all. i've attached html, sql (for getloandata()), , codebehind. why every parameter exist in new/oldvalue arguments except "salesprice" parameter? i've tried populating textbox without formatstring, , it's still missing. there money sql datatype might cause problem? html: <asp:formview id="fvloandetails" runat="server" datakeynames="orderid" datasourceid="sqlloandetails" width="100%"> <itemtemplate> ... </itemtemplate> <edititemtemplate> <table class="ordersectionheader"> <tr> ...

android - Custom Adapter for a Gallery -

i've come across problem while writing custom adapter items on gallery. followed steps on android developer site, instead of returning imageview i'm returning textview. however, when try run application classcastexception when trying add child items gallery. however if use basic string adapter gallery works, , if use imageview works too. don't problem since method @override public view getview(int position, view convertview, viewgroup parent) return view base class both imageview , textview. don't possible wrong. know cause of problem? thanks lot this code of adapter, public class historyindexadapter extends baseadapter { private context context; private arraylist<history> historyindex; private typeface typeface; public historyindexadapter(context context, arraylist<history> historyitems) { this.context = context; this.historyindex = historyitems; this.typeface = typeface.createfromasset(context.getassets(), context.getstri...

vb.net - Cross-thread operation not valid -

i doing following try out threadings 'cross-threading' error in line txtbox.text = datagridview2.rows.item(iloop).cells(3).value , can point out what's wrong, thanks: dim lm new thread(addressof load_movie) dim lt new thread(addressof load_timings) lm.start() lt.start() private sub load_movie() iloop integer = 0 datagridview1.rows.count - 2 dim cstring string = "txt_movie_0" & iloop.tostring each cctrl control in panel1.controls if typeof cctrl textbox dim txtbox textbox txtbox = cctrl if txtbox.name = cstring txtbox.text = datagridview1.rows.item(iloop).cells(1).value end if end if next next end sub private sub load_timings() iloop integer = 0 datagridview2.rows.count - 2 each cctrl control in panel2.controls ...

Write file with specific permissions in Python -

i'm trying create file user-readable , -writable ( 0600 ). is way using os.open() follows? import os fd = os.open('/path/to/file', os.o_wronly, 0o600) myfileobject = os.fdopen(fd) myfileobject.write(...) myfileobject.close() ideally, i'd able use with keyword can close object automatically. there better way i'm doing above? what's problem? file.close() close file though open os.open() . with os.fdopen(os.open('/path/to/file', os.o_wronly | os.o_creat, 0o600), 'w') handle: handle.write(...)

PHP array change array structure -

i have array in following form, array ( [foo] => array ( [3] => hello [1] => world ) [bar] => array ( [3] => other stuff [1] => more stuff ) [baz] => array ( [3] => value ) ) how have on following form: array ( [3] => array ( [foo] => hello [bar] => other stuff [baz] => value ) [1] => array ( [foo] => world [bar] => more stuff ) ) thanks $array; //<--- assuming array starting $new_array = array(); //<--- new array you're building foreach($array $i=>$element) { foreach($element $j=>$sub_element) { $new_array[$j][$i] = $sub_element; //we inverting indexes } }

.net - Does Delphi Prism have Sleep() function? -

i coding in delphi prism , need pause loop sleep timer, sleep(x) doesn't exist in delphi prism. function or procedure there in delphi prism replace sleep(x) procedure? thanks. delphi prism using .net framework, should able use thread.sleep instead of sleep(x);

.net - Should I apply service attributes to the interface, to the concrete class, or to both? -

i implementing .net wcf service , want apply namespace future versioning. coworker mentioned ought apply several attributes both interface , concrete implementation class interface, not clear me 1) if correct, , 2) assuming correct, why important apply attributes in both places. [servicecontract] [servicebehavior(namespace = constants.namespace1_0)] [webservice(namespace = constants.namespace1_0, name = "myservice1_0")] [webservicebindingattribute(conformsto = system.web.services.wsiprofiles.basicprofile1_1, emitconformanceclaims = true)] public interface imyservice { [operationcontract] [operationcontract(name = "mymethod", action = constants.namespace1_0 + "/imyservice/mymethod")] string mymethod(string phrase); } public class myserviceconcrete : imyservice { public string mymethod(string phrase); } in example, should apply attributes applied interface concrete class (and methods) implements myservice interface? should apply...

Wix: create a sql server database at a specified location -

i have installer created using wix. i'd able specify location sql server installed. 1 solution can think of put placeholder in createdatabase script , in run time replace placeholder actual path user specified. i wondering if there better way this? wix provide can use of? thanks, you can take advantage of standard wix sql extension . instance, sqlstring element provides option specify sql query execute @ install time. sqldatabase element gives out-of-the-box option create sql database. both accept windows installer properties @sql , @server attributes respectively. means can user input, save property , use property in sql elements.

android - Renaming directory gives positive result code, but didn't rename -

i know it's cosmetic below code should rename directory doesn't. difference capitalisation - afaik android case sensitive when comes filenames. linux too. rename gives true result, indicating operation successful. directory in question not renamed, , still has 2 capital d's. have used same code rename /deaddropdroid /.deaddropdroid , works fine. every time run below code log says "success". oldbasepath = new file (environment.getexternalstoragedirectory()+ "/.deaddropdroid/"); if (oldbasepath.exists()) { if (oldbasepath.renameto(new file(environment.getexternalstoragedirectory()+ "/.deaddropdroid/"))) log.v(tag, "rename success."); else log.v(tag, "rename fail."); } have @ this answer similar question. key content is by default, sd card formatted fat, preserves case case insensitive. i did checks , can confirm mentioned file methods work 'case insensitive' on sd card. ...

java - How to efficiently convert character encoding in Channel? -

i need accept streams different encodings , transcode them single predefined encoding (e.g. utf-8). know how ( inputstream ) reader / ( outputstream ) writer combo , array buffer, time i'm dealing bytechannel 's. naturally, looking charsetdecoder / charsetencoding solution, best came is: public static void copy(readablebytechannel rbc, charset in, writablebytechannel wbc, charset out) throws ioexception { bytebuffer b1 = bytebuffer.allocatedirect(buffer_size); charbuffer cb = charbuffer.allocate(buffer_size); bytebuffer b2 = bytebuffer.allocatedirect(buffer_size); charsetdecoder decoder = in.newdecoder(); decoder.onmalformedinput(codingerroraction.replace); charsetencoder encoder = out.newencoder(); encoder.onunmappablecharacter(codingerroraction.replace); while( rbc.read(b1)!=-1 ){ b1.flip(); decoder.decode(b1, cb, false); cb.flip(); encoder.encode(cb, b2, false); b2.flip(); wb...

Customized navigation menu in Android -

Image
i'd create navigation menu in android app: bar @ bottom of screen, 4 choices home|categories|search|favorites, , current page highlighted. seems options menu can hardly customized, can't use it. do have add navigation bar in every layout or there better solutions? thanks julien it sounds you're replicating iphone interface. android phones have buttons along bottom of screen (home, back, etc) it's bad idea put navigation there it's easy hit wrong one. the google-recommended approach use action bar pattern, across top of screen, clear, , means app consistent others (look @ twitter, google maps, facebook - use action bar pattern). from honeycomb (v3.0) onwards: http://developer.android.com/reference/android/app/actionbar.html a simple library create action bar on version of android https://github.com/johannilsson/android-actionbar to create action bar uses library on versions earlier 3.0, uses official implemention v3.0+, try this: https://gi...

cygwin - gcc/ld: undefined reference to unused function -

i'm using gcc 4.3.4 , ld 2.20.51 in cygwin under windows 7. here's simplified version of problem: foo.o contains function foo_bar() calls bar() in bar.o bar.o contains function bar() main.c calls functions in foo.o , foo_bar() not in call chain if try compile main.c , link foo.o, undefined reference _foo_bar error ld. can see makefile except below, i've tried using flags putting each function in own section , having linker discard unused sections. compile_cygwin = gcc -iquote$(incdir) compile = $(compile_cygwin) -g -mmd -mp -wall -ffunction-sections -wl,-gc-sections $(define) main_objects = main.o foo.o main.exe : $(main_objects) $(compile) -o main.exe $(main_objects) the function foo_bar() short function provides connection between 2 networking layers in protocol stack. programs don't need it, won't link in other object files related upper layer of stack. it's small function, , seems inappropriate put own .o file. i don't u...

xcode4 - Should the Xcode 4 workspace file be version controlled? -

i using workspace new xcode 4 project. should *.xcworkspace file included in main repository (along source files of project example)? thanks ross btw. using git probably yes. workspace set of projects, if other developers want work same set, should put workspace version control. if workspace strictly own use, or if there 1 project in workspace, maybe don't need put version control. means you'd need recreate whenever move new machine or decide blow away , start scratch. xcode 4 pretty putting user-specific data folders/files names contain word "user" or user name, , putting build products , temporary files somewhere outside of source tree, in general, i'd put isn't user-specific repository.

Frequency of HTML5 updates -

html5 published couple of interesting features. however, have concerns regarding frequency of html updates in general. last version of html 4 has been published more decade ago , in it, 10 years eternity. what kind of update frequency should expect after release of first html5 version? on regular basis (yearly?) or can worst people involved in process? (please, try provide link official answer w3c or article because don’t want start opinion debate here) the html spec updated continuously, a living document : we moved new development model, technology not versioned , instead have living document defines technology evolves there's further discussion of means in questions 2.5 2.21 of faq .

iPhone - Another Objective-C Memory leak with SBJsonParser -

Image
i'm new iphone development , stack overflow questions. i've been doing first app since january. my app has memory leak related sbjsonparser. after googling found post here on stackoverflow. function konrad77 posted on answer , changed lines of app. i'm still getting memory leaks. appreciate help. i'm using asihttprequest 1.8 , jsonframework 3.0beta1. instruments tell me leak on following line of mylists.m 99.2%: resultobject = [self.model jsonobjectforrequest:request]; the other 0.8% goes following line of mylists.m: [self.model.mylists addobject:userdata]; both of previous lines inside listagetrequestonresult function. here have related code: -mylists.h: #import <uikit/uikit.h> #import "model.h" #import "asiformdatarequest.h" @interface mylists : uitableviewcontroller { model *model; nsobject *resultobject; } @property (assign) model *model; @property (nonatomic,assign) nsobjec...

iphone - iOS - Know when modal view has been dismissed -

i have uiviewcontroller present modalviewcontroller in. after modal view shown, user can dismiss it. is there way know when modal view has been dismissed can fire method original controller? sounds job for: viewdiddisappear: http://developer.apple.com/library/ios/#documentation/uikit/reference/uiviewcontroller_class/reference/reference.html

which algorithm does mysql use to search an row in the table? -

like give query: select name employee id=23102 , sir_name="raj"; want know using algorithm search happen? assuming have indexed id field , unique. algorithm binary search (there optimizations , improvements, below general theory behind it). lets have following ordered list of numbers: 1,45,87,111,405,568,620,945,1100,5000,5102,5238,5349,5520 say want search number 5000, there 2 ways. scan entire list, in case have check 10 numbers (count start until reach 5000). binary -> here steps: 2a. go middle number (620), since 5000 bigger that-> 2b. same on numbers 945-5520, median 5102 since 5000 smaller that-> 2c. go median of part 945-5102, 1100 since lower 5000 go part between 1100-5102 2d. found it! that 4 operation against 10, so, binary search complexity grow @ same rate full scan when in binary search data grows exponentially

java - Creating an algorithm that can sort string/integer arrays -

i trying figure out how make sorting function sort array in descending order. public void dsort(string field) throws datasetexception { int front = 0; int findex = -1; string[] tosort = new string[50]; (int = 0; < filedata[0].length; i++) { if (field.equalsignorecase(filedata[0][i])) { findex = i; } } if (findex == -1) { throw new datasetexception(); } else { (int k = 0; k < getnumrecords(); k++) { if (filedata[k][findex] != null) { tosort[front] = filedata[k][findex]; front++; } } comparator comparator = collections.reverseorder(); arrays.sort(tosort, comparator); system.out.println(arrays.aslist(tosort)); } } what creates new array taking elements array of arrays, want do. however, output of sort 32, 3, 25, 20, 2, 1000, 1 etc.. these "integers" considered strings, , sorting function supposed able s...

osx - ERROR: Error installing ffi: ERROR: Failed to build gem native extension -

i getting error in mac 64 bit , have xcode inatalled on machine. building native extensions. take while... error: error installing ffi: error: failed build gem native extension. /users/jreddy/.rvm/rubies/ruby-1.8.7-p302/bin/ruby extconf.rb checking ffi.h in /usr/local/include... no checking rb_thread_blocking_region()... no checking ruby_thread_has_gvl_p()... no checking ruby_native_thread_p()... no checking rb_thread_call_with_gvl()... no creating extconf.h creating makefile make sh: make: command not found i use homebrew, after did brew install libffi gem installed me. have xcode 4.2 tools active (with xcode-select). did have close , open new terminal window home-brew's install recognised gem installation. working ruby 1.8.7 not 1.9.3 (using rvm).

sql server - Alternative to VS for editing RS reports? -

vs works guess, it's pretty clunky in lot of ways, , wondering if there third-party alternative that's better. how first version of report builder? designed stripped down tool easy use without "bloat" of visual studio

iphone - Encoding/Decoding using NSData+Base64.h -

i have encrypted data i'm converting base64. having difficulty converting string nsdata can use decryption. nsdata *encrypteddata = [self encrypt:_secretdata key:[self md5data:_key] padding:&padding]; //i've tried different data nsstring *cyphertext = [encrypteddata base64encodingwithlinelength:0]; //this works fine [cyphertext datausingencoding:nsutf8stringencoding]; //this returns many bytes ... it's longer original data i'm using standard "nsdata+base64.h" dave winer - found on github. any tips on how convert string same nsdata object? using counterparts maybe? + (nsdata *) datawithbase64encodedstring:(nsstring *) string note converting base64 must brings multiple of 4...

iphone - How to erase rectangles drawn in uitableviewcell? -

i subclassed uitableviewcell based on blog http://www.iphonedevx.com/?p=153 . can draw columns , place text in grid. when reload table, text , grid remains there. removed labels using [[cell viewwithtag:k] removefromsuperview]; how removethe grid lines drawn using drawrect: assuming drawrect: method no longer drawing grid lines, should try calling setneedsdisplay or layoutsubviews on table view forces of cells redraw. reloading table using reloaddata reloads datasource, , don't believe redraws unless there changes model.

javascript - JQuery Mobile Detected if there's internet Connection -

what best way detect if there's internet connection or not on mobile via web app? there's no code necessary -- it's part of html5 api. check value of window.navigator.online -- false if user offline. http://www.whatwg.org/specs/web-apps/current-work/multipage/offline.html#browser-state

android - Changing the ListView shadow color and size -

when list of items in listview longer size of listview, you'll see shadow indicating there more items above or below. default, shadow black. not desirable. if set cachecolorhint following: android:cachecolorhint="#00000000" the shadow transparent, showing drawable have set layout's background. not desirable either. i wish change color of shadow lighter shade of black, or perhaps gray. there way specify this? also, there way change shadow's size? by android:cachecolorhint="#00000000" setting color transparent. don't know color want use exactly, try android:cachecolorhint="#ff777777" . think must work.

bash - syntax of for loop in linux shell scripting -

i have problem implementing loop. error when execute script test1.sh: 2: syntax error: bad loop variable i don't understand error. this script #!/bin/bash (( c=1; c<=5; c++ )) echo "welcome $c times..." done can 1 tell me syntax for loop in sh(in ubuntu links dash shell) shell in ubuntu? you run sh , not bash . try bash test1.sh , or ./test1.sh if it's executable, not sh test1.sh .

Jquery animate width from left to right -

i trying animate menu elements shrinking width 170 150px on mouseover. problem is, default .animate shrinking happens on right side of rectangle, need shrink on left side. have tried animating left margin, since have text inside element, shifts on right during animation. this actual code i'm using $(document).ready(function(){ //when mouse rolls on $("#navigation li").mouseover(function(){ $(this).stop().animate({marginleft:'20'},{queue:false, duration:600, easing: 'easeoutbounce'}) }); //when mouse removed $("#navigation li").mouseout(function(){ $(this).stop().animate({marginleft:'0'},{queue:false, duration:600, easing: 'easeoutbounce'}) }); }); i had found other answers this, didn't understand proposed solution. this default behavior. way change via css #navigation li { float: right; //sometimes using float funks things so... } or changing css of parent , child li (bett...

Change the content of PHP classes and methods at runtime, with Reflection? -

this fun only, don't scream please. i rewrite content of class's methods @ runtime (i mean, without modifying file, replacing/editing code in memory ), possible? using reflection, or else? don't close question please, i'm looking answer runkit. why not create new class inherits 1 want modify , overwrite it's methods? <?php class mysimplexml extends simplexmlelement { public function themethodiwanttooverwrite() { //... } } ?> as long method isn't marked final...

dll - 32-bit Keyboard Hook unexpectedly works in 64-bit apps, but is hanging Outlook -

have been reading lot 1 , picture gets muddier. have 32-bit app installs keyboardhook wait global hotkey , wake up. running on win 7 x64 edition notice hangs outlook x64 edition when hotkey pressed. so did research , looks 32-bit keyboard hooks aren't supposed work in 64 bit apps. time more testing... they hotkey works fine in 64-bit notepad, wordpad, , sticky notes. verified these 64-bit apps since don't have "*32" next them in task manager. doesn't hang app , it's supposed to. wait... 32-bit hook dll can't loaded 64-bit app, right? a @ process explorer shows hook dll isn't loaded notepad process! (if run 32-bit notepad.exe wow64 directory, can see dll loaded process, know i'm using tools right). so outlook hanging issue might or might not related, why hook working @ in 64-bit notepad? i have 32-bit app installs keyboardhook wait global hotkey , wake up. if that's ultimate goal, it's simpler , less of impact on s...

javascript - place value into input box from query string not working -

how can take value of query string , place input box? have: <input type="text" name="spouse" id="spouse" value="<script type="text/javascript"> document.write("name: " + request.querystring("spouse")); </script>"/> but takes script take , of contents , places input box. i able take query string coming code: <tr > <td><input type="text" name="n1" value="duck, donald" /></td> <td><input type="text" name="n2" value="daisy" /></td> <td><input type="button" value="show" title="show" onclick="location.href='example123.html?name=' + escape(this.form.n1.value)+ '&spouse=' + escape(this.form.n2.value);" /> </td> and have value name or spouse appear inside of input box. proper way plac...

C# WPF Binding a text file to datagrid -

how can bind text file datagrid c# wpf? idea have row in text file show row in datagrid. i don't think can bind text directly datagrid what can bind objet datagrid create objet representing text file. -- content -- text1, param1, param2 text2, param1, param2 class oneline{ string text {get;set;} string param { get;set; } ... } you can bind objects datagrid bindinglist, list. magic lies in properties of object. bindinglist try each property of object , display them in grid. bindinglist<oneline> mylist = new bindinglist<oneline>(); mylist.add(oneobject); datagrid mygrid = new datagrid(); mygrid.datasource = mylist;

java - Enabling/Disabling drawing of a JFreeChart -

i have chart created shown below, , adding values timeseries (in different location in program). chartpanel contained within jtabbedpane, , not redraw chart unless it's tab being displayed. there way me signal rendering should not occur when new data comes timeseries unless tab 1 being shown? i'm guessing there call signals data has been updated , new rendering needed, want intercept call , nothing if tab not being shown, let call through if tab being shown, , call once manually when user switches tab. isn't major issue 1 chartpanel in background, have few on different tabs , it's starting eat cpu nasty update 4-5 charts constantly. saccuracy = new timeseries("a"); timeseriescollection dataset = new timeseriescollection(saccuracy); jfreechart c = chartfactory.createtimeserieschart("accuracy", "", "percent", dataset, false, false, false); chartpanel cp = new chartpanel(c); i've faced ...

Simplest Ajax Photo Gallery -

i don't think "simplest" subjective. looking hostable photo gallery nothing show image , provide "next image" , "previous image" without reloading page. precaching nice too. php, python, ruby, or js. if want simple, maybe this? <html> <body> <div> <img id="image"> </img> </div> <table> <tr> <td onclick="getimage("previous");">previous</td> <td onclick="getimage("next");">next</td> </tr> </table> <script type="text/javascript"> counter = 0; nextimage = new image(); previousimage = new image(); getimage = function(what) { if (what === "previous") {counter--;} else {counter++;} nextimage...

html - Margin bottom not working on %100 div -

i have following html code: <html> <body style="margin:0px; padding:0px;"> <div id="outer" style="height:100%;"> <div id="header" style="height:40px; background:blue;">header</div> <div id="main" style="height:100%; margin-bottom:-40px; background:red; overflow:auto;"> <p style="height:1000px">main</p> </div> </div> </body> </html> i want vertical scroll appear on main div when content within exceeds viewable area, seems margin-bottom on main div not working. can me issue? you seem solving wrong problem, actually. if want rid of scroll bar body itself, set body's style overflow:hidden . <html> <body style="margin:0px; padding:0px;overflow:hidden;"> <div id="outer" style="height:100%;"> <div id="header" style=...

Pixel handling in Android -

i new android. in iphone have standard pixel sized of 320*480 work on screen. specifications android based devices. there many different android devices many different screen sizes. can read official documentation advice on how handle these variations. http://developer.android.com/guide/practices/screens_support.html

android - Force Close trying to launch a market page from and alert box -

can figure out why causes force close?? void failbox(){ // create alert box alertdialog.builder alertbox = new alertdialog.builder(this); // set message display alertbox.setmessage(r.string.fail); alertbox.setpositivebutton("get busybox", new dialoginterface.onclicklistener() { // when button clicked public void onclick(dialoginterface arg0, int arg1) { intent = new intent(intent.action_view); i.setdata(uri.parse("market://details?id=stericson.busybox")); } }); // set negative/no button , create listener alertbox.setnegativebutton("cancel", new dialoginterface.onclicklistener() { // when button clicked public void onclick(dialoginterface arg0, int arg1) { } }); // show alert box alertbox.show(); } thanks in advance! if you're getting forced close i...

What is the most similar web framework to Web2py (Python) but for PHP? -

things love web2py: neatness of template views ease of site setup basic features signup/login, form validation, , ajax. i'm switching on php own reasons i'm trying find similar web framework web2py. similar? there no framework in php similar web2py.

iphone - restoreCompletedTransactions broken? -

is restorecompletedtransactions broken in sdk 4.3 ? i trying restore auto-renewable subscription. not resulting in callback updatedtransactions. here code. { .... [appdelegate.inapp loadstore]; [[skpaymentqueue defaultqueue] restorecompletedtransactions]; .... } expecting callback updatedtransactions, not receive it. - (void)paymentqueue:(skpaymentqueue *)queue updatedtransactions:(nsarray *)transactions { nslog(@"in updatedtransactions, transaction.transactionstate"); (skpaymenttransaction *transaction in transactions) { switch (transaction.transactionstate) { ... ... case skpaymenttransactionstaterestored: nslog(@"in updatedtransactions, skpaymenttransactionstaterestored"); [self restoretransaction:transaction]; break; } } } but receive call @ end. -(void) paymentqueuerestorecompletedtransactionsfinished:(skpaymentqueue *)qu...

char array in C++ -

in c++ can read file contains integers , store in char array[] ? yes, possible store numbers file in char array: #include <fstream> #include <iterator> #include <algorithm> int main(int argc, char* argv[]) { std::ifstream in("input.txt"); char arr[100]; char* end = std::copy(std::istream_iterator<int>(in), std::istream_iterator<int>(), arr); return 0; } there 2 issues here. one, must know @ compile time size of array. two, each of input numbers must fit char . note formatted input, valid range not 0-255 or 0-127. it's valid character, '0', '2', 'a', 'c' , on valid inputs each character. maybe want read file std::vector<std::string> ? #include <fstream> #include <iterator> #include <algorithm> #include <vector> #include <string> int main(int argc, char* argv[]) { std::ifstream in(...

Initialize a session var as array in Rails 3 -

i need initialize session var array. that? when try this: session[:complains_id] << params[:id] i message you have nil object when didn't expect it! might have expected instance of array. error occurred while evaluating nil.<< i know have initialize var dont know where. thanks! just do: (session[:complains_id] ||= []) << params[:id] which saying: if session[:complains_id] returns nil, set []. append params[:id] session[:complains_id] demo: ruby-1.9.2-p136 :007 > (session[:complains_id] ||= []) << 5 => [5] ruby-1.9.2-p136 :008 > (session[:complains_id] ||= []) << 3 => [5, 3] ruby-1.9.2-p136 :009 > (session[:complains_id] ||= []) << 1 => [5, 3, 1]