Posts

Showing posts from September, 2014

python - local variable - run time error with local -

x=5 def printx() print x x=10 running gives unboundlocal error but when function print x no error.. simply assigning value x in function making local variable, therefore shadowing global x specified on previous line. , on line you're trying print it, local version of x hasn't been initialized yet. curious how doing on later line influencing lines come before it, that's how works. you don't need special declaration read global variable, therefore works without assignment. however, if you'd rather assign global x instead of making new, local x , you'll have specify global x before assigning it.

MIPS assembly to determine whether hardware I/O interrupt has occurred? -

in mips32 exception handler, want determine whether exception caused i/o interrupt. cause register bits 2-6 inclusive has checked. what's mips assembly code determine this? you have mask out each bit check interrupt came from. exception handler procedure shown here: exchandler http://i47.tinypic.com/5yt47c.png can see manual hardware says interrupt came , theres error codes u can load register , compare epie register see if exception trap or interrupt, remember reset epie (error status register) before return error , enable interrupt bits in processors control register allow hardware make interrupts. this scheme used when coding exception handler nios ii, procedure should similar mips32. mips assembly language , mips: interrupts , exceptions page 22

Implementing conditional fluent mapping according to db -

i'm working 2 different db's in app, big(oracle) 1 online mode , small(sqlce) 1 offline mode. the problem mappings, id generation strategy not same, need custom implementation on sqlce(something sequences negative direction). how can achieve ability, without mapping contain if's instead of manually setting it, can define convention? have 1 if, convention load @ session factory config time. or maybe none if convention can examine way dialect being used (though don't know if fluent nhibernate objects available conventions supports that).

database - REDIS: Numeric keys (1,2,3..) vs compressed keys (A9z3,A9z4..)? -

we having fun redis on nodejs server - great combo btw. question out of curiosity , should treated "in theory". is there performance difference between storing values on numeric keys (1,2,3,4...) on compressed keys (a9z3,a9z4,a9z5...). i'm thinking select speed in database 2 million keys. i hope question not damn stupid, best regards ;) if storing keys list or string, there should no performance difference, integers stored same way strings in memory. so, there no noticeable performance difference when selecting string or integer. memory wise, compressed keys have less overhead in memory "because small keys , values there lot of overhead." talking bytes here. (http://redis.io/topics/faq)

Why were old games programmed in assembly when higher level languages existed? -

i noticed if not nes / atari, etc games coded in assembly, @ time, c, cobol, , fortran existed think make easier code right? why did choose assembly on these available higher level languages? those games had 8-bit cpu chips , microscopic memories, like, 2kb. answer take on half ram. compiled code out of question. on 8-bit cpu's "large" memories, "64k" (whee!) compiled code difficult use; not routinely seen until 16-bit microprocessors appeared. also, potentially useful language c , had not yet taken on world. there few if c compilers 8-bit micros @ time. but c wouldn't have helped much. games had horribly cheap hacks in them pretty required timing-specific instruction loops ... e.g., sprite's y-coordinate might depend on when (in video scan) control register written. (shudder...) now there was nice interpreted-bytecode language around time or perhaps little bit later: ucsd pascal running on ucsd p-system. although i'm not big ...

sql server - Changes to a table-valued function called by a stored procedure are not recognized? -

i have stored procedure sp calls table-valued function tvf. modify tvf when subsequently executing sp, output sp same before modification. seems cached or compiled or something. if make dummy change sp, right output of sp. is there way, can overcome problem? in oracle possible re-compile stored procedures, haven't been able figure out how in sql server? any highly appreciated. you can use sp_recompile recompile stored procedure afaik, describe shouldn't happen. could post udf ? scenario can think of when udf returns same result, regardless of input parameters.

iphone objective-c custom font -

how can load , embed custom font in iphone app? font file types supported? (otf, ttf...) it possible supply fonts app , use them. take @ cgfontcreatewithdataprovider should provide functionality need. at least ttf supported, not sure otf.

c# - List method creation -

i'm creating list of defined objects so list<clock> cclocks = new list<clocks>(); for each object in list i'm calling method movetime, so foreach(clock c in cclocks) { c.movetime(); } is way can write cleaver thing can call cclocks.movetime(); it go though list doing method i guess want create collection method? i'm guessing there must thing can don't know what. thanks help you write extension method on list<t> iterates this , calls movetime() on each of items in collection. see this article more information. this approach obscures lot of information, though. if we're you, i'd go for-loop. , if you're calling 1 method on each of objects, can shorten for-loop, so: // no need declare scope if you're doing 1 operation on collection foreach(var object in collection) object.method(); ... or use linq: collection.foreach(object => object.method());

C# creating buffer overflow -

i'm trying create buffer overflow c# school project: unsafe { fixed (char* ptr_str = new char[6] {'h', 'a', 'l', 'l', 'o', ','}) { fixed (char* ptr_str2 = new char[6] {'w', 'e', 'r', 'e', 'l', 'd'}) { fixed (char* ptr_str3 = new char[6] {'!', '!', '!', '!', '!', '!'}) { (int = 0; < 8; i++) { ptr_str2[i] = 'a'; } (int = 0; < 6; i++) { this.label2.text += ptr_str[i]; this.label3.text += ptr_str2[i]; this.label4.text += ptr_str3[i]; } } } } } i thought flood ptr_str2 , thereby overwriting chars in ptr_str . not seem happen. execute values in ptr_str not overwritten. can ach...

reduce - Clojure: finding sequential items from a sequence -

in clojure program, have sequence of numbers: (2 3 4 6 8 1) i want find longest sub-sequence items sequential: (2 3 4) i assuming involve (take-while ...) or (reduce ...) . any ideas? clarification : need longest initial list of sequential items. easier, i'm sure. solutions more difficult problem posed. if interested in longest initial sequence, it's 1-liner: (defn longest-initial-sequence [[x :as s]] (take-while identity (map #(#{%1} %2) s (iterate inc x))))

performance - percentage of memory used used by a process -

percentage of memory used used process. normally prstat -j give memory of process image , rss(resident set size) etc. how knowlist of processes percentage of memory used each process. i working on solaris unix. addintionally ,what regular commands use monitoring processes,performences of processes might useful all! the top command give several memory-consumption numbers. htop nicer, , give percentages, isn't installed default on systems.

delphi - Why doesn't this D2006 code to fade a PNG Image work? -

this question springs earlier one. of code suggested answers worked in later versions of delphi. in d2006 don't full range of opacity, , transparent part of image shows white. image http://upload.wikimedia.org/wikipedia/commons/6/61/icon_attention_s.png . loaded pngimagecollection timage @ run-time because have found have image doesn't remain intact after dfm saved. purposes of demonstrating behaviour don't need pngimagecollection , can load png image timage @ design time , run ide. there 4 buttons on form - each 1 sets different value of opacity. opacity=0 works fine (paintbox image not visible, opacity=16 looks ok except white background, opacity=64, 255 similar - opacity seems saturate @ around 10%. any ideas what's up? unit unit18; interface uses windows, messages, sysutils, variants, classes, graphics, controls, forms, dialogs, extctrls, pngimage, stdctrls, spin, pngimagelist; type talphablendform = class(tform) paintbox1: tpaintbox;...

c# - Standardize color within an image -

i have .net application need browse image, standardize colors in image 6 colors? is there library or process perform kind of image manipulation? any appreciated... thanks, mike you need perform process called color quantization . process of picking set of "appropriate" colors palette , finding how far away each of colors each pixel in image can select closest match replace with. microsoft have details on process here: http://msdn.microsoft.com/en-us/library/aa479306.aspx that said, using 6 colors seem little mean!

Help With C++ CLASS Definition -

i have bit of code: int main() { string s1; // s1 == "" assert(s1.length() == 0); string s2("hi"); // s2 == "hi" assert(s2.length() == 2); cout << "success" << endl; } and want write class go through , ending "cout" statement. so far, have this: #include <iostream> #include <cassert> #include <string> using namespace std; class string { int size; char * buffer; public: string(); string(const string &); string(const char *); ~string(); int length(); }; string::string() { buffer = 0; } string::string(const string &) { } string::string(const char *) { buffer = 0; } string::~string() { delete[ ] buffer; } string::length() { } which believe correct far, @ least in terms of how class should built i'm no sure should go within of member functions. can me out or show me example of need class go throu...

Quicktime Directshow Filters -

i'm looking directshow source filters playing quicktime media. can has been down same path offer advice? i've tested offerings medialooks , roguestream. there others should check out? there free or open source alternatives? thanks, we had experience using roguestream filter transcoding, i'd go one.

php - How other websites detect that you are logged in facebook? -

if user logged in facebook how detect im website? how iframe takes care of it. need methods beside iframe. from javascript sdk: fb.getloginstatus(function(response){ if(response.session){ //user logged in }else{ //user not logged in } });

ios - Graphical glitches when adding cells and scrolling with UITableView -

i using uitableview display results of series of calculations. when user hits 'calculate', add latest result screen. when add new cell, uitableviewcell object added array (which indexed tableview:cellforrowatindexpath: ), , use following code add new row displayed on screen: [thisview beginupdates]; [thisview insertrowsatindexpaths:[nsarray arraywithobject:newindexpath] withrowanimation: uitableviewrowanimationfade]; [thisview endupdates]; this results in new cell being displayed. however, want scroll screen down new cell lowermost cell on-screen. use following code: [thisview scrolltorowatindexpath:newindexpath atscrollposition:uitableviewscrollpositionbottom animated:yes]; this almost works great. however, first time cell added , scrolled to, appears onscreen briefly before vanishing. view scrolls down correct place, cell not there. scrolling view hand until invisible new cell's position offscreen, again, causes cell appear - after behaves normally. happens ...

C++ resize a docked Qt QDockWidget programmatically? -

Image
i've started working on new c++/qt project. it's going mdi-based ide docked widgets things file tree, object browser, compiler output, etc. 1 thing bugging me far though: can't figure out how programmatically make qdockwidget smaller. example, snippet creates bottom dock window, "build information": m_compileroutput = new qtextedit; m_compileroutput->setreadonly(true); dock = new qdockwidget(tr("build information"), this); dock->setwidget(m_compileroutput); adddockwidget(qt::bottomdockwidgetarea, dock); when launched, program looks (bear in mind stage of development): however, want appear this: i can't seem happen. qt reference on qdockwidget says this: custom size hints, minimum , maximum sizes , size policies should implemented in child widget. qdockwidget respect them, adjusting own constraints include frame , title. size constraints should not set on qdockwidget itself, because change depending on whether docked now...

How to connect Database in C++? What database to use? -

what suitable database visual studio c++? how connect database c++? your choice of database dependent on requirements. sqlite offers nice , simple interface.

how to display current webview in android -

i have 3 webviews displaying query result search string 3 search engines.. if google displayed, have yahoo , ask buttons @ bottom....when click either of them, results entered query... if(btn2.gettext()=="yahoo") { wv2.loadurl("http://search.yahoo.com/bin/search?p="+value); vf.setdisplayedchild(1); system.out.println("yahoo working"); btn1.settext("ask"); btn2.settext("google"); } else if(btn2.gettext()=="ask") { wv3.loadurl("http://www.ask.com/web?q="+value); vf.setdisplayedchild(2); system.out.println("ask working"); btn1.settext("google"); btn2.settext("yahoo"); } else if(btn2.gettext()=="google") { wv1.loadurl("http://www.google.com/search?q="+value)...

iphone - Unable to view table in RootViewController -

i have navigation app working on reason not allowing me view table on initial screen (i.e. rootviewcontroller). have following method called "viewdidload" method:` - (void) locationmanager:(cllocationmanager *)manager didupdatetolocation:(cllocation *)newlocation fromlocation:(cllocation *)oldlocation { ` work, , calls method: - (void) readrestaurantsfromdatabase:(double)userlatitude withuserlocation:(double)userlongitude{ this method work nsarray called "sortedarray" property declared, , synthesized in rootviewcontroller: //compile list of categories nsmutablearray *categorylist = [[nsmutablearray alloc] init]; [categorylist addobject:@"all types"]; (restaurant *restcat in restaurants){ [categorylist addobject:restcat.category]; } //remove duplicates nsarray *copy = [categorylist copy]; nsinteger index = [copy count] - 1; (nsstring *...

android - Drawing a graph, can not see the resulting image -

i trying draw graph in android. want graph scale current screen size, instead of setting them explicitly in constants, size of linearlayout intended contain graph. however, there problem it's not possible sizes in activity's oncreate() , use custom linearlayout overridden onsizechanged() . include layout with: view class="com.nnevod.loggraph.graph$graphdisplaylayout" android:layout_height="fill_parent" android:id="@+id/linearlayout1" android:layout_width="fill_parent" android:layout_weight="1" android:background="@color/white" i've omitted angular brackets. in overridden o nsizechanged() , dimensions of view read, done described in many graphing examples: bitmap created, passed graph-drawing class, imageview created, set bitmap, , added custom linearlayout. problem is, graph's image not visible. however, if try inspect hierarchyviewer , image becomes visible. if cut-paste code o...

Dynamic 2d array in c++ and memory leaks -

i wrote code. runs ok, when check under valgrind catches 2 problems. since can not interpret valgrind's messages appreciate if explain me more , tell me problem!!! here code: #include <iostream> #define width 70000 #define height 10000 using namespace std; int main(void) { int** pint; pint = new int*[height]; for(int = 0; < height; i++) pint[i] = new int[width]; for(int = 0; < height; i++){ delete[] pint[i]; pint[i] = null; } delete[] pint; pint = null; return 1; } okay, there couple of valgrind warnings 3.4 first important. new/new[] failed , should throw exception, valgrind cannot throw exceptions , aborting instead. sorry. new throws exception when out of memory (unless use nothrow version of new). unfortunately, valgrind cannot handle , gives before code completes. because valgrind aborts, code free memory never executed shows memory leaks. that said, not handling case ...

c# - TryParse failing with negative numbers -

i'm having problem getting tryparse work correctly me. have list of values assured valid (as come component in our system) make sure there proper error handling in place. here example list of values: 20.00 20.00 -150.00 and here method wrote: private decimal calculatevalue(ienumerable<xelement> summaryvalues) { decimal totalvalue = 0; foreach (xelement xelement in summaryvalues) { decimal successful; decimal.tryparse(xelement.value, out successful); if (successful > 0) totalvalue += decimal.parse(xelement.value); } return totalvalue; } the variable 'successful' returning false -150.00, added numberstyles: private decimal calculatevalue(ienumerable<xelement> summaryvalues) { decimal totalvalue = 0; foreach (xelement xelement in summaryvalues) { ...

html - Best way to manage a header navigation menu from within a template? -

i'm looking put navigation in gsp template, , set active class on navigation elements each respective page. what's best way this? have several .gsp views merging single template looks this: <div id="bd" role="main"> <div role="navigation" class="yui-g"> <ul id="nav"><a href="index.gsp"><li class="active">home</li></a><a href = "products.gsp"><li>products</li></a><a href = "contacts.gsp"><li>contact</li></a></ul> </div> <g:layoutbody/> </div> i armandino's suggestion, may have problems if you're accessing pages other means clicking menus (eg through bookmark or first page after login). this solution if you're using sitemesh, not isolated menu template , hence not nice design-wise: grails active page navigation menu

c - Stack / base pointers in assembly -

i know topic has been covered ad nauseam here, , other places on internet - question simple 1 try head around assembly... so if understand correctly ebp (base pointer) point top of stack, , esp (stack pointer) point bottom -- since stack grows downward. esp therefore points 'current location'. on function call, once you've saved ebp on stack insert new stack frame - function. in case of image below, if started n-3 go n-2 function call. when @ n-2 - ebp == 25 , esp == 24 (at least initially, before data placed on stack)? is correct or off on tangent here? thanks! http://upload.wikimedia.org/wikipedia/en/a/a7/programcallstack2.png http://upload.wikimedia.org/wikipedia/en/a/a7/programcallstack2.png this depends upon not hardware architecture , compiler, calling convention , agreed-upon way in functions work stack call 1 another. in other words, there different orders in function can push things onto stack, depending on compiler settings (and peculiar #pra...

facebook - How to programmatically add an event to a page using Graph API? -

is possible programmatically add event page using facebook graph api? if yes, http request shall made? for example, startup weekend has events on facebook page . these events can added using graph api event object ? update creating event api no longer possible in v2.0+. check: https://developers.facebook.com/docs/apps/changelog#v2_0 yes it's possible. permissions: create_event manage_pages so first page id , access token, through: $facebook->api("/me/accounts"); the result like: array ( [data] => array ( [0] => array ( [name] => page name [category] => website [id] => xxxxxx [access_token] => xxxxx ) [1] => array ( [name] => page name 2 [category] => company [id] => xxxxxxx ...

mvvm light - RelayCommands overriding the "IsEnabled" of my buttons -

relaycommands overriding "isenabled" of buttons. is bug? here xaml view , code viewmodel <button grid.column="0" content="clear" isenabled="false" cmd:buttonbaseextensions.command="{binding clearcommand}" /> public relaycommand clearcommand { { return new relaycommand(() => messagebox.show("clear command")); } } notice hardcoded isenabled="false" in xaml. value ignored (button enabled). i realize relaycommand have canexecute overload did want use want more have disabled button. that's interesting point. right, isenabled property gets overriden. guess improvement ignore isenabled property if canexecute delegate not set in constructor... consider in next version. in mean time, use canexecute delegate , set return false always. public relaycommand clearcommand { { return new relaycommand( () => messagebox.show("clear command"), () =...

c# - The data types text and nvarchar are incompatible in the equal to operator -

this code productcontroller.cs public actionresult details(string id) { product productx = productdb.products.single(pr => pr.product1 == id); return view(productx); } details.aspx <td> <%-- : html.actionlink("edit", "edit", new { id=item.id }) % --> <%: html.actionlink("details", "details", new { id = item.product1 })%> </td> this im using list products sql database, each product have link details page show more informations it what im trying put product label in link let show www.mysite.com\products\battery (not id) i've imagined should work, throw the data types text , nvarchar incompatible in equal operator. error , neither (pr => pr.product1.equals(id)); works the error clear , im asking how should make work way ? thanks text columns in sql server considered large object data , therefore aren't indexable/searchable. they're depre...

what are the animation formats supported by iphone? -

i have flash based animation.but since iphone doesnt support flash.which format can convert other gif? (gif doesnt support audio) you may not able directly convert check out raphael javascript / vector animation. it's great! works on modern browser including iphone. http://raphaeljs.com/ not sure sound part though.

SQLite from C# - Which is easier to LINQ-to-SQL or Entity Framework? -

what people recommend using persistence approach sqlite c# windows forms application - linq-to-sql or entity framework? (i ask on basis i've had people stay away datatables , move 1 of new approaches) linq-to-sql available sql server. may limit choices somewhat. apparently there's project called dblinq tries port linq-to-sql interfaces other databases: http://code.google.com/p/dblinq2007/ . haven't tried myself.

flash - How to load Google's financial chart into a movieclip -

google finance has nice charts visualize data, 1 of them: www.google.com/finance?q=sha:000001 i've been searching lot , learned there ways put on html site. cannot find way load swf. i think problem seems uses flashvars pass data draw chart. (i saw looooong flashvars value using firebug) if there possible way load swf, using actionscript 2, or 3, please let me know. appreciate that. thanks time. i think can access data using google finance api .

c++ - error LNK2005: xxx already defined in MSVCRT.lib(MSVCR100.dll) C:\something\LIBCMT.lib(setlocal.obj) -

i'm using dcmtk library reading dicom files (image format used in medical image processing.) i'm having problem in compiling dcmtk source code. dcmtk uses additional external libraries (zlib, tiff, libpng, libxml2, libiconv). know libraries should generated same code generation options. i've downloaded compiled versions of these support libraries compiled "multithreaded dll" runtime options (/md). in each project of dcmtk source code ensured runtime options "multithreaded dll" (/md). still i'm getting these errors: error 238 error lnk2005: ___iob_func defined in msvcrt.lib(msvcr100.dll) c:\dcmtk-3.5.4-src\cmakebinaries\dcmpstat\apps\libcmt.lib(_file.obj) dcmp2pgm error 239 error lnk2005: __lock_file defined in msvcrt.lib(msvcr100.dll) c:\dcmtk-3.5.4-src\cmakebinaries\dcmpstat\apps\libcmt.lib(_file.obj) dcmp2pgm error 240 error lnk2005: __unlock_file defined in msvcrt.lib(msvcr100.dll) c:\dcmtk-3.5.4-src\cmakebinaries\dcmpstat...

html - Images and copy won't align -

please take @ website: http://jlwingert.com/seametrics.html didn't post source code because it's quite lengthy. problem lower half of page. i'm supposed clean website , noticed bottom half of page has unaligned images , copy. i've gone through coding , i'm having hardest time finding problem. i'd appreciative if view source & see if provide assistance novice! thank you! jen you start new table @ wmx series rather continuing existing 1 has 150px padding column. that's problem. ready "don't use tables" crowd flame you.

Catch f5 in Silverlight? -

i have app uses navigation controls. app stay on page showing rather reload whole application when f5 (refresh) pressed? is @ possible? jd. it seems way contentframe_navegating event. on refresh, url user on passed through. can use to redirect application try load default page. jd.

wpf - Bind width on UI element to Width of another UI Element -

i wanted bind width of column header width of header defined. code doesn't work. if specify width explicitly (width="100"), works fine. can shed light , tell me wrong code below? <datagrid:datagridtemplatecolumn x:name="pdpcol" width="100"> <datagrid:datagridtemplatecolumn.header> <grid horizontalalignment="stretch"> <textblock text="pdp" verticalalignment="center" horizontalalignment="center" textwrapping="wrap" width="{binding elementname=pdpcol,path=actualwidth }" textalignment="center" /> </grid> </datagrid:datagridtemplatecolumn.header> </datagrid:datagridtemplatecolumn> remove horizontalalignment="center" textblock or set property stretch . textblock consume available width automatically. furthermore, if don't show else textbloc...

iphone - CLLocation getting EXC_BAD_ACCESS -

i getting error when trying access cllocation, can please explain why? cllocation *currentlocation; @property (nonatomic, retain) cllocation *currentlocation; i geeting feedback location location manager: - (void)locationmanager:(cllocationmanager *)manager didupdatetolocation:(cllocation *)newlocation fromlocation:(cllocation *)oldlocation { if (newlocation != nil) { currentlocation = newlocation; nslog(@"locationmanager: %@", currentlocation); } } locationmanager: <+36.45307493, +28.22220462> +/- 100.00m (speed -1.00 mps / course -1.00) @ 9/2/11 10:14:58 π.μ. gmt+02:00 but when trying access currentlocation didselectannotationview exc_bad_access: - (void)mapview:(mkmapview *)mapview didselectannotationview:(mkannotationview *)view { nslog(@"current location: %@", currentlocation); } can please explain why cannot access it? many thanks! you not retaining location. like: - (void)locationmana...

ruby - Rubyzip vs native OS compression -

i wondering performance difference when zipping data using rubyzip compared using native os libraries performing compression. fetching data compressed url , using zipoutputstream create zip file. in case of native os utilities thinking of using zip tool. nice hear pros , cons both approaches. it turns out there not of difference in terms of time taken operation or cpu usage. there significant difference when came memory usage. rubyzip process ended using lot more memory compared when using zip util. in our use case memory usage significant concern , hence ended using zip util.

java - How to get the parameter names of an object's constructors (reflection)? -

this question has answer here: can obtain method parameter name using java reflection? 14 answers say somehow got object reference other class: object myobj = anobject; now can class of object: class objclass = myobj.getclass(); now, can constructors of class: constructor[] constructors = objclass.getconstructors(); now, can loop every constructor: if (constructors.length > 0) { (int = 0; < constructors.length; i++) { system.out.println(constructors[i]); } } this giving me summary of constructor, example constructor public test(string paramname) shown public test(java.lang.string) instead of giving me class type however, want name of parameter.. in case "paramname". how that? tried following without success: if (constructors.length > 0) { (int icon = 0; icon < constructors.length; icon++) ...

What's a good open-source debugger & memory analyzer for Windows? -

in unix world i've been happily using gdb debugging , valgrind memory analyzation. are there open-source quality alternatives windows? i'm looking lightweight pieces of software need, , never in way (just gdb , valgrind). microsoft visual studio express edition free (but not open source). in microsoft debugging tools there's windbg debugger. free, not open source.

javascript - Jquery having trouble positioning images -

follow on from: javascript wait image load before calling ajax function initresources() { var newimage; (i = 0; < resourcedata.length; i++) { // create image newimage = $('<img alt="big" id="imga' + + '" class="mediaimg" width="' + math.round(resourcedata[i][2] * currentscale) + '" height="' + math.round(resourcedata[i][3] * currentscale) + '" />'); newimage.load(function() { alert(i); // position $('#imga' + i).position().top(math.round(resourcedata[i][5] * currentscale)); $('#imga' + i).position().left(math.round(resourcedata[i][4] * currentscale)); }); newimage[0].src = uploadfolder + '/' + imgdata[resourcedata[i][1]][1]; $('#thepage').append(newimage); } } i have array of images. when page loaded server, function loops through images , pl...

tfs2010 - Where can I find additional TFS 2010 Process Guidance templates? -

does know can find process guidance templates tfs 2010 other 2 provided default? the project creation wizard has link download more microsoft certified process templates, link points page: http://msdn.microsoft.com/en-us/vstudio/aa718795.aspx . make sure keep eye on site new templates posted there. thanks, ladislau

node.js - var vs this in Javascript object -

i'm developing web framework node.js. here code; function router(request, response) { this.routes = {}; var parse = require('url').parse; var path = parse(request.url).pathname, reqroutes = this.routes[request.method], reqrouteslen = reqroutes.length; ..... // more code }; should change var this, so: function router(request, response) { this.routes = {}; this.parse = require('url').parse; this.path = this.parse(request.url).pathname; this.reqroutes = this.routes[request.method]; this.reqrouteslen = this.reqroutes.length; ..... // more code }; any comments? add properties this when want properties persist life of object in question. use var local variables. edit — bergi notes in comment, variables declared var don't necessarily vanish upon return function invocation. are, , remain, directly accessible code in scope in declar...

xaml - WPF Custom Buttons below ListBox Items -

wpf experts - i trying add buttons below custom listbox , have scroll bar go bottom of control. items should move , not buttons. hoping guidance on best way achieve this. thinking itemspaneltemplate needed modified not certain. thanks alt text http://i41.tinypic.com/15p4c35.jpg my code below <!-- list item selected --> <lineargradientbrush x:key="gotfocusstyle" endpoint="0.5,1" startpoint="0.5,0"> <lineargradientbrush.gradientstops> <gradientstop color="black" offset="0.501"/> <gradientstop color="#ff091f34"/> <gradientstop color="#ff002f5c" offset="0.5"/> </lineargradientbrush.gradientstops> </lineargradientbrush> <!-- list item hover --> <lineargradientbrush x:key="mouseoverfocusstyle" startpoint="0,0" endpoint="0,1"> ...

silverlight - MouseWheel: Scrolling vs. Zooming -

i've got silverlight 4 custom control several canvas elements wrapped inside scrollviewer. user can set property determine whether scroll or zoom when using mouses wheel. in custom control's mousewheel event, check see if want scroll or zoom. if zooming, determine delta , modify custom control's zoom level (which handles zooming code me). the problem zooming won't start until scrollviewer's current position of vertical scrollbar @ top or bottom of scrollbar. once their, zooming works perfectly. does have suggestions on how can prevent scrolling zoom (when user wants zoom, is)? thanks! looks 1 of child elements hogging mousewheel event. traced adding debug.writeline statements each of child element's mousewheel event parent control's mousewheel event. so, can't blame sl4. myself. :)

.net - How do I calculate a good hash code for a list of strings? -

background: i have short list of strings. the number of strings not same, of order of “handful” in our database store these strings in 2nd normalised table these strings never changed once written database. we wish able match on these strings in query without performance hit of doing lots of joins. so thinking of storing hash code of these strings in main table , including in our index, joins processed database when hash code matches. so how hashcode? could: xor hash codes of string together xor multiply result after each string (say 31) cat string hashcode some other way so people think? in end concatenate strings , compute hashcode concatenation, simple , worked enough. (if care using .net , sqlserver) bug!, bug! quoting guidelines , rules gethashcode eric lippert the documentation system.string.gethashcode notes 2 identical strings can have different hash codes in different versions of clr, , in fact do. don't store string ...

asp.net - Does an HttpHandler require an aspnet_isapi.dll mapping -

if configure (via web.config) httphandler handle .gif requests specific folder, absolutely essential me map .gif requests aspnet_isapi.dll in iis? is there other way of ensuring .gif http request handled aspnet_isapi.dll? i have server configured virtual dir contained .gif->aspnet_isapi.dll mapping has been deleted, .gif requests still being passed handler. know how might being done, , setting might lurking? thanks the mapping required otherwise iis never send request asp.net , handler never have chance process request. there no other way know of. have let iis know @ point has handle file type. to remove, can follow instructions @ http://msdn.microsoft.com/en-us/library/bb515343.aspx delete rather add extension mapping. also check not have wildcard mapping in there well.

Visual Studio - How to use an existing vsproj's project settings as a template for new project? -

there software want write plugin for. software includes sample plugins. want create new fresh project want use 1 of sample plugin vsproj's project settings template. it doesn't seem clear on how this. if "new project existing code" imports cpp, h, etc files new project. right way can see copy sample projects settings open 2 instances of vs2005 next each other , mimic settings... surely there built in method of doing this? you copy project file , remove source files it. then add new source that. doesn't software provide template? when worked on toolkit allowed developers write own plugins provided these.