Daily Archives

Articles indexed Saturday May 8 2010

Page 8/78 | < Previous Page | 4 5 6 7 8 9 10 11 12 13 14 15  | Next Page >

  • Writing catch block with cleanup operations in Java ...

    - by kedarmhaswade
    I was not able to find any advise on catch blocks in Java that involve some cleanup operations which themselves could throw exceptions. The classic example is that of stream.close() which we usually call in the finally clause and if that throws an exception, we either ignore it by calling it in a try-catch block or declare it to be rethrown. But in general, how do I handle cases like: public void doIt() throws ApiException { //ApiException is my "higher level" exception try { doLower(); } catch(Exception le) { doCleanup(); //this throws exception too which I can't communicate to caller throw new ApiException(le); } } I could do: catch(Exception le) { try { doCleanup(); } catch(Exception e) { //ignore? //log? } throw new ApiException(le); //I must throw le } But that means I will have to do some log analysis to understand why cleanup failed. If I did: catch(Exception le) { try { doCleanup(); } catch(Exception e) { throw new ApiException(e); } It results in losing the le that got me here in the catch block in the fist place. What are some of the idioms people use here? Declare the lower level exceptions in throws clause? Ignore the exceptions during cleanup operation?

    Read the article

  • shutdown.exe timer

    - by user311130
    I'm trying to run shutdown.exe -l -t 10 only showed shutdown help manual. I thought of inelegant but working solution of ping -n 10 localhost shutdown.exe -l How wasteful is this solution? I thought of downloading sleep.exe, but I want my bat file to work on a machine with no previous preparations. Any more ideas? Thanks

    Read the article

  • Why it is Important to Hire an SEO Company For Your Internet Business

    The World Wide Web is not only limited to sharing information; in fact, the Internet is now being used by profit-based organizations or businesses to help increase their potential for success and productivity. Though it is true that the Web offers plenty of untapped market for your business to delve into, you have to keep in mind that competition are also in abundance that will pull you down.

    Read the article

  • How SEO Services Work to Improve Your Online Popularity

    There are assorted SEO Services available to help boost your online popularity. You might not know it but all these Internet Marketing strategies work together to make sure you appear on search engines, increase your rankings to outdo your competition, and of course, make a name for yourself on the Web.

    Read the article

  • When is it appropriate to use error codes?

    - by Jim Hurne
    In languages that support exception objects (Java, C#), when is it appropriate to use error codes? Is the use of error codes ever appropriate in typical enterprise applications? Many well-known software systems employ error codes (and a corresponding error code reference). Some examples include operating systems (Windows), databases (Oracle, DB2), and middle-ware products (WebLogic, WebSphere). What benefits do error codes provide? What are the disadvantages to using error codes?

    Read the article

  • flickr.photos.search strange behavior with nested xml response

    - by JohnIdol
    I am querying flickr with the following request: view-source:http://www.flickr.com/services/rest/?method=flickr.photos.search&api_key=MY_KEY&text=cork&per_page=12&&format=rest if I put the above url in the browser I get the following as I would expect: <rsp stat="ok"> <photos page="1" pages="22661" perpage="12" total="271924"> <photo id="4587565363" owner="46277999@N05" secret="717118838d" server="4029" farm="5" title="06052010(001)" ispublic="1" isfriend="0" isfamily="0" /> <photo id="4587466773" owner="25901874@N06" secret="32c5a1a57f" server="4002" farm="5" title="black wine cork 2 BW" ispublic="1" isfriend="0" isfamily="0" /> <photo id="4588084730" owner="25901874@N06" secret="b27eef5635" server="4032" farm="5" title="black wine cork 2" ispublic="1" isfriend="0" isfamily="0" /> <photo id="4587457789" owner="43115275@N00" secret="ae0daa0ab6" server="4034" farm="5" title="Matthew" ispublic="1" isfriend="0" isfamily="0" /> <photo id="4587443837" owner="49967920@N07" secret="2b4c1a58de" server="4066" farm="5" title="Two car garage" ispublic="1" isfriend="0" isfamily="0" /> <photo id="4588050906" owner="45827769@N06" secret="72de138f7e" server="4067" farm="5" title="Dabie Mountains, Central China" ispublic="1" isfriend="0" isfamily="0" /> <photo id="4587979300" owner="36531359@N00" secret="e5f8b30734" server="3299" farm="4" title="stroll" ispublic="1" isfriend="0" isfamily="0" /> <photo id="4587304769" owner="7904649@N02" secret="995062f550" server="4034" farm="5" title="IMG_4325" ispublic="1" isfriend="0" isfamily="0" /> <photo id="4587306827" owner="7904649@N02" secret="b92d7ff916" server="4050" farm="5" title="IMG_4329" ispublic="1" isfriend="0" isfamily="0" /> <photo id="4587311657" owner="7904649@N02" secret="bb1b34ccf8" server="4053" farm="5" title="IMG_4336" ispublic="1" isfriend="0" isfamily="0" /> <photo id="4587933110" owner="7904649@N02" secret="f733b1d482" server="3300" farm="4" title="IMG_4334" ispublic="1" isfriend="0" isfamily="0" /> <photo id="4587930650" owner="7904649@N02" secret="9bc202b3ed" server="4018" farm="5" title="IMG_4331" ispublic="1" isfriend="0" isfamily="0" /> </photos> </rsp> Now I've got something very simple PHP to query the exact same url, called from javascript through AJAX - it all works as I can see putting a breakpoint in my javascript function that handles the response: function HandleResponse(response) { document.getElementById('ResponseDiv').innerHTML = response; } Looking at response value in the snippet above I see what I expect (xml formed as above) - then the strangest thing happens: when I inspect the DOM instead of having photo elements all as children of photos they're all nested within each other. What amI missing - How is this possible in light of the fact that the response string is definitely formed as I would expect it to be?

    Read the article

  • Django DRY Feeds

    - by Mandx
    I'm using the Django Feeds Framework and it's really nice, very intuitive and easy to use. But, I think there is a problem when creating links to feeds in HTML. For example: <link rel="alternate" type="application/rss+xml" title="{{ feed_title }}" href="{{ url_of_feed }}" /> Link's HREF attribute can be easily found out, just use reverse() But, what about the TITLE attribute? Where the template engine should look for this? Even more, what if the feed is build up dinamically and the title depends on parameters (like this)? I can't come up with a solution that "seems" DRY to me... All that I can come up with is using context processors o template tags, but it gets messy when the context procesor/template tag has to find parameters to construct the Feed class, and writing this I realize I don't even know how to create a Feed instance myself within the view. If I put all this logic in the view, it would not be just one view. Also, the value for TITLE would be in the view AND in the feed.

    Read the article

  • sql 2008 express connection problems

    - by user163457
    Hi, I've just installed a fresh copy of SQL 2008 Express. before I did anything I opened Management Studio and successfully connected using Window Authentication. However I tried to run the following on the command line "telnet localhost 1433" and got the error "Could not open connection to the host, on port 1433: Connect failed" I checked netstat and there is nothing listening on port 1433. Before I go any further, is there a problem with the install? thanks, Shane

    Read the article

  • How to deploy and register a VSPackage supporting multiple versions of Visual Studio (2005, 2008, 20

    - by Steve Cadwallader
    I have an open source VSPackage that I would like to release with support for Visual Studio 2005, Visual Studio 2008, and Visual Studio 2010. I'm trying to figure out how to create the installer and how to perform the package registration with each edition of Visual Studio. The deployment research I've done indicates my best bet for an installer is a VSIX inside an MSI. The registration research I've done is a lot less clear. VSPackage registration seems to differ for every edition (VS2005 uses regpkg, VS2008 uses pkgdef, VS2010 uses VSIX). Can anyone share their experiences and/or point me towards any information about the best approach for targeting multiple versions of Visual Studio? I'm looking for the easiest implementation and preferably keeping it in a single installer if reasonably feasible. Any help would be greatly appreciated!

    Read the article

  • Running out of memory.. How?

    - by maxdj
    I'm attempting to write a solver for a particular puzzle. It tries to find a solution by trying every possible move one at a time until it finds a solution. The first version tried to solve it depth-first by continually trying moves until it failed, then backtracking, but this turned out to be too slow. I have rewritten it to be breadth-first using a queue structure, but I'm having problems with memory management. Here are the relevant parts: int main(int argc, char *argv[]) { ... int solved = 0; do { solved = solver(queue); } while (!solved && !pblListIsEmpty(queue)); ... } int solver(PblList *queue) { state_t *state = (state_t *) pblListPoll(queue); if (is_solution(state->pucks)) { print_solution(state); return 1; } state_t *state_cp; puck new_location; for (int p = 0; p < puck_count; p++) { for (dir i = NORTH; i <= WEST; i++) { if (!rules(state->pucks, p, i)) continue; new_location = in_dir(state->pucks, p, i); if (new_location.x != -1) { state_cp = (state_t *) malloc(sizeof(state_t)); state_cp->move.from = state->pucks[p]; state_cp->move.direction = i; state_cp->prev = state; state_cp->pucks = (puck *) malloc (puck_count * sizeof(puck)); memcpy(state_cp->pucks, state->pucks, puck_count * sizeof(puck)); /*CRASH*/ state_cp->pucks[p] = new_location; pblListPush(queue, state_cp); } } } return 0; } When I run it I get the error: ice(90175) malloc: *** mmap(size=2097152) failed (error code=12) *** error: can't allocate region *** set a breakpoint in malloc_error_break to debug Bus error The error happens around iteration 93,000. From what I can tell, the error message is from malloc failing, and the bus error is from the memcpy after it. I have a hard time believing that I'm running out of memory, since each game state is only ~400 bytes. Yet that does seem to be what's happening, seeing as the activity monitor reports that it is using 3.99GB before it crashes. I'm using http://www.mission-base.com/peter/source/ for the queue structure (it's a linked list). Clearly I'm doing something dumb. Any suggestions?

    Read the article

  • Training speech recognition software

    - by wyatt
    A little left field, but I'm trying to train a speech recognition program and the guidelines suggest that I attempt to speak clearly but naturally. I notice, however, that when one speaks naturally each word tends to drift into the next, resulting in a rather ambiguous boundary between the words. One the one hand, speaking in a more stilted manner would seem to aid the computer in recognising the phonemes, but on the other it would tend to make it less likely to understand more natural speech. Anyone knowledgeable in the field out there who can suggest which of the two approaches is more effective? Thanks

    Read the article

  • Why does instanceof seem to work in a static generic function sometimes?

    - by michael
    Greetings. This is my first post in this site. I thought that because of type erasure, one could not expect the following code to compile, and indeed, it did not compile on an earlier version of Eclipse. My understanding was that instanceof was a run-time operator and could not know about the generic type which would be, by run-time, compiled away: public static <E extends Comparable<? super E>> void SampleForQuestion(E e) { if ( !(e instanceof String) ) System.out.println("I am not a String"); else System.out.println("I am a String"); } However, I was surprised to see that one of your threads actually included some code like this in an answer, and my latest Eclipse (Galileo on Windows with JVM 1.6 rev 20) is perfectly happy with it -- and it works, too. (I did notice that someone said it worked on Eclipse but not in another IDE/JDK in that thread, but don't remember the specifics.) Can someone explain why it works, and more importantly, because I have to guide my students, whether it should be expected to work in the future. Thank you. (I hope the code formatting comes through correctly - it looks indented correctly from my perspective and there are no tabs.)

    Read the article

  • Modifiers in Makefile rule's dependency list

    - by gnu_maker
    The problem is fairly simple. I am trying to write a rule, that given the name of the required file will be able to tailor its dependencies. Let's say I have two programs: calc_foo and calc_bar and they generate a file with output dependent on the parameter. My target would have a name 'target_*_*'; for example, 'target_foo_1' would be generated by running './calc_foo 1'. The question is, how to write a makefile that would generate outputs of the two programs for a range of parameters?

    Read the article

  • How to do an array of hashmaps?

    - by Joren
    This is what I tried to do, but it gives me a warning: HashMap<String, String>[] responseArray = new HashMap[games.size()]; "Type safety: The expression of type HashMap[] needs unchecked conversion to conform to HashMap[]"

    Read the article

  • Time-lapse software for Windows 7

    - by Kevin L.
    Timershot was an excellent part of the PowerToys for Windows XP collection. But alas, it doesn't appear to work on Windows 7, even when run in XP SP3 compatibility mode. Can anyone recommend a good replacement? (...Preferably one that is compatible with the webcam on an Eee PC 1005HA. But I'll take whatever I can get.)

    Read the article

  • My Quicken 401(K) account has changed to Checking. How do I fix this?

    - by user36492
    This is actually the second time this has happened to me, but I don't remember what I did last time (nor can I find the original forum post that helped then). I'm using Quicken Mac 2007. My 401(k) account, previously properly set up, has changed, seemingly irrevocably, to a Checking account. When I click "Edit" and try to change the account type, the 401(k) option is grayed out. I've got years of data stored in this account, so I am really hoping there's a way to salvage this data file!

    Read the article

  • Apple IIe Software Disks

    - by Mike Grace
    I just got a working Apple IIe but I don't have any system or software disks. I did some searches on Google to look for sources for disks but haven't been able to find many resources that I could actually buy disks from. What are some good places to purchase disks for my Apple IIe? Are there some good groups on the web where others are using and restoring Apple IIes?

    Read the article

  • Comparing utf-8 strings in java

    - by cppdev
    Hi, In my java program, I am retrieving some data from xml. This xml has few international characters and is encoded in utf8. Now I read this xml using xml parser. Once I retrieve a particular international string from xml parser, I need to compare it with set of predefined strings. Problem is when i use string.equals on internatinal string comparison fails. How to compare strings with internatinal strins in java ? Here's the line that compares strings string country; if(country.equals("Côte d'Ivoire")) { }

    Read the article

< Previous Page | 4 5 6 7 8 9 10 11 12 13 14 15  | Next Page >