Posts

Showing posts from February, 2014

c# - What exactly is "managed" code? -

i've been writing c / c++ code twenty years, , know perl, python, php, , java well, , i'm teaching myself javascript. i've never done .net, vb, or c# stuff. managed code mean? wikipedia describes it as code executes under management of virtual machine and says java (usually) managed code, so why term seem apply c# / .net? can compile c# .exe contains vm well, or have package , give .exe (a la java)? in similar vein, is .net language or framework , , "framework" mean here? ok, that's more 1 question, who's been in industry long have, i'm feeling rather n00b-ish right now... when compile c# code .exe, compiled common intermediate language(cil) bytecode. whenever run cil executable executed on microsofts common language runtime(clr) virtual machine. no, not possible include vm withing .net executable file. must have .net runtime installed on client machines program running. to answer second question, .net framework...

Android Random -

string rank[] = {"tclub1.png", "tclub2.png", "tclub3.png", "tclub4.png", "tclub5.png", "tclub6.png", "tclub7.png", "tclub8.png", "tclub9.png", "tclub10.png", "tclub11.png", "tclub12.png", "tclub13.png"}; random randint = new random(); int b = randint.nextint(rank.length); string d = ("tclub" + b + ".png"); log.v(log_tag, "in value:=" + d); above code. array giving me 1 random index between(0 12)..after m appending make image name. eg(tclub1.png) image name gives me string fromat. how can assign thhis image randomly?? if want load image imageview, can this: string imgname = "tclub1"; // image want load int id = getresources().getidentifier(imgname, "drawable", getpackagename()); imageview.setimageresource(id);

security - Visual Studio 2008 complains about trusted locations. What to do? -

i messing around rhinomocks morning , couldn't run tests because rhinomocks.dll not in "trusted location". assembly in c:\documents , settings\\my documents\visual studio 2008\projects (and on) folder. what's deal? did download zip file internet , extract using standard explorer tools. think marks directory untrusted , visual studio detects this.

ruby on rails - How can I test with a certain word is a link or not with Cucumber? -

i custom step: then should see link 'foo' and opposite: but should not see link 'foo' in page can have like: lorem foo bar or alternatively lorem <a href=''>foo</a> bar i need test when 'foo' link , when isn't. thank you. try (i haven't tried running it, minor tweaks might needed): then /^i should see link "([^\"]*)"$/ |linked_text| # afaik raises exception if link not found find_link(linked_text) end /^i should not see link "([^\"]*)"$/ |linked_text| begin find_link(linked_text) raise "oh no, #{linked_text} link!" rescue # cool, text not link end end

vim - How do you paste multiple tabbed lines into Vi? -

i want paste have cut desktop file open in vi. but if paste tabs embed on top of each other across page. i think sort of visual mode change can't find command. if you're using plain vi: you have autoindent on. turn off while pasting: <esc> :set noai <paste want> <esc> :set ai i have in .exrc following shortcuts: map ^p :set noai^m map ^n :set ai^m note these have actual control characters - insert them using ctrl - v   ctrl - p , on. if you're using vim: use paste option. in addition disabling autoindent set other options such textwidth , wrapmargin paste-friendly defaults: <esc> :set paste <paste want> <esc> :set nopaste you can set key toggle paste mode. .vimrc has following line: set pastetoggle=<c-p> " ctrl-p toggles paste mode

Android emulator fails to start when using scale (Win7 x64) -

my configuration this: windows 7 x64 eclipse helios x64 jdk x64 android sdk r06 when try start emulator eclipse (android sdk setup application) scale parameter fails. second command prompt screen (which think java app) shows exception closes right after. annoying because without scale, wvga emulator not fit on laptop's screen. idea how fix this? and when try start emulator command prompt scale, works. you might able see error log, doing way : open command line window use "cd c:/.../android-sdk/tools" own path start emulator instance here, use command "emulator -avd nameofyouravd -scale 0.5" (actually can choose number between 0.1 , 3 factor scaling (like in eclipse) hit "enter" , copy-past error log here if there one...

customization - Changing the default folder in Emacs -

i new emacs , have been trying figure out how change default folder c-x c-f on start-up. instance when first load emacs , hit c-x c-f default folder c:\emacs\emacs-21.3\bin , rather desktop. believe there way customize .emacs file this, still unsure is. update: there 3 solutions problem found work, believe solution 3 windows only. solution 1: add (cd "c:/users/name/desktop") .emacs file solution 2: add (setq default-directory "c:/documents , settings/user_name/desktop/") .emacs file solution 3: right click emacs short cut, hit properties , change start in field desired directory. you didn't so, sounds you're starting emacs windows shortcut. the directory see c-x c-f cwd, in emacs terms, default-directory (a variable). when start emacs using ms windows shortcut, default-directory folder (directory) specified in "start in" field of shortcut properties. right click shortcut, select properties , , type path desktop i...

c# - Unable to refresh/update data grid after insert in Silverlight 4 -

i creating master detials silverlight page , having trouble updating datagrid after inserting new record. on top of page have text boxes enter information, when user clicks on save information automatically updated in database , displayed on datagrid without refreshing screen. i able save information db no problems trying datagrid refresh new changes. some of code behind save button below: viewmodel.updateworkflow(summary, reason, email); loadoperation<document> lo = _context.load<document>(_context.getdocumentsquery(_docid), rtrefresh, null); the code rtrefresh: private void rtrefresh(loadoperation<document> oloadoperation) { if (oloadoperation.iscomplete) { viewmodel.getdocuments(_docid); } } i set viewmodel in xaml file as: <controls:childwindow.resources> <viewmodel:documentchildwindowviewmodel x:key="viewmodel...

.net - Adding assemblies to the GAC from Inno Setup -

until using inno setup our installations, continue doing, unless can uninstall option in start menu (thanks giovanni galbo), need gac external libraries, suspect doable (or @ least supported) though .net setup project. is possible call gac'ing library setup application? according http://jrsoftware.org/files/is5-whatsnew.htm should able v5.3 , above added .net support (these cause internal error if used on system no .net framework present): * added new [files] section flag: gacinstall. * added new [files] section parameter: strongassemblyname. * added new constants: {regasmexe}, {regasmexe32}, {regasmexe64}.

datetime - C# Casting vs. Parse -

this may seem rudimentary some, question has been nagging @ me , write code, figured ask. which of following better code in c# , why? ((datetime)g[0]["myuntypeddatefield"]).toshortdatestring() or datetime.parse(g[0]["myuntypeddatefield"].tostring()).toshortdatestring() ultimately, better cast or parse? all! if g[0]["myuntypeddatefield"] datetime object, cast better choice. if it's not datetime, have no choice use parse (you invalidcastexception if tried use cast)

c++ - Link external libraries portably? -

i've got .dll file created in vc++ 2008 needs distributed, requires external resources (namely openssl libraries) operate. dll compiles , runs on own system, other system appropriate external libraries manually installed on them, need .dll contain necessary data itself. at present external resources linked via #pragma comment(lib, "libeay32.lib") #pragma comment(lib, "ssleay32.lib") #pragma comment(lib, "ws2_32.lib") and that's not quite cutting it. there way have of included in dll? include openssl dlls distribution, or link dll static openssl libraries. install.w32 : ... can build static version of library using makefile ms\nt.mak ...

javascript - E4X : Assigning to root node -

i using adobe flex/air here, far know applies of javascript. have come across problem few times, , there must easy solution out there! suppose have following xml (using e4x): var xml:xml = <root><example>foo</example></root> i can change contents of example node using following code: xml.example = "bar"; however, if have this: var xml:xml = <root>foo</root> how change contents of root node? xml = "bar"; obviously doesn't work i'm attempting assign string xml object. it seems confuse variables values contain. assignment node = textinput.text; changes value variable node points to, doesn't change object node points to. want can use setchildren method of xml class: node.setchildren(textinput.text)

audio - What is the best way to merge mp3 files? -

i've got many, many mp3 files merge single file. i've used command line method copy /b 1.mp3+2.mp3 3.mp3 but it's pain when there's lot of them , namings inconsistent. time never seems come out right either. as thomas owens pointed out, concatenating files leave multiple id3 headers scattered throughout resulting concatenated file - time/bitrate info wildly wrong. you're going need use tool can combine audio data you. mp3wrap ideal - it's designed join mp3 files, without needing decode + re-encode data (which result in loss of audio quality) , deal id3 tags intelligently. the resulting file can split component parts using mp3splt tool - mp3wrap adds information idv3 comment allow this.

actionscript 3 - AS3 FTP Programming and the Socket and ByteArray Classes -

sorry subject line sounding nerdier harry potter title. i'm trying use as3's socket class write simple ftp program export air app in flex builder 3. i'm using ftp server on local network test program. can connect server (the easy part) can't send commands. i'm pretty sure have use bytearray class send these commands there's crucial piece of information i'm missing apparently. know how this? thanks! dave the ftp protocol predates utf encoding. switch ansi/ascii better results. if opt writemultibyte instead of writeutfbytes, aware buggy in linux. here's 1 way around it. there's question here line ending turns out culprit, make sure right (as suggested above). as said before, if running web, socket connections require crossdomain policy, not file based on http. recent changes security rules mean socket based connection must first crossdomain policy server hosted on port 843 of target host. quoting adobe: a swf file may n...

hash - Generating a Unique ID in c++ -

what best way generate unique id 2 (or more) short ints in c++? trying uniquely identify vertices in graph. vertices contain 2 4 short ints data, , ideally id kind of hash of them. prefer portability , uniqueness on speed or ease. there lot of great answers here, trying them tonight see fits problem best. few more words on i'm doing. the graph collection of samples audio file. use graph markov chain generate new audio file old file. since each vertex stores few samples , points sample, , samples short ints, seemed natural generate id data. combining them long long sounds good, maybe simple 0 1 2 3 generateid need. not sure how space necessary guarantee uniqueness, if each vertex stores 2 16 bit samples, there 2^32 possible combinations correct? , if each vertex stores 4 samples, there 2^64 possible combinations? library , platform specific solutions not relevant question. don't want else might compile program have download additional libraries or change...

ruby - Rails forms helper: dealing with complex forms and params (it's my first day with rails) -

learning rails , smells little funny. i have following form updating quantities in shopping cart. <% form_for(:cart, @cart.items, :url => { :action => "update_cart" }) |f| %> <table> <tr> <th>item</th> <th>quantity</th> <th>price</th> </tr> <% item in @cart.items %> <% f.fields_for item, :index => item.id |item_form| %> <tr> <td><%=h item.title %></td> <td><%=item_form.text_field :quantity, :size => 2 %> <span>@ <%=h number_to_currency(item.item_price) %></span></td> <td><%=h number_to_currency(item.line_price) %></td> </tr> <% end %> <% end %> <tr> <td colspan="2">total:</td> <td><%=h number_to_currency(@cart.tot...

linux - Can't find libavcodec when running ./configure for vlc -

i trying run './configure' vlc on ubuntu 10.04. can't find libavcode libraries reason. have check /usr/lib, has libraries, why ./configure can't find it? this error './configure': checking avcodec... no configure: error: not find libavcodec or libavutil. use --disable-avcodec ignore error. but install libavcodec-dev, still fails: $ sudo apt-get install libavcodec-dev reading package lists... done building dependency tree reading state information... done libavcodec-dev newest version. 0 upgraded, 0 newly installed, 0 remove , 201 not upgraded. i have checked '/usr/lib', see libavcodec.so: -rw-r--r-- 1 root root 7339558 2010-03-04 04:42 libavcodec.a lrwxrwxrwx 1 root root 21 2010-06-26 00:38 libavcodec.so -> libavcodec.so.52.20.1 lrwxrwxrwx 1 root root 21 2010-05-10 22:30 libavcodec.so.52 -> libavcodec.so.52.20.1 -rw-r--r-- 1 root root 5560152 2010-03-04 04:54 libavcodec.so.52.20.1 -rw-r--r-- 1 root root 1316312 201...

osx - Is there any way in the OS X Terminal to move the cursor word by word? -

i know combination ctrl + a jump beginning of current command, , ctrl + e jump end. but there way jump word word, alt + ← / → in cocoa applications does? out of box can use quite bizarre esc + f move beginning of next word , esc + b move beginning of current word.

winapi - Simulating a radio button check command -

i've been trying change state of radio button programatically: sendmessage(m_hwnd, wm_command, makewparam(idc_radio1, bst_checked), (lparam)(hwnd_radio1)); why won't work? how using bm_setcheck? http://msdn.microsoft.com/en-us/library/bb775989(vs.85).aspx

javascript - How can I suppress the browser's authentication dialog? -

my web application has login page submits authentication credentials via ajax call. if user enters correct username , password, fine, if not, following happens: the web server determines although request included well-formed authorization header, credentials in header not authenticate. the web server returns 401 status code , includes 1 or more www-authenticate headers listing supported authentication types. the browser detects response call on xmlhttprequest object 401 , response includes www-authenticate headers. pops authentication dialog asking, again, username , password. this fine until step 3. don't want dialog pop up, want want handle 401 response in ajax callback function. (for example, displaying error message on login page.) want user re-enter username , password, of course, want them see friendly, reassuring login form, not browser's ugly, default authentication dialog. incidentally, have no control on server, having return custom status code (i.e., ot...

java - What is the best way to obtain a list of site resources when writing a Maven2 site plugin? -

when creating plugin executes in default life-cycle, it's easy obtain reference project , resources, i'm getting null instead of mavenproject object when creating plugins execute in site life-cycle. any hints, tips or suggestions? it turns out problem having related declaration of project parameter being passed mojo. since there's 1 instance of mavenproject within maven build, can't specify expression (and there's no java string can cast mavenproject object) parameter , default value has "${project}". so access mavenproject within maven plugin mojo, phase, use following parameter declaration: /** * project instance, used add new source directory build. * * @parameter expression="export.project" default-value="${project}" * @required * @readonly */ private mavenproject project;

javascript - How do I build a page preloader for a php page? -

i want include page preloader pages on application. gmail displays when loading entire page in background. don't want prelaoding bar mechanism display preloading message while entire page loads in background , upon successful load displayed. take example site: http://www.emirates.com/ae/english/ run search flight - see preloading message after teh page loaded. don't see redirects here. how implement - site built using php , tonnes of javascript. your html writes out pre-loading message, , set javascript onload event. event calls javascript code load whatever data need via ajax, hide loading message , shows actual page. of course, means people no javascript have problems - have sort them or decide can live without them. add: oh, , may want check disability laws in country before deciding can live without them - may have legal responsibility make site accessible disabled. i've ever used technique on sites rely on js heavily can't run without it. note...

Django: How to completely uninstall a Django app? -

what procedure uninstalling django app, complete database removal? django has handy management command give necessary sql drop tables app. see sqlclear docs more information. basically, running ./manage.py sqlclear my_app_name you'll sql statements should executed rid of traces of app in db. still need copy , paste (or pipe) statements sql client. to remove app project, need remove installed_apps in project's settings.py . django no longer load app. if no longer want app's files hanging around, delete app directory project directory or other location on pythonpath resides. (optional) if app stored media files, cache files, or other temporary files somewhere, may want delete well. wary of lingering session data might leftover app. (optional) remove stale content types. like so. from django.contrib.contenttypes.models import contenttype c in contenttype.objects.all(): if not c.model_class(): print "deleting %s"%c c.dele...

c# - Try-catch every line of code without individual try-catch blocks -

i not have issue , never know, , thought experiments fun. ignoring obvious problems have have architecture attempting this , let's assume had horribly-written code of else's design, , needed bunch of wide , varied operations in same code block, e.g.: widgetmaker.setalignment(57); contactform["title"] = txttitle.text; casserole.season(true, false); ((recordkeeper)session["casseroletracker"]).seasoned = true; multiplied hundred. of these might work, others might go badly wrong. need c# equivalent of "on error resume next", otherwise you're going end copying , pasting try-catches around many lines of code. how attempt tackle problem? it's pretty obvious you'd write code in vb.net, have on error resume next , , export in dll c#. else being glutton punishment.

windows - WebResource.axd giving 403 error in ASP.Net Post backs using IIS7 -

i installed asp.net website on windows 2008 server, default using iis7. website seems work fine, post backs on forms not work. after few hours of debugging, realized when manually try hit webresource.axd file in browser (e.g. type http://www.domain.com/webresource.axd in address bar), http 403 error (access denied). i'm not quite sure next , windows 2008 security knowledge limited. how go giving access file? navigate iis config folder. typically: c:\windows\system32\inetsrv\config , open applicationhost.config file. within file navigate <handlers> section , check following line present: <add name="assemblyresourceloader-integrated" path="webresource.axd" verb="get,debug" type="system.web.handlers.assemblyresourceloader" precondition="integratedmode" /> that if you're running in integrated mode. check verb specified. if running in classic pipeline mode line should present <add name=...

model view controller - Do fancy MVC URLs affect how caching is done? -

when reading answers aquestion on clearing cache js files , pointed part of http spec . says urls containing ? should not pulled cache, unless specific expiry date given. how query string absent urls common mvc websites (ror, asp.net mvc, etc.) cached, , behaviour different more traditional query string based urls? afaik there no difference on part of browsers both firefox , ie (incorrectly) cache response url querystring, in same way cache response url without querystring. in case of safari respects spec , doesn't cache urls querystrings. http proxies tend tad errectic consider cacheable. it pays have headers set correctly , it's worth investigating etags .

homebrew - Tutorials for Wii programming -

i have nintendo wii , , i've got devkitpro working load simple programs. example source code i've been able find simplistic, such drawing , rotating simple shape. i've been looking more in depth tutorials, , haven't been able find much. of applications available on wiibrew open source, through those. however, i'd rather have that's little more geared towards teaching techniques, rather have browse through else's code find answer. what tutorials? i'm stuck @ getting alpha (translucent) colours work, i'm interested in getting lighting , other more advanced graphics techniques working. i'm going provide nice links: getting started (dead) wii programming (dead) wii wiki homebrew a blogger talks wii programming a big resource on wii development (dead) another resource wiibrew , here development specific links: tutorials debugging development tools devkitpro getting started development developer tips i ...

Opinions: CakePHP or CodeIgniter for eCommerce -

i know there many options out there ecommerce , know there many opinions on these 2 frameworks differ beyond belief. i looking thoughts on framework easier use create site used sell prints of photos. prints sold in various sizes, each size being added cart @ set price same every picture. shouldn't complex, don't want jump 1 , find out missed easier journey using other. thanks in advance! (if you're going give me stats difference in speed between two, keep in mind hosted on shared hosting , millisecond differences make no difference me). go whatever feel comfortable with. cake has got steeper learning curve, because wants lot of things done way. i've found myself looking @ source code quite few times - documentation not clear or missing. takes care of lot of things you, , cake console application nice. generates code you. whereas codeigniter can start developing right away if familiar php; , it's bit faster cake too. manual clear , concise - ...

.net - How to create a custom log filter in enterprise library 4.0? -

i using enterprise library 4.0 , can't find documentation on creating custom logging filter. has done or seen online documentation on this? http://geekswithblogs.net/.netonmymind/archive/2006/05/15/78201.aspx great article.

html - What is the difference between relative and absolute tags of div element? -

what difference between relative , absolute tags of div element ? absolute positioning positions element relitive first parent has position oher static, , removes element document flow. relative positioning allows move element "normal" positon, leaving space in content. relative small adjusents in page layout, absolute exact positioning.

iphone - What are best practices that you use when writing Objective-C and Cocoa? -

i know hig (which quite handy!), programming practices use when writing objective-c, , more when using cocoa (or cocoatouch). there few things have started do not think standard: 1) advent of properties, no longer use "_" prefix "private" class variables. after all, if variable can accessed other classes shouldn't there property it? disliked "_" prefix making code uglier, , can leave out. 2) speaking of private things, prefer place private method definitions within .m file in class extension so: #import "myclass.h" @interface myclass () - (void) somemethod; - (void) someothermethod; @end @implementation myclass why clutter .h file things outsiders should not care about? empty () works private categories in .m file, , issues compile warnings if not implement methods declared. 3) have taken putting dealloc @ top of .m file, below @synthesize directives. shouldn't dealloc @ top of list of things want think in cla...

eclipselink - How do I delete all JPA entities? -

in testing code need have blank/empty database @ each method. there code achieve that, call in @before of test? actually can use jpql, em .createquery("delete myentity m") .executeupdate() ; but note, there no grants entity cache cleaned also. unit-test purposes solution.

java - How can I execute a stored procedure with JDBC / jTDS without using a transaction? -

we run website written in java uses jdbc jtds access sql server database. our database contains complex stored procedure typically takes 10 minutes run. stored procedure works fine if execute directly (say sql server management studio) because not run in transaction. if execute using jtds locks entire website 10 minutes. happens because jtds runs in transaction, , website requests on hold waiting transaction finish. for example, following locks website due transaction: connection connection = drivermanager.getconnection("jdbc:jtds:sqlserver://example/example"); callablestatement callablestatement = connection.preparecall("exec dbo.proctest"); callablestatement.execute(); is there way can run stored procedure using jdbc / jtds without running in transaction? please note calling on jtds connection not valid: connection.settransactionisolation(connection.transaction_none); that throws exception stating connection.transaction_none parameter not support...

Can I find to what target .NET dll was built looking into the file? -

i have bit of mess projects coming on 4.0 on 3.5 is possible find out version of .net dll built looking file (not code!) ? you use ildasm.exe : ildasm assembly.dll then double click on manifest , @ version: metadata version: v4.0.30319 (clr 4.0, meaning .net 4.0) metadata version: v2.0.50727 (clr 2.0, meaning .net 2.0 .net 3.5)

php - The most flexible framework architecture for web development? -

obviously, there no 1 single solution satisfy everyone's needs; architecture trade-off. want create framework, aimed @ rad of web games. target language php, although architecture should applicable. goals have in head framework are: flexibility in ways can achieve result; maximal comfort developers; connecting modules lego® blocks; many types of input, many types of output, 1 format processing. the goals not priority speed, enterprise use , making money. it's supposed open source project. the cornerstone of design content, before transformation, processed in xml (idea based on eai system i've worked with, egate). data abstraction layer - smart orm - not important now. output generated using xslt or other custom modules, virtually client - html old browsers, xhtml/html5 modern browsers, simple html mobile clients, xml ajax/xmlrpc, etc. main reasons using xml are: it's well-known standard existing tools xpath, simplexml , dom navigating , modifying content...

c# - Highlight of ListView items without setting the focus -

this question has answer here: selecting item in listview control ( winforms ) while not having focus 2 answers in situation there textbox typing in , there listview jumps item typing in text box focus should in text box can continue typing! said when selecting item in listview want item highlighted blue background other standard highlights in windows forms. there way this? thanks. have @ setting listviewitembackcolor , change type looks though has been selected, when reality has blue background. or try setting colour of background blue , selecting item , setting focus textbox can continue typing, although may not happen enough key presses may lost you'd have try , see how works.

iPhone SDK: Assertion failure in -[UILabel setFont:] -

i have iphone app compiles , runs fine in simulator on laptop. now, try build , run same code in simulator on imac, , starts , lets me click button, assertion failure. here in console: *** assertion failure in -[uilabel setfont:], /sourcecache/uikit/uikit-738/uilabel.m:438 *** terminating app due uncaught exception 'nsinternalinconsistencyexception', reason: 'invalid parameter not satisfying: font != nil' stack: ( 2493366603, 2432871995, 2493366059, 2459146836, 817183141, 817926218, 837317240, 837317032, 837315376, 837314643, 2492860866, 2492867620, 2492869880, 85304, 85501, 816175835, 816221412, 9096, 8930 ) here's stack trace: #0 0x949dbff4 in ___terminating_due_to_uncaught_exception___ #1 0x9102ae3b in objc_exception_throw #2 0x94962ad3 in cfrunlooprunspecific #3 0x94962cf8 in cfrunloopruninmode #4 0x00014d38 in gseventrunmodal #5 0x00014dfd in gseventrun #6 0x30a5dadb in -[uiapplication _run] #7 0x30a68ce4 in uiapplicationmain #8 0x00002388...

encryption - howto encrypt passwords in configuration files, grails [and java] -

i looking step-by-step how on securing passwords put in configuration files, in grails. means securing passwords in config.groovy , datasource.groovy. there lot of google results contains bits , pieces of answer, no concise guides on how this. can please point me in right direction? thanx for config.groovy, encrypt password way , put hash in config.groovy, manually. when need use in code, have code decrypt you. doesn't seem hard. datasource.groovy different animal, however, since fed hibernate api you. did see code on interwebs , seems headed in right direction... datasource { pooled = false driverclassname = "org.hsqldb.jdbcdriver" username = "sa" password = someencryptionapiobject.decrypt(propertyfile.readproperty("mypassword")) } ...where encrypt property file containing data need, , decrypt when needed.

python - Elegant structured text file parsing -

i need parse transcript of live chat conversation. first thought on seeing file throw regular expressions @ problem wondering other approaches people have used. i put elegant in title i've found type of task has danger of getting hard maintain relying on regular expressions. the transcripts being generated www.providesupport.com , emailed account, extract plain text transcript attachment email. the reason parsing file extract conversation text later identify visitors , operators names information can made available via crm. here example of transcript file: chat transcript visitor: random website visitor operator: milton company: initech started: 16 oct 2008 9:13:58 finished: 16 oct 2008 9:45:44 random website visitor: cover sheet tps report? * there no operators available @ moment. if leave message, please type in input field below , click "send" button * call accepted operator milton. in room: milton, random website visitor. milton: y-- excuse me. you-- ...

java - Double cast for Double smaller than zero -

double out = othertypes.somemethod(c, c2); assertequals((double)-1.0d, out); i error "double cannot resolved" (the double in assertequals), there way hack around except extracting variable? is bug in java or usefull feature wont fix? one important note: because of way floating point numbers work, should never compare 2 doubles (or floating point numbers spoken) equality directly, compare if difference within specified delta: abs(double1 - double2) < delta . junit has assertequals(double expected, double actual, double delta) method that. said, should use assertequals(-1.0d, (double) out, 0.000001d) in code. you can find more on tricks , traps of floating point number in example in 1 of brian goetz's articles: "where's point?"

html - Tooltip for a line of text -

<td title="this long line i'm going truncate">this long line i'm going trunc ...</td> is correct way it? there maximum length title. it's around 80 characters (tested on ff2). so if text long title won't help. there several css/javascript tooltip solutions show whatever need.

bash - How do I prompt for Yes/No/Cancel input in a Linux shell script? -

i want pause input in shell script, , prompt user choices. standard 'yes, no, or cancel' type question. how accomplish in typical bash prompt? the simplest , available method user input @ shell prompt read command. best way illustrate use simple demonstration: while true; read -p "do wish install program?" yn case $yn in [yy]* ) make install; break;; [nn]* ) exit;; * ) echo "please answer yes or no.";; esac done another method, pointed out steven huwig, bash's select command. here same example using select : echo "do wish install program?" select yn in "yes" "no"; case $yn in yes ) make install; break;; no ) exit;; esac done with select don't need sanitize input – displays available choices, , type number corresponding choice. loops automatically, there's no need while true loop retry if give invalid input. also, please check out e...

memory - Assembler: How are segments used in 32bit systems? -

from know, in days of 16bit pc's had segment registers contain address of each type of segment , access offset ss:[edi], take value contained in edi offset stack segment. now know in 32bit systems, have gdt (global descriptor table) , ldt (local descriptor table), segments contain index table , offset calculated point right memory address. is understanding correct? push dword ptr ss:[ebp+8] ; basicbof.00401000 so statement such mean on 32bit os (xp sp2)? segment registers contain selectors. each selector index in either global or local descriptor table, plus security level requested. for example: mov ds, 0x0000 will put selector 0 table 0 (gdt), level 0 access ds. (this special register, used null pointer testing). the tables contain base + length information each selector, no longer limited 64k (but might 0 4gb). the best way learn these reading (freely available) intel processor documents. edit: link ...

spring - BeanFactory vs ApplicationContext -

i'm pretty new spring framework, i've been playing around , putting few samples apps purposes of evaluating spring mvc use in upcoming company project. far see in spring mvc, seems easy use , encourages write classes unit test-friendly. just exercise, i'm writing main method 1 of sample/test projects. 1 thing i'm unclear exact differences between beanfactory , applicationcontext - appropriate use in conditions? i understand applicationcontext extends beanfactory , if i'm writing simple main method, need functionality applicationcontext provides? , kind of functionality applicationcontext provide? in addition answering "which should use in main() method", there standards or guidelines far implementation should use in such scenario? should main() method written depend on bean/application configuration in xml format - safe assumption, or locking user specific? and answer change in web environment - if of classes needed aware of spring, more n...

How do I turn a String into a InputStreamReader in java? -

how can transform string value inputstreamreader ? bytearrayinputstream trick: inputstream = new bytearrayinputstream( mystring.getbytes( charset ) );

python - Smallest learning curve language to work with CSV files -

vba not cutting me anymore. have lots of huge excel files need make lots of calculations , break them down other excel/csv files. i need language can pick within next couple of days need, because kind of emergency. have been suggested python, check if there else csv file handling , easily. there many tools job, yes, python perhaps best these days. there special module dealing csv files. check official docs .

html - Separate stylesheets -

how use separate stylesheet opera? like: <![if !ie 6]> <link rel=»stylesheet» type=»text/css» href=»ctyle.css» /> <![endif]> but opera? (for versions of opera) i don't think can without sniffing user agent server side code or javascript. besides usual caveats of user agent sniffing, server side code more reliable wouldn't require javascript enabled. there may possibly opera specific hacks, implementing these worse sniffing imo. if there layout problems, google bug , see solutions exist fix. may not need separate stylesheet.

java - Why does notifyAll() raise IllegalMonitorStateException when synchronized on Integer? -

why test program result in java.lang.illegalmonitorstateexception ? public class test { static integer foo = new integer(1); public static void main(string[] args) { synchronized(foo) { foo++; foo.notifyall(); } system.err.println("success"); } } result: exception in thread "main" java.lang.illegalmonitorstateexception @ java.lang.object.notifyall(native method) @ test.main(test.java:6) you have noted correctly notifyall must called synchronized block. however, in case, because of auto-boxing, object synchronized on not same instance invoked notifyall on. in fact, new, incremented foo instance still confined stack, , no other threads possibly blocked on wait call. you implement own, mutable counter on synchronization performed. depending on application, might find atomicinteger meets needs.

xml - PHP SimpleXML, CodeIgniter and Apache with Suhosin -

i have application writing in php5, using codeigniter framework. have running on both windows (using xampp) , ubuntu (using standard apache, php, mysql stack). i have form, takes xml, parses (using simplexml) , posts results database. on windows - no problem, works intended. on linux - big problem. errors out. i have double checked xml, , it's fine. i removed large amount of xml, , seems ok. i think it's related size of xml string being posted form, not sure. again, on windows it's ok - on linux, errors out. the size of data posted in form ~160k (yeah, that's lot of text, it's automated - , it's gonna 200k). the error below. any appreciated. fatal error: uncaught exception 'exception' message 'string not parsed xml' in /var/www/ci/system/application/controllers/system.php:49 stack trace: #0 /var/www/ci/system/application/controllers/system.php(49): simplexmlelement->__construct('') #1 [internal function]: sys...

c# - Uploading files to file server using webclient class -

currently have application receives uploaded file web application. need transfer file file server happens located on same network (however might not case). i attempting use webclient class in c# .net. string filepath = "c:\\test\\564.flv"; try { webclient client = new webclient(); networkcredential nc = new networkcredential(uname, password); uri addy = new uri("\\\\192.168.1.28\\files\\test.flv"); client.credentials = nc; byte[] arrreturn = client.uploadfile(addy, filepath); console.writeline(arrreturn.tostring()); } catch (exception ex) { console.writeline(ex.message); } the machine located @ 192.168.1.28 file server , has share c:\files. of right receiving error of login failed bad user name or password, can open explorer , type in path login successfully. can login using remote desktop, know user account works. any ideas on error? possible transfer file directly tha...

Tools to view/diagram function-call hierarchies for C or C++ source files in OSX -

are there source-code analyses tools osx. particularly interested in tools capable of diagramming function-call hierarchies c , c++ source files. you might take @ doxygen

c# - What is the best way to use ListView and GroupBoxes as an "options" window? -

what best way use listview , set of groupboxes options window? for example, listview have items such general, sounds, shortcuts , there 3 groupboxes defining same things. what best programmatical way navigate through them everytime item in listview selected? hide groupboxes, show groupbox based index of selected listview? or have better idea handle this? i don't know if there's better way, in past described general approach have taken.

Print from a windows App - data from an Oracle DB on Linux -

we have oracle db running on linux. when data ready report, value placed in table in db. presently app scheduled run every 10 seconds check value , if it's there prints out report. not prety. how can make pretty? i sort of envision oracle db somehow triggering windows server print (tcp/ip? small service listening on windows box) windows app fires when it's time work. how linux/oracle system "signal" windows box? actually, polling quite quick, cheap, resilient, , best of - implemented method of achieving goal. remote db-initiated triggers wonderfully sexy, , simple using cups samba , printing directly linux box. or complicated full two-way rpc error checking. either way, don't fix things aren't broken.

iphone - How to start an NSTimer when i click on a button? -

how can start nstimer when user clicks button? edit:i had code working , everything, put code hide button above nstimer code, , when placed below nstimer code worked! the line of code start timer ( read docs here ) : [nstimer scheduledtimerwithtimeinterval:1.0 target:self selector:@selector(timerfired:) userinfo:nil repeats:nil]; this call method timerfired: after 1 second i.e. - (void)timerfired:(nstimer *)timer { nslog(@"timer : %@ has gone off", timer); } to trigger button, need method in .h file : - (ibaction)buttonpressed:(id)sender; and in .m file, detect button press : - (ibaction)buttonpressed:(id)sender { nslog(@"button's been pressed!"); } then, in interface builder connect button's 'toiuch inside' action method.

tango - Applications development with D language -

for had developed applications d, which libraries did use build application? those libraries documented? did use tango? do feel d ready build big applications? which ide did use? descent maybe? note c library can used d, d supports c abi. d has limited support c++ libraries, though not c++ template libraries.

Finding the c# exception handler -

i'm writing complex c# code. i'm finding code throwing exception (noted in output window) debugger isn't breaking in. have exceptions sets break on user-unhandled clr exceptions. since debugger isn't breaking in, assume there must try{} somewhere in call stack. problem is, can't find it. how find exception handler line of code that's throwing exception? open exceptions window in visual studio. expand appropriate tree find exception being thrown , check "thrown" checkbox. next time exception thrown in debug mode (vice uncaught) debugger break.

Download GWT plugins for eclipse without using eclipse Instaqll new softeware -

is possible download gwt plugins eclipse separately ( without downloading eclipse directly ) ? because need install on multiple eclipse on multiple pc , want archive future needs. i want paste in dropins folder in eclipse later. regards here go: http://code.google.com/eclipse/docs/install-from-zip.html

c# - Doing Eager Loading and Projection in Linq to Entities -

this spin off question posted few days ago answered didn't underlying issue having wasn't able express in original query. i have table product. product related productdescription in one-to-many relationship. productdescription can have more 1 row each product. have multiple rows if there multiple translations description of product. product has many-to-one relationship language. language has language code (en, es, etc.) languageid (found in productdescription well). i want give users ability request product , further tell application return descriptions product in specific language. the problem i'm having understand need use projection accomplish task in 3rd paragraph of question. this: var query = inventoryrepository.products .where(wherepredicate) .select( a=> new product { productdescriptions = inventoryrepository.objectcontext.productdescriptions ...

sql - In Oracle what does 'Buffer Gets' actually refer to? -

i'm dealing oracle dba @ moment, has sent me profiling he's done. 1 of terms in report 'buffer gets', idea means? guess bytes retrieved buffer, have no idea really. here sample output: buffer gets executions gets per exec %total time (s) time (s) hash value --------------- ------------ -------------- ------ -------- --------- ---------- 137,948,100 31,495 4,380.0 98.4 6980.57 6873.46 4212400674 module: jdbc thin client select fieldone, fieldtwo, fieldthree, fieldfour, fieldfive tableexample fieldone = 'example' it handy know 'gets per exec' means, guess related? i'm programmer, not dba. oracle storage arranged blocks of given size (e.g. 8k). tables , indexes made of series of blocks on disk. when these blocks in memory occupy buffer. when oracle requires block buffer get . first checks see if has block needs in memory. if so, in-memory version used. if not have block in memory read disk memory. ...

c# - Typed DataSet connection - required to have one in the .xsd file? -

in .xsd file typed dataset in .net, there's <connections> section contains list of data connections i've used set datatables , tableadapters. there times when i'd prefer not have there. instance, prefer pass in connection string custom constructor , use rather 1 in settings, .config, etc. but seems if remove connection strings section (leaving empty), or remove section entirely, dataset code-generation tool freaks out. whereas if don't remove them, dataset gripes when put in different project because can't find settings connection strings. is there way can tell typed dataset not worry connections? (obviously i'll have give connection if change tableadapter sql or stored procs, should my problem.) this has bugged me long time , did testing recently. here came with. record, i'm using vs 2008 sp1. datasets will store connection string information whether want them or not. you can make sure datasets won't store password...

unit testing - OCUnit for iPhone App - Set all .m files as part of UnitTest Target -

hy everybody, i have 2 targets: myapp , unittests myapp contains 2 classes: classa , classb. classa has method "getsomenumber" uses classb method. unittest "unit test bundle" , in "groups & files" section have folder named "unittests" create "myapptest" class. myapptest class has following method: -(void)testsomething { classa *ca = [[classa alloc] init]; int x = [ca getsomenumber]; [ca release]; stassertequals(1, x, @"the number not equal 1"); } i imported "classa.h" , need set "classa.m" part of "unittest" target. when build have error **"_objc_class_$_classb", referenced from:** so need add "classb.m" "unittest" taget , works. what happens if classa uses classc uses thousands of classes? have problem , need include thousand of class "unittest" target. i think sould better solution or configuration include whole myap...

sql server - Partial Keyword Searching (MS SQL 2005) -

current, i've got stored procedure has main goal of doing full text search through database table of films , tv shows. in order partial-keyword searching, added code in sql split search query spaces, , output statement following: ' "batman*" ~ "be*" ' the original string, "batman be", instance, generated textbox on page user typing , on each javascript keyup event, send whatever in textbox stored proc results results type (like autocomplete). in case, user may have been looking "batman begins", or "the batman: batgirl begins" (a tv show episode) , both should show result. below sample of query. @partialkeywordstring is, in example above, ' "batman*" ~ "be*" '. select f.title films f inner join containstable(films, title, @partialkeywordstring) f_key on f.filmid = f_key.[key] order f_key.rank desc the problem have query ranking doesn't seem i'd expect. if search "b...

xml - Why doesn't xpath work when processing an XHTML document with lxml (in python)? -

i testing against following test document: <?xml version="1.0" encoding="utf-8"?> <!doctype html public "-//w3c//dtd xhtml 1.0 strict//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>hi there</title> </head> <body> <img class="foo" src="bar.png"/> </body> </html> if parse document using lxml.html, can img xpath fine: >>> root = lxml.html.fromstring(doc) >>> root.xpath("//img") [<element img @ 1879e30>] however, if parse document xml , try img tag, empty result: >>> tree = etree.parse(stringio(doc)) >>> tree.getroot().xpath("//img") [] i can navigate element directly: >>> tree.getroot().getchildren()[1].getchildren()[0] <element {http://www.w3....

io - What's the best way of reading a sprite sheet in Java? -

i'm writing basic sprite engine own amusement , better aquainted java's 2d api. making use of large numbers of separate .png files transparent backgrounds represent various sprites , different frames of animation need. 'real world' game development projects seem make use of 'sprite sheets' contain multiple sprites or frames of animation within single file. also, rather making use of native image transparency support, people nominate arbitrary colour not appear in sprite pallette transparent colour. how 1 manage file programatically? how know 1 sprite starts , next begins how deal transparency there may other factors i've not thought of here, may add list above think of things or people make suggestions (please in comments). i use xml files generated simple sprite editor store sprite collection of (optionally animated) poses, in turn collection of frames or cells. frames store per-frame information x , y offset of frame in sheet, cell widt...

css - How to center an image horizontally and align it to the bottom of the container? -

how can center image horizontally , aligned bottom of container @ same time? i have been able center image horizontally self. have been able align bottom of container self. have not been able both @ same time. here have: .image_block { width: 175px; height: 175px; position: relative; margin: 0 auto; } .image_block img { position: absolute; bottom: 0; } <div class="image_block"> <a href="..."><img src="..." border="0"></a> </div> that code aligns image bottom of div. need add/change make center image horizontally inside div? image size not known before hand 175x175 or less. .image_block { width: 175px; height: 175px; position: relative; } .image_block { width: 100%; text-align: center; position: absolute; bottom: 0px; } .image_block img { /* nothing specific */ } explanation : element positioned absolutely relative closest parent has no...

javascript - this keyword in a class method -

var mc = function(map){ var init = function(imap){ alert("init " + + " with"); } init(map); }; var m = new mc({}); why getting value of [object window]? window object?? yes! because init variable of mc , share scope (which global scope, window object). however. if changed following: var mc = function(map){ this.init = function(imap){ alert("init " + + " with"); } this.init(map); }; var m = new mc({}); then this inside init reference instance.

.net - How do I create a Generic Linked List? -

i trying use generic linked list hold workflow steps in application. here how i'm persisting database. orderid  workflowstepid  parentworkflowstepid 178373    1                         null 178373    2                         1 178373    3                         2 i dataset in datareader object. loop through datareader , create workflowstep object includes workflowstepid property , parentworkflowstepid property. add first object linkedlist using .addfirst() method. next idea create next object , insert after object in linked...

mysql - Development and Production Database? -

i'm working php & mysql. i've got head around source control , quite happy whole development (testing) v production v repository thing php part. my new quandary database. create 1 test environment , 1 production environment? have 1 both environments use, leaving test data sitting there. kind of feel should have two, i'm nervous in terms of making sure production database looks , feels same test one. any thoughts on way go? and, if think latter, best way keep 2 databases same (apart data, of course...)? each environment should have separate database. script of database objects (tables, views, procedures, etc) , store scripts in source control. scripts applied first development database, promoted test (qa, uat, etc), production. applying same scripts each database, should same in end. if have data needs loaded (code tables, lookup values, etc), script data load part of database creation process. by scripting , keeping in source control, databa...

.net - Debug C# webservice client -

i ran strange problem using c# webservice client call asp.net 2.0 webservice. service simple product search , returns array of products matching search term - see relevant part of wsdl file below. c# client generated adding web reference in vs2010 (non-wcf) , comparison i'm using axis 1.4 java client. using same search paramaters in both c# , java client call returns 50 products in c# client result array has length 1 while java client shows correct 50 elements. i looking suggestions how locate problem - i've tried following: compare xml returned webservice using tcp/ip monitor: xml looks identical c# vs. java , contains 50 products compare http parameters using netcat: c# defaults http 1.1 while axis 1.4 uses http 1.0, changing c# client use http 1.0 no change anything try soap 1.2 instead of soap 1.1: no effect try httpgetprotocol, httppostprotocol instead of soap any suggestions highly appreciated. edit: full wsdl , generated code (reference.cs) can foun...