Posts

Showing posts from July, 2012

objective c - Is there a way to detect when a standard iPhone View Controller push/pop animation has completed? -

for custom animations in app, can use setanimationdidstopselector: method respond event animation has finished. there similar kind of mechanism detecting animation has finished standard view controller animation transition pushes , pops? (i.e. [self.navigationcontroller pushviewcontroller:vc animated:yes]) i think can try overide method: - (void)viewdidappear:(bool)animated this method called after view appeared in interface comment code: - (void)viewwillappear:(bool)animated; // called when view made visible. default nothing - (void)viewdidappear:(bool)animated; // called when view has been transitioned onto screen. default nothing so think if override viewdidappear , put logic here, code executed after transition finished more in viewwillappear , viewdidappear

Does anyone know where to find free database design templates? -

i'm not talking full solution, starting point common applications software architects. cms, e-commerce storefront, address book, etc. uml diagram not essential, table schema data types in least. thanks! check out library of free data models databaseanswers.org -- might starting point. can't vouch quality, there lot here...

osx - MacBook vs MacBook Pro for .NET development and other stuff -

i buy notebook , between mb or mbpro recomendation? other stuff presentations , word processing i have both , have used both .net development - here pros both: macbook: good size portability mbp: nicer keyboard bigger screen better graphics i guess comes down resolution in end me. both fast , nice use. prefer bit more real estate coding, if can hook mb external monitor day day use it's ideal (for coding) given lesser price. depends "other stuff" - games or video related, mbp it's non onboard graphics winner.

ssis - How to resolve SQL query parameters mapping issues while using Oracle OLE DB provider? -

when trying enter sql query parameters using oracle ole db provider following error: parameters cannot extracted sql command. provider might not parse parameter information command. in case, use "sql command variable" access mode, in entire sql command stored in variable. additional information: provider cannot derive parameter information , setparameterinfo has not been called. (microsoft ole db provider oracle) i have tried following suggestion here don't quite understand required: parameterized queries against oracle any ideas? to expand on link given in question: create package variable double click on package variable name. (this allows access properties of variable) set property 'evaluateasexpression' true enter query in expression builder. set ole db source query sql command variable the expression builder can dynamically create expressions using variable create 'parametised queries'. following 'normal...

c# - Entity framework with oracle database -

i'm using entity framework oracle database. i downloaded provider http://oracleef.codeplex.com/ . today converted project work vs2010. is there way (free) work oracle db using vs2010? thanks! try express editions of data providers. example, http://www.devart.com/dotconnect/oracle/ ...

multithreading - Measuring stack usage for Linux multi-threaded app -

i'm developing multi-threaded app linux embedded platform. at moment i'm setting stack size each thread (via pthread_set_attr) large default value. fine tune value each thread smaller reduce application's memory usage. go through trial , error route of setting each thread's stack size progressively smaller values until program crashed, application uses ~15 threads each different functionality/attributes approach extremely time consuming. i rather prefer being able directly measure each thread's stack usage. there utility people can recommend this? (for example, come vxworks background , using 'ti' command vxworks shell directly gives stats on stack usage other useful info on task status.) thanks i not know tools last resort include code in application check it, similar following: __thread void* stack_start; __thread long stack_max_size = 0l; void check_stack_size() { // address of 'nowhere' approximates end of stack char now...

asp.net - ASP Server variable not working on local IIS -

i'm working on simple asp.net page (handler, actually) check value of logon_user server variable. works using visual studio's built-in web server , works in other sites deployed live intranet site. doesn't work on iis instance on local xp machine. how can fix it, or what's going on if can't? what authentication have enabled in iis? anonmyous, basic, digest, integrated windows? sounds me anonymous access enabled/allowed, , nothing else. means logon_user not populated. when access local iis, trying using http://127.0.0.1 in particular if use ie. ie recognize "localhost" being in local trusted zone , automatically pass xp login credentials through when integrated windows auth enabled.

html - Css list align problems -

Image
hei guys, have following problem: as can see arrows not aligned text, i've tried alot of things didn't find solution, mabe can me, here code: .domains-wrapper .sidebar{ width: 203px; } /* background */ .domains-wrapper .links .the-top{ background: url(/images/top-sidebar-domains.png) no-repeat; width: 202px; height: 7px; } /* background */ .domains-wrapper .links .repeat{ background: url(/images/repeat-sidebar-domains.png) repeat-y; width: 202px; } /*---here starts code list items---*/ .domains-wrapper .links .repeat ul{ padding-top: 14px; padding-bottom: 14px; padding-left:8px; padding-right: 8px; } .domains-wrapper .links .repeat ul li{ font-size: 12px; ...

activerecord - Updating a large record set in Rails -

i need update single field across large set of records. normally, run quick sql update statement console , done it, utility end users need able run in app. so, here's code: users = user.find(:all, :select => 'id, flag') users.each |u| u.flag = false u.save end i'm afraid going take while number of users increases (current sitting @ around 35k, adding 2-5k week). there faster way this? thanks! if want update records, easiest way use #update_all : user.update_all(:flag => false) this equivalent of: update users set flag = 'f' (the exact sql different depending on adapter) the #update_all method accepts conditions: user.update_all({:flag => false}, {:created_on => 3.weeks.ago .. 5.hours.ago}) also, #update_all can combined named scopes: class user < activerecord::base named_scope :inactive, lambda {{:conditions => {:last_login_at => 2.years.ago .. 2.weeks.ago}} end user.inactive.update_all(:flag =>...

iphone - UIWebView load content On demand -

i have huge amount of data load on uiwebview. there has issues 1. it's take lot of time on loading 2. on iphone-os3 shows little chunk in iphone-os4 doesn't 3. on orientation takes time. so suggestion? how can load content on demand need? you may need use nsurlconnection connectionwithrequest: instead of [webview loadrequest:] . implement connection:didreceivedata: accumulate data received , connectiondidfinishloading: inform user there no more data loaded.

java - How should I load Jars dynamically at runtime? -

why hard in java? if want have kind of module system need able load jars dynamically. i'm told there's way of doing writing own classloader , that's lot of work should (in mind @ least) easy calling method jar file argument. any suggestions simple code this? the reason it's hard security. classloaders meant immutable; shouldn't able willy-nilly add classes @ runtime. i'm surprised works system classloader. here's how making own child classloader: urlclassloader child = new urlclassloader (myjar.tourl(), this.getclass().getclassloader()); class classtoload = class.forname ("com.myclass", true, child); method method = classtoload.getdeclaredmethod ("mymethod"); object instance = classtoload.newinstance (); object result = method.invoke (instance); painful, there is.

c++ - How to solve Memory Fragmentation -

we've been getting problems whereby our long-running server processes (running on windows server 2003) have thrown exception due memory allocation failure. our suspicion these allocations failing due memory fragmentation. therefore, we've been looking @ alternative memory allocation mechanisms may , i'm hoping can tell me best one: 1) use windows low-fragmentation heap 2) jemalloc - used in firefox 3 3) doug lea's malloc our server process developed using cross-platform c++ code, solution ideally cross-platform (do *nix operating systems suffer type of memory fragmentation?). also, right in thinking lfh default memory allocation mechanism windows server 2008 / vista?... current problems "go away" if our customers upgrade server os? first, agree other posters suggested resource leak. want rule out first. hopefully, heap manager using has way dump out actual total free space available in heap (across free blocks) , total number of ...

asp.net mvc - EntityReference can have no more than one related object -

i have 2 identical controller actions , 2 identical views (one has different javscript file it). 1 view works fine, other gets hung on ef error: a relationship multiplicity constraint violation occurred: entityreference can have no more 1 related object, query returned more 1 related object. non-recoverable error. i understand error doesn't make sense in context, when 1 view works , 1 doesn't. here bit 2 views causing choke (it's nasty lets ignore now...): <% var x = ((ienumerable<project.models.booth>)viewdata["booths"]).where(b => b.rownumber == && b.columnnumber == j && b.boothgroupid == item.id).firstordefault(); %> <%if ( x != null) { %> <td class="assigned" title="<%: x.boothnumber %> - <%: x.exhibitor.name %>" style="width:<%: item.width %>px; height:<%: item.height %>px;">...

Empty namespace using Linq Xml -

i'm trying create sitemap using linq xml, getting empty namespace attribute, rid of. e.g. xnamespace ns = "http://www.sitemaps.org/schemas/sitemap/0.9"; xdocument xdoc = new xdocument(new xdeclaration("1.0", "utf-8", "true"), new xelement(ns + "urlset", new xelement("url", new xelement("loc", "http://www.example.com/page"), new xelement("lastmod", "2008-09-14")))); the result ... <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"> <url xmlns=""> <loc>http://www.example.com/page</loc> <lastmod>2008-09-14</lastmod> </url> </urlset> i rather not have xmlns="" on url element. can strip out using replace on final xdoc.tostring(), there more correct way? the "more correct way" be: xdocument xdoc = new xdocument(new xdeclaration("...

sql - View MDX query generated while browsing a cube -

in sql server management studio once browse cube can drop column fields, row fields , filter fields. displays required data. i want know if there way view mdx query being generated behind scenes display data? thanks. sql server profiler works on ssas servers. select analysis services server type in connection dialog when initiating profiler connection. select analysis services server , connect. can use standard profiler template , start trace. should able see mdx query way.

recursion - Recursive lambda expression to traverse a tree in C# -

can show me how implement recursive lambda expression traverse tree structure in c#. ok, found free time finally. here go: class treenode { public string value { get; set;} public list<treenode> nodes { get; set;} public treenode() { nodes = new list<treenode>(); } } action<treenode> traverse = null; traverse = (n) => { console.writeline(n.value); n.nodes.foreach(traverse);}; var root = new treenode { value = "root" }; root.nodes.add(new treenode { value = "childa"} ); root.nodes[0].nodes.add(new treenode { value = "childa1" }); root.nodes[0].nodes.add(new treenode { value = "childa2" }); root.nodes.add(new treenode { value = "childb"} ); root.nodes[1].nodes.add(new treenode { value = "childb1" }); root.nodes[1].nodes.add(new treenode { value = "childb2" }); traverse(root);

java - jtds No Suitable Driver Exception when running a maven built project -

we have simple spring-hibernate application(console app) in have set classpath in manifest file of executable jar file. , app connects database using jtds driver, works expected on windows machine , jdk1.6. on linux, app unable find driver, running program using java -jar mainclassname any suggestions why might happening appreciated. this issue occurred because our jdbc.url had invalid url. because maven treats jdbc.url property special property , while profiling, instead of url defined in filter.properties. , reason "no suitable driver" exception. question should have been more clear. anyways fix had rename jdbc.url properties jdbc.url.somename. fixed our issue maven profiling. had similar maven profiling issue property called "server.name" filter property confusing maven profiling . had change name of property well. thanks again fernando.

How to be notified of file/directory change in C/C++, ideally using POSIX -

the subject says - easy , cross platform way poll, intelligently. every os has means notify without polling. possible in reasonably cross platform way? (i care windows , linux, use mac, thought posix may help?) linux users can use inotify inotify linux kernel subsystem provides file system event notification. some goodies windows fellows: file change notification on msdn " when folders change " article file system notification on change

latex - Public CLSI servers -

does know publicly accessible clsi (common latex service interface) servers other scribtex ? (nothing wrong scribtex, in fact it's great, wondering if there alternatives) edit: i'm not looking online latex equation editors or proprietary apis (e.g. monkeytex ), i'm asking clsi because seems standard server-side latex compilation. i don't know if it's clsi, there latexlab, built on google's app engine. http://code.google.com/p/latex-lab/

documentation - Do you use UML in Agile development practices? -

it feels artifacts of earlier days, uml sure have use. however, agile processes extreme programming advocates "embracing changes", means should make less documents , uml models well? since gives impression of setting in stone. where uml belongs in agile development practice? other preliminary spec documents, should use @ all? edit: found this: potential artifacts agile modeling breeze through robert martin's agile principles, patterns , practices the suggestion use uml communicate designs within team .. shared language ; taking @ diagram can understand solution (faster talking it) , contribute quicker. if find team making same diagrams on , on again, make version , store on wiki / source control. overtime the more useful diagrams start collate in place . don't spend time on it ... don't need detail. models built in architectural / construction realms because building house validate-test design expensive/infeasible. software not - validate de...

geometry - How can I set different stroke properties to in a path object in WPF -

i have path shape combine lines have different line thicknesses? strokethickness property set on path object cannot change different lines. same issue arise if wanted change line color. the reason want can draw arrowhead. charles petzold arrowheads http://www.charlespetzold.com/blog/2007/04/191200.html don't work me. if line dashed closed arrowhead draws weirdly. i figured way combine @ end of path/line new short line geometry thicker original path/line , had trianglelinecap, voila, got myself arrowhead. can't combine geometries have different line thicknesses , dashed types, etc. any ideas? just use multiple path objects in panel canvas or grid draw on top of each other: <grid> <path stroke="blue" strokethickness="2"> <path.data> <ellipsegeometry center="20 20" radiusx="10" radiusy="10" /> </path.data> </path> <path stroke=...

java - SWT Browser - disabled Vertical Scroll how do i hide it? -

i have swt shell, swt browser in it. on osx works fine, when on windows insists on putting disabled vertical scrollbar in shell or browser (i don't know which!). there way of forcing widgets hide scroll bars? when call getverticalscrollbar() or horizontal equivilant on either shell or browser null. there way of removing scrollbars completley? here code, nothing special: this.shell = new shell(this.display, swt.close | swt.min | swt.max); shell.addlistener(swt.close, new listener(){ public void handleevent(event event) { event.doit = false; location = shell.getlocation(); shell.setvisible(false); } }); shell.setsize(popupsize); shell.setminimumsize(popupsize); if(this.location == null){ shell.setlocation(x, y); }else{ shell.setlocation(this.location); } shell.setlayout(new filllayout()); this.browser = new browser(shell, swt.none | swt.smooth); any ideas...

svn - TFS vs open source alternatives? -

we're in process of setting source control/build/and more-server .net development , we're thinking either utilizing team foundation server (which costs lot of dough) or combining several open source options, such sourceforge enterprise/gforge , subversion , cruisecontrol.net , on. has walked down full blown oss road or tfs if want right , work soon? my work using oss build process cruise control engine , great. suggest if don't know why need tfs, it's not worth cost. the thing have keep in mind oss stuff software has either been in use java crew years previously, or software port of similar java code. robust , suitable purpose. microsoft cannot ship oss code, why have re-implement lot of open source stuff. so, no, not necessary, , there have been millions of projects shipped on stack. flip side there lot of nice features tfs won't (easily) oss stack, such integration bug/feature tracking software.

Is there any free PHP IDE that offers these features? -

written in c++ highlighter php, html, css, javascript easy code navigation hinting remote , local project development ftp code collapsing (folding) intelligent auto-complete code completion optional: - debugging these features im looking ide not written in java , free. phpdesigner 7 fast. has looking for, except it's not free, it's worth money. i use on old machines, others unusable. opens files , runs smoothly. it has source code navigator (shows index of php functions, classes, methods , variables have defined in current file), , lets jump function call definition ctrl+click, netbeans , big ones. lacks code collapsing. other used in past: dev-php. written in delphi, fast also. found bugs left it, other users in company didn't had bugs, installation only... try yourself. http://sourceforge.net/projects/devphp/

c# - ASP.NET MVC 2 - Html.EditorFor a nullable type? -

i have 2 editor templates: 1 decimal, , 1 decimal? (nullable) but when have nullable decimal in model, tries load normal decimal editor: <%: html.editorfor(model => model.somedecimal )%> <%: html.editorfor(model => model.somenullabledecimal )%> the first 1 works fine, , loads decimal editor template. second 1 tries load decimal template (and fails because not decimal field). the error message is: the model item passed dictionary null, dictionary requires non-null model item of type 'system.decimal'. my templates declared this: decimal template: <%@ control language="c#" inherits="system.web.mvc.viewusercontrol<system.decimal>" %> nullable decimal template: <%@ control language="c#" inherits="system.web.mvc.viewusercontrol<system.decimal?>" %> i know can make work passing in template name, eg but prefer work automatically using type other templates. <%: html.e...

c# - Acceptance Tests for Tetris when using Test Driven Development -

i want try implement tetris game using tdd. from i've come understand when reading growing object-oriented software, guided tests , should start defining acceptance tests. if right, acceptance tests when doing tdd defined use cases. it of great importance define first acceptance test work "skeleton" of app, should kind of simple. i've choosen following 2 acceptance tests first implement: the game starts , player closes it. the game starts , player nothing. loses. are these 2 acceptance tests starting tests? next acceptance tests? think of like the game starts , square pieces drop. player puts them in such way lines "explode", making game after 100 game-steps still not over. but feel kind of awkward, in real tetris game have different pieces falling, , acceptance testing should about. also, feel kind of tempted try implement in 1 go when doing (2), think not 1 pretends when implementing second acceptance test. guess idea have game imp...

alphablending - Implementing Porter-Duff Rules in Direct3D -

what direct3d render states should used implement java's porter-duff compositing rules (clear, src, srcover, etc.)? i'm haven't used java much, based on white paper 1984 , should straightforward mapping of render state blend modes. there of course more can these, normal alpha blending (sourcealpha, invsourcealpha) or additive (one, one) name few. (i assume asking these because porting existing functionality? in cause may not care other combinations...) anyway, these assume blendoperation of add , alphablendenable true. clear sourceblend = 0 destinationblend = 0 a sourceblend = 1 destinationblend = 0 b sourceblend = 0 destinationblend = 1 a on b sourceblend = 1 destinationblend = invsourcealpha b on a sourceblend = invdestinationalpha destinationblend = 1 a in b sourceblend = destinationalpha destinationblend = 1 b in a sourceblend = 0 destinationblend = sourcealpha a out b sourceblend = invdestinationalpha destinationblend = ...

image - CSS How to display a single icon out of a matrix for a list item -

i use single icon out of icon matrix (with around 16 x 16 icons) bullet image list. can position background image background-position, , repeat: norepeat. display whole line of remainder of matrix, i'm looking way crop background image. (by using can add different background-position lines in css diferent states open collapsed hover etc). not need run on internet explorer. i've been looking use generated content don't think can't achieved using that. next step have jquery create span or div before text, nice if can solve using purely css. html <ul> <li><a href="" title="">link#1</a></li> </ul> css li {background: url(sprite.gif) no-repeat 0 0; padding: 0 0 0 16px;} {text-transform: uppercase;} to show 2nd icon in 3rd row li {background: url(sprite.gif) no-repeat 16px -48px; padding: 0 0 0 16px;} note : sprite.gif has 16 icons, each 16x16px, set in 16x16 matrix

static libraries - problems using cross-compiled library -

i've cross-compiled library called adol-c on linux windows (mingw). seems ok, when try link new cross-compiled library (libadolc.a) in project on windows find following problems: g++ -lc:\1500tb\libs\cross-adol-c-2.1.0\adolc_base\lib -mwindows -oteste.exe src\main.o -ladolc -lstdc++ -lm c:\1500tb\libs\cross-adol-c-2.1.0\adolc_base\lib/libadolc.a(adouble.o): in function znsirserd': /usr/lib/gcc/i586-mingw32msvc/4.2.1-sjlj/include/c++/istream:219: undefined reference to std::istream& std::istream::_m_extract(double&)' c:\1500tb\libs\cross-adol-c-2.1.0\adolc_base\lib/libadolc.a(adouble.o): in function znsolsed': /usr/lib/gcc/i586-mingw32msvc/4.2.1-sjlj/include/c++/ostream:214: undefined reference to std::ostream& std::ostream::_m_insert(double)' c:\1500tb\libs\cross-adol-c-2.1.0\adolc_base\lib/libadolc.a(adouble.o): in function operator<< <std::char_traits<char> >': /usr/lib/gcc/i586-mingw32msvc/4.2.1-sjlj/include/c++/ostream:5...

java - Android: Activity establish network connection -

i have activity looks data web in oncreate method. activity activated user hitting notification. common problem user turn on phone, unlock it, slide open notifications, tap notification, , activity activate before phone done connecting internet. i have friendly alertdialog pops informing user data couldn't received , try again when network connected; is there way activity actively tell phone connect , detect connection being made , wait connection establish, , load data successfully ? usually, this: @override public void onresume(){ super.onresume(); // first, check connectivity if ( isonline ){ // things if there's network connection }else{ // seems there's no internet connection // ask user activate new alertdialog.builder(youractivity.this) .settitle("connection failed") .setmessage("this application requires network access. please, enable " + ...

SharePoint List Definition Instantiation Error (Cannot find a url for for quick launch element id 0, setting as ") -

i’ve run complex list through sharepoint solution generator 2008 , have set wspbuilder feature. list definition project deploys , activates fine when try create list through gui takes me error page has following text: exception hresult: 0x81070909 @ microsoft.sharepoint.library.sprequestinternalclass.createlistfromformpost(string bstrurl, string& pbstrguid, string& pbstrnexturl) @ microsoft.sharepoint.library.sprequest.createlistfromformpost(string bstrurl, string& pbstrguid, string& pbstrnexturl) and log file contains following messages: creating list "grouptasklist" in web " http://sharepoint2007:102 " @ url "lists/", (setuppath: "c:\program files\common files\microsoft shared\web server extensions\12\template\features\ grouptasklistdefinition\grouptasklist") creating list "grouptasklist" web " http://sharepoint2007:102 ", feature 33b16b15-5b5c-4286-bc30-566d99d80861, template id 111116. standa...

openoffice.org - How to convert ppt to images in Ruby? -

i'm using ruby displaying contents of powerpoint files in webpage. i've found solutions using win32ole i'm in linux environment , doesn't work. think application trigger openoffice command conversion. i recommend using docsplit . install gem, , can like: docsplit.extract_images(filename, :size => '920x', :format => [:png])

iPhone Deck Game interface -

i wrote code of card game .. it's time todo graphic , interface what's best approach represent card ?? a) calayer b) uiview c) uibutton which 1 best animate , receive user touches??? recommend?? thanks in advance as uibutton subclass of uiview, there's no difference in both of them. if need 'clicks' handling, can choose button, if need override touchesbegan/touchesmoved should override uiview instead uibutton.

how to trim leading zeros from alphanumeric text in mysql function -

what mysql functions there (if any) trim leading zeros alphanumeric text field? field value "00345abc" need return "345abc". you looking trim() function . alright, here example select trim(leading '0' myfield) table

c# - Combine lists of key value pairs where keys match -

i have list of list<keyvaluepair<datetime, int>> , want merge 1 (union), , there pairs same key in more 1 list, have values summed. example: input list 1: date1, 1 date2, 2 input list 2: date2, 3 date3, 4 input list 3: date3, 5 date4, 6 desired output: date1, 1 date2, 5 date3, 9 date4, 6 from i've been reading linq trickery sort of thing possible neatly, far i've not been able head around it. if there's nice way linq i'd love hear it, if not i'll grateful other tidy looking answer - c++ brain can think of long-winded procedural ways of doing :) note i'm using list reason please don't suggest using dictionary or datatype. thanks. ilookup<datetime, int> lookup = source .selectmany(list => list) .tolookup(kvp => kvp.key, kvp => kvp.value); or list<keyvaluepair<datetime, int>> result = source .selectmany(list => list) .groupby(kvp => kvp.key, kvp => kvp.value) .select(g => n...

shader - Count image similarity on GPU [OpenGL/OcclusionQuery] -

opengl. let's i've drawn 1 image , second 1 using xor. i've got black buffer non-black pixels somewhere, i've read can use shaders count black [ rgb(0,0,0) ] pixels on gpu? i've read has occlusionquery. http://oss.sgi.com/projects/ogl-sample/registry/arb/occlusion_query.txt is possible , how? [any programming language] if you've got other idea on how find similarity via opengl/gpu - great too. i'm not sure how xor bit (at least should slow; don't think of current gpus accelerate that), here's idea: have 2 input images turn on occlusion query. draw 2 images screen (i.e. full screen quad 2 textures set up), fragment shader computes abs(texel1-texel2), , kills pixel ( discard in glsl) if pixels the same (difference 0 or below threshold). easiest using glsl fragment shader, , there read 2 textures, compute abs() of difference , discard pixel. basic glsl knowledge enough here. get number of pixels passed query. pixels same, quer...

hotkeys - What are cross-browser & cross-OS safe keyboard shortcuts usable for web application? -

i developing quite large web app , idea use hotkeys common tasks. discovered finding safe key combinations problem, regarding different browsers , oses. example chrome has such long list of hotkeys trying use kind of logical hotkeys scheme webapp impossible - e.g. ctrl+1, ctrl+2, ctrl+3, etc ... so repeat question, have cheatsheet of safe hotkeys can used in webapp , not worry browser or os interference ? thank you. i wouldn't count on it. it's okay listen shortcuts use alt modifier, there's still no way sure keyboard shortcut free. users can install programs listen keyboard shortcuts, or use browser didn't expect. if shortcuts can used when user not typing in textbox or something, might better idea listen keys pressed without modifier key. if no textbox or other gui element focused, document.activeelement == document.body should true. (somebody correct me if i'm wrong).

.Net 8-bit Encoding -

i'm working on serial port, transmitting , receiving data hardware @ 8bit data. store string facilitate comparison, , preset data stored string or hex format in xml file. found out when using encoding.default ansi encoding 8bit data converted , reversible. ascii encoding works 7bit data, , utf8 or utf7 doesn't works too, since i'm using character 1-255. encoding.default fine, read on msdn it's dependent on os codepage setting, means might behave differently on different codepage configured. use getbytes() , getstring extensively using encoding, failsafe , portable method works time @ configuration. idea or better suggestion this? latin-1 aka iso-8859-1 aka codepage 28591 useful codepage scenario, maps values in range 128-255 unchanged. following interchangeable: encoding.getencoding(28591) encoding.getencoding("latin1") encoding.getencoding("iso-8859-1") the following code illustrates fact latin1, unlike encoding.default, characters...

security - Extracting an unique identifier from a PC using PHP without PECL? -

i need distribute php site , want control installation this, extract unique identifier based on hardware of machine site deployed , send identifier site validation. how extract unique identifier without using win32 api pecl extension? can forward me guides or tutorials show how done? if planning on limiting app can installed, have encode using zend guard . otherwise, no matter restrictions put in place, can removed. heck, having encoded won't stop determined user getting source code.

Trouble using MySQL transactions with loops in PHP -

i trying set mysql transaction such can loop through bunch of queries (see below) , if of them fail, rollback of changes. finding if 1 fails, not of queries rolled back. doing wrong here? mysql_query("start transaction"); foreach($array1 $arr){ // loop sql query if(mysql_error()){ $failed = "..."; } } foreach($array2 $arr){ // loop sql query if(mysql_error()){ $failed = "..."; } } if(isset($failed)){ mysql_query("rollback"); } else { mysql_query("commit"); } thanks! the reason if query fails (due error), transaction automatically rolled , terminated. should stop looping if query fails, because executing after failed query autocommit (or @ least in transaction if autocommit off)...

viewstate - ASP.NET - View State being passed in URL -

when submitting forms using "get" method, getting huge url containing viewstate (as other values don't want). e.g. http://mysite.com/page.aspx?__eventtarget=&__eventargument=&__viewstate=%2fwepdwukmti5njy4ndkznw9kfgicaw9kfgicbw8pfgiebfrlehqfozx0ywjszt48dhi%2bphrkpln0yxj0aw5npc90zd48dgq%2bvghlifrhymxlpc90zd48l3rypjwvdgfibgu%2bzgrkm8tna9%2fwbz9egjjcukk29hg%2brje%3d&__eventvalidation=%2fwewawki9pjfbwkm54rgbglwlm%2bbam8w77lt5q4or%2fztwd8vqiy36fwa&days=6&displaytype=dash&button1=back you can see, there values want @ end, want rid of else. how can this?

How do you do a deep copy of an object in .NET (C# specifically)? -

this question has answer here: deep cloning objects 37 answers i want true deep copy. in java, easy, how do in c#? i've seen few different approaches this, use generic utility method such: public static t deepclone<t>(t obj) { using (var ms = new memorystream()) { var formatter = new binaryformatter(); formatter.serialize(ms, obj); ms.position = 0; return (t) formatter.deserialize(ms); } } notes: your class must marked [serializable] in order work. your source file must include following code: using system.runtime.serialization.formatters.binary; using system.io;

java - how to execute a vba macro every 30 minutes automatically? -

i'm working on project send alert notifications mailing list. i've excel file vba macro permit updating datatbase. need execute macro in file automatically every 30 minutes without having open file. i've been told write macro in separate program, don't know how it. excel vba dom has nice feature called application.ontime . can schedule macro run @ time. run macro every 15 min, schedule 15 min in future on application startup, , schedule 15 min in future everytime macro runs. from website: http://www.ozgrid.com/excel/run-macro-on-time.htm example: private sub workbook_open() application.ontime + timevalue("00:15:00"), "mymacro" end sub

NHibernate ICriteria - order by child collection count? -

here simple example scenario - a 'tag' has many 'questions'. when list of tags how order tags question count using criteria api? i have done before haven't touched nh in 4 months , have forgotten... projections maybe? help!!! thanks sat down fresh pair of eyes , figured out... tags ordered propery on tags question collection (views).. made alot more sence in domain ordering count of children public ilist<tag> gettop(int numberoftags) { using (itransaction transaction = session.begintransaction()) { detachedcriteria detachedcriteria = detachedcriteria.for<tag>() .createcriteria<tag>(x => x.questions) .addorder<question>(x => x.views, order.desc) .setmaxresults(numberoftags) .setprojection(projections.distinct(projections.id())); ilist<tag> tags = session.createcriteria<tag>()...

performance - Is Fortran easier to optimize than C for heavy calculations? -

from time time read fortran or can faster c heavy calculations. true? must admit hardly know fortran, fortran code have seen far did not show language has features c doesn't have. if true, please tell me why. please don't tell me languages or libs number crunching, don't intend write app or lib that, i'm curious. the languages have similar feature-set. performance difference comes fact fortran says aliasing not allowed. code has aliasing not valid fortran programmer , not compiler detect these errors. fortran compilers ignore possible aliasing of memory pointers , allows them generate more efficient code. take @ little example in c: void transform (float *output, float const * input, float const * matrix, int *n) { int i; (i=0; i<*n; i++) { float x = input[i*2+0]; float y = input[i*2+1]; output[i*2+0] = matrix[0] * x + matrix[1] * y; output[i*2+1] = matrix[2] * x + matrix[3] * y; } } this function run...

reporting - Crystal Reports vs ReportViewer Pros/Cons? -

we have been designing our reports around crystal reports in vs2008 our web application , discovered microsoft provided reportviewer control. i've searched around bit cannot find breakdown of pros , cons of each method of producing reports. i'm looking pros , cons regarding: ease of development ease of deployment ability export data ease of support , finding on web well, can answer 1 side. have used reportviewer aka client side reporting. cna tell easy use, easy deploy, easy develop. if can create sql reporting services reports can create these. can take kind of datasource have full control. here excellent book on client side reporting: http://www.apress.com/book/view/9781590598542 you can export using pdf , excel built in, can add own export handling also. can use in winfporms, asp.net, in own services, can can imagie them. for crystal, dont know enough them, sorry.

security - secure transfer between login form and server in php -

how can implement secure transfer login form on client server in php? mean coding password , user ,something except using https. http digest authentication can work without requiring ssl. but has same problems other http authentication. e.g. there's no logout function, can't control & feel of login ui, no integration between login credentials , application-specific user account data, etc. i agree @charles -- use https when sending sensitive data. re comment: at start of login.php script, check if request https , if not redirect correct url. if (!isset($_server["https"])) { header("location: https://mydomain.com/login.php"); } alternatively use apache rewrite rule: rewriteengine on rewritecond %{server_port} !^443$ rewriterule ^/(login.php) https://%{server_name}/$1 [l,r] also, remember don't care if client read page login form plain http. care if client submits form insecurely, because that's request contai...

.net - Reading .resx files programmatically -

i have application contents of e-mails sent stored in .resx file. asp.net application, .resx file lives in /app_globalresources when need send e-mail, i'm reading using: httpcontext.getglobalresourceobject("mailcontents", "emailid").tostring now, need use same mailing method project (not website). mailing method in dll projects in solution share. in other project, don't have httpcontext. how can read these resources? my current approach is, inside mailing class, check whether httpcontext.current null, , if so, use separate method. separate method i'm looking @ right (after resigning myself fact there's nothing better) have path .resx file of website stored in app.config file, , somehow read file. started trying system.resources.resourcereader, looks wants .resources file, not .resx one. i think answered own question... there's resxresourcereader class. couldn't find because it's in windows forms namespace, n...

Conversion of table to Excel from JavaScript -

i need export editorgridpanel grid data excel without sending data server-side, cross browser , cross platform solution work in ie6 , ie7. any pure javascript solution well! far have found data uri solution great ie supports 8-th version. there possibility export through activex component not want since makes app depended windows , msoffice. can recommend me solution ? you export csv , import file excel , open office or numbers?

java - How to do dynamic URL redirects in Struts 2? -

i'm trying have struts2 app redirect generated url. in case, want url use current date, or date looked in database. /section/document becomes /section/document/2008-10-06 what's best way this? here's how it: in struts.xml, have dynamic result such as: <result name="redirect" type="redirect">${url}</result> in action: private string url; public string geturl() { return url; } public string execute() { [other stuff setup date] url = "/section/document" + date; return "redirect"; } you can use same technology set dynamic values variable in struts.xml using ognl. we've created sorts of dynamic results including stuff restful links. cool stuff.

Global action filter in ASP.NET MVC -

is possible create global action filter automatically apply actions in controllers in asp.net mvc application? want "before_filter" defined in applicationcontroller in ruby on rails. thank help. this depends want it. in many scenarios, previous answers vucetica , adeel want do. however, neither of them meet criteria listed: automatically apply all actions/controllers . to that, need implement handler application beginrequest event in global.asax. see msdn documentation more information. update - july 27, 2010 : scottgu blogged about mvc 3 preview 1, includes framework global filters you're talking about. they're registered via global.asax, , can apply controllers or based on specific criteria.

android - Run method from extends Activity extends Runnable -

i'm trying call method inside runnable running. waits string entered , when depending on string (the strings act commands) calls method , supposed run whats inside it. public class app extends activity implements runnable { public void run() { try { serversocket serversocket = new serversocket(portnum); while (true) { socket client = serversocket.accept(); try { bufferedreader in = new bufferedreader(new inputstreamreader(client.getinputstream())); string str = in.readline(); if(str.equals("test")) { //method call here } } catch(exception e) { log.d("app", e.getmessage()); } { client.close(); log.d("app", "done."); ...

C# - How to add an Excel Worksheet programmatically - Office XP / 2003 -

i starting fiddle excel via c# able automate creation, , addition excel file. i can open file , update data , move through existing worksheets. problem how can add new sheets? i tried: excel.worksheet newworksheet; newworksheet = (excel.worksheet)excelapp.thisworkbook.worksheets.add( type.missing, type.missing, type.missing, type.missing); but below com exception , googling has not given me answer. exception hresult: 0x800a03ec source is: "interop.excel" i hoping maybe able put me out of misery. you need add com reference in project " microsoft excel 11.0 object library " - or whatever version appropriate. this code works me: private void addworksheettoexcelworkbook(string fullfilename,string worksheetname) { microsoft.office.interop.excel.application xlapp = null; workbook xlworkbook = null; sheets xlsheets = null; worksheet xlnewsheet = null; try { xlapp = new microsoft.office.interop....

Is it possible make scroll invisible in facebook when we are playing a game? -

we coding application facebook. it´s game diferent kind of levels, , in on level use navigation keyboad, , when press down key or up... page move because scroll, wanna make scroll invisible, possible? don´t wanna make invible in levels, in someones. thanks :) i think need stop key press event propagation main page doesn't notified when press key in game area (by returning false @ end of onkeydown() example).

binary - Is there any way of reducing the dump file size of a Sybase database? -

when dump sybase database, doesn't seem matter whether there's data in tables or not, file size same. i've been told down fact dump file binary , not logical, file of dump file based on allocated size of database. know oracle can use logical dump files, can sybase similar, or there other sneaky ways of getting dump file size down? since somewhere around version 12 have been able perform compressed dumps in ase. the syntax is: dump database database_name file_name [ compression=compress_level] compress_level 0-9. 0 no compression , 9 most. more compress higher cpu usage whilst running dump. need peform little testing find appropriate balance of size versus performance. no special commands needed load dump.

In a Java debugger, how to ignore exceptions never passing through my code -

i'm using intellij idea java development, i'm interested in answers targeting other ides or general concepts debugging java code. because feature i've missed in number of ides, i'm unsure if i've missed workflow concept when transferring debug habits other languages. let's i'm writing code in myapp.* while using framework classes somelib.* . typical stack trace may start in either package , may switch several times between them. let's i'm debugging under assumption there bugs in my code , there aren't in library code . example stack trace (showing class names): somelib.d (current stack frame) somelib.c myapp.y myapp.x somelib.b somelib.a normally, i'm not interested in following types of exceptions , not want debugger break on them: thrown in somelib.b , caught in somelib.a . either library code throwing exceptions handle problematic state inside library or stop application. in latter case, i'm interested in exception mess...

php - How to change URL's for each ISSET with PAGINATION? -

i'm using script pagination. when url have $_get['word'] cant change url's of links. how can it? <? if (isset($_get['page']) ) { $pageno = $_get['page']; } else { $pageno = 1; } // if $limit = ""; if(isset($_get['word'])) { $word = mysql_real_escape_string($_get['word']); $word = $word{0}; $limit = " baslik '$word%'"; } $query = mysql_query("select count(*) m3_music_mp3" .$limit); $query_data = mysql_fetch_row($query); $numrows = $query_data[0]; $rows_per_page = 30; $lastpage = ceil($numrows/$rows_per_page); $pageno = (int)$pageno; if ($pageno > $lastpage) { $pageno = $lastpage; } // if if ($pageno < 1) { $pageno = 1; } // if $limit .= " order id desc limit " .($pageno - 1) * $rows_per_page .',' .$rows_per_page; //$limit = 'order id desc limit ' .($pageno - 1) * $rows_per_page .',' .$rows_per_page; $query = mysql_query("s...

html - Width of an element accounting for quirks mode in javascript? -

i've been scanning through popular js libraries, can't find 1 has width function dom element accounts quirks mode in internet explorer. issue padding , borders don't counted in the width when quirks mode engaged. far can tell happens when doctype left out or doctype set html 3.2. obviously set doctype standards compliant, script can embedded anywhere don't have control on doctype. to break problem down smaller parts: 1) how detect quirks mode? 2) what's best way extract border , padding element compensate? example prototype: <html> <head> </head> <body> <div id="mydiv" style="width: 250px; pading-left: 1px; border: 2px black solid">hello</div> <script> alert($('mydiv').getwidth()) </script> </body> </html> result: 253 (ff) 250 (ie) thanks in advance! @1 document.compatmode "css1compat" means " standards mode " , "back...

Get Windows "load average" in Java -

i'm writing java application needs @ how "heavily loaded" machine it's running on is. on *nix, load average divided number of processors fits bill perfectly, , retrieve load average managementfactory.getoperatingsystemmxbean().getsystemloadaverage() . unfortunately, returns -1 on windows, call apparently "expensive" called frequently. what's easiest way retrieve similar windows metrics such processor queue length or cpu utilisation, either in pure java or via jni? you can retrieve cpu utilization on windows using wmi. code , documentation accessing wmi java appears available here .

qt - CONFUSED -- c++ 3rd party library, new to c++ -

(mingw32, windows xp) hello, attempting migrate java c++. confused , frustrated finding, installing, , compiling non-standard c++ libraries. in java it's convenient stuffed every functionality , documentation ever needed in java's standard api. there list of essential c++ library such threading, gui, networking, image\ audio processing, xml, etc.etc. in 1 place? or possibly, offered single package? i tried installing qt library weeks , wont compile. in java used learn trial-and-error learn new aspect of functionality, impossible if can't fetch , run new api in first place. please, need suggestion, wanted break free of java's abstraction, want able use c++ before decided shooting myself in head. the c++ standard library extremely light. contains near functionality offered java runtimes or .net clr. the boost libraries add whole bunch of functionality c++, not (if any) in area of user interface. for ui, there's question of platform you're tar...

Session in Asp.net -

when add variable asp.net session, variables stored on client side? if using default session in asp.net stored in memory inside asp.net worker process. server side cache, nothing @ client. there other session store options available such dedicated session state machine or sql server. can roll own session provider. all explained here http://msdn.microsoft.com/en-us/library/ms972429.aspx

survey - What is software development at your company really like (methodologies, tools, ...)? -

since i've started first job professional software developer 2 years ago, i've read many articles commonly accepted methodologies (e.g. scrum, xp), technologies (e.g. ejb, spring), techniques (e.g. tdd, code reviews), tools (bug tracking, wikis) , on in software companies. for many of these i've found @ our company doesn't use them , ask myself why. doing wrong or merely these articles i've read not telling it's in real world? these articles more academic? so, please tell me it's @ company. tell regarding software development. here suggestions (in order come mind). tell @ least if or not, or give short comment: test-driven-development domain-driven-design model-driven-design/architecture do test? unit testing integration testing acceptance testing code reviews innovative technologies (spring, hibernate, wicket, jsf, ws, rest, ...) agile pair programming uml domain-specific languages requirement specification (how?) continous integrat...

NHibernate calling Oracle stored procedure with schema prefix, how? -

i have nhibernate calling stored procedure in oracle working currently. however, how specify schema prefix in {call} syntax in tag? i tried <sql-query name="my_sproc"> <return class="my_sproc_class" /> {call schema2.my_sproc (:p1)} </sql-query> but nhibernate run-time came 'schema2' not defined while 'schema2' defined schema on oracle db. thanks. could privileges ? procedure may exist in schema may not have privileges execute it, or may have privileges through role isn't enabled. could parameters. if procedure expects 2 parameters (or function) trying call 1 can "doesn't exist" error when means "there isn't 1 can call 1 parameter". final option if have package in schema same name other schema. can happen generic 'utils'. if ask oracle execute utils.proc , have utils package, in package , throw error if doesn't find it, if there utils schema procedure proc. ...