exception

NHibernate, WCF & SqlServerCE - Exception thrown loading driver

Background I have a BLL DLL that uses NHibernate. I share the same BLL between a client application and the WCF service (even though the client runs on another machine). I can successfully use either SqlServerCe or SqlServer driver with the BLL with the client application but can only use the SqlServer driver for the WCF. If I change...

java rmi exceptions

I'm writing an rmi application. Everything works perfectly fine when i put the all classes in one directory. However, when i try to split the server part and the client part, it raises java.lang.ClassNotFoundException.myclasses It seems to be the Registry can't find that class on its CLASSPATH. I'm wondering how to I solve this problem? ...

HAML throwing exception on Production but not Development

I've written this HAML: %script{:src => "http://www.google.com/jsapi?key=mykey" :type => "text/javascript"} Note the missing comma between :src and :type. On my Production server (Dreamhost/Linux), I get the following logged exception when I try to view the page: ActionView::TemplateError (compile error /home/.kuce/sugarthrill_stage...

Ruby Constructors and Exceptions

New to Ruby, and I'm trying to figure out what idiom to use to restrict some integer values to the constructor of a class. From what I've done so far, if I raise an exception in initialize(), the object is still created but will be in an invalid state (for example, some nil values in instance variables). I can't quite see how I'm suppo...

Should ASP.NET AJAX be avoided in heavy pages?

Hi, I'm getting some js errors only for some users, and only every once in a while on a page that uses quite a bit of ASP.NET AJAX. The page also does some intense SQL querying and some string manipulation to highlight text found in the search results. Could this be a result of performance? Is it always safe to use ASP.NET AJAX in de...

ServerException is being thrown while binding RMI service

I'm trying to build simple echo server as RMI application (step by step as it's described in Sun tutorial). All source code is shown below, it's very simple: package test; import java.rmi.Remote; import java.rmi.RemoteException; public interface EchoServer extends Remote { public String sendString (String str) throws RemoteExcept...

DOS: Command-Line Argument Validation

Bear with me, it's been a while. :) What is a good way to validate command-line arguments passed to an MS-DOS batch script? For example, here is what I want to do: IF "%1"=="" throw "Missing 1st argument: Machine Name" IF "%2"=="" throw "Missing 2nd argument: File Path" ...

access violation in WM_PAINT not caught

To test this problem I have written a minimal windows application. If I force an access violation in the WM_PAINT handler this exception never gets to the debugger. If started without debugger the access violation also does not show up. Usually you should get the Windows Error Reporting dialog. Digging a bit deeper it seems that somethi...

Why doesn't Visual Studio break on exceptions when debugging unit tests?

When I attempt to debug a unit test that fails because of an unhandled exception in my code, I expect Visual Studio to break on the unhandled exception so I can inspect the code and isolate the problem. Instead, the IDE instantly exits debug mode and the test is listed as "Failed", leaving me to consult the test result's stack trace to ...

What exception type to use when a property cannot be null?

In my application I need to throw an exception if a property of a specific class is null or empty (in case it's a string). I'm not sure what is the best exception to use in this case. I would hate to create a new exception and I'm not sure if ArgumentNullException is appropriate in this case. Should I create a new exception or there's...

Best practices: throwing exceptions from properties

When is it appropriate to throw an exception from within a property getter or setter? When is it not appropriate? Why? Links to external documents on the subject would be helpful... Google turned up surprisingly little. ...

'Cross-thread operation not valid' does not kill WinForms application (and it should).

Update: here is an MSDN article How to: Make Thread-Safe Calls to Windows Forms Controls. It states: The .NET Framework helps you detect when you are accessing your controls in a manner that is not thread safe. When you are running your application in the debugger, and a thread other than the one which created a control t...

How can I handle a windows forms datetimepicker ArgumentOutOfRangeException?

I've run into a very specific bug with the DateTimePicker control in Windows Forms. The control has a custom format (MM-YYYY -> 01/2010) - the month/year of a credit card. Today is the 29th of September. If a user selects the control, and uses the keyboard to set the month to February, the control will throw an ArgumentOutOfRangeExceptio...

Testing for an empty iterator in a Python for... loop

The code below is based on this recipe. However, the key point of the recipe - that it provides a way to break out of the iteration on an iterator if the iterator is empty - doesn't seem to work here, instead behaving in the following undesired ways: If get_yes_no_answer() == False and there are two or more items left in the iterator, ...

ASP.NET Security Exception

I moved an ASP.NET application from a XP to a new server and now I have this exception: 'System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.0.0, Culture=neutral, On this line code: System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("it-IT"); My server is so con...

Why does this compile?

I was taken aback earlier today when debugging some code to find that something like the following does not throw a compile-time exception: public Test () { HashMap map = (HashMap) getList(); } private List getList(){ return new ArrayList(); } As you can imagine, a ClassCastException is thrown at runtime, but can someone ...

How to return often occurring error in object oriented environment?

Hi, assume you have a function that polls some kind of queue and blocks for a certain amount of time. If this time has passed without something showing up on the queue, some indication of the timeout should be delivered to the caller, otherwise the something that showed up should be returned. Now you could write something like: class ...

WebRequest.Create throws "Value cannot be null. Parameter name: str" exception

Hi I wrote a wrapper around HttpWebRequest with the constructor : public MyHttpRequest(string requestUrl) { this.webRequest = (HttpWebRequest)WebRequest.Create(requestUrl); } when I pass a vaild url that works in IE : http://www.google.co.il/search?q=%D7%A9%D7%9E%D7%A8+%D7%97%D7%A1%D7%95%D7%9F&ie=utf-8&am...

Server Application Unavailable

I am using visual studio 2005. When I debug and reached at exception point. I got following error dialouge. message screenshot When I click No, I got following error page. The web application you are attempting to access on this web server is currently unavailable. Please hit the "Refresh" button in your web browser to retry your req...

What are the most commonly used runtime exceptions in java?

As a java programmer who wishes to perfect his programming skills, I often come across the situations that I have to create a runtime exception. I know it's a good practice if one use wisely. Personally, NullPointerException and IllegalStateException are the most commonly used in the softwares that I have created. How about you? What ...