Posts

Showing posts from March, 2014

winforms - BufferedGraphicsContext Error -

i getting below error , call stack @ same time everyday after several hours of application use. can shed light on happening? system.invalidoperationexception: bufferedgraphicscontext cannot disposed of because buffer operation in progress. @ system.drawing.bufferedgraphicscontext.dispose(boolean disposing) @ system.drawing.bufferedgraphicscontext.dispose() @ system.drawing.bufferedgraphicscontext.allocbufferintempmanager(graphics targetgraphics, intptr targetdc, rectangle targetrectangle) @ system.drawing.bufferedgraphicscontext.allocate(intptr targetdc, rectangle targetrectangle) @ system.windows.forms.control.wmpaint(message& m) @ system.windows.forms.control.wndproc(message& m) @ system.windows.forms.scrollablecontrol.wndproc(message& m) @ system.windows.forms.toolstrip.wndproc(message& m) @ system.windows.forms.menustrip.wndproc(message& m) @ system.windows.forms.control.controlnativewindow.onmessage(message& m) @ system.windows.forms.contro...

javascript - Is the downside of coding styles (css) in jQuery genuinely prohibitive? -

i reading article non-compatibility of css, when occurred me maybe should writing of css in jquery. aside javascript-disabled browsers, ajax website isn't going support anyway, what's downside? the benefit, aside greater browser support, use of variables throughout (pseudo) css file. control color across borders , backgrounds etc. in single place. know has been done backend programming, i'm considering front-end. wanna talk me off ledge? the article reading here, if you're interested: http://www.impressivewebs.com/buggy-css-selectors-cross-browser-jquery/ javascript-disabled browsers, say. more people have javascript turned off css turned off. secondly, imagine performance worse on clients-end. in general, css goes @ top. means browser can style html loads, rather waiting html load. javascript, unless there really fancy tricks don't it, need wait html load before styling, resulting in fouc also, browsers heavily optimised execute css efficiently...

java - Algorithm to find the simplest combination of integers that has not yet been used -

i looking algorithm finding simplest combination of integers 0 5 (that 1 consists of fewest number of integers) has not yet been used (the used combinations in list). the order matter , combinations should returned in list. for example, list used numbers this: {{0},{1},{2},{3},{4},{0,0},{0,1},{0,2},...,{2,1},{2,2},...,{1,5,4},...} in case, algorithm should return list {5}, {5} combination consists of fewest integers. if list looks this: {{0},{1},{2},{3},{4},{5},{0,0},{0,1},{0,2},{0,3},{0,5},...} the algorithm should return list 0 , 4 ({0,4}). as used in java, java answer preferable pseudo-code or other programming languages usable too. thank in advance! i guess example 2 wrong: {{0},{1},{2},{3},{4},{5},{0,1},{0,2},{0,3},{0,5},...} smallest solution {0,0}, not {0,4} complete solutions here: import java.util.*; public class algorithm { static list<list<integer>> getchildren(list<integer> node){ list<list<integer>...

Benefits and uses of a functional programming language -

possible duplicate: why functional languages? i began programming c/c++, vb, , python - imperative languages. took course programming languages , learned first functional language - ocaml. terrible. syntax , other horrors aside, ocaml took imperative thought process , threw out window. frustrating. insisted done functionally done imperatively. thought of functional programming imperative programming without limb (side effects). in response frustration, benefit professor come fpl's ability parallelize side-effect-free functions. anyways, enough talk. what advantages fpls offer above ipls? is there can done in fpl cannot done in ipl? are there real-world examples of fpls in use, or serve academic exercises? (when real-world, mean project heavily relies on functional aspect of language , doesn't cram fpl scenario doesn't belong). thanks, advait first of all, language in common use today equivalent in expressive power, imperative or functi...

Access variables programmatically by name in Ruby -

i'm not entirely sure if possible in ruby, there's easy way this. want declare variable , later find out name of variable. is, simple snippet: foo = ["goo", "baz"] how can name of array (here, "foo") back? if indeed possible, work on variable (e.g., scalars, hashes, etc.)? edit: here's i'm trying do. i'm writing soap server wraps around class 3 important variables, , validation code this: [foo, goo, bar].each { |param| if param.class != array puts "param_name wasn't array. a/an #{param.class}" return "error: param_name wasn't array" end } my question then: can replace instances of 'param_name' foo, goo, or bar? these objects arrays, answers i've received far don't seem work (with exception of re-engineering whole thing ala dbr's answer ) what if turn problem around? instead of trying names variables, variables names: ["foo...

algorithm - How do I convert a set of polygons into a bitmap -

how take set of polygons contain arbitrary values , create corresponding bitmap each pixel contains value of polygon @ location? to put question context, polygons contain information average number of people per square kilometre within polygon. need create raster/bitmap contains pixels representing population in 200 metre bins. i've done similar in past i've used polygon create mask drawing bitmap , filling values, converting bitmap array can manipulate. i'm sure there's better method doing this! i'm clarifying question bit more requested. there multiple polygons, each polygon set of vectors each polygon have single unique value the polygons don't overlap thanks nick @nick r i using arcgis 9.2, doesn't work c# , 64 bit, using gdal ( http://www.gdal.org ). doesn't gdal_rasterize want?

ruby on rails - How do you change the displayed order of ActiveScaffold "actions"? -

i using activescaffold in ruby on rails app, , have replaced default "actions" text in table (ie. "edit", "delete", "show") icons using css. have added couple of custom actions action_link.add ("move" , "copy"). for clarity, i have icons displayed in different order are. specifically, "edit" first icon displayed. i seem able change order of action_links changing order of definition in controller. have been able change order of default actions first config.actions.excluding everything, , adding them config.actions.add in specific order. however, my custom actions seem appear before default actions in list. ideally them display "edit" "copy" "move" "delete" (ie - built-in, custom, custom, built-in). can suggest how might this? one idea had re-define "edit" custom action (with default functionality), don't know how go either. caveat: don...

sql server - Redgate SQL Tools -

i testing redgate belt , set of tools seems pretty amazing... before buy anything... recommend other tools similar these? the other vendor similar line-up , quality know of apexsql

excel 2007 vba add item sheet names to listbox -

using excel 2007 vba have sheet "dashboard", have other sheets special task sheets can anywhere in book, found between sheets "tasknew" , "taskend". these special task sheets vary in count. upon dashboard activation, want populate listbox names of special task sheets, user can select sheet form drop down , navigate sheet. following results in runtime error '438' object doesn't support property or method: application.calculation = xlcalculationautomatic application.screenupdating = true dim startindex integer dim endindex integer dim loopindex integer 'dim sht worksheet startindex = sheets("tasknew").index + 1 endindex = sheets("taskend").index - 1 loopindex = startindex endindex 'sheetsnavigationdropdown.additem sheets(loopindex).name 'sheets("dashboard").listbox20.additem sheets("sample").name sheets("dashboard").listbox20.additem sheets(loopindex).name next...

How can I show a grey transparent overlay in C#? -

how can show grey transparent overlay in c#? should overlay other process not owned application doing overlay. create transparent window size of whole screen, mark always-on-top, calculate regions of other application windows, , make non-window regions of top window grey. i suppose position own application windows on top of transparent grey one, being above other ones, getting tricky z-order scenario right, in conjunction other apps might doing z-order tricks, tough.

.net - How to get entire chain of Exceptions in Application.ThreadException event handler? -

i working on fixing exception handling in .net 2.0 app, , stumbled onto weird issue application.threadexception . what want able catch exceptions events behind gui elements (e.g. button_click, etc.). want filter these exceptions on 'fatality', e.g. types of exceptions application should keep running , others should exit. in .net 2.0 app learned that, default, in debug mode exceptions leave application.run or application.doevents call. in release mode not happen, , exceptions have 'caught' using application.threadexception event. now, however, noticed the exception object passed in threadexceptioneventargs of application.threadexception event innermost exception in exception chain . logging/debugging/design purposes want entire chain of exceptions though. isn't easy determine external system failed example when handle socketexception: when it's wrapped e.g. npgsqlexception, @ least know it's database problem. so, how entire chain of exceptions eve...

javascript - How can I create a loop in an onClick event? -

i want write onclick event submits form several times, iterating through selected items in multi-select field, submitting once each. how code loop? i'm working in ruby on rails , using remote_function() generate javascript ajax call. my quick answer (as i've not coded yet) create function creates post using xmlhttprequest , specific parameters single call. inside onclick() handler call function loop through selected items. i suggest proof of concept using dummy html page , javascript , try figure out how work in ror. also, why attempting make multiple calls browser opposed handling looping conditions in ror controller?

Hidden Features of PHP? -

i know sounds point-whoring question let me explain i'm coming from. out of college got job @ php shop. worked there year , half , thought had learned there learn programming. then got job one-man internal development shop @ sizable corporation work in c#. in commitment position started reading ton of blogs , books , realized how wrong think knew everything. learned unit testing, dependency injection , decorator patterns, design principle of loose coupling, composition on inheritance debate, , on , on , on - still absorbing all. needless programming style has changed entirely in last year. now find myself picking php project doing coding friend's start-up , feel constrained opposed programming in c#. bothers me variables @ class scope have referred appending '$this->' . annoys me none of ides i've tried have intellisense , simpletest unit tests methods have start word 'test'. drives me crazy dynamic typing keeps me specifying implicitly p...

Can I use TextMate with existing Flex projects created in Flex / Flash Builder? -

i wondring if has resource opening existing flex projects created in flex / flash builder , run them using textmate bundle flex , actionscript projects. basically want know if can walk existing project , configure or pretty stuck using eclipse ? it doable, it's pretty hard, cumbersome , not pretty. don't me wrong, love textmate, pros of eclipse (auto completion, profiling, etc...) , main con of being eclipse; i've never moved. this place start though, there as3 , flex bundles out there: http://pixelate.de/blog/setting-up-a-as3-project-in-textmate but said, don't auto completion, code lookup, etc...

Howto import an oracle dump in an different tablespace -

i want import oracle dump different tablespace. i have tablespace used user a. i've revoked dba on user , given him grants connect , resource. i've dumped command exp a/*** owner=a file=oracledump.dmp log=log.log compress=y now want import dump tablespace b used user b. i've given him grants on connect , resource (no dba). i've executed following import: imp b/*** file=oracledump.dmp log=import.log fromuser=a touser=b the result log lots of errors: imp-00017: following statement failed oracle error 20001: "begin dbms_stats.set_table_stats imp-00003: oracle error 20001 encountered ora-20001: invalid or inconsistent input values after i've tried same import command option statistics=none. resulted in following errors: ora-00959: tablespace 'a_tblspace' not exist how should done? note: lot of columns of type clob. looks problems have that. note2: oracle versions mixture of 9.2, 10.1 , 10.1 xe. don't think h...

wse2.0 - WSE 2.0 raises wse910 error -

i had use microsoft web services enhancements 2.0 service , raised wse910 error when time difference between server , client more 5 minutes. i read in many places setting timetoleranceinseconds , ttlinseconds , defaultttlinseconds values should help, setting clock of client machine solved problem. any experiences? does this help? mentions setting timetoleranceinseconds , defaultttlinseconds on client server.

asp.net mvc - Ajax #anchors processing with MVC -

i looking standardize processing of ajax #anchors @ server side, using mvc. before controller action invoked want convert every request ajax anchors request without ajax anchors, controller code not know there anchors in request: for example: 1) /user/profile#user/photos should treated /user/photos 2) /main/index#user/profile/33 should treated /user/profile/33 what best technique in mvc accomplish that? anchors not pushed server url. 1 option put value /main/index#user/profile/33 inside hidden field , contents of controller. however not sure how using anchors within markup page may not help!

html - Child div behind parent div, how to fix link? -

i'm trying put child <div> (with link in it) behind parent <div> , links doesn't work. i using z-index: -1 , maybe link being drawn "behind" <body> . is there way achive without breaking link? thanks the css .front { width: 200px; height: 200px; background: #ea7600; -moz-box-shadow: 5px 5px 5px rgba(0,0,0,0.3); -webkit-box-shadow: 5px 5px 5px rgba(0,0,0,0.3); box-shadow: 5px 5px 5px rgba(0,0,0,0.3); } .back { width: 300px; height: 50px; background: #93cdfb; position: absolute; left: 100px; text-align: right; padding: 5px; } the html <div class="front"> <div class="back"> <a href="http://www.stackoverflow.com">this link works</a> </div> </div> &nbsp; <div class="front" style="z-index: 1"> <div class="back" sty...

data structures - Implement Scrolling text in C -

i asked question in 1 of interviews mnc recently. question "we need display screen in text scrolls @ bottom of screen , remaining screen empty . how accomplish in c ? data structures use ..??" any ideas please ...! assuming console application, print new lines 24 times, puts @ bottom. the string printed gets stored on fixed size array/vector of 81 chars (\0 terminated @ position 81), gets updated feeding routine. potentially come socket, typing, file, calling process, etc... at feeding time (timer callbacks, when file changes, socket buffer not empty, whatever), need rotate text 1 char @ time. assuming rotation right left, copy chars 1 (not 0) till 80 i-1 preceding position. write new char on position 80. the key graphical trick here terminate printf \r instead of \n. \r modifier return carriage : cursor returns column 0, , not go next line. allows re-print of same line.

Is Unit Testing worth the effort? -

i working integrate unit testing development process on team work on , there sceptics. ways convince sceptical developers on team of value of unit testing? in specific case adding unit tests add functionality or fixed bugs. unfortunately our code base not lend easy testing. every day in our office there exchange goes this: "man, love unit tests, i've been able make bunch of changes way works, , able confirm hadn't broken running test on again..." the details change daily, sentiment doesn't. unit tests , test-driven development (tdd) have many hidden , personal benefits obvious ones can't explain until they're doing themselves. but, ignoring that, here's attempt! unit tests allows make big changes code quickly. know works because you've run tests, when make changes need make, need tests working again. saves hours. tdd helps realise when stop coding. tests give confidence you've done enough , can stop tweaking , move on...

c# - How do you pass an authenticated session between app domains -

lets have websites www.xyz.com , www.abc.com. lets user goes www.abc.com , authenticated through normal asp .net membership provider. then, site, sent (redirection, linked, whatever works) site www.xyz.com, , intent of site www.abc.com pass user other site status of isauthenticated, site www.xyz.com not ask credentials of said user again. what needed work? have constraints on though, user databases separate, not internal organization, in regards, passing stackoverflow.com google authenticated, separate in nature. link relevant article suffice. try using formauthentication setting web.config authentication section so: <authentication mode="forms"> <forms name=".aspxauth" requiressl="true" protection="all" enablecrossappredirects="true" /> </authentication> generate machine key. example: easiest way generate machinekey – tips , tricks: asp.net, iis ... when posting other applicati...

android - Get all TableRow's in a TableLayout -

i've been looking hours on how tablerow's in tablelayout. know how add , delete rows dynamically, need loop on rows , selectively delete of them. i think can come work around, i'm trying avoid crude hacks in app. have tried using getchildcount() , getchildat(int) respectively? should easy in loop: for(int = 0, j = table.getchildcount(); < j; i++) { view view = table.getchildat(i); if (view instanceof tablerow) { // then, can remove the row want... // instance... tablerow row = (tablerow) view; if( want check ) { table.removeviewat(i); // or... table.removeview(row); } } }

java - Is it worth the effort to move from a hand crafted hibernate mapping file to annotaions? -

i've got webapp original code base developed hand crafted hibernate mapping file. since then, i've become proficient @ 'coding' hbm.xml file. cool kids using annotations these days. so, question is: is worth effort refactor code use hibernate annotations? gain anything, other being hip , modern? lose of control have in existing hand coded mapping file? a sub-question is, how effort be? databases lean , mean. mapping covers dozen domain objects, including 2 sets, subclassing, , 8 tables. thanks, dear sopedians, in advance informed opinions. "if ain't broke - don't fix it!" i'm old fashioned pojo/poco kind of guy anyway, why change annotations cool? best of knowledge can of stuff annotations, more complex mappings expressed more xml.

How can I extract a predetermined range of lines from a text file on Unix? -

i have ~23000 line sql dump containing several databases worth of data. need extract section of file (i.e. data single database) , place in new file. know both start , end line numbers of data want. does know unix command (or series of commands) extract lines file between line 16224 , 16482 , redirect them new file? sed -n 16224,16482p filename > newfile from sed manual : p - print out pattern space (to standard output). command used in conjunction -n command-line option. n - if auto-print not disabled, print pattern space, then, regardless, replace pattern space next line of input. if there no more input sed exits without processing more commands. and addresses in sed script can in of following forms: number specifying line number match line in input. an address range can specified specifying 2 addresses separated comma (,). address range matches lines starting first address matches, , continues until sec...

what are the differences in the WebKit nightly build binary and in the Safari binary? -

i know projects about: safari apples browser. webkit engine used in safari (and in many other browsers) open source. webkit source code contains code compile standalone application. can download nightly build of webkit here: http://nightly.webkit.org/ i have compared of nightly builds of webkit official safari application. , besides different logo , different name, haven't seen difference. are there any? or branding? edit: tried again current nightly build of today , names "safari" now. the webkit nightly builds contain changes in render engine, don't change ui @ all. if install webkit nightly build newer version of webkit render engine, faster , more advanced older webkit render engine shipped apple's safari. example if visite www.html5test.com safari , webkit nightly build, you'll see webkit nightly build scores more points because has newest version of webkit , therefor has more advanced html5/css3 etc. support webkit build used in saf...

Difference between title and name in html href element -

in href in html, whats difference between using <a href="http://www.somesite.com/" name="the name"> and <a href="http://www.somesite.com/" title="the name"> is there advantage using 1 on other? thanks look in spec, or better yet resource condenses spec bit. (and, spec if isn't enough.) title text specifies information element http://www.w3schools.com/tags/tag_a.asp the name attribute specifies name of anchor. the name attribute used create bookmark inside document. the href or name attribute must present in tag http://www.w3schools.com/tags/att_a_name.asp so, name of anchor used links exampledomain.com/index.php#some_section , bring anchor focus on page. many modern browsers display title attribute in tooltip when hovering on link. it's useful screen readers , such.

utf 8 - C++ ifstream UTF8 first characters -

why file saved utf8 (in notepad++) have character in beginning of fstream opened in c++ program? ´╗┐ i have no idea is, know it's not there when save ascii. update: if save utf8 (without bom) it's not there. how can check encoding of file (ascii or utf8, else rejected ;) ) in c++. these characters? thanks! when save file utf-16, each value 2 bytes. different computers use different byte orders. put significant byte first, put least significant byte first. unicode reserves special codepoint (u+feff) called byte-order mark (bom). when program writes file in utf-16, puts special codepoint @ beginning of file. when program reads utf-16 file, knows there should bom there. comparing actual bytes expected bom, can tell if reader uses same byte order writer, or if bytes have swapped. when save utf-8 file, there's no ambiguity in byte order. programs, ones written windows still add bom, encoded utf-8. when encode bom codepoint utf-8, 3 bytes, 0xef...

I'm looking for publications about the history of the internet browsers -

i'm looking publications history of internet browsers. papers, articles, blog posts whatever. cannot find on acm ieee etc. , blog search didn't reveal remarkable. did take @ entries in wikipedia? it's useful starting point. here few start off: wikipedia - web browser wikipedia - timeline of web browsers wikipedia - browser wars

How do you evaluate the efficiency of an algorithm, if the problem space is underspecified? -

there post on here posed following question: you have two-dimensional plane of (x, y) coordinates. bunch of random points chosen. need select largest possible set of chosen points, such no 2 points share x coordinate , no 2 points share y coordinate. this all information provided. there 2 possible solutions presented. one suggested using maximum flow algorithm, such each selected point maps path linking ( source → x → y → sink ). runs in o(v 3 ) time, v number of vertices selected. another (mine) suggested using hungarian algorithm. create n×n matrix of 1s, set every chosen (x, y) coordinate 0. hungarian algorithm give lowest cost matrix, , answer number of coordinates selected equal 0. runs in o(n 3 ) time, n greater of number of rows or number of columns. my reasoning that, vast majority of cases, hungarian algorithm going faster; v equal n in case there's 1 chosen point each row or column, , substantially greater case there's more that: given 50...

c++ - How do I use Qt and SDL together? -

i building physics simulation engine , editor in windows. want build editor part using qt , want run engine using sdl opengl. my first idea build editor using qt , share code engine (the resource manager, renderer, maths). but, able run simulation inside editor. this means have share simulation code uses sdl threads. so, question this: there way have render opengl qt window using sdl? i have read on web might possible supply sdl window handle in render. has experience dong that? also, threaded part of simulator might pose problem since uses sdl threads. while might work first answer suggest run problems due threading. there no simple solutions when comes threading, , here have sdl qt , opengl mainloop interacting. not fun. the easiest , sanest solution decouple both parts. sdl , qt run in separate processes , have them use kind of messaging communicate (i'd recommend d-bus here ). can have sdl render borderless window , editor sends commands via messages. ...

performance - How to do saturating addition in C? -

what best (cleanest, efficient) way write saturating addition in c? the function or macro should add 2 unsigned inputs (need both 16- , 32-bit versions) , return all-bits-one (0xffff or 0xffffffff) if sum overflows. target x86 , arm using gcc (4.1.2) , visual studio (for simulation only, fallback implementation ok there). you want portable c code here, compiler turn proper arm assembly. arm has conditional moves, , these can conditional on overflow. algorithm becomes add, , conditionally set destination unsigned(-1) if overflow detected. uint16_t add16(uint16_t a, uint16_t b) { uint16_t c = + b; if (c<a) /* can happen due overflow */ c = -1; return c; } note differs other algorithms in corrects overflow, instead of relying on calculation detect overflow. x86-64 clang 3.7 -o3 output adds32 : better other answer: add edi, esi mov eax, -1 cmovae eax, edi ret armv7: gcc 4.8 -o3 -mcpu=cortex-a15 -fverbose-asm output adds32 : ...

firefox - How to debug javascript? -

this question has answer here: how can debug javascript code? [closed] 20 answers i have old javascript code around 2000-2002 (surprisingly) still works in ie, doesn't in firefox, chrome, opera etc. found out quirks, browsers things way, another. there code snippets on internet create browser plattform independent function it. now problem is, locate problems. right now, there buttons in website, when click them, happens in ie, firefox nothing. there isn't errormsg. tried stepping through javascript firebug, @ point in code, when next debug step, script seems abort, without error message. doesn't continue next statement. pretty strange , have no idea causes or how fix it. :/ so how debug javascript error messages telling me problem is, example, function/variable i'm using isn't defined in firefox or when use wrong parameters. thx & best r...

css - Transitions on the display: property -

i'm designing kind of css 'mega dropdown' menu - normal css-only dropdown menu, 1 contains different types of content. at moment, appears css3 transitions don't apply 'display' property, i.e. can't sort of transition display: none display: block (or combination). can think of way second-tier menu above example 'fade in' when hovers on 1 of top level menu items? i'm aware can use transitions on visibility: property, can't think of way utilise effectively. i've tried using height failed miserably. i'm aware it's trivial achieve using javascript, wanted challenge myself use css , think i'm coming little short. all , suggestions welcome. you can concatenate 2 transitions or more, , visibility comes handy time. div { border: 1px solid #eee; } div > ul { visibility: hidden; opacity: 0; transition: visibility 0s, opacity 0.5s linear; } div:hover > ul { visibility: visible; ...

performance - How to solve slow Java `SecureRandom`? -

if want cryptographically strong random number in java, use securerandom . unfortunately, securerandom can slow. if uses /dev/random on linux, can block waiting sufficient entropy build up. how avoid performance penalty? has used uncommon maths solution problem? can confirm performance problem has been solved in jdk 6? if want true random data, unfortunately have wait it. includes seed securerandom prng. uncommon maths can't gather true random data faster securerandom , although can connect internet download seed data particular website. guess unlikely faster /dev/random that's available. if want prng, this: securerandom.getinstance("sha1prng"); what strings supported depends on securerandom spi provider, can enumerate them using security.getproviders() , provider.getservice() . sun fond of sha1prng, it's available. isn't fast prngs go, prngs crunching numbers, not blocking physical measurement of entropy. the exception if don...

php - Move a file and rename it -

figured php's rename best bet. didn't see many examples on how use relative urls in though, kind of compromised. either way, give me permission denied: i want this: $file = "../data.csv"; rename("$file", "../history/newname.csv"); where ../ of course go 1 directory script being ran. couldn't figure out way...so did instead: $file = "data.csv"; $path = dirname(realpath("../".$file)); rename("$path/$file", "$path/history/newname.csv"); however getting permission denied (yes history folder owned www-data, , yes data.csv owned www-data). thought weird tried simple test: rename( 'tempfile.txt', 'tempfile2.txt' ); and made sure www-data had full control on tempfile.txt...still got permission denied. why? file renaming have exist? can not rename linux's mv? instead copy() , unlink()? in order move file "../" "../history/", process needs write p...

c++ - error LNK2019: unresolved external symbol SHInitExtraControls referenced? -

how can resolve error: error 1 error lnk2019: unresolved external symbol shinitextracontrols referenced in function "public: virtual int __cdecl ctestapp::initinstance(void)" (?initinstance@ctestapp@@uaahxz) test.obj thanks you need link against aygshell.lib . note msdn page shinitextracontrols() says aygshell.lib required library use it. a lnk2019 means forgot provide definition of something. in case, definition of shinitextracontrols() located in aygshell.lib . without it, linker complain when attempt use shinitextracontrols() . to link against aygshell.lib in visual studio, go project --> properties --> linker --> input --> additional dependencies type aygshell.lib in box.

jQuery: .load image, then fadeIn() fails when clicked twice! -

so i've got .load setup image .fadein() callback, works fine. problem if fire .load twice in row on same image, doesn't callback! here's snippet of code: $('#thumbs a').click( function() { imagesrc = $(this).attr('href').substring(1)+'.jpg'; // grab src, remove hash, add jpeg extension $('#viewer img').fadeout('fast', function() { // fade old image out fast, wait until finished before changing src $('#viewer img').attr('src', (mediumpath+imagesrc)); // change src new image $('#viewer a').attr('href', imagesrc); }); $('#viewer img').load(function(){ // once image loaded, fade img in $('#viewer img').fadein('slow'); }); return false; }); and can try on website (in progress) here . click on thumbnail on left twice in row , loader.gif doesn't go away, i.e. not getting .fadein(). note : i believe affecting webkit browsers...

php - Using arrays by reference -

why following code "crashing" in php? $normal_array = array(); $array_of_arrayrefs = array( &$normal_array ); end( $array_of_arrayrefs )["one"] = 1; // choking on 1 the expected result final code line appends $normal_array key one having value 1 there no output ever, not prints preceeding code. in real context of scenario use end() function append last array reference. this doesn't crash, contains syntax error: end( $array_of_arrayrefs )["one"] = 1; unfortunately, cannot treat function return values arrays in php. have assign value explicitly. unfortunately, doesn't work here because end makes copy of returned value.

Inner workings of the .NET garbage collector? -

i've read detailed papers inner workings of various garbage collectors in jvm, i've had trouble finding same level of details .net's runtime... anyone have links articles/research/pages on .net's garbage collector? garbage collection . also check garbage collector basics , performance hints . also worth reading jeffrey richters articles in gvs answer.

Where to place JavaScript in an HTML file? -

say have hefty javascript file, packed down 100kb or so. file mean it’s external file linked in via <script src="..."> , not pasted html itself. where’s best place put in html? <html> <head> <!-- here? --> <link rel="stylesheet" href="stylez.css" type="text/css" /> <!-- here? --> </head> <body> <!-- here? --> <p>all page content ...</p> <!-- or here? --> </body> </html> will there functional difference between each of options? the yahoo! exceptional performance team recommend placing scripts @ bottom of page because of way browsers download components. of course levi's comment "just before need , no sooner" correct answer, i.e. "it depends".

How does ruby on rails work? -

i'm php developer knows little bit of ruby. want learn ruby on rails, of resources i've come across treat ror functionality "magic" -- i.e., has internal consistency, don't bother asking how works in terms of ruby, mysql, etc. anyway, want deep understanding of how ror works, design decisions went building it, etc. in particular i'm interested in activerecord, i'm looking whole package. any books / sites / advice welcome. the books "agile web development rails" , "the rails way" both pretty good. "pro active record" goes in depth active record, doesn't touch on else. podcast railscasts uses magic, explains going on. various blogs such art of mission can looking for. additionally, using ruby-debug gem gives better understanding of going on - can step running behind scenes.

UserControl that embeds another user control, how to access embedded form fields? -

i have long form user has fill out. so broke form logical units , created user control elements (they reused elsewhere). so form has these fields: usercontrol3.ascx username password email -- usercontrol2.ascx address -- usercontrol2.ascx city -- usercontrol2.ascx state -- usercontrol2.ascx so in codebehidn of usercontrol3.ascx, how access usercontrol2.ascx's fields can write db? something works, not elegant: dim txtbox textbox = ctype(parentcontrol.controls(index), system.web.ui.controls.textbox) stringvariable = txtbox.text the correct way implement properties parentcontrol access child's controls properties. public property addressfield() string set(byval value string) txtaddressfield.text = value end set return txtaddressfield.text end end property

Copy the latest version of an artifact from a Maven repository -

i trying copy war file company's nexus repository specific location. using maven-dependency-plugin in following way: <plugin> <groupid>org.apache.maven.plugins</groupid> <artifactid>maven-dependency-plugin</artifactid> <version>2.1</version> <executions> <execution> <id>copy-to-output</id> <phase>prepare-package</phase> <goals> <goal>copy</goal> </goals> </execution> </executions> <configuration> <artifactitems> <artifactitem> <groupid>com.mycompany</groupid> <artifactid>myproduct</artifactid> <version>2.3.0</version> <type>war</type> <overwrite>false</overwrite> </artifactitem> </artifactitems> <o...

php try catch wsod -

i have issue. when run: try { $as ->setforename($_post['fname']) ->setsurname($_post['sname']) ->setemail($_post['email']) ->setuser($_post['user']) ->setpass($_post['pw']) ->setphone($_post['tel']) ->setmobile($_post['mob']) ->setjob($_post['job']) ->setauth($_post['auth']) ->addprocess(); } catch (exception $e) { echo $e; } i "white screen of death" when use: $as ->setforename($_post['fname']) ->setsurname($_post['sname']) ->setemail($_post['email']) ->setuser($_post['user']) ->setpass($_post['pw']) ->setphone($_post['tel']) ->setmobile($_post['mob']) ->setjob($_post['job']) ->setauth($_post['auth']) ->addprocess(); it works fine. confused please help, in advance. the try-catch block seems fine, try putting these lines o...

What's the best open source game to learn from? -

this question has been preserved historical reasons, not considered on-topic, don't use excuse post similar. more info @ https://stackoverflow.com/faq . for me read code , learn, not play... ...of course ;-) quake (1,2 , 3) , dukenukem 3d source code available under gpl.

c - How do I programmatically return the max of two integers without using any comparison operators and without using if, else, etc? -

how programmatically return maximum of 2 integers without using comparison operators , without using if , else , etc? max: // put max(a,b) a a -= b; &= (~a) >> 31; += b; and: int a, b; min: // put min(a,b) a a -= b; &= >> 31; += b; from here .

flash - can SWF apps running in the browser be automatically controlled/spidered, like in browser automation? -

suppose owner of website shows info "for humans only" tired of bots , spiders grabbing data , decides show info in swf app running in browser. reimplements structure of website flash app , bad guys can no longer navigate using url-following, html-parsing scripts. what can bad guys here? can make flash app run in browser , somehow establish control on flash app running in browser in order navigate user interface , grab text displaying user? flash (swf) files have been indexing nightmare search engines , today struggle when compared old html. however, google reported on webmaster central blog in 2008 had "improved flash indexing". q: flash files can google better index now? we've improved our ability index textual content in swf files of kinds. includes flash "gadgets" such buttons or menus, self-contained flash websites, , in between. q: content can google better index these flash files? of text users can see...

database - Storing occurrences for reporting -

what best way store occurrences of event in database can pull reports on it? ie (total number of occurrences, number of occurrences between date range). right have 2 database tables, 1 holds individual timestamps of event - can query on date range, , 1 holds total count can pull number tally table 1: event | total_count ------+------------ bar | 1 foo | 3 table 2: event | timestamp ------+---------- bar | 1/1/2010 foo | 1/1/2010 foo | 1/2/2010 foo | 1/2/2010 is there better approach problem? i'm thinking of converting table 2, hold date tallies, should more efficient, since date range queries done on whole dates, not timestamp (1/1/2010 vs 1/1/2010 00:01:12) ie: updated table 2 event | date | total_count ------+----------+------------ bar | 1/1/2010 | 1 foo | 1/1/2010 | 1 foo | 1/2/2010 | 2 perhaps theres smarter way tackle problem? ideas? your approach seems good. see table 2 more detail table, while table 1 summary ta...

sql - How to pipe visually selected text to a UNIX command and append output to current buffer in Vim -

using vim, i'm trying pipe text selected in visual mode unix command , have output appended end of current file. example, have sql command such as: select * mytable; i want following: <esc> v " select text :'<,'>!mysql -uuser -ppass mydb but instead of having output overwrite selected text, have output appended end of file. see going. i'm working on using vim simple sql editor. way, don't have leave vim edit, tweak, test sql code. how copying selected text end of file, select copy , run command? if not want repeat same commands on , on again, can record sequence using q or add new command. have tried latter follows: :com -range c <line1>,<line2>yank | $ | put | .,$ !rev with can select lines , type :c . first yank selection, go end of file, paste yanked text , run command ( rev in case) on new text.

ruby - Good Way to Handle Many Different Files? -

i'm building specialized pipeline, , basically, every step in pipeline involves taking 1 file input , creating different file output. not files in same directory, output files of different format, , because i'm using several different programs, different actions have taken appease different programs. this has led complicated file management in code, , more try organize file directories, more ugly it's getting. every class involves sort of code following: @filename = file.basename(file) @datapath = "#{$path}/../data/" mzmltoother.new("mgf", "#{@datapath}/spectra/#{@filename}.mzml", 1, false).convert system("wine readw.exe --mzxml #{@file}.raw #{$path}../data/spectra/#{file.basename(@file + ".raw", ".raw")}.mzxml 2>/dev/null") filename = "#{$path}../data/" + parts[0] + parts[1][6..parts[1].length-1].chomp(".pep.xml") is there sort of design pattern, or ruby gem, or clean up? writin...

Setting up a standard directory layout using Maven -

i'm new maven , have skimmed on documentation following hibernate tutorial @ http://docs.jboss.org/hibernate/stable/core/reference/en/html_single/#tutorial-firstapp-mvn . i have installed maven , setup web-app not contain of standard directories mentioned in tutorial. going mad? when building maven project using maven-archetype-webapp . gives me arh-webapp\src\main\resources , arh-webapp\src\main\webapp directories i'm missing quite few directories mentioned on link http://maven.apache.org/guides/introduction/introduction-to-the-standard-directory-layout.html . surely don't have manually add these? if not hibernate documentation not mention archetype use in order achieve directory structure used in tutorial. please can enlighten me. what archetype need use in order have above directory plus src/main/java directory? if there no such archetype can append these using maven? , how? not directories mentioned required standard web application. in fact, rea...

wcf ria services - Any example on binding Silverlight Combobox with both text and image from database -

i working northwind , using wcf ria (with ef 4.0) pull data on silverlight client. trying accomplish have combobox showing list of categories both categoryname , picture database. using valueconverter convert bytes bitmapimage, getting catastrophic error. anyone has combobox example binds categories/employees table of northwind (along pictures) using wcf ria. thanks

Nokogiri/Ruby array question -

i have quick question. writing nokogiri/ruby script , have following code: fullid = doc.xpath("/success/data/annotatorresultbean/annotations/annotationbean/concept/fullid") fullid.each |e| e = e.to_s() g.write(e + "\n") end this spits out following text: <fullid>d001792</fullid> <fullid>d001792</fullid> <fullid>d001792</fullid> <fullid>d008715</fullid> i wanted numbers text in between "< fullid>" saved, without < fullid>,< /fullid> markup. missing? bobby i think want use text() accessor (which returns child text values), rather to_s() (which serializes entire node, see here). i'm not sure g object you're calling write on is, following code should give array containing of text in fullid nodes: doc.xpath(your_xpath).map {|e| e.text}

python - How to fetch more than 1000? -

how can fetch more 1000 record data store , put in 1 single list pass django? starting version 1.3.6 (released aug-17-2010) can from changelog: results of datastore count() queries and offsets datastore queries no longer capped @ 1000 .

Is there any performance reason to declare method parameters final in Java? -

is there performance reason declare method parameters final in java? as in: public void foo(int bar) { ... } versus: public void foo(final int bar) { ... } assuming bar read , never modified in foo() . the final keyword not appear in class file local variables , parameters, cannot impact runtime performance. it's use clarify coders intent variable not changed (which many consider dubious reason usage), , dealing anonymous inner classes. there lot of argument on whether final modifier on method has performance gain since methods inlined optimizing compiler @ runtime anyway, regardless of modifier. in case should used restrict overriding of method.

xml - How can I reuse this Android button? -

i have button using 13 times in android application's main.xml file. have xml defined once, can make changes in 1 place instead of 13. each of 13 instances needs have own id, though. should simplify xml? i've tried using <include> hasn't worked me. must have been doing wrong. i'd appreciate if show me how correctly. thanks. here's xml button i'd reuse: <button android:width="70dp" android:layout_marginleft="10dp" android:layout_marginright="10dp" /> you should use styles , themes sort of things.

windows - How to inhibit communication with PS/2 keyboard with assembly? -

the host has ultimate control on bus , may inhibit communication @ time pulling clock line low. how pull clock line low in assembly , release in windows? short answer: can't. not on windows nt/2k/xp/vista/7 anyway. the instructions kind of thing blocked nt kernel. security flaw if had access them (a virus disable keyboard example). if really need disable communication on ps/2 bus, have write driver. want in c, not assembler, since quite complicated.

c++ - How to implement CEditListCtrl -

how implement ceditlistctrl?. list control edit capabality (report/grid view). have list view in report view. has values. need extend edit values present in list view. declared class inherits clistctrl. , have handled 2 window messages start , end edit. upon getting messages displaying text box. not getting control inside these message handlers. there way know reason? or there other way implement this. there neat grid controls on code project might help: http://www.codeproject.com/kb/miscctrl/gridctrl.aspx http://www.codeproject.com/kb/library/gridprojects.aspx http://www.codeproject.com/kb/mfc/ultimategrid.aspx

c++ - How to wait until all child processes called by fork() complete? -

i forking number of processes , want measure how long takes complete whole task, when processes forked completed. please advise how make parent process wait until child processes terminated? want make sure stop timer @ right moment. here code use: #include <iostream> #include <string> #include <fstream> #include <sys/time.h> #include <sys/wait.h> using namespace std; struct timeval first, second, lapsed; struct timezone tzp; int main(int argc, char* argv[])// query, file, num. of processes. { int pcount = 5; // process count gettimeofday (&first, &tzp); //start time pid_t* pid = new pid_t[pcount]; for(int indexofprocess=0; indexofprocess<pcount; indexofprocess++) { pid[indexofprocess]= fork(); if (pid[indexofprocess] == 0) // child { // code executed child process // magic here // end exit(0); } else if ...

perl + identify if param is empty value from ARG -

when run following script.pl script no arguments: ./script.pl i not message no arg . why? how identify if $param null value or empty value, same [ -z ksh? #!/usr/bin/perl $param = $argv[0]; if ($param = "") { print no arg; } else { print arg: $param; } because it's not perl. did learn syntax? wrong it. $param = "" assigns empty string $param , that's not want. null spelled undef in perl. to compare strings, use eq operator . you must quote strings: print "no arg" much easier: #!/usr/bin/perl if (@argv) { print 'have parameters'; } else { print q{don't have parameters}; }

Dummy data generator -

can suggest sites can generate dummy data based on requirement testing purposes of project? note: need dummy data usage of vms , physical servers in terms of memory, cpu, disk, i/o utilization in percentage. there site provides utility generate kind of data? check out infochimps , may have sort of data after. if you're looking numbers, should exceptionally trivial generate them yourself.

Clearcase: List labels matching a particular string -

i list available labels matching particular string applied in view. i confirm filter in cleartool find not possible: ct find . -ele "lbtype_sub(my_lab*)" -print would not work (no wildcard in query argument . if cannot use grep in shell pipe, can consider using grep in exec part of find, like in example ? ct find . -kind lbtype -exec "echo %clearcase_pn%|grep my_lab" if not acceptable, need write result in file , process tool (sed?) you have packages windows including unix commands: see so question . of have freeware emulating grep command . if must stay native windows commands, must redirect result in file, and use find ( english translation ).

.net - C# List<> Sort by x then y -

similar list<> orderby alphabetical order , want sort 1 element, another. want achieve functional equivalent of select * table order x, y we have class contains number of sorting functions, , have no issues sorting 1 element. example: public class myclass { public int x; public int y; } list<myclass> mylist; public void sortlist() { mylist.sort( mysortingfunction ); } and have following in list: unsorted sorted(x) desired --------- --------- --------- id x y id x y id x y [0] 0 1 [2] 0 2 [0] 0 1 [1] 1 1 [0] 0 1 [2] 0 2 [2] 0 2 [1] 1 1 [1] 1 1 [3] 1 2 [3] 1 2 [3] 1 2 stable sort preferable, not required. solution works .net 2.0 welcome. do keep in mind don't need stable sort if compare members. 2.0 solution, requested, can this: public void sortlist() { mylist.sort(delegate(myclass a, myclass b) { int xdiff = a.x.compareto(b.x...

ASP.NET MVC Editing A Collection Best Practices - Your Opinion -

given following class, opinion on best way handle create/edit attributes.count can number. public class product { public int id {get;set;} public string name {get;set;} public ilist<attribute> attributes {get;set;} } public class attribute { public string name {get;set;} public string value {get;set;} } the user should able edit both product details (name) , attribute details (name/value) in same view, including adding , deleting new attributes. handling changes in model easy, what's best way handle ui , actionmethod side of things? use formcollection , iterate through key/value pairs. presumably can use naming scheme allow determine key/value pairs belong attribute set. [acceptverbs( httpverb.post )] public actionresult whatever( formcollection form ) { .... }

c++ - What happens to namespace? -

when dll created out of source code in given namespaces a,b functions a::open,b::open there conflict in calling these function. no, because function names exported dlls c++ mangled names. mangled names include namespace, there no conflict.

jobs - Did you ever get an unexpected answer during interview? -

when interviewing programming position, did ever answer question didn't quite expect? answer could've been quite smart didn't know or could've been dumbest answer never expected. i'm expecting technical type of questions interesting fine. q: "do have weaknesses?" a: "kryptonite"

javascript - TinyMCE Plugin building -

i working on modifying existing spell check plugin tinymce. this supposed happen: 1. user hits "space" , spell check runs. 2. if word spelled wrong word gets wrapped span , gets red underline what find happening when user hits space bar word spell checked cursor pops end of word typed (instead of space is) (you can see in action @ http://mail.solidhouse.com/webmail2/test.html ) here pseudcode: var b = this.editor.selection.getbookmark(); //for each node node.nodevalue.replace(r5, '$1$2'); this.editor.selection.movetobookmark(b); what suspecting movetobookmark keeps cursor within element have no idea remedy this. (i have tried incrementing b.start , b.end did not work) i know hard explain. thoughts on appreciated. try incrementing bookmark start/end 2 instead of 1 if haven't already. since underline adds tag around mispelled words, that's additional 2 places need accounted in bookmark: 1 each side of span.

design - Communication between client class library and web service / web service and server class library -

wondering others / best practice communicating between layers. question relates communication between layers 2-3 , 3-4. our basic architecture (in order) follows: ui front end business classes web services back end business classes dal the web services façade include logging , authentication end class libraries. as such, web service passed request object includes parameters required web method along user credential (the user credential example stored in base class need pass webservice) , responds response objects (has things such status , message, if failed etc along object required) both request & response use custom generic class/or interface 1 result returned, otherwise class needs created. sometimes makes sense response object @ layer 4 (though don't use request object unless lot of parameters need pasaws), in case have adapter class in layer 3 returns client. consistency have considered doing time, though think may overkill. so iterate question, best ...

Lucene QueryParser -

does lucene queryparser.parse(string) still work? if deprecated, new syntax? query query = queryparser.parse("ophelia"); thanks tatyana not sure of exact api, it's changed instance object. queryparsers instance objects. var qp = new queryparser(new standardanalyzer(),fields); qp.parse(inputstring,fields);

design patterns - Advice on designing loosely-coupled complete systems? -

how 1 design loosely-coupled systems may require data each-other don't belong in same category? for instance, lets take old pet-shop example one-step further , create pet-store franchise. each pet-store has own website listing contact information, promotions, , current stock. the franchise owners want have listing of franchised pet-stores along contact information , possibly few photos available on corporate site. want able update information, , have updates pushed automatically both-ways. want provide promotions information stores' sites in automated way. so, in instance stock lists "owned" stores, , contact information part-"owned" both entities, , promotion information "owned" hq. due arbitrary reasons data can't stored in same place. are there best-practices or common strategies coping situation this? i've been thinking problem, , express saying relationships between classes contextually determined. , model assumes ...