Search Results

Search found 13011 results on 521 pages for 'catch block'.

Page 15/521 | < Previous Page | 11 12 13 14 15 16 17 18 19 20 21 22  | Next Page >

  • How to catch exceptions from processes in C#

    - by kitofr
    I all... I have an acceptance runner program here that looks something like this: public Result Run(CommandParser parser) { var result = new Result(); var watch = new Stopwatch(); watch.Start(); try { _testConsole.Start(); parser.ForEachInput(input => { _testConsole.StandardInput.WriteLine(input); return _testConsole.TotalProcessorTime.TotalSeconds < parser.TimeLimit; }); if (TimeLimitExceeded(parser.TimeLimit)) { watch.Stop(); _testConsole.Kill(); ReportThatTestTimedOut(result); } else { result.Status = GetProgramOutput() == parser.Expected ? ResultStatus.Passed : ResultStatus.Failed; watch.Stop(); } } catch (Exception) { result.Status = ResultStatus.Exception; } result.Elapsed = watch.Elapsed; return result; } the _testConsole is an Process adapter that wraps a regular .net process into something more workable. I do however have a hard time to catch any exceptions from the started process (i.e. the catch statement is pointless here) I'm using something like: _process = new Process { StartInfo = { FileName = pathToProcess, UseShellExecute = false, CreateNoWindow = true, RedirectStandardInput = true, RedirectStandardOutput = true, RedirectStandardError = true, Arguments = arguments } }; to set up the process. Any ideas?

    Read the article

  • Putting a block inside another in Django

    - by hekevintran
    I have a Django template that I want to extend in multiple places. In some the div must be inside a form, and in others it must not be. To do this I put a block above and below the div so I could add and in them respectively. Desired: <form> <div class="my_div"> {% block div_content %} ... {% endblock %} </div> </form> Template: {% block div_top %}{% endblock %} <div class="my_div"> {% block div_content %} {% endblock %} </div> {% block div_bottom %}{% endblock %} Looking at this I can't help but think that there is a better way to do it. What is the standard Django way of doing this?

    Read the article

  • error catching exception while System.out.print

    - by user1702633
    I have 2 classes, one that implements a double lookup( int i); and one where I use that lookup(int i) in solving a question, or in this case printing the lookup values. This case is for an array. So I read the exception documentation or google/textbook and come with the following code: public double lookup(int i) throws Exception { if( i > numItems) throw new Exception("out of bounds"); return items[i]; } and take it over to my class and try to print my set, where set is a name of the object type I define in the class above. public void print() { for (int i = 0; i < set.size() - 1; i++) { System.out.print(set.lookup(i) + ","); } System.out.print(set.lookup(set.size())); } I'm using two print()'s to avoid the last "," in the print, but am getting an unhandled exception Exception (my exception's name was Exception) I think I have to catch my exception in my print() but cannot find the correct formatting online. Do I have to write catch exception Exception? because that gives me a syntax error saying invalid type on catch. Sources like http://docs.oracle.com/javase/tutorial/essential/exceptions/ are of little help to me, I'm can't seem to grasp what the text is telling me. I'm also having trouble finding sources with multiple examples where I can actually understand the coding in the examples. so could anybody give me a source/example for the above catch phrase and perhaps a decent source of examples for new Java programmers? my book is horrendous and I cannot seem to find an understandable example for the above catch phrase online.

    Read the article

  • Define new Drupal theme region inside a block

    - by oalo
    I have a footer block, and I need to print a block inside that block. So i have defined the new region inside my theme.info file, cleared caches, enabled PHP code input, and written this code inside the footer block: <div class="grid-4 suffix-4 omega"> <?php if ($footer-right): ?> <div id="footer-right"> <?php print $footer-right; ?> </div> </div> I have configured a block to appear inside the new region (which appears in the blocks admin page), but it doesnt show. Any idea about what may be happening? Thank you

    Read the article

  • Amazon EC2 spot instances - is there a catch ?

    - by gareth_bowles
    I needed to start a new EC2 instance today and decided to try out the new spot instances, where you can reduce your instance cost by bidding on the maximum per-hour price you're prepared to pay. Since today's spot price was only 35c / hour, compared with 85c / hour for an on-demand instance, I was wondering: if I just bid a really high price, say $1 / hour, can I effectively be sure of getting a much cheaper long-running instance than an on-demand instance (since the spot instances are only charged by the current spot price) ? I suppose it's theoretically possible for the spot price to go over the on-demand price, but as far as I can tell from the data on the AWS site, the spot price has always been well below that.

    Read the article

  • Amazon EC2 spot instances - is there a catch ?

    - by gareth_bowles
    I needed to start a new EC2 instance today and decided to try out the new spot instances, where you can reduce your instance cost by bidding on the maximum per-hour price you're prepared to pay. Since today's spot price was only 3.5c / hour, compared with 8.5c / hour for an on-demand instance, I was wondering: if I just bid a really high price, say 10c / hour, can I effectively be sure of getting a much cheaper long-running instance than an on-demand instance (since the spot instances are only charged by the current spot price) ? I suppose it's theoretically possible for the spot price to go over the on-demand price, but as far as I can tell from the data on the AWS site, the spot price has always been well below that.

    Read the article

  • problem when view the super block in ext3 file system

    - by xuczhang
    I tried to view the superblock by command "dd" in ext3 file system. dd if=/dev/sda3 bs=4096 skip=1 count=1 of=superblock But the result in superblock file is not correct(I compare the value of Inodes count I got from dumpe2fs). The device file /dev/sda3 is started at the boot block and then the superblock of the group0? And another question is the boot block and superblock's size are both BLOCKSIZE(here is 4096)? The disk format of ext2/ext3(I think they are the same) are shown below:

    Read the article

  • Software to block Facebook [closed]

    - by the_learner
    I wish to install a software in server of my office which can block facebook or any other website which I wish to block in client systems. (I dont want to edit host file for the same purpose) I google it out and found lots of them...but I am confused which is the best. Please suggest me some good blocking softwares along with download link (if providing link is possible, else no probz) Thanks in advance...

    Read the article

  • "Catch-All" access log with Apache Virtual Hosts?

    - by pix0r
    I have many virtual hosts set up on a web server, each one having its own error and access log. The relevant lines of httpd.conf are something like this: ErrorLog /var/log/httpd-error.log LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined CustomLog /var/log/httpd-access.log combined NameVirtualHost *:80 <VirtualHost *:80> ServerName myhost.com ServerAlias www.myhost.com DocumentRoot /var/www/myhost.com/htdocs ErrorLog /var/www/myhost.com/log/error.log CustomLog /var/www/myhost.com/log/access.log combined </VirtualHost> # ... many more VirtualHosts Currently, I'm getting some random errors in /var/log/httpd-error.log, but I'm getting nothing in /var/log/httpd-access.log. Is it possible to have ALL accesses and errors duplicated to a shared logfile? Is it possible to do this without adding new entries to every single VirtualHost?

    Read the article

  • WIndows server 2008 ip list to block

    - by MiniScalope
    Hello, i have a pretty long list of ip ranges to block for some ports But the HMI let me only add ips one by one (stupid...-_-') Is there a way to block a group of ip ranges? (with a command line or something else....) my ip range format : 0.0.0.0/11 thank you very much. Sorry for my english.

    Read the article

  • catch-22 with apt-get

    - by Mark J Seger
    I'd recently installed a package and discovered my scp stopped working. After removing and installing some things I got it fixed but then I stated getting errors in apt-get about dpkg: error: configuration error: /etc/dpkg/dpkg.cfg.d/multiarch:1: unknown option 'foreign-architecture' so I commented it out and thought that fixed the problem until I discovered the chrome icon in my launcher turned into a ? and chrome no longer worked. I tried to reinstall it and got the apt-get error: "ambiguous package name 'libglib2.0-0' with more than one installed instance" if I try to remove libglib2 I get the error The following packages have unmet dependencies: iceape-browser : Depends: iceape but it is not going to be installed iceape-chatzilla : Depends: iceape (>= 2.7.11) but it is not going to be installed Depends: iceape (<= 2.7.11-1.1~) but it is not going to be installed E: Error, pkgProblemResolver::Resolve generated breaks, this may be caused by held packages. so then I tried to remove icape-browser and it complained about the 2 instances of libglinb2. in fact virtually any command I issue does the same thing so I don't know what I can do to untangle things.

    Read the article

  • Apache Default/Catch-All Virtual Host?

    - by SJaguar13
    If I have 3 domains, domain1.com, domain2.com, and domain3.com, is it possible to set up a default virtual host to domains not listed? For example, if I would have: <VirtualHost 192.168.1.2 204.255.176.199> DocumentRoot /www/docs/domain1 ServerName domain1 ServerAlias host </VirtualHost> <VirtualHost 192.168.1.2 204.255.176.199> DocumentRoot /www/docs/domain2 ServerName domain2 ServerAlias host </VirtualHost> <VirtualHost 192.168.1.2 204.255.176.199> DocumentRoot /www/docs/everythingelse ServerName * ServerAlias host </VirtualHost> If you register a domain and point it to my server, it would default to everythingelse showing the same as domain3. Is that possible?

    Read the article

  • WCF/C# Unable to catch EndpointNotFoundException

    - by Paul Jones
    Hi all, I have created a WCF service and client and all works until it come to catching errors. Specifically I am try to catch the EndpointNotFoundException for when the server happens not to be there for whatever reason, I have tried performing a simple try catch block catching the specific error and the communication exception it derives from and I've tried catching just Exception. None of these succeed in catching the exception, however I do get A first chance exception of type 'System.ServiceModel.EndpointNotFoundException' occurred in System.ServiceModel.dll in the output window when the client tries to open the service. Any ideas as to what I'm doing wrong?

    Read the article

  • TRY/CATCH_ALL vs try/catch

    - by Tim
    I've been using c++ for a while, and I'm familiar with normal try/catch. However, I now find myself on Windows, coding in VisualStudio for COM development. Several parts of the code use things like: TRY { ... do stuff } CATCH_ALL(e) { ... issue a warning } END_CATCH_ALL; What's the point of these macros? What benefit do they offer over the built-in try/catch? I've tried googling this, but "try vs TRY" is hard to search for.

    Read the article

  • how to catch ajax query post error?

    - by TTCG
    I would like to catch the error and show the appropriate message if the ajax request fails. My code is like the following, but I could not manage to catch the failure ajax request. function getAjaxData(id) { $.post("status.ajax.php", {deviceId : id}, function(data){ var tab1; if (data.length>0) { tab1 = data; } else { tab1 = "Error in Ajax"; } return tab1; }); } I found out that, "Error in Ajax" is never executed when the Ajax request failed. How to handle the ajax error and show the appropriate message if it fails? Thanks very much.

    Read the article

  • Using ClaimsPrincipalPermissionAttribute, how do I catch the SecurityException?

    - by Ryan Roark
    In my MVC application I have a Controller Action that Deletes a customer, which I'm applying Claims Based Authorization to using WIF. Problem: if someone doesn't have access they see an exception in the browser (complete with stacktrace), but I'd rather just redirect them. This works and allows me to redirect: public ActionResult Delete(int id) { try { ClaimsPrincipalPermission.CheckAccess("Customer", "Delete"); _supplier.Delete(id); return RedirectToAction("List"); } catch (SecurityException ex) { return RedirectToAction("NotAuthorized", "Account"); } } This works but throws a SecurityException I don't know how to catch (when the user is not authorized): [ClaimsPrincipalPermission(SecurityAction.Demand, Operation = "Delete", Resource = "Customer")] public ActionResult Delete(int id) { _supplier.Delete(id); return RedirectToAction("List"); } I'd like to use the declarative approach, but not sure how to handle unauthorized requests. Any suggestions?

    Read the article

  • ComboBox.SelectionChanged doesn't catch the first selection

    - by trnTash
    I need to fill textboxes depending on the item selected in a combobox. I fill combo async and in Completed event I have the following code combo.ItemsSource = e.Result; combo.DisplayMemberPath = "Name"; combo.SelectedIndex = -1; Then in the SelectionChanged event of the combo, I catch the selected object MyClass mc= ((ComboBox)sender).SelectedItem as MyClass; tbxName.Text = mc.Name; ... However, when I load the project and select any event for the 1st time, NOTHING happens. Every other time (2nd, 3rd, nth) the data is correctly caught and displayed. So I need to know why the combo doesn't catch the first selection? That's the reason I have the code combo.SelectedIndex = -1 (when the app loads, combo is empty - selection -1 works).

    Read the article

  • Check For Duplicate Records VS try/catch Unique Key Constraint

    - by Jed
    I have a database table that has a Unique Key constraint defined to avoid duplicate records from occurring. I'm curious if it is bad practice to NOT manually check for duplicate records prior to running an INSERT statement on the table. In other words, should I run a SELECT statement using a WHERE clause that checks for duplicate values of the record that I am about to INSERT. If a record is found, then do not run the INSERT statement, otherwise go ahead and run the INSERT.... OR Just run the INSERT statement and try/catch the exception that may be thrown due to a Unique Key violation. I'm weighing the two perspectives and can't decide which is best- 1. Don't waste a SELECT call to check for duplicates when I can just trap for an exception VS 2. Don't be lazy by implementing ugly try/catch logic VS 3. ???Your thoughts here??? :)

    Read the article

  • How to catch mousewheel up/down event using RaphaelJs

    - by alex.dominte
    I need to implement a horizontal scrollable timeline. I've drawn the timeline/grids/rulers etc. I just need to catch mousewheel up/down to scroll the timeline (backward - past/forward - future). First I need to catch the event: but nothing I've found seems to work. Need browser support only for chrome/firefox (latest versions). These 2 won't listeners won't work: var paper = new Raphael('raphael-paper'); // ... paper.canvas.on('mousewheel', function(event) { console.log(event); }); // ... paper.canvas.addEventListener('mousewheel', function(event) { console.log(event); });

    Read the article

  • Catch PyGTK TreeView reorder

    - by mkotechno
    I have a simple gtk.TreeView with a gtk.ListStore model and set_reorderable(True), I want to catch the signal/event emited when the user reorder through drag&drop the list, but the documentation does not help much: "The application can listen to these changes by connecting to the model's signals" So I tried to connect the model (ListStore) signals... but surprise! ListStore has no signals, so you are dispatched to TreeModel signals, then I tried to connect with the TreeModel "rows-reordered" signal with no lucky. How should I catch the list reorder performed by the user?

    Read the article

  • Delete temp file during finally vs delete output file during catch

    - by Russell
    This is in Java 6. I've seen more than once that people create temp files, do something, then rename it to the output file. Everything is wrapped in a try-finally block, where the temp file is deleted in finally in case something goes wrong in between. try { //do something with tempFile //do something with tempFile //do something with tempFile tempFile.renameTo(outputFile); } finally { if (tempFile.exists()) tempFile.delete() } I was wondering what are the benefits of doing that instead of doing something to the output file directly and delete it in case of exceptions. try { //do something with outputFile //do something with outputFile //do something with outputFile } catch (Exception e) { if (outputFile.exists()) outputFile.delete(); } My guess is that deleting temp files in finally benefits me when the try block can throw many kinds of exceptions. Is my guess right? What else?

    Read the article

< Previous Page | 11 12 13 14 15 16 17 18 19 20 21 22  | Next Page >