Search Results

Search found 4077 results on 164 pages for 'throw'.

Page 92/164 | < Previous Page | 88 89 90 91 92 93 94 95 96 97 98 99  | Next Page >

  • Windows Service Fails on Launch

    - by Jeff
    I'm trying to write a windows service. It installs fine, but fails when I run it with the following exception. I've searched for the string "MyNewProgramService", but I can't find any conversions that would throw this error. I've also added try/catch blocks to a bunch of code with custom exception handling without finding where this exception is occuring. I'm thinking it's somewhere in the auto-generated configuartion/setup code. Any ideas? Event Type: Error Event Source: MyNewProgram Event Category: None Event ID: 0 Date: 4/15/2010 Time: 12:48:34 PM User: N/A Computer: 20F7KF1 Description: Service cannot be started. System.InvalidCastException: Conversion from string "MyNewProgramService" to type 'Integer' is not valid. ---> System.FormatException: Input string was not in a correct format. at Microsoft.VisualBasic.CompilerServices.Conversions.ParseDouble(String Value, NumberFormatInfo NumberFormat) at Microsoft.VisualBasic.CompilerServices.Conversions.ToInteger(String Value) --- End of inner exception stack trace --- at Microsoft.VisualBasic.CompilerServices.Conversions.ToInteger(String Value) at TaskManagerFailureHandlerService.MyNewProgramService.OnStart(String[] args) at System.ServiceProcess.ServiceBase.ServiceQueuedMainCallback(Object state)

    Read the article

  • A Few Questions About QT

    - by ForgiveMeI'mAN00b
    Is it free? It looks like on the website it says "Try Now", which makes me worry that it just gives you a demo. Do you have to pay the QT company anything to distribute a program using QT, or can you just throw it (the program) out there and just say you used QT. Is it native c++, or something wierd, like, the same way .NET programs aren't actual c++, they just look like it. Would somebody who uses my program have to install the QT framework before they can run it, or will the program run without any installation? Can it easily be compiled to work on a Windows, Linux and Mac OS?

    Read the article

  • Grails Services / Transactions / RuntimeException / Testing

    - by Rob
    I'm testing come code in a service with transactional set to true , which talks to a customer supplied web service the main part of which looks like class BarcodeService { .. /// some stuff ... try{ cancelBarCodeResponse = cancelBarCode(cancelBarcodeRequest) } catch(myCommsException e) { throw new RuntimeException(e) } ... where myCommsException extends Exception .. I have a test which looks like // As no connection from my machine, it should fail .. shouldFailWithCause(RuntimeException){ barcodeServices.cancelBarcodeDetails() } The test fails cause it's catching a myCommsException rather than the RuntimeException i thought i'd converted it to .. Anyone care to point out what i'm doing wrong ? Also will the fact that it's not a RuntimeException mean any transaction related info done before my try/catch actually be written out rather than thrown away ?? Thanks

    Read the article

  • MD5 and Hibernate Query

    - by theJava
    public Login authenticate(Login login) { String query = "SELECT L FROM Login AS L WHERE L.email=? AND L.password=?"; Object[] parameters = { login.getEmail(), login.getPassword() }; List<Login> resultsList = (getHibernateTemplate().find(query,parameters)); if (resultsList.isEmpty()) { //error dude } else if (resultsList.size() > 1) { //throw expections } else { Login login1 = (Login) resultsList.get(0); return login1; } return null; } I have my DB tables password col set as MD5, now how to retrieve it back here.

    Read the article

  • Bad allocation exceptions in C++

    - by me1982
    Hello, In a school project of mine I was requested to create a program not using STL. In the program I use alot of Pointer* = new Something; if (Pointer == NULL) throw AllocationError(); My question is about allocation errors: 1. is there an autamtic exception thrown by new when allocation fails? 2. if so how can I catch it if I'm not using STL (#include "exception.h) 3. is using the NULL testing enugh? thank you. I'm using eclipseCDT(C++) with MinGW on windows 7.

    Read the article

  • C++ how can I refactor this?

    - by ShaChris23
    I have the code below in my test code in many places: // // Make a function call while expecting an exception should be thrown // bool exceptionThrown = false; try { expectNotEqual(someData, anotherData, methodName); } catch(std::logic_error&) { exceptionThrown = true; } if(!exceptionThrown) throw std::logic_error(methodName+"exception not thrown"); It would be nice (more readable, concise) if I could encapsulate all that, and do something like: exceptionShouldBeThrown(expectNotEqual(someData, anotherData, methodName)); I dont want to use macro ...does anyone know how I could achieve the one-liner above with C++?

    Read the article

  • Checking exception before using GETITEMBYID()

    - by ps123
    Hello, I am getting item by getiembyid...but I want to check before using it that whether item exist or not...I don't want to use query as main purpose of using Getitembyid is performance.....any idea how to achieve this... itemid = Response.QueryString["loc"]; SPList mylist = myweb.GetList(SPUrlUtility.CombineUrl(myweb.ServerRelativeUrl, "/Lists/Location")); //now id itemid does not exist it throws exception...so i want to check before using following statement that itemid exist...I know i can check throw SPQuery but as i said above because of performance issue only i m using itemid.... SPListItem myitem = mylist.GetItemById(Convert.ToInt32(itemid)); Any idea how to achieve this?

    Read the article

  • Can you step into specific properties in VS 2010?

    - by cyclotis04
    I know that you can either step into every property or not step into every property, but I would really like to be able to step into a specific property, and not the rest. Is this possible? (I also know I can use keyboard commands, but I'm asking if there's a more permanent solution.) I have a lot of properties and my setters do important things, so it's silly to step over them, but most of my getters are pointless. I'm looking for something like: public string ImportantProperty { get { return _importantProperty; } [DebuggerStepThrough(false)] set { if (this.State != ConnectionState.Closed) throw new InvalidOperationException( "Important Property cannot be changed unless This is closed."); if (ImportantProperty == value) return; _importantProperty = value; OnImportantPropertyChanged(new EventArgs()); } } Unfortunately, I can't find anything that will act like [DebuggerStepThrough(false)] and I must resort to turning off property step-over and putting [DebuggerStepThrough] everywhere I don't want to step-through.

    Read the article

  • Need help with cURL and POSTing in PHP

    - by alex
    I need to post to a payment gateway. The example PHP script for the gateway simply sets the XML like this curl_setopt($ch, CURLOPT_POSTFIELDS, $xmlRequest); // $xmlRequest is just a string of XML In all of my experience, generally you need to use an array with key/values or a string similar to GET params. I am using Kohana, and tracked down a cURL module. It accepts the POST key/values as an array only. Now, I could ditch the module and throw some cURL straight in, but I am using this module fine all throughout the site, so would prefer to use it here. So, my question is, how does that first one work? Does it just POST the whole thing without any named key? Is there a default key I could use for an array to get the module to work?

    Read the article

  • Why Use java.lang.reflect.Array For Anything Other Than Array Creation?

    - by dimo414
    Java Class java.lang.reflect.Array provides a set of tools for creating an array dynamically. However in addition to that it has a whole set of methods for accessing (get, set, and length) an array. I don't understand the point of this, since you can (and presumably would) cast your dynamically generated array as an array upon creation, which means you can use the normal array access (bracket notation) functionality. In fact, looking at the source code you can see that is all the class does, cast the array, and throw an exception if the cast fails. So what's the point / usefulness of all of these extra methods?

    Read the article

  • Linq: comparison with nonexisting value should not cause the exception, but it does

    - by Seacat
    Hello, Given I don't know if the parameter will be null or not and I want to use it in the following way: if Param != null then compare with its id if Param == null then compare with null. Something like that: var c = from cat in context.Categories where ParamCat != null && cat.ParentId == ParamCat.Id || ParamCat == null && cat.ParentId == null select c; If ParamCat is null as soon as I try to get something from c (for example c.Count()) it throws the exception. Usually when we use some kind of condition it stop comparison as soon as condition fail especially if we use AND. For example this code will not cause any exception: if (ParamCat != null && cat.ParentId == RaramCat.Id) { } If so, why the linq code above throw exception? (Null reference) Thanks

    Read the article

  • What's causing "NoMethodError: undefined method `include?' for nil:NilClass"

    - by NudeCanalTroll
    I have a Book model in my Rails application, with various properties (aka columns in the book db table). One of these properties is "ranking". Recently, may app has started to throw NoMethodError: undefined method 'include?' for nil:NilClass for the following code: def some_method(book, another_arg) return book.ranking unless book.ranking.blank? ... end However, it's not consistent. The vast majority of the time, accessing book.ranking works -- the error is thrown maybe 2-4% of the time. If I change the code to book[:ranking] or book['ranking'] instead of book.ranking, it works 100% of the time. Any ideas?

    Read the article

  • What is the purpose of this delegate usage?

    - by Kev
    Whilst poking around some code in .NET Reflector in an app I don't have the source code for I found this: if (DeleteDisks) { using (List<XenRef<VDI>>.Enumerator enumerator3 = list.GetEnumerator()) { MethodInvoker invoker2 = null; XenRef<VDI> vdiRef; while (enumerator3.MoveNext()) { vdiRef = enumerator3.Current; if (invoker2 == null) { // // Why do this? // invoker2 = delegate { VDI.destroy(session, vdiRef.opaque_ref); }; } bestEffort(ref caught, invoker2); } } } if (caught != null) { throw caught; } private static void bestEffort(ref Exception caught, MethodInvoker func) { try { func(); } catch (Exception exception) { log.Error(exception, exception); if (caught == null) { caught = exception; } } } Why not call VDI.destroy() directly. Is this just a way of wrapping the same pattern of try { do something } catch { log error } if it's used a lot?

    Read the article

  • Java generics conversion

    - by LittleGreenMan
    I have build a generic datacontainer and now I want to manipulate data depending on their type. However, I get an incompatable types warning. What am I doing wrong? Type _Value; public void set(Type t) throws Exception { if (_Value instanceof Integer && t instanceof Integer) { _Value = (((Integer) t - _MinValue + getRange()) % getRange()) + _MinValue; } else if (_Value instanceof Boolean && t instanceof Boolean) { _Value = t; } else throw new Exception("Invalid type"); }

    Read the article

  • Add progressbar to BZip2CompressorInputStream

    - by bordeux
    This is my code: public void extract(String input_f, String output_f){ int buffersize = 1024; FileInputStream in; try { in = new FileInputStream(input_f); FileOutputStream out = new FileOutputStream(output_f); BZip2CompressorInputStream bzIn = new BZip2CompressorInputStream(in); final byte[] buffer = new byte[buffersize]; int n = 0; while (-1 != (n = bzIn.read(buffer))) { out.write(buffer, 0, n); } out.close(); bzIn.close(); } catch (Exception e) { throw new Error(e.getMessage()); } } How can i add progress bar to extract task, or how can i get the compressed file size?

    Read the article

  • allocator with no template

    - by Merni
    Every stl container take an allocator as a second object, template < class T, class Allocator = allocator<T> > class vector; If you write your own class It is possible to use your own allocator. But is it possible to write your own allocator without using templates? For example, writing this function is not easy if you are not allowed to use templates pointer allocate(size_type n, const_pointer = 0) { void* p = std::malloc(n * sizeof(T)); if (!p) throw std::bad_alloc(); return static_cast<pointer>(p); } Because how could you know the size of T?

    Read the article

  • different for lusses java

    - by Ayrton
    Hi I'm having some difficulties with the following problem: I'm making a little game where you're at a specific spot and each spot has each some possible directions. The available directions are N(ord),E(ast),S,W . I use the function getPosDirections to get the possible directions of that spot. The function returns the directions into an ArrayList e.g. for spot J3: [E,W] Now the game goes like this: 2 dices will be rolled so you get a number between 2 and 12, this number represents the number of steps you can make. What I want is an ArrayList of all the possible routes e.g.: I throw 3 and I'm currently at spot J3: [[E,N,E],[E,N,S],[E,S,E],[E,S,S],[W,N,E],[W,N,S],[W,S,E],[W,S,S]] How would obtain the last mentioned Array(list) Thanks in advance

    Read the article

  • Why am I getting a Java NoSuchPortException when the port exists?

    - by user258526
    Got the following production code below, I'm using it for a new driver. portName is COM4 and this port exists on the PC (and I can connect to it with hyperterminal), so why does Javacomm throw a NoSuchPortException? COM4 shows up fine in device mgr. too final String portName = getSerialPort(); try { final CommPortIdentifier id = CommPortIdentifier.getPortIdentifier(portName); port = (SerialPort) id.open(getName(), 1000); } catch (NoSuchPortException nspe) { report(SeverityCode.LEVEL2, getName(), "PIN Pad is not connected to " + portName + " port, or the port does not exist."); return; } catch (PortInUseException piue) { report(SeverityCode.LEVEL2, getName(), portName + " port is already in-use by some other device. Reason: " + piue.getMessage()); return; }

    Read the article

  • Compiler: Translation to assembly

    - by sub
    I've written an interpreter for my experimental language and know I want to move on and write a small compiler for it. It will probably take the source, go through the same steps as the interpreter (tokenizer, parser) and then translate the source to assembly. Now my questions: Can I expect that every command in my language can be 1:1 translated to a bunch of assembly instructions? What I mean is if I will have to completely throw over the whole input program or if it is just translated to assembly per line. Which assembler should I use as output format?

    Read the article

  • Appengine backreferences - need composite index?

    - by davezor
    I have a query that is very recently starting to throw: "The built-in indices are not efficient enough for this query and your data. Please add a composite index for this query." I checked the line on which this exception is being thrown, and the problem query is this one: count = self.vote_set.filter("direction =", 1).count() This is literally a one-filter operation using appengine's built-in backreferences. I have no idea how to optimize this query...anyone have any suggestions? I tried to add this index: - kind: Vote properties: - name: direction direction: desc - kind: Vote properties: - name: direction And I got a message (obviously) saying this was an unnecessary index. Thanks for your help in advance.

    Read the article

  • WebClient - The remote server returned an error: (403) Forbidden.

    - by daniel
    Opening a public page from browser works fine. Downloading same page using WebClient throws - (403) Forbidden. What is going on here ? Here is quick copy/paste example (used on console app) to specific page on web: try { WebClient webClient = new WebClient(); string ss = webClient.DownloadString("http://he.wikisource.org/wiki/%D7%A9%D7%95%D7%9C%D7%97%D7%9F_%D7%A2%D7%A8%D7%95%D7%9A_%D7%90%D7%95%D7%A8%D7%97_%D7%97%D7%99%D7%99%D7%9D_%D7%90_%D7%90"); } catch (Exception ex) { throw; }

    Read the article

  • HRESULT exception not caught in VS 2008

    - by arionik
    Hello all, I've got a stange situation in visual studio 2008 C++. I work on code that was originally written for visual studio 2003, where everything works well. Now, ported to VS 2008, the exception handling, which unfortuantely exists widely in the code, does not work anymore. standard code example: try { HRESULT hr = S_OK; // do stuff... if( FAILED( hr ) ) throw hr; } catch( HRESULT hr ) { // error handling, but we never get here } catch( ... ) { // ... not even here } Under VS 2008, no exception is encountered, but I get a crash somewhere else, indicating that the stack pointer must be screwed up. Did anybody come across this behaviour? Any help is appreciated.

    Read the article

  • SkinId and Dynamic Control

    - by Alex
    Hi! I have some control that I add dynamically to my page: public partial class _Default : Page { protected override void CreateChildControls() { base.CreateChildControls(); var testControl = new TestControl { SkinID = "TestSkin" }; Controls.Add(testControl); } } I have the following skin file for this control: <cc:TestControl runat="server" SkinID="TestSkin" TestProperty="LALALA" /> But TestProperty is null (if control is static all works): public class TestControl : LinkButton { public string TestProperty { get; set; } protected override void OnPreRender(EventArgs e) { if (String.IsNullOrEmpty(TestProperty)) { throw new ArgumentNullException("TestProperty"); } } } Any ideas about how to fix it?

    Read the article

  • PrivateFontCollection fails on appharbor

    - by grennis
    I am trying to load a custom font (ttf file) and draw into an image with the Graphics object. This code runs fine locally: PrivateFontCollection fonts = new PrivateFontCollection(); string path = context.Server.MapPath("~/App_Data/Futura LT Bold.ttf"); if (!System.IO.File.Exists(path)) { throw new InvalidOperationException("Font file is not deployed: " + path); } fonts.AddFontFile(path); However when run on appharbor, the call to AddFontFile fails with the exception: System.ArgumentException: Font 'Futura LT Book' does not support style 'Regular'. at System.Drawing.Font.CreateNativeFont() at System.Drawing.Font.Initialize(FontFamily family, Single emSize, FontStyle style, GraphicsUnit unit, Byte gdiCharSet, Boolean gdiVerticalFont) at System.Drawing.Font..ctor(FontFamily family, Single emSize) at LumenboxWeb.Controllers.GalleryController.FontTest() in d:\temp\h5oqslma.udd\input\src\LumenboxWeb\Controllers\GalleryController.cs:line 59 at lambda_method(Closure , ControllerBase , Object[] ) at System.Web.Mvc.ActionMethodDispatcher.Execute(ControllerBase controller, Object[] parameters) at System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters) I have tried different fonts, and they all work locally, but none work on appharbor. Is it possible to load fonts dynamically on appharbor?

    Read the article

  • Validation of method parameters

    - by Anton Tsivarev
    I have a RESTful web service. For implementation using JAX-RS (Jersey). Have the following method: public void foo (@PathParam ("name") String uuid) { ... } I need to do validation of input parameters. And if data invalid throw WebApplicationException. I added my custom annotation CheckUuid (extends ): public void foo (@PathParam ("name") @CheckUuid String uuid) { ... } Is it possible to do validation using annotations on a stage when the method chosen, but not yet called? For example using PreProcessInterceptor?

    Read the article

< Previous Page | 88 89 90 91 92 93 94 95 96 97 98 99  | Next Page >