Posts

ajax - http packets in dynamic web pages -

Image
i want know in web pages yahoo every example 5 min news changes, send http packet server? if want implement feature ajax need send http packet again? can 1 explain dynamic structure(like updating news)for me. you can find out what's going on on page: example use firefox , download firebug addon. open firebug after installation , open network tab. may have enable it. reload page in question, you'll see evere request made. , of course see timed requests done later update page. details pretty thorough. this how firebug network tab looked after posting first paragraph of answer:

c# - When is the variable from the calling scope altered, if using out parameters? -

i cannot try rigth now, sure, knows: void func(out mytype a) { = new mytype(); // other stuff here // take time ... , return } when call in asynchronous manner that: mytype a; func(out a); will altered immediately, once assigned in function? or new object reference assigned when function returns? are there specifications if want relay on implemented behavior? it's assigned once assigned in function. use of out provides reference whatever passed in, means gets modified whenever modified in method. an extract c# language spec: 5.1.6 output parameters a parameter declared out modifier output parameter. an output parameter not create new storage location. instead, output parameter represents same storage location variable given argument in function member or delegate invocation. thus, value of output parameter same underlying variable. the following definite assignment rules apply output parameters. note different rule...

android - Starting new Activity in OnCreate -

i got android app based on 2 activities. main activity input field , button user information. when user press button barcodescanner (zxing) start. every thing works perfect. know try check in oncreate if user information known. if true -> start barcodescanner. looks barcodescanner activity starts twice, because: pressing button once: annother barcodescanner wil active. pressing button twice: main activty active. this check inside oncreate: if(pref.length() == 6){ startactivityforresult(intent, 0); } and function called when clicking button: public void onclick(view view) { switch (view.getid()) { case r.id.button1: final edittext edit = (edittext) findviewbyid(r.id.panelid); if(edit.gettext().tostring().length() == 6){ string temp = edit.gettext().tostring(); log.e("click", temp); editor e = this.getpreferences(context.mode_private).edit(); e...

c++ - Dynamic Programming Problem -

well, don't need code itself, understanding trying in order write code. in nutshell, given 1000 projects each set of resources, , have (set ammount) of resources utilize calculate best projects can pick. the pseudocode bestprofit function follows: bestprofit: parameters - projects: vector of projects r: resources available solve subinstance valuemap: map data structure used memoization n: projects numbered 0,...,n-1 may used solve subinstance returns - maximum amount of profit may obtained on subinstance of optimization problem post-condition – if n > 0, valuemap contains entry key (r, n). if n equals 0 return 0 check valuemap see whether subinstance has been solved - if so, return computed result (function terminates) best1 = bestprofit(projects, r, valuemap, n-1) check whether r provides enough resources undertake project n-1 - if so, best...

c# - ActiveX works on localhost, doesn't work on external server -

edit2: users having same problem, have managed solve using this page . luck! edit: apperently problem need install activex component on client computer. right way this? i wrote small activex component in c# searches removable drives usb flash drives. have followed steps here , in short wrote code , did: regasm aclass.dll /tlb /codebase i wrote activex component because needs executed on external server. made small webpage uses activex. when use localhost code gets executed , usb key gets detected. works inside asp.net page final goal. however, when accessing page external server, code doesn't executed. placed javascript alerts before , after loading activex component. alert after loading activex doesn't fire. the webpage uses code: <html> <head> <script language="javascript"> alert("loading activex"); var x = new activexobject("anamespace.aclass"); alert(x.getdrives()); alert("done")...

Refactor reading elements in an XML file - C# -

can refactor following piece of code reading elements in xml file: if (!(xmldoc.element("element1").element("element2").element("element3").element("element4").element("element5").element("element6") == null)) { } try use xpath expression find element want, code submited can easly throw unexpected nullreferenceexception don't want catch . something this: if (xpath.evaluate("count(/element1/element2/element3/element4)", xmldoc) > 0) { } ps. why negating expression of == null ? better readable , maintainable != null without negation , trailing () in boolean expression.

java - What is the largest possible heap size with a 64-bit JVM? -

the theoretical maximum heap value can set -xmx in 32-bit system of course 2^32 bytes, typically (see: understanding max jvm heap size - 32bit vs 64bit ) 1 cannot use 4gb. for 64-bit jvm running in 64-bit os on 64-bit machine, there limit besides theoretical limit of 2^64 bytes or 16 exabytes? i know various reasons (mostly garbage collection), excessively large heaps might not wise , in light of reading servers terrabytes of ram, i'm wondering possible . if want use 32-bit references, heap limited 32 gb. however, if willing use 64-bit references, size limited os, 32-bit jvm. e.g. on windows 32-bit 1.2 1.5 gb. note: want jvm heap fit main memory, ideally inside 1 numa region. that's 1 tb on bigger machines. if jvm spans numa regions memory access , gc in particular take longer. if jvm heap start swapping might take hours gc, or make machine unusable thrashes swap drive. note: can access large direct memory , memory mapped sizes if use 32-bit referenc...