I recently saw that the boost program_options library throws a logic_error if the command-line input was un-parsable. That challenged my assumptions about logic_error vs. runtime_error.
I assumed that logic errors (logic_error and its derived classes) were problems that resulted from internal failures to adhere to program invariants,...
I have created a dll in C++ using a Class Library project in Visual Studio. I need to call a method in the dll from a C# application.
I got to know there are 2 approches. One is to add the dll project reference to C# project or use DllExport to export method. However when I tried in both ways it always gives the following error when t...
90% of the time I am unable to launch osk.exe from a 32bit process on Win7 x64. Originally the code was just using:
Process.Launch("osk.exe");
Which won't work on x64 because of the directory virtualization. Not a problem I thought, I'll just disable virtualization, launch the app, and enable it again, which I thought was the correct ...
Why can't you throw an InterruptedException in the following way:
try {
System.in.wait(5) //Just an example
} catch (InterruptedException exception) {
exception.printStackTrace();
//On this next line I am confused as to why it will not let me throw the exception
throw exception;
}
I went to http://java24hours.com, but it ...
Here's some code from an FTP application I'm working on. The first method comes from an interface which is being triggered by a class which is monitoring server output.
@Override
public void responseReceived(FTPServerResponse event) {
if (event.getFtpResponseCode() == 227) {
try {
setupPassiveConnection(event.get...
Hello,
I have written a COM object that in turn uses a thrid party ActiveX control. In my FinalConstruct() for my COM object, I instantiate the ActiveX control with the follow code:
HRESULT hRes;
LPCLASSFACTORY2 pClassFactory;
hRes = CoInitializeEx(NULL,COINIT_APARTMENTTHREADED);
bool bTest = SUCCEEDED(hRes);
if (!bTest)
r...
HI, I have one global generic exception handler(catch ex as Exception) for all unhandled exceptions from application.
But in debug mode(app runs from VS) I don`t want that exceptions go to this global handler.
Better for me is when VS stops app on place when exception occurs.
How can I do this, or is there some better approach for this?...
UPDATE: This is a Django web app
Hi folks, I want to set up email notifications when there is an error happening in my application. In ruby, there is a very elegant solution called ExceptionNotifier, which wraps around the exception handler and uses the built-in mailer to send an email.
What is the best way of doing this in Python? I k...
As the title suggests, how can I tell a JVM thrown exception from a Programmatically(does this mean, thrown by a programmer or the program) thrown exception ?
JVM Exceptions
1) ArrayIndexOutOfBoundsException
2) ClassCastException
3) NullPointerException
Programmatically thrown
1) NumberFormatException
2) AssertionErr...
Hello Guys,
i'm trying to access twitter via oauth. Therefore, i registered my app, downloaded Twitter4j, added the jars in my Eclipse-Project, and then tried to execute the following code:
Twitter twitter = new TwitterFactory().getOAuthAuthorizedInstance("[key]","[secretKey]");
RequestToken requestToken = twitter.getOAuthRequestToken(...
need to implement a global error handling, so maybe you can help out with the following example...
i have this code:
public bool IsUserAuthorizedToSignIn(string userEMailAddress, string userPassword)
{
// get MD5 hash for use in the LINQ query
string passwordSaltedHash = this.PasswordSaltedHash(userEMail...
Hi,
My Java application, which uses Hibernate and it's hosted by Tomcat 6.0, gets the following exception after a long time of inactivity when it tries to access the DB:
com.mysql.jdbc.CommunicationsException: Communications link failure due to underlying exception:
** BEGIN NESTED EXCEPTION **
java.io.EOFException
STACKTRACE:
ja...
i've inherited a site that in production is generating dozens of "no block given" exceptions every 5 minutes.
the top of the stack trace is:
vendor/gems/nkallen-cache-money-0.2.5/lib/cash/accessor.rb:42:in `add'
vendor/gems/nkallen-cache-money-0.2.5/lib/cash/accessor.rb:33:in `get'
vendor/gems/nkallen-cache-money-0.2.5/lib/cas...
I have application with this code:
Module Startup
<STAThread()> _
Public Sub Main()
Try
Application.EnableVisualStyles()
Application.SetCompatibleTextRenderingDefault(False)
InitApp()
Dim login As New LoginForm()
Dim main As New MainForm()
Application.Run(login)
If login.DialogResult...
OK so I am getting an ArrayIndexOutofBoundsException. I don't know why.
Here's my code:
/**
Tile Generator
Programmer: Dan J.
Thanks to: g00se, pbl.
Started May 23, 2010
**/
import java.awt.*;
import java.awt.event.*;
import java.applet.Applet;
public class tileGen extends Applet implements KeyListener {
Image[] tiles; // tile...
I have the following code in some app:
int lowRange=50;
int[] ageRangeIndividual = {6, 10, 18, 25, 45, 65, 90};
int index=0;
for (; index<ageRangeIndividual.length-1 && ageRangeIndividual[index]<=lowRange;index++);
I am getting an "Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 7" in the for line! even though I ...
I have enum:
public enum SymbolWejsciowy
{
K1 , K2 , K3 , K4 , K5 , K6 , K7 , K8
}
and I want to create list of this enum
public List<SymbolWejsciowy> symbol;
but in my way to add enum to List:
1.
SymbolWejsciowy symbol ;
symbol.Add(symbol = SymbolWejsciowy.K1);
2.
symbol.Add(SymbolWejsciowy.K1);
I always ...
HttpResponse.End() seems to throw an exception according to msdn. Right now i have the choice of returning a value to say end thread (it only goes 2 functions deep) or i can call end().
I know that throwing exceptions is significantly slower (read the comment for a C#/.NET test) so if i want a fast webapp should i consider not calling i...
I am having trouble importing my C++ functions. If I declare them as C functions I can successfully import them. When explicit loading, if any of the functions are missing the extern as C decoration I get a the following exception:
First-chance exception at 0x00000000 in cpp.exe: 0xC0000005: Access violation.
DLL.h:
extern "C" __decl...
I'm having trouble using the Ribbon control from the Office 2007 RibbonControlsLibrary.dll.
It works for most people but not for me. The fault I get is:
Cannot create instance of 'Ribbon' defined in assembly 'RibbonControlsLibrary, Version=3.5.31016.1, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. Exception has been thrown by the ...