Posts

Showing posts from February, 2012

easiest way to undo one file change in svn -

let's have following situation: myrepo/ foo.txt bar.txt baz.txt quux.txt bingo.txt in rev 419, changed foo.txt, bar.txt, , bingo.txt. now discover error , keep foo.txt rev 418, leave changes in bar.txt , bingo.txt rev 419 intact, can commit rev 420 foo.txt same rev 418. how can minimum of hassle? this how, have rolled changes of previous commit. the reverse merge : svn --revision (version revert):(version below it) <. or filename> svn merge --revision 419:418 foo.txt svn commit -m "reverting commit ver:419 foo.txt"

c++ - Debugging error in STL -

i have 1 big problem using stl, c++ , visual studio. when use std or stl functions (in debug compilation) have errors "incorrect format specifier" . but code large "hand searching" error. maybe 1 know how finding error, __file__ & __line__ assert? because code of program large. or try & catch last hope?... with respect alex since have source code stl, set breakpoint @ point "incorrect format specifier" string located. grep (eg find in files) string, set breakpoint @ each one, run program , hope death. :)

python - Problem with Arduino and pySerial -

i got problem. bought arduino uno board. tried make funny controlling input computer. used python pyserial , program following: arduino = serial.serial(portacom, 9600, timeout = 1) ... in loop -> arduino.write(value) def sliderupdate(self, event): pos = self.slider.getvalue() arduino.write(pos) time.sleep(.1) print arduino.readline() try: arduino = serial.serial(portacom, 9600, timeout = 1) except: print "errore di connessione alla porta seriale" the write value should send value board though usb. program loaded on board is: const int ledpin = 11; byte brightness; void setup(){ serial.begin(9600); pinmode(ledpin, output); } void loop(){ while(serial.available()){ brightness = serial.read(); serial.print(brightness); analogwrite(ledpin, brightness); //led doesn't refresh brightness delay(10); } } my led working properly. tried fade example provided

java - eclipse tomcat: take the classpath from the project -

i have java web project in eclipse , want define tomcat server. seems in tomcat server must define again classpath. how can tell tomcat use classpath project (shouldn't obvious?). unfortunately jars scattered around , headache add them 1 one tomcat configuration , maintain this. you don't have tell tomcat jars scattered around places. can taken care eclipse. configure eclipse build path properly. create libraries (in eclipse) , group jar together. try export war , check if eclipse packaging required jars in web-inf/lib.

Where does rails source file locate? -

hey guys i'm new rails, read reading source code way study rails, , found related rb file in rails' online document, such this page can't find rails source file locate in mac, me out? easiest way online @ github repo if want browse locally, can (depending on version of rails) bundle show rails rails 3.0, tell it's installed. for rails 2.3.x need find out gem installed , open up. if you're using rvm instance somewhere in ~/.rvm

Error occured while export data from excel -

i getting error while exporting data excel sheet. code response.clear() response.addheader("content-disposition", "attachment;filename=completiondatesreport.xls") response.charset = "" response.cache.setcacheability(httpcacheability.nocache) response.contenttype = "application/vnd.xls" dim stringwrite stringwriter = new stringwriter() dim htmlwrite htmltextwriter = new htmltextwriter(stringwrite) griddata.rendercontrol(htmlwrite) response.write(stringwrite.tostring()) response.end() error internet explorer cannot download abc.aspx www.xyz.com. internet explorer not able open internet site.the requested site either unavailable or cannot found.please try again later. remove line no 4 response.cache.setcacheability(httpcacheability.nocache) it work.

How to get src of from image -

i have text box value <img src="http://localhost/wp/review/wp-content/uploads/2010/11/sunset.jpg" /> i have replace text box value 'http://localhost/wp/review/wp-content/uploads/2010/11/sunset.jpg' main target remove img tag , keep src value. thanks ashok negi strip 10 characters beginning , 4 characters end. or use html parser.

algorithm - Efficient way to count occurrences of a key in a sorted array -

this asked in on-site microsoft interview. count number of occurrences of given key in array. i answered linear search because elements may scattered in array. key found in beginning , @ end. need scan entire array. next asked if array sorted? thought while , said i'll use linear search again. because repetitions of key if present can anywhere in array. optimization said if first , last array elements same can take array length answer. is analysis correct in both cases? example: input = [0 0 1 1 1 2 2 3 3], key = 1, answer = 3 input = [0 0 2 2 3 3], key = 1, answer = 0 for unsorted array there not can other linear search. for sorted array can in o(logn) using modified binary search: find index of first occurrence of key , call f . find index of last occurrence of key , call l . if key exists in array l-f+1 answer. finding first occurrence: arr[i] first occurrence of key iff arr[i] == key and either i == 0 ( it's first el

javascript - scriptaculous: onmouseover /onmouseout for several ids and flickering problem -

hi want have same event happen different images , write code line 1 time in .js file. should basic can't find easy guide. this 1 sample of code, , have @ least 2 times per page: <ul class="car-slide"> <li onmouseover="$('fp1').fade( {duration:.2, from:1, to:0.8 }); return false;" onmouseout="$('fp1').appear( {duration:.2}); return false;"><img src="{{skin url='myimage1'}}" id="fp1"></li> <li onmouseover="$('fp2').fade( {duration:.2, from:1, to:0.8 }); return false;" onmouseout="$('fp2').appear( {duration:.2}); return false;" style="border-left:1px solid #000;border-right:1px solid #000;"><img src="{{skin url='myimage2'}}" id="fp2"></li> <li onmouseover="$('fp3').fade( {duration:.2, from:1, to:0.8 }); return false;" onmouseout="$('fp3&

database - How to create Teechart in VB6? -

how create teechart in vb6? you should follow tutorial using tee chart in vb 6.0 http://www.steema.com/files/public/teechart/java/v1/docs/tutorials/tutorial6.htm

c# - Custom message for Object reference not set to an instance of an object -

hi have huge windows application poor exception handling. application throw object reference error lot of places , system error message showing users using message boxes. i looking simple solution can used replace message user friendly entire application thanks... @anz: not use exception handling in every in code keep in mind , must know meaning of different type of exception. in scenario getting "object reference exception" , main reason of exception not checking null while accessing variable like exa_1:- dataset ds; now if acces ds.table.count() give exception, here should use dataset ds; if(ds!=null) { int val = ds.table.count(); } exa_2:- string strvariable=txtinput.text; int number = convert.int32(strvariable); // here if txtinput.text empty them through exception here can use if(!string.isnullorempty(strvariable)) int number = convert.int32(strvariable); and if want show custom message in exception handle can

c++11 - Why does the C++ standard not prohibit such a dreadful usage? -

the source code simple , self-evident. question included in comment. #include <iostream> #include <functional> using namespace std; using namespace std::tr1; struct { a() { cout << "a::ctor" << endl; } ~a() { cout << "a::dtor" << endl; } void foo() {} }; int main() { a; /* performance penalty!!! following line implicitly call a::dtor 6 times!!! (vc++ 2010) */ bind(&a::foo, a)(); /* following line doesn't call a::dtor. obvious that: when binding member function, passing pointer first argument (almost) best way. now, problem is: why c++ standard not prohibit bind(&someclass::somememberfunc, arg1, ...) taking arg1 value? if so, above bind(&a::foo, a)(); wouldn't compiled, want. */ bind(&a::foo, &a)(); return 0; } first of all, there third alternative code

c# 4.0 - Can we use DefaultIfEmpty to show a default image? -

i have album task need show images db. supposing there no matching image in db, can use defaultifempty select default image? edit: defaultifempty has suitable overload. you can't provide default value firstordefault() use: // select first image, or default otherwise var image = query.firstordefault() ?? defaultimage; or write own overload of firstordefault does accept default, of course. this: public static t firstordefault<t>(this ienumerable<t> source, t defaultvalue) { // ever iterate once, of course. foreach (t item in source) { return item; } return defaultvalue; }

autoscrolling memo in delphi -

does delphi contain component allows auto scroll text loaded db, in news sites? tt's delphi 7 application , requires vertical scrolling. none of solutions scrolling worked me in richedit memo. using delphi 2010 + w7. 1 works perfectly: after every lines.add('...') follows: sendmessage(richeditmemo.handle, wm_vscroll, sb_linedown, 0); found in: http://www.experts-exchange.com/programming/languages/pascal/delphi/q_10120212.html

ruby - Test method that was called from other method -

i have module database method generate_from_database spins loops , calls method get_length. how can test if get_length called n times, using rspec or mocha? module database class length < activerecord::base def get_length(i,j) ... end end def database.generate_from_database ... in 0...size j in 0...size length.new.get_length(i+1,j+1)) end end this: mock_length = mock("length") length.should_receive(:new).exactly(n).times.and_return(mock_length) mock_length.should_receive(:get_length).exactly(n).times should work.

Why are the bounds of type parameters ignored when using existential types in Scala? -

what mean this: scala> class bounded[t <: string](val t: t) defined class bounded scala> val b: bounded[_] = new bounded("some string") b: bounded[_] = bounded@2b0a141e scala> b.t res0: = string why res0 have type , not string? sure know b.t @ least string. writing val b: bounded[_ <: string] = new bounded("some string") works, redundant respect declaration of class itself. first, have edited question title. not using dependent types, scala doesn't have anyway, existential types. second, not inferring anything, explicitly declaring type. now, if did write bounded[any] , scala wouldn't let you. however, 1 of uses of existential types deal situations type parameter unknown -- such java raw types, where. so guess making exception in situation seems obvious enough break other situation existential type way deal something.

java - Collada and Jogl -

i creating wwj (world wind java sdk) based application. want import collada objects , looking library parse , render collada objets. found xith3d, java game 3d engine, able render collada objects, looking in code impossible use in existing application. can point me look. there library/engine can used load collada model , use in existing jogl applicaiton. thank you. ardor3d supports collada have tinker little bit if don't want use whole engine.

html - Embedded Youtube video problem on iPhone -

so have uiwindow has custom properties. have transparent uiwebview on top of window. have embedded youtube video. problem when user presses video starts off , custom properties of uiwindow still visible while youtube video plays. anyone knows how can notified when user starts youtube video , can hide customizations on parent view? note, youtbe video embedded using html. not using native youtube.app. i think you're maybe missing uiview layer. hierarchy should uiwindow->uiview->uiwebview, , customization should happen on uiview layer of that. problem. what custom properties stay visible? shouldn't need notified of in-app youtube player appearing. presented modal view controller.

regex - Looking for correct Regular Expression for csplit -

i have file contains several lines these: 1291126929200 started 88 videolist15.txt 4 4 1291126929250 59.875 29.0 29.580243595150186 43.016096916037604 1291126929296 59.921 29.0 29.52749417740926 42.78632483544682 1291126929359 59.984 29.0 29.479540161281143 42.56031951027556 1291126929437 60.046 50.0 31.345036510255586 42.682281485516945 1291126932859 started 88 videolist15.txt 5 4 i want split files every line contains started (or videolist , not matter). the following command produces 2 output files: $ csplit -k input.txt /started/ however expect lot more, can seen in: $ grep -i started input.txt |wc -l $ 146 what correct csplit command? thanks just add {*} @ end: $ csplit -k input.txt /started/ {*} the man page says: {*} repeat previous pattern many times possible. demo: $ cat file 1 foo 2 foo 3 foo $ csplit -k file /foo/ {*} 2 6 6 4 $ ls -tr xx* xx03 xx02 xx01 xx00 $ csplit --version csplit (gnu coreutils) 7.4

jquery - Problem using dynamically added html-object from javascript -

i have problem dynamically including object-tag in html. have external service call html-fragment, includes object-tag, script , simple html-form. take content , add div in page , try execute script uses included object. when debug using firebug can see code correctly inserted in page script gets error when tries access object. seems me object isn’t initialized. let me show code exemplify mean. getfragment makes ajax call using jquery content. var htmlsnippet = requestmodule.getfragment( dto ); $('#plugin').html( htmlsnippet ).hide(); the included content in plugin-div looks this <div id="plugin" style="display: none; "> browser: chrome <object name="signer" id="signer" type="application/x-personal-signer2"></object> <form method="post" name="signerdata" action="#success"> <input name="nonce" value="asyhs..." type="hidd

java - Does JOSSO provide any user management itself? -

i've been asked use josso provide sso set of web apps have own authentication , authorization systems. part of project creating master source of user information , permissions including administrative tasks creating users, assigning permissions, deleting users, resetting passwords, etc. my impression of working josso far provides bridge between master authentication source (ldap, rdbms, etc.) , end applications not provide management of master authentication. the josso 1.7 release notes mention new "ajax user management application" sounds might need, can't further documentation it. does josso provide user management itself? there sso system does? it seems provide such management. in mentioned release notes written more "offers web-based management of user , roles". the topic demonstrated in josso 2 tutorial , internal "identity vault" created , users configured in josso management application.

Doxygen: how to describe class member variables in php? -

Image
i'm trying use doxygen parse php code xml output. doxygen not parse description of class member variables. here sample php file: <?php class { /** * id on page. * * @var integer */ var $id = 1; } ?> note comment has brief description , variable type. here xml got source: <?xml version='1.0' encoding='utf-8' standalone='no'?> <doxygen xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:nonamespaceschemalocation="compound.xsd" version="1.7.2"> <compounddef id="class_a" kind="class" prot="public"> <compoundname>a</compoundname> <sectiondef kind="public-attrib"> <memberdef kind="variable" id="class_a_1ae97941710d863131c700f069b109991e" prot="public" static="no" mutable="no"> <type></type> <definition>$id</defin

Smarty : substr a variable -

how can print first n characters of smarty variable, e.g. first 30 characters of {$var}? you should use truncate modifier: {$var|truncate:30} more information here .

How Update does work for iPhone App? -

i know how updates work apple store. does apple delete old data related old version of application , update newer one? when user updates new version of application, older version deleted iphone data ( pictures, database, sound,etc) , replaced newer version or not? i updated application few days ago, , think apple not replace old sqlite database newer one. during update old application bundle replaced new one. other folders , contents in application sandbox (documents, library, tmp) remain untouched. so if want replace old database (if must save data changed users in old database) need check database version in app , copy new 1 application bundle if version old (you can use sqlite user_version pragma version tracking)

won't let me delete rows in sql server 2005 management studio -

Image
i want delete null rows, tried use them , wont let me edit them, same error trying delete or edit them. the problem being there number of rows nulls, when try , delete 1 row complain row not unique, maybe try sql statement delete rows, such delete sop order null i have not been able test query should work you.

matlab - Evolution strategy with individual stepsizes -

Image
i'm trying find solution evolution strategy 30 dimensional minimization problem. have developed success simple (1,1) es , self-adaptive (1,lambda) es 1 step size. the next step create (1,lambda) es individual stepsizes per dimension. problem matlab code doesn't work yet. i'm testing on sphere objective function: function f = sphere(x) f = sum(x.^2); end the plotted results of es 1 step size vs. 1 individual stepsizes: the blue line performance of es individual step sizes , red 1 es 1 step size. the code (1,lambda) es multiple stepsizes: % strategy parameters tau = 1 / sqrt(2 * sqrt(n)); tau_prime = 1 / sqrt(2 * n); lambda = 10; % initialize xp = (ub - lb) .* rand(n, 1) + lb; sigmap = (ub - lb) / (3 * sqrt(n)); fp = feval(fitnessfct, xp'); evalcount = 1; % evolution cycle while evalcount <= stopeval % generate offsprings , evaluate = 1 : lambda rand_scalar = randn(); j = 1 : n osigma(j,i) = sigmap(j) .* exp

synchronization - Auto-update iPhone content -

i developing enterprise app has lot of dynamic content. there way have app auto update content(new stories, download new videos, etc) @ 3am every sunday. is possible? while it’s not possible when app isn’t running, can @ launch or while running (if it’s going running @ 3 am). here’s i’d do: store nsdate using nsuserdefaults last time updated. at launch, if 3 period has passed since date, initiate sync. also @ launch, start nstimer long interval—5 minutes or so. @ each firing, check if 3 period has passed , if has, initiate sync. roll last bullet’s code nstimer ’s firing method , run once @ launch. sure update nsdate object each time. in application delegate, in methods called returning background, check time , sync if necessary—or start nstimer , have fire first. that should cover of scenarios need update app.

sybase - How do I set a default datetime parameter in a stored procedure? -

i have declared stored procedure in sybase, , 1 of parameters of type datetime. want assign datetime default value. here's declaration: create procedure procedure ( @fromdate datetime = getdate() ) ... however sybase giving me error number (102) severity (15) state (1) server (server) procedure (procedure) incorrect syntax near '('. is possible this? if not, there workaround? you can not use function call in default variable assignment (as found out). set default null, , put assignment first thing in stored procedure. create procedure procedure ( @fromdate datetime = null ) begin set @fromdate = coalesce( @fromdate , getdate() ) end

mysql left join order by null values to the end -

mysql select * media left join media_priority on (media_priority.media_id = media.id , media_priority.media_tag = '".$tag."') = 'something' order media_priority.media_order; this works fine except media_priority.media_order comes null , mysql puts null values @ top. so trying figure out how null tempcol statement left join can order first.....i can't seem syntax right. where put null statement in query above? i thinking like: left join media_priority on (media_priority.media_id = media.id , media_priority.media_tag = '".$tag."') media_priority.media_order null isnull but doesn't work. order case when media_priority.media_order null 1 else 0 end, media_priority.media_order; or use magic number if have upper limit media_order never feasibly reach. order coalesce( media_priority.media_order,99999999); the first approach safer!

objective c - How do I wait for an asynchronously dispatched block to finish? -

i testing code asynchronous processing using grand central dispatch. testing code looks this: [object runsomelongoperationanddo:^{ stassert… }]; the tests have wait operation finish. current solution looks this: __block bool finished = no; [object runsomelongoperationanddo:^{ stassert… finished = yes; }]; while (!finished); which looks bit crude, know better way? expose queue , block calling dispatch_sync : [object runsomelongoperationanddo:^{ stassert… }]; dispatch_sync(object.queue, ^{}); …but that’s maybe exposing on object . trying using dispatch_sempahore . should this: dispatch_semaphore_t sema = dispatch_semaphore_create(0); [object runsomelongoperationanddo:^{ stassert… dispatch_semaphore_signal(sema); }]; dispatch_semaphore_wait(sema, dispatch_time_forever); dispatch_release(sema); this should behave correctly if runsomelongoperationanddo: decides operation isn't long enough merit threading , runs synchronously inste

types - Defining a datatype in Haskell -

greetings, new haskell , i've gotten stuck in defining datatype assignment. i need create "strategy" type, it's string 1-6 characters each representing numeric value, , must represent values greater 9 letter (up 35 total different values), tried defining auxiliary type representing each possible value , using create type, code isn't working , have ran out of ideas. definition have been trying: data value = '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' | 'a' | 'b' | 'c' | 'd' | 'e' | 'f' | 'g' | 'i' |'j' | 'k' | 'l' | 'm' | 'n' | 'o' | 'p' | 'q' |'r' | 's' | 't' | 'u' | 'v' | 'w' | 'y' | 'x' | 'z' data strategy = value | value:value | value:value:value | value:value:value:value |

How can I use an F# type with generics in Silverlight 4 and XAML? -

take f# following code: type blah<'t>(objects : 't array) = // whatever when try use type in xaml document, there no type associated generic parameter, , it's ugly. think compiler complains, too: <ns:blah foo="bar"/> so, try alias type (at bottom of blah.fs file): type stuffblah = blah<stuff> then when use in same way in xaml document, type not found exist: <ns:stuffblah foo="bar"/> why that? there cleaner, more elegant way this? i'm still getting hang of silverlight, xaml, , f#, advice appreciated. thanks. the reason stuffblah version doesn't work particular piece of f# syntax creates type alias f# project vs. creating actual type. since name not visible @ il level actual type not accessible silverlight or xaml in general. one way work around create stuffblah first class type derives stuff<'t> . not ideal @ work.

html - IE7 footer overlap -

my website has footer overlap in ie7, while fine in later browsers. here's link: http://www.kindreviews.com i have tried finding solution via google, answers seem variant. please help! thanks, zeem i have site layout bit messy: container divs smaller widths , heights contents, many negative margings, , like.. for instance, div #cuber_div containing flash banner, having height set 515px, overlapping text, upper part of text isn't selectable. besides, #footer div outside of #wrapper div, relative positioning in buggy browsers such ie < 8 gets messed up. my personal suggestion fix mark-up , re-style whole site scratch. may take time, far less keeping site , having break every once in while seemingly no reason, , go figure.. it's decide.

xslt - XSL substring and indexOf -

i'm new xslt. wonder if possible select substring of item. i'm trying parse rss feed. description value has more text want show. i'd subtring of based on index of substring. basically, want show result of substring call passing indxof('some_substring') , length parameters. possible? from comments : i want select text of string located after occurrence of substring it's not clear want index of substring [update: clearer - thanks] may able use function substring-after or substring-before : substring-before('my name fred', 'fred') returns 'my name ' . if need more detailed control, substring() function can take 2 or 3 arguments: string, starting-index, length. omit length whole rest of string. there no index-of() function strings in xpath (only sequences, in xpath 2.0). can use string-length(substring-before($string, $substring))+1 if need position. there contains($string, $substring) . these documente

'To' field when parsing email in Python -

i'm using python standard library's email module parse email. allows me determine sender: msg = email.message_from_string(data) sender = msg.get_unixfrom() but i'm having trouble determining mail for. thoughts? you can access headers of message by index , e.g. msg["from"] . in case of recipient, use msg.get_all("to") because there might multiple values. also note following: headers stored , returned in case-preserving form matched case-insensitively.

How do i list all children terms of related term in Drupal Views -

i'm struggling trying find answer , have spent 6 hours searching , messing around in views. let me explain. i have 2 taxonomy vocabularies: catalog , fabric. have list of fabrics in fabric in hierarchical structure similar following: seasonal-2010 -company --fabric designer ---fabric collection ----fabric name seasonal-2009 -company --fabric designer ---fabric collection ----fabric name in catalog vocabulary have catalog categories: christmas, spring, summer etc. have related (using taxonomy vocabulary relate module), christmas term in catalog seasonal-2010 term in fabric. what trying pass in term id christmas , display list of fabric names in category. need termid related terms children related terms. i've made view outputs related term, need children. in different view can immediate children (ie company) not children , on. have suggestion? i don't know answer... can use node hierarchy module. module hierarchical view.hope out.

html - JavaScript switch not executing -

i have simple javascript code. switch not executed, reason, mystery me! stupid error have made? function hndlev ( e ) { switch ( document.forms[0].zcode.length ) { case 1: document.forms[0].zcode.style.backgroundcolor = "ffcc33"; break; case 2: document.forms[0].zcode.style.backgroundcolor = "ffff33"; break; case 3: document.forms[0].zcode.style.backgroundcolor = "ccff33"; break; case 4: document.forms[0].zcode.style.backgroundcolor = "66ff33"; break; case 5: document.forms[0].zcode.style.backgroundcolor = "00ff33"; break; } } ... <body onload="setfocus();" onkeypress="hndlev(event);"> ... <input type="text" name="zcode" size="6" maxlength="6" class="code" /> function hndlev ( e ) { switch ( document.forms[0].zcode.value.length ) { case 1: document.forms[0].zcode.style.backg

java - Tomcat webapp error - application started thread [AWT-Windows] but has failed to stop it - memory leak? -

i didn't notice until today during testing locally on pc, tomcat had posted error in log file. i'm using tomcat 6.0.29 , java jdk 1.6. dec 1, 2010 12:36:57 pm org.apache.catalina.core.standardcontext reload info: reloading context has started dec 1, 2010 12:36:57 pm org.apache.catalina.loader.webappclassloader clearreferencesthreads sever: web application [/autospyder] appears have started thread named [awt-windows] has failed stop it. create memory leak. what? i've never seen before. checked log file yesterday, , sure enough, error there too. don't quite understand what's causing this. can assume have 1 of servlets uses objects java.awt package? if so, how pinpoint code causing this? edited add thread dump 2010-12-01 14:28:18 full thread dump java hotspot(tm) client vm (17.1-b03 mixed mode, sharing): "jmx server connection timeout 34" daemon prio=6 tid=0x03069400 nid=0x960 in object.wait() [0x0461f000] java.lang.thread.state: time

asp.net mvc - MVC 3 - Posting partial view to a chosen controller -

i'm trying learn mvc 3 , razor coming asp.net background. i've want simple partial view (in shared folder) post specific controller can re-use elsewhere such articles, blogs etc. tried using variations of following. @using (html.beginform("create", "comment", formmethod.post, new { })) { <div> <fieldset> <legend>comments</legend> <div > @html.labelfor(m => m.name) @html.textboxfor(m => m.name) </div> <div > @html.labelfor(m => m.email) @html.textboxfor(m => m.email) </div> <div > @html.labelfor(m => m.body) @html.textboxfor(m => m.body) </div> <p> <input type="submit" value="create"

Excel 2003 VBA - Locate Date & Move Relevant data -

i need automate process that's not one-off event, ~500 facilities, each 100+ assets scheduled different dates throughout year completion. have workbook set main/source sheet 12 month sheets (jan, feb, march, ... dec). need sort of code allow me search particular date , send other same-row corresponding data appropriate sheet. for example have asset due maintenance in june, 6/17/11. need excel search using month only, , moving asset it's name, description, cost, etc june tab. ive managed locate assets searching "6/" cannot find assets date of 6/17/11. copies needed data , attempts move proper sheet, when makes attempt microsoft visual basic error code 400 pops up. ideas? appreciated. see if helps ... private sub findcells() '' step 1, find rows containing date (june 2011 dates hardcoded in example) dim collectionofrowranges new collection dim ws worksheet dim rgcell range each ws in thisworkbook.worksheets each rgcel

C# Enum using values in Sql Server table -

at moment have sql server 2005 table looks bit like: id | name | desc ---------------------- 1 | 1 | value 1 3 | 3 | value 3 5 | 5 | value 5 this table corresponds enum in c# looks like: enum msgtypes{ <summary>value one</summary> 1 = 1, <summary>value three</summary> 3 = 3, <summary>value five</summary> 5 = 5 } so question this: there way associate enum sql table changes/additions values in table don't need manually made in c# code? if want dynamic, why make enum start with? fetch details table on app startup, , remember them in (say) dictionary<int, string> . encapsulate value within own value type enforced range, if wanted to. alternatively, if don't mind recompiling, fetch @ build time , autogenerate enum source code.

css - Best option for embedding fonts in webpage (SEO, speed, cross-compatibility) -

i have font i've downloaded, true type font. i'm developing own portfolio website i'd high in google (i can seo it) i'm wondering options have using font menu items, headings, etc..i've checked out cufon wont let me upload because wasn't valid. i'd rather not use flash..what other options have got? fontsquirrel best font converter. free service creates css you. http://fontsquirrel.com

wcf - IParameterInspector Identify a REST Service -

i planning add wcf behavior web services(soap + rest) in solution. plan use same iparameterinspector implementation. there way in implementation can identify if request call wcf service or rest service. i found solution below //to identify if rest service. //action null in case of rest service bool isrestservice = string.isnullorempty(operationcontext.current.incomingmessageheaders.action);

model view controller - spring mvc @requestmapping best practice -

checked official ref, found million ways things. guess have 2 set of use cases. 1. return customized http response, responsible filling in status code, response body(either xml or json or text). 2. return model , view. view jsp page typically , fill in view data modle. my question better way go? possible mix them together. in first use set, possible return view? possible have both on them in 1 method. if return customized http response, if b return modelandview. thanks! the return value request handling method ( i.e. on marked @requestmapping annotation must either identify view (that generate http response) or generate http response itself. each handler method stands alone; mean, can return view name handler methods , generate http response in other handler methods. check out 15.3.2.3 supported handler method arguments , return types in spring 3x reference document @ http://static.springsource.org/spring/docs/3.0.x/spring-framework-reference/html/ as opti

How to add events to templated control in silverlight? -

bounty rewarded solid tutorial/learning resources regarding wiring events templated controls. i have control template this: <style targettype="local:datepicker"> <setter property="template"> <setter.value> <controltemplate targettype="local:datepicker"> <border background="{templatebinding background}" borderbrush="{templatebinding borderbrush}" borderthickness="{templatebinding borderthickness}" x:name="mydatepickercontentarea"> <stackpanel orientation="vertical"> <button x:name="mytestbutton" content="test button" /> <telerik:raddatepicker style="{staticresource visitsreporttextboxstyle}" foreground="#ffffff" x:name="startdate" datetimewatermarkcont

function - PHP - eval code from DB -

there have been hundreds if not thousands of posts concerning use of php's eval(); run code database. through searching have not found answer question (explained shortly). firstly i'll introduce application. i have 3 records of valid code stored in database: eg: ['code1'] $num1 = 1; $num2 = 3; $num3 = $num1+$num2; //4 ['code2'] $num4 = $num3; //4 $num5 = 5; $num6 = $num4+$num5; //9 ['code3'] $num7 = $num4; //4 $num8 = $num6; //9 $num9 = $num7+$num8; //13 echo $num9; //13 next have function call , run record: eg: function runcode($codename) { // assume db connection established $result = mysql_query("select `code` codestore `name` = '".$codename."'"); if ($result) { // fetch 1 row $row = mysql_fetch_assoc($result); if (!$row) { die('no rows returned.'); } else { return eval($row['code'])

for loop - Parsing a string to a Java method -

i'm new java, i'm sorry if answer seems obvious... i've written method in class follows: private static final string[] rcode = {"m", "cm", "d", "cd", "c", "xc", "l", "xl", "x", "ix", "v", "iv", "i"} private int getcharvalue(string code) { // loop through codes find // matching code, if found exit loop (via return). (int position = 0; position < rcode.length; position++) { if (rcode[position] == code) return rval[position]; } // // otherwise return 0 return 0; } // getcharvalue in method of same class looping through characters of string follows: string number = "mmmcdxxxiv"; (int pos = 0; pos < number.length(); pos++) { system.out.println(number.substring(pos, pos + 1) + " " + getcharvalue(number.substring(pos, pos + 1))); } // my problem while getcharva

ios4 - iPhone app has issues only if 3GS users upgrade in iTunes? -

an upgrade app went live in itunes. 3gs iphones seem having issue if 3gs did upgrade of app. if 3gs iphone fresh download or deletes app , downloads it, fine. i'm wondering if have missed coding perspective should have prevented issue? i used several 3gs iphone testers. same 3gs iphones tested adhoc fine, have upgrade issue. iphone 4s have no issues whether downloads new or upgrades. is there chance upgrade not replacing previous version of there app? is there xcode setting ensure such thing? or kind of fluke? i have upgraded other apps in past similar functionality , had no issues. did had breaking changes in app data formats? if remember correctly, itunes upgrades backup app data on device , restores after upgrade.

jQuery repeat animations within functions -

i have simple flash animation trying rebuild jquery. have 5 animations chained start 1 after another. after animations fire, need pause 5 seconds, clear , begin animation again. need do indefinitely. here code: $(".bars").ready(function() { $(".barone").animate({ 'height': '49px' }, 2000, function() { $(".bartwo").animate({ 'height': '112px' }, 2000, function() { $(".barthree").animate({ 'height': '174px' }, 2000, function() { $(".barfour").animate({ 'height': '236px' }, 2000, function() { $(".barfive").animate({ 'height': '298px' }, 2000, function() { $('.bars div').delay(5000, function() {

python unicode support -

i'm trying figure out how use unicode support in python; convert string unicode : "abcde" --> "\x00a\x00b\x00c\x00d\x00e" any built-in functionnality can that, or shall use join() ? thanks ! that's utf-16be, not unicode. >>> 'abcde'.decode('ascii').encode('utf-16be') '\x00a\x00b\x00c\x00d\x00e'

Caching Fluent NHibernate ISessionFactory -

we're building mobile application, , we're evaluating nhibernate + fluent use it. problem is, first time create isessionfactory, takes full 2 minutes. though table structure simple (3 tables). each call after extremely fast. what i'd either cache isessionfactory between application restarts, or somehow speed creation of in first place. any ideas on if it's possible cache? reading, there's not speeding up. you can serialize , save configuration , load second time around reduce time takes create. tho if make changes need blow away old config , serialize new version, otherwise loading old configuration. i can't remember code tho, try dig example. edit: http://vimeo.com/16225792 in video @ 24 minutes in ayende discusses configuration serialization.

php - Cakephp Custom Datasource Save/Update -

using latest cakephp build 1.3.6. i'm writing custom datasource external rest api. i've got read functionality working beautifully. i'm struggling model::save & model::create. according documentation, below methods must implemented (see below , notice not mention calculate). these implemented. however, getting "fatal error: call undefined method apisource::calculate()". implemented apisource::calculate() method. describe($model) listsources() @ least 1 of: create($model, $fields = array(), $values = array()) read($model, $querydata = array()) update($model, $fields = array(), $values = array()) delete($model, $id = null) public function calculate(&$model, $func, $params = array()) { pr($model->data); // post data pr($func); // count pr($params); // empty return '__'.$func; // returning __count; } if make call model $this->save($this->data) it calling calculate, none of other implemented met

codeigniter - Code Igniter - form_dropdown selecting correct value from the database -

im having few problems form_dropdown function in codeigniter .... application in 2 parts, user goes in, enters form , submits .... once submitted admin can go in , edit persons form , save database. so, display dropdown in initial form, im using following ( options in dropdown coming database ) model: function get_salaries_dropdown() { $this->db->from($this->table_name); $this->db->order_by('id'); $result = $this->db->get(); $return = array(); if($result->num_rows() > 0){ $return[''] = 'please select'; foreach($result->result_array() $row){ $return[$row['id']] = $row['salaryrange']; } } return $return; } then in controller: $data['salaries'] = $this->salary_expectation->get_salaries_dropdown(); then view: <?php echo form_dropdown('salaries', $salaries, set_value('salaries', $salaries)); ?>

visual c++ - how to make the cmd window go away when running a system command in c++ -

i using c++.net , program needs make directory i system command system("mkdir"); but when command in gui program cmd window comes in , disapears again there way command without window showing up? or there easier way make directory in c++? thanks luck createdirectory ( http://msdn.microsoft.com/en-us/library/aa363855%28vs.85%29.aspx ) easier way, though have create intermediate directories yourself. alternatively can use createprocess launch console flag create_no_window (and remember wait process terminate).

Implementing a Measured value in Scala -

a measured value consists of (typically nonnegative) floating-point number , unit-of-measure. point represent real-world quantities, , rules govern them. here's example: scala> val oneinch = measure(1.0, inch) oneinch : measure[inch] = measure(1.0) scala> val twoinch = measure(2.0, inch) twoinch : measure[inch] = measure(2.0) scala> val onecm = measure(1.0, cm) onecm : measure[cm] = measure(1.0) scala> oneinch + twoinch res1: measure[inch] = measure(3.0) scala> oneinch + onecm res2: measure[inch] = measure(1.787401575) scala> onecm * onecm res3: measure[cmsq] = measure(1.0) scala> onecm * oneinch res4: measure[cmsq] = measure(2.54) scala> oncem * measure(1.0, liter) console>:7: error: conformance mismatch scala> oneinch * 2 == twoinch res5: boolean = true before excited, haven't implemented this, dummied repl session. i'm not sure of syntax, want able handle things adding measured quantities (even mixed units), multiplying measured q

In Python, how can I send a Queue to a multiprocessing.Process after it has already been started? -

typically like: q = queue() p = process(target=f, args=(q,)) p.start() is there way pass p queue? er... think - can done through q? yes, can done via q . can pass object there, queue included i wouldn't recommend practice, however. describe why need this, maybe there's better design.