Posts

.net - There's no @Html.Button ! -

this weird. see references out there @html.button() when type intellisense doesn't find such helper... there's dropdownlist, hidden, editors, et cetera, no button! what's that? public static class htmlbuttonextension { public static mvchtmlstring button(this htmlhelper helper, string innerhtml, object htmlattributes) { return button(helper, innerhtml, htmlhelper.anonymousobjecttohtmlattributes(htmlattributes) ); } public static mvchtmlstring button(this htmlhelper helper, string innerhtml, idictionary<string, object> htmlattributes) { var builder = new tagbuilder("button"); builder.innerhtml = innerhtml; builder.mergeattributes(htmlattributes); return mvchtmlstring.create(builder.tostring()); } }

jquery - How To Create A News Feed/Stream In Front-End Code -

i trying design primary news feed/stream our platform on "home" page. it, many others, aggregation of content unique user engage site. info pulled database, designing front end right now. i'd prefer html + css right now, , add jquery after make dynamic. know need have number of different div's accomodate different items in each post (entire content, photo, user's update, date, etc...) i'm wondering best way is? know basic structure, want make sure doing properly. can me div structure/corresponding css or has done useful tutorial? some examples of great streams; http://ted.com/conversations http://stackoverflow.com obviously facebook i know can dig in inspect element in chrome , take structure, css patchy , not easy access. thanks much! would jquery plugin looking for, http://www.baijs.nl/tinycarousel/ can customised pull in data database using php.

.net - How to get accurate CPU usage for a process on a multi-processor / multi-core system -

or maybe question more "what doing blatantly wrong here?" i have test app nothing watch own cpu usage. looks little this: protected performancetrace() { process currentprocess = process.getcurrentprocess(); this.cpucounter = new performancecounter("process", "% processor time", currentprocess.processname); this.corecount = environment.processorcount; } private int corecount; private datetime lastcpuread = datetime.minvalue; private float _cpuusage; private float cpuusage { { if ((datetime.now - this.lastcpuread) > timespan.fromseconds(1.0)) { this._cpuusage = this.cpucounter.nextvalue(); } return this._cpuusage / this.corecount; } } the cpuusage property read frequently. here's thing: on machine, environment.processorcount produces value of 2. however, value coming counter 800. assuming has multiple cores , hyperthreading. can actual value i'm looking for? (the total % process...

inversion of control - Resolve dependencies with Castle Windsor using MEF in Visual Studio 2010 addin -

i wondering if there best practices using castle windsor visual studio 2010 addin, uses mef internally instantiate controls, such iwpftextview . all dependencies registered when vspackage created. how can later resolve dependencies when iwpftextviewcreationlistener created via mef, sometime later? should expose container singleton , access it, or there better way? edit here's i'm trying accomplish. when vspackage created, windsor wiring dependencies, is, of course, great. my addin "editor adornment" type of extensibility, after solution loaded , code file opened, callback class inherits iwpftextviewcreationlistener (and exported [export(typeof(iwpftextviewcreationlistener))] via mef (which done automatically visual studio). this happens in context, is, don't have access vspackage class, , dependencies need not initialized. @ point i'm not sure how can dependencies wired windsor. hope makes clearer. (you can try creating own extensibilty pr...

inheritance - Problem removing objects in Java -

lets graphic world ,lets api of world , , actor , , built object new class name food inherent actor in situations need object disappeared world. should way ? i tried this: public void killfood () { getworld().removeobject(this); // >>>>>kill object inherate food , operate method. } but didn't killed kind of object class inherent food... why ? i wrapped (in food class) with: public void act() { if (canmove()) move(); else killfood(); } public boolean canmove() { world myworld = getworld(); int x = getx(); int y = gety(); y--; // test outside border if (x >= myworld.getwidth() || y >= myworld.getheight()) return false; else if (x < 0 || y < 0) // if out of 1st quarter return false; return true; // if inside 1st quarter & borders can move. } but object did not ...

blackberry - String text to long value -

well, thats it! need convert string text (like"hrd$457"), long value. blackberry ide has button it, need code. please note string alpha numeric. thx! note: sorry if question not clear. ide button im talkin converts entire string in long value makes string unique number. blackberry documentation says: "to create unique long key, in blackberry® integrated development environment, type string value. com.rim.samples.docs.userinfo right-click string , click convert ‘com.rim.samples.docs.userinfo’ long." so, need same code. i appreciate buddies, , trying help. if looking a number constant string can following. string str = "asdfasdf345asdfasdf"; int asint = str.hashcode(); long aslong = (long) asint;

Upload google docs with coldfusion -

i've built forum-like app in coldfusion , want add feature users can upload files google docs using google accounts , other users can edit files. i've been using cfc: http://cfgoogle.riaforge.org/ retrieve google docs, upload function missing. need upload function first upload of file , second part of editing it. hope makes sense. that's i'm asking for. i'm not experienced cffunctions , wondering if give me hand it. this have far: <cffunction name="upload" access="public" returntype="any" hint="i upload document." output="false"> <cfargument name="myfile" type="string" required="true" hint="file upload."> <cfset var result = ""> <cfset var service = variables.docservice> <cfset theurl = "https://docs.google.com/feeds/documents/private/full http/1.1"> <cfhttp url="#theurl#" method="post" res...