Posts

Showing posts from March, 2011

What happens when two Java frameworks need third one but each of the two need different version of third one? -

in java project i'm using 2 different frameworks (let's a.jar , b.jar) , both of them require 1 common framework (let's log4j.jar) in 2 different versions. how treated java if framework needs log4j v1.1 , b needs log4j v1.2? cause kind of conflict/error or somehow (how?) resolved? if not cause conflict/error (my project can compiled , run) - can use version of log4j myself in project? or forced select lower / higher version number of log4j? update: to more specific... if part of log4j api changed in v1.2 (let's 1 single method doit() signature changed) , both , b call doit. happend? project run? crash on first use of doit? version of log4j must put on classpath - v1.2 or both? java doesn't natively support management of multiple versions of same piece of code, is, can use @ 1 version within same jvm (with default class loader). however, checkout question 1705720 , has several answers pointing out possible ways of achieving (osgi or custom class l...

php - What is the best method of maintaining a large query string? -

in several php applications i'm making need maintain long query string filters table. want change 1 or more variables per filter change, while rest of query string stays unchanged. i have few ideas on how this, including using javascript build query string every time filter changed, or maintaining query string in session variable, changing there. i opinions or experience on how best way be. thanks! yes, use associative array store map of keys values. can change 1 easily. these supported in both php , javascript, you're good. you'll need write functions output array query string. i did on lark once (and every time): alphabetize (or otherwise order) parameters in query string. why? convenient if same page has same url/query string. if write tests, it's easier assert query strings match. otherwise, @ mercy of associative array implementation's traversal order.

c++ - How to raise warning if return value is disregarded? -

i'd see places in code (c++) disregard return value of function. how can - gcc or static code analysis tool? bad code example: int f(int z) { return z + (z*2) + z/3 + z*z + 23; } int main() { int = 7; f(i); ///// <<----- here disregard return value return 1; } please note that: it should work if function , use in different files free static check tool you want gcc's warn_unused_result attribute: #define warn_unused __attribute__((warn_unused_result)) int warn_unused f(int z) { return z + (z*2) + z/3 + z*z + 23; } int main() { int = 7; f(i); ///// <<----- here disregard return value return 1; } trying compile code produces: $ gcc test.c test.c: in function `main': test.c:16: warning: ignoring return value of `f', declared attribute warn_unused_result you can see in use in linux kernel ; have __must_check macro same thing; looks need gcc 3.4 or greater work. find macro used in kernel header files: ...

c# - How can i structure a program (proces) with a very high number of IF statements -

i have create program kind of complex proces. well, process not complex, there lot of variables control process. can't in detail tell process, i've made one, has same load of if's: the process is: should stop iron melt oven or not. we've got these parameters: if temp goes above 800 degrees celcius, stop except, when expect cool water available oven 2 in next 20 minutes, can continue except, when temp rises 10 degrees in next 10 minutes, can't wait 10 minutes cold water, have stop. except, when temp goes down reason 790-800 degrees 5 minutes, add 5 minutes time need cool water. except, when temp goes down reason 780-790 degrees 5 minutes, add 5 minutes time need cool water. etc. etc. you can think of 20 except / if / then's in our process have > 50 situations, 1 goal: should machine stop or not. i must don't have many situations 1 goal/issue (namely: stop machine or not), , timebound: if happening 10 minutes then...., , have calculate s...

File explorer for Android devices -

does android platform provide ability list of files , sizes stored on android device? need find or write explorer type of application. tre esfileexplorer www.estrongs.com

pair programming - Server is down, is there an alternative server for ECF than ecftcp://ecf.eclipse.org:3282/ -

i trying setup eclipse collaborationframework using doc share plgin i managed connect through google talk ok, when tried create collboration share workspace, on trying connect ther server got connection failed error, not connect server anybody know if is server not available anymore? is there alternative elsewhere? would better creating own? thanks you can create ecf server - there's faq on how launch server @ wiki.eclipse.org. from command line, can invoke eclipse application: eclipse.exe -console -application org.eclipse.ecf.provider.appgenericserver 1234 that starts port on ecftpc://localhost:1234 you can bring osgi command line , use startapp ring instance. allow have multiple servers in same runtime. java -declipse.application.registerdescriptors=true -declipse.ignoreapp=false -jar org.eclipse.osgi -console -noexit osgi> startapp org.eclipse.ecf.provider.genericserver 1234 osgi> startapp org.eclipse.ecf.provider.genericserver 5678 s...

java garbage collection -

i going through question on scjp preparation site . how answer correct? what true objects referenced a, b, aa @ line labeled "// code goes here"? class { private b b; public a() { this.b = new b(this); } } class b { private a; public b(a a) { this.a = a; } } public class test { public static void main(string args[]) { aa = new a(); aa = null; // code goes here } } a) objects referenced , b eligible garbage collection. b) none of these objects eligible garbage collection. c) object referenced "a" eligible garbage collection. d) object referenced "b" eligible garbage collection. e) object referenced "aa" eligible garbage collection. answer: a java doesn't use simple reference-counting garbage collector. when jvm full gc run, walks entire object graph, marking each item finds. items aren't marked eligible cleanup. since neither a nor b reac...

python 3.1 - DictType not part of types module? -

this found in install of python 3.1 on windows. where can find other types, dicttype , stringtypes? >>> print('\n'.join(dir(types))) builtinfunctiontype builtinmethodtype codetype frametype functiontype generatortype getsetdescriptortype lambdatype memberdescriptortype methodtype moduletype tracebacktype __builtins__ __doc__ __file__ __name__ __package__ >>> according doc of types module ( http://docs.python.org/py3k/library/types.html ), this module defines names object types used standard python interpreter, not exposed builtins int or str are. ... typical use isinstance() or issubclass() checks. since dictionary type can used dict , there no need introduce such type in module. >>> isinstance({}, dict) true >>> isinstance('', str) true >>> isinstance({}, str) false >>> isinstance('', dict) false (the examples on int , str outdated too.)

c# - Is it necessary to implement a BST with both keys and values? -

is necessary implement bst both keys , values? can implement bst has method calls such following, in make comparison @ each node of whether traversal should go left node or right node based upon v value: public class bst<v> { public void insert(v value) { //implementation } public v remove(v value) { //implementation } //other methods } or, can implement bst such has method calls following, in k keys comparing determination of whether traverse left node or right node: public class bst<k key, v value> { public void insert(k key, v value) { //implementation } //which of following appropriate method signature? public v remove(k key) { //implementation } //or? public v remove(v value) { //implementation } //other methods } not using key value fine. however, tree become immutable if this. modifying value no longer safe since imbalance tree...

c# - Exception escapes from workflow despite TryCatch activity -

i have workflow inside windows service loop performs work periodically. work done inside trycatch activity. try property transactionscope activity wraps custom activities read , update database. when transaction fails, expect exception caused caught trycatch . however, workflow aborts. workflow have following: var wf = new while(true) { body = new sequence { activities = { new trycatch { try = new transactionscope { isolationlevel = isolationlevel.readcommitted, body = new sequence { activities = { ..custom database activities.. } }, abortinstanceontransactionfailure = false }, catches = { new catch<exception> { action = new activityaction<exception> ...

actionscript 3 - Flex: time how long HTTPService takes to load? -

i loading xml httpservice in flex. taking longer load. want trouble shooting, in order tell making difference need able time requests , how long taking. what best way time http service see how long took httpservice.send() httpservice.result thanks! this duplicate, go here see previous answer question: in flex, there way determine how long httpservice.send() call takes round-trip?

c# - Explain this: CheckBox checkbox = (CheckBox)sender; -

while going through checkbox found there written checkbox checkbox = (checkbox)sender on checkbox1_checkedchanged event. please explain means? the line casts sender checkbox . why? the event handler signature checkedchanged event is: checkchanged(object sender, eventargs e) so, need cast sender checkbox if want use checkbox specific functionality - object doesn't have can use... this way checkbox variable can used checkbox id , operate on checkbox.

c# - Change the cell border width and also make the cell border only all,left ,right,top,bottom or none -

change cell border width , make cell border all,left ,right,top,bottom or none in winform datagridview. in datagridview problem change border style of each cell , in excel sheet. have tried following didnt work. datagridviewadvancedborderstyle mystyle = new datagridviewadvancedborderstyle (); datagridviewadvancedborderstyle myplaceholder = new datagridviewadvancedborderstyle (); mystyle.top =datagridviewadvancedcellborderstyle.none; datagridview1.rows[1].cells[1].adjustcellborderstyle(mystyle, myplaceholder, true, true, true, true); that's not how works. virtual method, you're supposed override in own custom datagridviewcell derived class. , datagridview have filled custom cells.

strip tags - Why doesn't strip_tags work in PHP? -

i've got following code: <?php echo strip_tags($firstarticle->introtext); ?> where $firstarticle stdclass object: object(stdclass)[422] public 'link' => string '/maps101/index.php?option=com_content&view=article&id=57:greenlands-newest-iceberg&catid=11:geography-in-the-news' (length=125) public 'text' => string 'greenland's newest iceberg' (length=26) public 'introtext' => string '<p>a giant chunk of ice calved off petermann glacier on northwest side of greenland summer. @ 100 square miles (260 sq. km) in size, 4 times size of manhattan, th' (length=206) public 'date' => object(jdate)[423] public '_date' => int 1284130800 public '_offset' => int 0 public '_errors' => array empty you can see $firstarticle->introtext refers string: " <p> a giant chunk of ice calved of...

objective c - utility applications in Iphone -

what utility applications & how use them in iphone? how start utility application implementation? the utility app template template useful apps require simple user interaction default. here definition apple getting started guide. hope helps. "utility application. application implements main view , lets user access flip-side view perform simple customizations. stocks application example of utility application." you might find example useful example: http://wh1t3s.com/2010/05/27/iphone-utility-app-with-eaglview-on-flipside/

What extension to enable in order to use scandir() in php? -

i read php documentation since 5.1.0 scandir() default not usable in php. how can enable it? on documentation page , don't see support claim - reference version "(php 5)", , scandir() built-in function, don't need additional extension it. (anyway, docs page has long list of alternative approaches and/or improvements.)

asp.net - Access code behind members in radiobuttonlist inside gridview -

how can access code behind methods radiobuttonlist insode gridview below? using code blocks of reason not allowed here.. <asp:GridView ID="gvChildren" runat="server" DataKeyField="ID"> <Columns> <asp:TemplateField> <ItemTemplate> <asp:RadioButtonList runat="server" ID="rblAccess">...

about certification in java -

i want know,what basic certification in java , syllabus it?.pls tell me. earlier scja oracle certified associate .book written cameron mckenzie covers topics.

How do you turn off the Action Log Data Collector in Microsoft Test Manager 2010? -

microsoft test manager 2010 not support silverlight applications, when navigate test silverlight 4 app running in ie, popup notifying me there compatibility issue. annoying. doing googling, found out solution disable action log data collector. cannot locate setting in test manager 2010. know ? thanks, scott in testing center click on plan (it shows current test plan). click on properties. in "run settings" / "manual runs" section choose 'local test run' "test settings". click open link next drop down. in opened window select data , diagnostics , uncheck items under role local.

winforms - Update datagrid view with updated data -

i've datagridview. read xml file , bind data gridview. change xml , save in form. reread xml file , bind gridview. datatable getting updated values. grid not getting updated till close , open application again. how it? thank you. regards, raghavendra #1 is there databind() or rebind() datagridview? set datasource - dvmovieslist.datasource = dtmovies; if add new row dtmovies table , set datasource again, getting reflected. if edit values of of existing rows , re assign datasource not getting reflected till close , open application again. ideas? thank you. i think need place bindingsource in between datagridview , datatable. datagridview _dgv = new datagridview(); bindingsource _bs = new bindingsource(); datatable _dt = new datatable(); . . . _dgv.datasource = _bs; _bs.datasource = _dt; now whenever _dt gets updated, bindingsource should take care of refreshing datagridview , shouldn't have worry resetting datasource property. datasource propertie...

optimization - iphone landscape mode slow -

the iphone app developing in landscape mode chugging. put in portrait comparison , appears run smoother in orientation. not doing i'd think process intensive: map view, buttons, labels, , quartz drawing, yet basic quartz animation slows down badly. does know if landscape mode terribly handicapped compared portrait, and/or if so, if there better ways create landscape app? use root rotated view transformed 90 degrees , attach sub views it. thanks. there should no real difference between landscape , portrait orientations when comes rendering performance. using transform rotate main view 90 degrees? of iphone os 2.1, believe, no longer need manually apply transform main view start in landscape. had force landscape orientation place delegate method within application delegate: - (void)application:(uiapplication *)application willchangestatusbarorientation:(uiinterfaceorientation)newstatusbarorientation duration:(nstimeinterval)duration; { // prevents view au...

java - Spring Tests : transaction not rolling back after test method executed -

i'm trying create integration tests legacy application deployed on weblogic 8.1 using subclass of abstracttransactionaljunit4springcontexttests. my test method has following annotations : @test @rollback(true) public void testdeployedejbcall throws exception {...} my test class references beans of type org.springframework.ejb.access.simpleremotestatelesssessionproxyfactorybean, proxy ejbs deployed on weblogic server. when call methods on proxy bean in sequencial manner in test method, transaction rolls correctly @ end of test. e.g. : @test @rollback(true) public void testdeployedejbcall throws exception { long result1 = myejb.method(100l); long result2 = myejb.method(200l); ... } however, make 2 parallel calls same ejb method. therefore i've made inner class implements callable, in order call methods in 2 different threads , hope run in parallel. however, doing seems make ejb methods called outside transaction, , nothing rolled back. here full t...

xslt convert xml string in xml elements -

here's tricky one. i have following xml <test> <testelement someattribute="<otherxml><otherelement>test test</otherelement></otherxml>"> </testelement> </test> using xslt, want transform xml have following result. <test> <testelement> <someattributetransformedtoelement> <otherxml> <otherelement>test test</otherelement> </otherxml> </someattributetransformedtoelement> </testelement> </test> basically, text in attribute must transformed actual elements in final xml any ideas how achieve in xslt? alex you can achieve disabling output escaping. however, note input document not valid xml document ( < illegal in attribute values , needs escaping). therefore changed input document follows: input document <?xml version="1.0" encoding="utf-8"?...

java - Injecting an enum with Spring -

i'm trying inject java enum through spring context using <util:constant . here's i've done. in spring config, i've following entry <util:constant id="content" static-field="com.test.taxonomy.model.metadatatypeenum.content_group" /> <util:constant id="category" static-field="com.test.taxonomy.model.metadatatypeenum.category" /> <bean id="adskcontentgroup" class="com.test.taxonomy.model.adskcontentgroup" scope="prototype"> <property name="name" ref="content" /> </bean> here, i'm trying leverage enum adskcontentgroup injected in bean's (adskcontentgroup) ame property. here's enum : public enum metadatatypeenum { content_group ("adskcontentgroup"), private string metadatatype; private metadatatypeenum(string metadatatype) { this.metadatatype = metadatatype; } public string getmetadatatype() { ...

uinavigationcontroller - How to display UIActionSheet just below top navigation status bar on iPhone -

i display action sheet sliding below top status bar. when use navigationbar view show in, sheet still displayed @ bottom of screen. how can show originating top instead? the class i'm calling following code 'uiviewcontroller' uiactionsheet *sheet = [[uiactionsheet alloc] initwithtitle:@"hello" delegate:nil cancelbuttontitle:nil destructivebuttontitle:nil otherbuttontitles:nil]; uinavigationbar *navbar = self.navigationcontroller.navigationbar; [sheet showinview:navbar]; i've seen apps show sliding out drawer of sort status bar is.(eg: twitterrific) how done? apple has stated action sheets work same way , slide in same direction. hence there no advertised way manipulate animations , such.

objective c - Wrap Text in UITextField? -

does know how wrap text in uitextfield ? using cocoa/objective-c in xcode iphone project, , can not seem find way this... uitextfield meant single-line text only. if want multiple lines of text, you'll have use uitextview class instead. it's worth noting uitextview inherits uiscrollview , if don't want scrolling, may want stick uitextfield , put text being on 1 line... once tried subclass uitextview make multiple-line uitextfield , uiscrollview made task nightmare—in end went using simple uitextfield .

php - SQL: search of nearest in 2d square and circle -

Image
i have table: points it has 2 filds: x, y each row represents dot on 2d field i want capable of performing search of dots in radius r and square side btw: use php access db. my main point nearest center of figure point first result in quqe how such thing in sql? mathematically point in circle statisfies equation (c.x-p.x)^2 + (c.y-p.y)^2 <= r^2 where c cetner of circle, p - point, r - radius for square max(abs(c.x-p.x),abs(c.y-p.y)) <= a/2 where c cetner of square, p - point, a - side of square you can write theese equations in language. left side of equations called distance various measures . finding nearest point should order resultset distance asceniding , take first result. something this: select top 1 p.x, p.x points p otrder ((@x - p.x)*(@x - p.x)+(@y - p.y)*(@y - p.y))

Android - how do I bring my activity to foreground automatically from Address book -

following scenario, my activity running on foreground , activity getting pushed background when hit on home button... trying display pop @ intervals, in case activity running on background when try display pop thats not shown on foreground. thanks, ramesh you can't show modal dialogs way. use android's notification system instead.

javascript - HTML onmousedown/onclick display hidden HTML -

i'm making form order different varieties of sweets website. @ moment have checkboxes each variety. once have chosen varieties want (they can have more one) need more information. want display new box when check each checkbox. event attributes seem adequate, don't know javascript, right way me it? can event attributes trigger javascript? or perhaps i'm going wrong way, there better way make form? i've considered shopping cart want think it's much, , i'm not advanced. so, want way show html after checkbox has been ticked, or better way make form. thanks if have skills server-side programming (php, asp, asp.net, jsp), may way go. when checkbox changes, redraw options using ajax of flavor (e.g. asp.net updatepanel). avoid doing javascript on client, though it's doable way. if aren't strong on either client or server-side programming, third-party shopping cart way go. start investigation paypal. important: if write own order form, ma...

c# - Write a function that compares two strings and returns a third string containing only the letters that appear in both -

i got homework. , have solved in following way. need comments whether approach or need use other data sturcture solve in better way. public string returncommon(string firststring, string scndstring) { stringbuilder newstb = new stringbuilder(); if (firststring != null && scndstring != null) { foreach (char ichar in firststring) { if (!newstb.tostring().contains(ichar) && scndstring.contains(ichar)) newstb.append(ichar); } } return newstb.tostring(); } that's fine first approach, can make few improvements, , there's small error. if b contains character in a that's in c , you'll repeat it. to avoid repeats, might consider using set store characters, since set won't have repeats. assembling strings += concatenation inefficient; consider using stringbuilder or analogous string-assembly class. your variable...

internet explorer 8 - fixing ASP.NET website that works in IE6, to work in IE8 -

i need fix asp.net website works in ie6, work in ie8 browser. added emulateie7 http header iis6 short term fix, still pages not displayed correctly. web app designed , developed ie6, upgrading ie8, there quick fix available ie6 website display correctly in ie8? thought emulateie7 works both ie7 , previous versions well, not correct? regards, rama i can't remember level of css ie6 uses. maybe try telling ie8 render page ie5 did using following meta tag in each page: <meta http-equiv="x-ua-compatible" content="ie=ie5" /> if site wide, add http header in web server itself.

python - How to compare dates in Django -

i compare date current date in django, preferably in template, possible before rendering template. if date has passed, want "in past" while if in future, want give date. i hoping 1 this: {% if listing.date <= %} in past {% else %} {{ listing.date|date:"d m y" }} {% endif %} with being today's date, not work. couldn't find in django docs. can give advice? compare date in view, , pass in_the_past (boolean) extra_context. or better add model property. from datetime import date @property def is_past_due(self): return date.today() > self.date then in view: {% if listing.is_past_due %} in past {% else %} {{ listing.date|date:"d m y" }} {% endif %} basically template not place date comparison imo.

asp.net mvc - .NET - Efficient collection of database entities? -

i have page class , pagecollection class in 3d party orm framework. can fill pagecollection based on parameters (pageid, parentid, url etc..) (sql query). need data multiple times around asp.net mvc website (sitemap, authentication), chose load pages 1 time , reference (global) collection. globalclass.pages //is pagecollection containing pages i have created functions return temporary subcollection or single entity based on parameters mentioned before (pageid, parentid, url etc..). globalclass.pages.getbypageid(id) //returns single page entity globalclass.pages.getbyparentid(parentid) //returns subcollection the site got slow. what way go here? cache subcollections ( getbyparent() ) ? create internal hash-lookup tables collection ? something else... ? namespace bll public class pagecollection inherits customcollectionbase public sub new() end sub public sub loadbyparent(byval pagparent integer) if pagparent = 0 me.wherea...

c# - How do I reproduce a DirectoryNotFoundException? -

i have problem using phantom delete , copy recursively. have solved actual problem quite easy checking below exception can tell me how reproduce problem visual studio? system.io.directorynotfoundexception: not find part of path 'build/webui\views/web.config'. @ system.io.__error.winioerror(int32 errorcode, string maybefullpath) @ system.io.file.internalcopy(string sourcefilename, string destfilename, boolean overwrite) @ phantom.core.wrappedfileinfo.copytodirectory(string path) in d:\opensource\build\phantom2\phantom\src\phantom.core\wrappedfileinfo.cs:line 75 @ build.$$execute$closure$23$closure$25.invoke(wrappedfilesysteminfo file) @ phantom.core.builtins.utilityfunctions.foreach[t](ienumerable 1 source, action 1 action) in d:\opensource\build\phantom2\phantom\src\phantom.core\builtins\utilityfunctions.cs:line 34 @ build.$execute$closure$23.invoke() @ phantom.core.target.execute() in d:\opensource\build\phan...

vsx - Web Project for F# -

i building project system visual studio mvc web projects controllers written in f#. comes along pretty cool. can build , run apps, have problem fsharp language service. in editor shows syntax colorization , diagnostic should. 1 problem - not pick project references. though during build picks them , builds project, on screen shows objects/namespaces referenced assemblies/projects unresolved. if out here has knowledge integrating f# language service - please me make work in response tomas: the code f# controllers in project file , mentioned can compile , run it. kept f# code in separate project , desire rid of complexity prompted project. not asp.mvc though bistro mvc . edit bistromvc solves problem in latest version of bistro designer based on f# project extender can describe you're doing in more detail? "flavoring", or new project system? other aspects of 'project environment' picked up? example, if have f# code with #if debug let x ...

android - ListView selector problem: Selection does not get removed -

i have listview. when click on listitem, set background of listitem (it's view) color: listview.setonitemclicklistener(new onitemclicklistener() { @override public void onitemclick(adapterview<?> a, view v, int position, long id) { setupdetailview(position); setupchartview(position); setuparview(position); emptyview.setvisibility(view.invisible); quotesadapter.isselected = true; //v.setbackgroundresource(r.drawable.stocks_selector); } }); here adapter: private class quoteadapter extends arrayadapter<quote> { private arraylist<quote> items; public boolean isselected = false; public quoteadapter(context context, int textviewresourceid, arraylist<quote> items) { super(context, textviewresourceid, items); this.items = items...

Alias attr_reader in Ruby -

is possible alias attr_reader method in ruby? have class favourites property want alias favorites american users. what's idiomatic ruby way this? attr_reader generates appropriate instance methods. this: class foo attr_reader :bar end is identical to: class foo def bar @bar end end therefore, alias_method works you'd expect to: class foo attr_reader :favourites alias_method :favorites, :favourites # , if need provide writers attr_writer :favourites alias_method :favorites=, :favourites= end

iphone - Is Three20 allowed? -

ive heard news apple turning down apps use three20 framework.my project uses extensively.does mean im running trouble. this old old news. there private api call in three20 on 1 year ago , promptly removed. when doing google searches tech-related, show results in past month, maybe past year if want accurate.

php - Using PHPMailer to send emails to Variable addresses -

i have form i've created, , on completion asked select person want emailed drop down list. my issue how add variable $mailer. right written this $mailer -> addaddress('email@email.com','first last'); how variable in there $mailer -> addaddress($emailaddress) - doesn't work. i've tried "'"$emailaddress"'" - gives me - invalid address: 'email@email.com' frustrating since that's format looking for. thanks, let me know here full code using call emails $mail->host = "mail.yourdomain.com"; // smtp server $mail->smtpdebug = 2; // enables smtp debug information (for testing) $mail->smtpauth = true; // enable smtp authentication $mail->host = "mail.yourdomain.com"; // sets smtp server $mail->port = 26; // set smtp port gmail server $mail->username = "yourname@yourdomain"; ...

asp.net mvc - How do I use MVC HandleError attribute with JQueryUI Dialog? -

i have handleerror attribute working normally, however: i have jqueryui dialog displays partial view. if generate error in action dialog remains blank , no redirect error.aspx page. what need work? in case exception inside controller action handleerror attribute catches exception , renders error view. problem sets statuscode 500. when jquery sees status code considers request failed , doesn't bother show contents. on way workaround write custom error handler attribute deriving standard 1 , overriding onexception method setting status code 200 when rendering error view.

Invoke an exe from PowerShell and get feedback on success or failure -

how can run executable in powershell , through if statement determine whether succeeded or failed? more i'm trying devenv.exe build solution powershell script , need know whether succeeded or failed. failed, mean build has failed , i'm assuming devenv sending out shell (possibly in stderr stream?) i tried using & , invoke-expression , invoke-item , managed of them run exe. never able feedback on success / failures. have tried using $lastexitcode variable? contain exit code of last .exe invoked. http://blogs.msdn.com/powershell/archive/2006/09/15/errorlevel-equivalent.aspx

How to check whether a proxy server is blocked in China -

how check whether proxy server blocked in china? website pulse has tool checking whether website blocked, proxy servers don't have web front end. short of getting own china-based proxy, options? your options : make data go through china (experimental solution) get hand on chinese blacklist (which doubt can obtain) (theoretical solution) to data go through china have following options : use available chinese proxy (google china , proxy) have script on chinese server or server behind chinese proxy tell if works have in china make test be in china if can't of those, can't check it.

caching - how to use memcache to speed-up rails/heroku -

heroku supports memcache natively addon. problem is, being rails newbie still, have no clue how use memcache in order speed-up time-consuming request (i know looking newrelic analysis). should use gem 'cache-money' on-top of memcache? use act_as_cached anymore? i know pretty trivial questions. yet after searching web hours, not find decent tutorial. help/link appreciated! you can watch caching in rails 2.1 , read memcached documentation (i suppose have read it) in heroku. also, touch , cache quite interesting technique avoid writing sweepers in order delete cached content when need refresh cached data. using touch auto expire cached data no need write new code. please note today, heroku memcached integration assumes using rails >= 2.3.3 the main idea add result(s) of time consuming method rails.cache (which interface through access caching mechanism). when fetch result(s) caching mechanism searches see if can find or if hasn't expired. if finds ...

mysql - Multiple individual users on one database -

i have .sql database interact using django . database in beginning filled public data can accessed anynone. multiple individual users can add rows table(private data). how can user see changes made in database(private data)? i assume you're using django.contrib.auth . need like: from django.contrib.auth.models import user # ... class privatedata(models.model): # ... private data fields ... user = models.foreignkey(user) then can user's fields with: privatedata.objects.filter(user=request.user) edit: so, if users ip addresses, , you're not using login mechanism, don't need django.contrib.auth ... though it's have anyway since can use authenticate yourself , use built-in admin stuff manage site. if want tie data ip addresses, set ipuser model: class ipuser(models.model): address = models.charfield(max_length=64, unique=true) # big enough ipv6 # add whatever other discrete (not list) data want store address. class privated...

Alternatives to MultiView in ASP.NET -

the website i'm building contains large number of views displayed on same place hidden or shown according how user navigates menu. it gets quite messy in visual studios design view when have multiview 10 different views in it. i've separated content of each view in several user controls. there alternative multiview? i use panel or placeholder , toggle visibilities manually. don't use vs designer either...

c# - How do delegate/lambda typing and coercion work? -

i've noticed examples of things work , don't work when dealing lambda functions , anonymous delegates in c#. what's going on here? class test : control { void testinvoke() { // best overloaded method match 'invoke' has invalid arguments invoke(dosomething); // cannot convert anonymous method type 'system.delegate' because not delegate type invoke(delegate { dosomething(); }); // ok invoke((action)dosomething); // ok invoke((action)delegate { dosomething(); }); // cannot convert lambda expression type 'system.delegate' because not delegate type invoke(() => dosomething()); // ok invoke((action)(() => dosomething())); } void testqueueuserworkitem() { // best overloaded method match 'queueuserworkitem' has invalid arguments threadpool.queueuserworkitem(dosomething); // ok threadpool.queue...

dsl - Boo: is the following code possible -

is there situation when following valid boo statement: target "something" requires "something" where target , requires can macros/method/anything other (except keywords)? dsl question, language hack long compiles. there patch support this, default, no.

postgresql - SQL: Get list of numbers not in use by other rows -

i'm using postgresql 8.1.17, , have table account numbers. acceptable range account number number between 1 , 1,000,000 (a 6 digit number). column "acctnum" contains account number. selecting numbers in use easy (select acctnum tbl_acct_numbers order acctnum). select numbers in acceptable range not in use, is, aren't found in rows within column acctnum. select new_number generate_series(1, 1000000) new_number left join tbl_acct_numbers on new_number = acctnum acctnum null;

svn - Subversion: Merge, Revert, Merge again. Why does it silently fail? -

is nasty subversion bug or approaching wrong way? merge branch trunk. ->helloworld.txt updates revert helloworld.txt do same merge again. ->no files update. why doesn't second merge update helloworld again? it's acting if change has been copied over. shouldn't revert reset it? if revert entire folder helloworld in, second merge applies change again. it's if revert file fails. this little scary. if need revert files now. future merge silently fail copy on critical code. subversion 1.6 os x 10.6.4 subversion performs merge tracking, meaning record revisions have been merged. merge info recorded in property called svn:mergeinfo on root of merge (ie whatever entered target after svn merge ). reverted file, didn't revert merge root contains modified or added svn:mergeinfo property.

GROUP BY and ORDER BY in same MySQL query? -

i want select bunch of data table using group by clause. works great, need order data date created, order by clause. question is, can use both these clauses within same query, or should using 1 in sub-query, or else? the original query (no modification) this: select * table tag_draft=0 , ( (target_id=2 , tag_del_target=0) or (source_id=2 , tag_del_source=0) ) , updated in ( select max(updated) table group thread_id ) order updated desc hopefully question readable enough able answer it. the mysql select syntax is: select [all | distinct | distinctrow ] [high_priority] [straight_join] [sql_small_result] [sql_big_result] [sql_buffer_result] [sql_cache | sql_no_cache] [sql_calc_found_rows] select_expr [, select_expr ...] [from table_references [where where_condition] [group {col_name | expr | position} [asc | desc], ... [with rollup]] [having where_condition] [order {col_name | ...

android - activity.onPause not always getting called -

for reason onpause method not getting called when app put background. either or mylocationoverlay not disabling. my app uses google maps , mylocationoverlay . when starting app, call mylocationoverlay.enablemylocation() in onresume method. in onpause method call mylocationoverlay.disablemylocation() . however, when hit home key or key go home screen, gps stays running indicated top of status bar gps icon. edit: not work on either emulator or phone. edit2: gps icon goes away when use advanced task killer kill it. edit3: onpause being called put log statement in it, gps icon remains. therefore looks either gps service isn't shutting down, or mylocationoverlay has bug disablemylocation() method. here manifest file , excerpts activity: <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" xmlns:myapp="http://schemas.android.com/apk/res/com.tfb" package="c...

Rails api doc - understanding & finding -

i trying find functions in rails api docs. example, in console can type in: activerecord::base.connection.tables activerecord::base.connection.indexes("sometable") and list of tables , list of indexes. in rails api doc http://api.rubyonrails.org/classes/activerecord/base.html cannot find reference either of these. i find connection() trail ends there! little figuring out apis! thanks... activerecord::base#connection internally relies on activerecord::base.connection (class method) return concrete implementation of activerecord::connectionadapters::abstractadapter class. you should search #indexes method in concrete adapter, instance postgresqladapter#indexes . rdoc doesn't provide hint on object type returned method call. should dig source code or have deep understanding of package itself. there alternatives such yard generates more complete api documentation. there's rails searchable api doc project offers searchable rails...

.NET Multicast Socket Error -

i have app uses 2 multicast channels, so _sock = new socket(addressfamily.internetwork, sockettype.dgram, protocoltype.udp); ipendpoint iep = new ipendpoint(ipaddress.any, 30002); _sock.bind(iep); _sock.setsocketoption(socketoptionlevel.ip, socketoptionname.addmembership, new multicastoption(ipaddress.parse("239.255.0.2"))); ... later on, in same app _sock2 = new socket(addressfamily.internetwork, sockettype.dgram, protocoltype.udp); ipendpoint iep = new ipendpoint(ipaddress.any, 30001); _sock2.bind(iep); _sock2.setsocketoption(socketoptionlevel.ip, socketoptionname.addmembership, new multicastoption(ipaddress.parse("239.255.0.2"))); (notice different ports). when execution point reaches second bind exception (hresult 0x80004005) raised, warning me 1 protocol/address/port can used... i have done in c++ apps think ther must error. what wrong that? thank in advance ok, i've got it: _sock.setsocketoption(socket...

php - Finding the value of a child in a specific attribute -

<data> <gig id="1"> <date>december 19th</date> <venue>the zanzibar</venue> <area>liverpool</area> <telephone>ticketline.co.uk</telephone> <price>£6</price> <time>time tba</time> </gig> <gig id="2"> <date>sat. 16th jan</date> <venue>celtic connection, classic grand</venue> <area>glasgow</area> <telephone>0141 353 8000</telephone> <price>£17.50</price> <time>7pm</time> </gig> say if wanted view values of "date" gig element has attribute of 2 how using php ? basically want delete id 2 , create again or modify it. using simplexml how can delete part ? to find nodes, use xpath . $data->xpath('//gig[@id="2"]'); it return array <gig/> nodes attribute id value 2. usually, contain 0 or 1 el...

python - Django primary key -

when querying in django people.objects.all(pk=code) , pk=code mean? it's query people object has primary key of whatever value of "code" is. by default, django model instances have primary key uniquely identifies object. it's auto-incrementing integer, define whatever want, long it's unique. http://docs.djangoproject.com/en/dev/topics/db/models/#id1 edit: @ code snippet little closer, rather assuming said, doesn't make sense. all() method should get(). doesn't make sense give pk all() since returns objects of type. http://docs.djangoproject.com/en/dev/ref/models/querysets/#all http://docs.djangoproject.com/en/dev/ref/models/querysets/#id5

java - Generate a Javadoc for my Android project -

i hoping me in generating javadoc eclipse project. when select 'generate javadoc' project menu lots of errors like cannot find symbol symbol : class listview everytime class referencing android api class, javadocs outputted classes not reference android api stuff. app compiles , runs correctly , on project setting android 1.6 lib present (on build path - external jars section). any ideas im doing wrong? thanks. dori i able javadocs generated classes making sure had "documentation android sdk" component installed in android sdk , avd manager, , selecting android.jar reference archive in step 2 of javadoc generation. it didn't generate links reference docs, did create docs of classes.

php - Filename regex extraction -

i'd parts of filename filename blabla_2009-001_name_surname-name_surname i'd get: 2009-001, name_surname, name_surname i've come this, it's no good preg_match("/(?:[0-9-]{8})_(?:[a-z_]+)-(?:[a-z_]+)/", $filename, $matches); any pointers? thanks! br assuming filename format doesn't change: preg_match('#(\d{4}-\d{3})_(.*?)-(.*?)$#', $filename, $match); updated version handle extension: preg_match('#(\d{4}-\d{3})_(.*?)-(.*?)\.(.*?)$#', $filename, $match);

Regex match in shell script -

i'm writing shell script makes sure dns server looking. here's output tests: server: 127.0.0.1 address: 127.0.0.1#53 name: galapagos.office address: 192.168.140.25 everything "galapagos.office" needs match exactly. "galapagos.office" part doesn't matter @ all. i figure can apply regex output tell me if looks how want: server: +127\.0\.0\.1\naddress: +127\.0\.0\.1#53\n\nname:.+\naddress: 192\.168\.140\.25 the thing don't know shell scripting. what's best way make sure regex matches output of nslookup command? just guess of want awk '/server/&&$2=="127.0.0.1"{f=1} /address/&&$2=="127.0.0.1#53"{g=1} /address/&&$2=="192.168.140.25"{h=1} end{if(h && g && f) print "ok"}' file

plsql - a triggers question in oracle -

i kind of new triggers , cant figure out how resolve this. after insert new row on specicfic table should influence other tables aswell. so if add(insert) order on table includes 3 quantity, want 3 less in_stock in table(column)... in advance assuming column , table names (order table column name : quantity , product_id key uniquely used identify order) .. should job create or replace trigger trg_update_available after insert on orders each row begin update in_stock set quantity = quantity - :new.quantity product_id = :new.product_id; end; / note : commit; still present in code insert order.

python - Prepare a string for Google Ajax Search? -

i have strings such as ["tabula rasa", "façade", "dj tiësto"] i'm accessing google ajax api in python using base url: base = 'http://ajax.googleapis.com/ajax/services/search/web' '?v=1.0&q=%s' i'm having issues using these strings plain , noticed have transform characters, eg. "tabula rasa" --> "tabula%20rasa" but have huge list of these strings , not know of way can automatically prepare these string url query. any appreciated. what you're looking urllib.quote(): >>> urllib.quote("tabula rasa") 'tabula%20rasa' the non-ascii strings may need recoded encoding expected google ajax api, if don't have them in same encoding already.

wpfdatagrid - WPF: Copy from a DataGrid -

i add copy functionality wpf datagrid. the copy option should appear in right-click menu it should copy display text selected cell. (i using read-only text columns.) in datagrid's contextmenu , can create menuitem , set menuitem.command value copy . it's command available through standard applicationcommands list, there won't additional code required have functional: <datagrid> <datagrid.contextmenu> <contextmenu> <menuitem command="copy" /> </contextmenu> </datagrid.contextmenu> </datagrid>

PostgreSQL Regex Word Boundaries? -

does postgresql support \b ? i'm trying \bab\b doesn't match anything, whereas (\w|^)ab(\w|$) does. these 2 expressions same, aren't they? postgresql uses \m , \m , \y , \y word boundaries: \m matches @ beginning of word \m matches @ end of word \y matches @ beginning or end of word \y matches @ point not beginning or end of word see regular expression constraint escapes in manual. there [[:<:]] , [[:>:]] , match beginning , end of word. the manual : there 2 special cases of bracket expressions: bracket expressions [[:<:]] , [[:>:]] constraints, matching empty strings @ beginning , end of word respectively. word defined sequence of word characters neither preceded nor followed word characters. word character alnum character (as defined ctype) or underscore. extension, compatible not specified posix 1003.2, , should used caution in software intended portable other systems. constraint escapes described below preferable (t...

iphone - SSLv3 communications in Objective-C -

i know if iphone os supports sslv3 network communications ? there tutorial or how on web ? didn't find this! framework/library should use ? thanks if you're asking ssl in general (and not specific version of ssl), yes. nsurlconnection supports https urls. follow standard docs on opening connect nsurlconnection specify url scheme https:// .

swing - Controlling Color in Java Tabbed Pane -

i have been going nuts trying figure out. i trying elimenate light blue background appears in jtabbedpane. i've tried , nothing seems work. below code. if run it, show tab, when selected light blue background , thing blue border @ top. want control color. how? import java.awt.*; import java.awt.event.*; import javax.swing.*; import javax.swing.event.*; import javax.swing.plaf.coloruiresource; public class main extends jframe { jtabbedpane tab=new jtabbedpane(); public main() { setsize(300,300); settitle("test tab pane"); tab.add("first",new mypanel("first")); tab.add("second",new mypanel("second")); tab.add("third",new mypanel("third")); tab.add("fourth",new mypanel("fourth")); tab.addchangelistener(new changetab()); getcontentpane().add(tab,borderlayout.center); setvisible(true); for(int i=0;i<tab.gettabcount();i++){ ...