Posts

java : Advantages of anonymous object -

i have 1 class named sample used in code. class sample{ . . object somemethod(){ return someobject; } . . } i call : object ob = new sample().somemethod(); i want know there advantage if create anonymous object of class( new sample() ) , call require method if don't have further use of object. benefits? i assume asking code posted contrasted following: sample s = new sample(); s.somemethod(); (where explicitly assign new sample() local variable). there's no significant performance or memory benefit 1 way or another. if store reference in local variable , invoke method, suppose there may (extremely) small performance penalty storing reference. however, suspect many compilers notice variable dead once method called , optimize away assignment. jit compiler might finish job. we're talking few cpu cycles @ most.

vba - How to transfer highlighted cells in Excel 2007 from one table to another in the same sheet? -

Image
i create code transfer content of highlighted cells 1 table in same sheet content, use button copy content, create macro transfer content dynamically clicking on button, when user change content of highlighted cells of first table content changes automatically in second table or clicking on button again. i use code highlight cells ' set of highlighted cells indexed row number dim highlightedcells new collection ' scan existing sheet cells coloured 'red' , initialise ' run-time collection of 'highlighted' cells. private sub worksheet_activate() activesheet.unprotect password:="p@ssw0rd" dim existinghighlights range ' reset collection of highlighted cells ready rebuild set highlightedcells = new collection ' find first cell has background coloured red application.findformat.interior.colorindex = 3 set existinghighlights = activesheet.cells.find("", _ ...

How to implement Hamburger Icon in Xamarin.Forms MasterDetailPage? -

how implement hamburger icon in xamarin.forms masterdetailpage? there arrow icon. need use masterdetailpage detailpage navigationpage: var masterdetailpage = new masterdetailpage { master = new menupage(), detail = new navigationpage(new yourhomepage()), };

How to read and output Hindi in R console? -

i have been trying read , output hindi .txt file r console gibberish. did far. hindi <- read.table('hindi_text.txt') hindi 1 कà¥à¤¯à¤¾ बोल रहे हो तà¥à¤® then typed this. still not work. > sys.setlocale(category="lc_all", locale="hindi") > [1] "lc_collate=hindi_india.1252;lc_ctype=hindi_india.1252;lc_monetary=hindi_india.1252;lc_numeric=c;lc_time=hindi_india.1252" > hindi > 1 कà¥à¤¯à¤¾ बोल रहे हो तà¥à¤® i tried reading chinese characters changing locale chinese , worked. > chinese <- read.table("chinese.txt") > sys.setlocale(category="lc_all", locale="chinese") > [1] "lc_collate=chinese (simplified)_china.936;lc_ctype=chinese (simplified)_china.936;lc_monetary=chinese (simplified)_china.936;lc_numeric=c;lc_time=chinese (simplified)_china.936" > chinese > 1 锘夸负浠€涔堣繖涓敞鎰忥紝杩欎釜宸ヤ綔 why work chinese , not hindi (and other...

powershell - Test-Connection Performance Better with HostName -

running test-connection ip address takes considerably longer running same command server's hostname. however; if add -quiet parameter performance same (ip fraction faster, may expect). using measure-command anomaly not show up; presumably quirk of output not being displayed. the below code more accurately reflects anomaly seen: $begin=(get-date).ticks;test-connection '123.45.67.89'; $a=((get-date).ticks - $begin) $begin=(get-date).ticks;test-connection 'myhostname'; $b=((get-date).ticks - $begin) $a-$b colleagues have reproduced same issue on machines. question: aware of may cause this? i.e. suspect it's bug (and have reported such), implies there's clever going on powershell may work differently depending on whether output displayed or not / causing quantum-like effect; it's not running commands given in order, doing (de)optimisation under covers. my environment os: ms windows 7 pro sp1 $psversioninfo : name ...

html - Locating tags via styles - using Python 2 and BeautifulSoup 4 -

i trying use beautifulsoup 4 extract text specific tags in html document. have html has bunch of div tags following: <div style="position:absolute; border: textbox 1px solid; writing-mode:lr-tb; left:42px; top:90px; width:195px; height:24px;"> <span style="font-family: fipxqm+arial-boldmt; font-size:12px"> futures daily market report financial gas <br/> 21-jul-2015 <br/> </span> </div> <div style="position:absolute; border: textbox 1px solid; writing-mode:lr-tb; left:54px; top:135px; width:46px; height:10px;"> <span style="font-family: fipxqm+arial-boldmt; font-size:10px"> commodity <br/> </span> </div> i trying text span tags in div tag has style of "left:54px". i can single div if use: soup = beautifulsoup(open(extracted_html_file)) print soup.find_all('div',attrs={"style":"posit...

Create Multi-Parameter Pipeable Function F# -

i want generalize standard deviation function allow calculations of multiples of deviations, still use in context of piping. appears setting function incorrectly. let variance (x:seq<float>) = let mean = x |> seq.average x |> seq.map(fun x -> (x - mean) ** 2.0) |> seq.average let stddeviation (deviations:float, x:seq<float>) = sqrt (x |> variance) * deviations example usage be let stester = seq{1.0 .. 20.0} let stddev = stester |> stddeviation 1.0 i keep getting error: expression expecting have type: seq -> a' here has type float help appreciated. thanks, ~david if change stddeviation takes 2 parameters, rather tuple works: let stddeviation (deviations:float) (x:seq<float>) = sqrt (x |> variance) * deviations let stddev = stester |> stddeviation 1.0 the idea when write let stddeviation (deviations, x:seq<float>) defining function takes single parameter tuple. the way |> operator ...