Posts

seo - How can I keep my doctype with htmlunit + the page.asXml method -

when run page.asxml() htmlunit lose page's doctype. there work around? note: intent serve dom google. try calling p.getwebresponse().getcontentasstring() instead of p.asxml() i tried against http://google.com , , in former case "<!doctype html>" remained in output.

osx - How do I search for all my git repositories on my Mac? -

i'm curious i've scattered git repositories across mac. i'm trying figure out how search find them can organize life bit. how can this? find friend. .git folder exist in each of repositories finding location of them give repos. find /users/username -name ".git" -print

java - How do I pass a primitive data type by reference? -

how can pass primitive type reference in java? instance, how make int passed method modifiable? there isn't way pass primitive directly reference in java. a workaround instead pass reference instance of wrapper class, contains primitive member field. such wrapper class extremely simple write yourself: public class intref { public int value; } but how pre-built wrapper classes, don't have write our own? ok: the apache commons-lang mutable* classes: advantages : performance single threaded use. completeness. disadvantages : introduces third-party library dependency. no built-in concurrency controls. representative classes : mutableboolean , mutablebyte , mutabledouble , mutablefloat , mutableint , mutablelong , mutableobject , mutableshort . the java.util.concurrent.atomic atomic* classes: advantages : part of standard java (1.5+) api. built-in concurrency controls. disadvantages : small performance hit when used in single-threaded setting. ...

c# - Windows Forms TabIndex not following the Indexes -

i have windows forms application , on 1 of forms there tabcontrol , inside 1 of tabs have multiple textboxes each of them having tabindex set values 1->9. when form loaded, 1 of textboxes (with tabindex 5) given focus , textbox tabindex 6 disabled. when user fills out first field , hits tab focus not go next textbox instead goes save button outside tabcontrol , has tabindex of 13. can't figure out why textbox (with index 7 below , left of 1 index 5) doesn't focus. when have form in design mode, in 'view' menu, there option 'tab order' allows set tab order clicking on controls in sequence like. helps in visualising tab order controls in other containers (like controls in panel). this way can not see if controls have right order if thet have right parent (container) too. vijay

iphone - Creating an array from a text file read from a URL -

i reading text file url , want parse contents of file array. below snippet of code using. want able place each line of text next row of array. there way identify carriage return/line feed during or after text has been retrieved? nsurl *url = [nsurl urlwithstring:ktexturl]; textview.text = [nsstring stringwithcontentsofurl:url encoding:nsutf8stringencoding error:nil]; when separating newline characters it's best use following procedure: nscharacterset *newlines = [nscharacterset newlinecharacterset]; nsarray *linecomponents = [textfile componentsseparatedbycharactersinset:newlines]; this ensures lines separated either cr, cr+lf, or nel.

C# Remove URL from String -

this seems easy 1 try doesn't seem work say have following string: string mystring = "http://www.mysite.com/folder/file.jpg"; how can process remove url , leave "file.jpg" string value? thanks! kris you can use system.io.path methods string mystring = "http://www.mysite.com/folder/file.jpg"; string filename = path.getfilename(mystring); // file.jpg if want process more complex uris can pass thought system.uri type , grab absolutepath string mystring = "http://www.mysite.com/folder/file.jpg?test=1"; uri uri = new uri(mystring); string file = path.getfilename(uri.absolutepath);

WCF transactions -

i imagine following wcf service usage: (of cash acceptor) service consumer 1 service consumer 2 cashacceptorservice.begintransaction(); cashacceptorservice.stopdevice(); //this should throw exception: device locked / used in transaction cashacceptorservice.acceptmoney(); cashacceptorservice.endtransaction(); service consumer 1 , 2 use same wcf single instance. wonder if functionality implemented. wcf transactions offer this? how see done? if following true: the service interacting transactional object (eg database) the service has transaction flow enabled then wcf indeed offer this. the client can use transactionscope class. transactions initiated on client flow through service automatically. using(transactionscope transactionscope = new transactionscope()) { // stuff service here cashacceptorservice.acceptmoney(); // ...