exception

com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Duplicate entry '' for key 'PRIMARY'

北慕城南 提交于 2019-12-30 06:54:14
问题 I am getting this exception from today onwards. Yesterday things were fine. I will post my code : public void enterStaff() throws ClassNotFoundException, SQLException { try { Class.forName("com.mysql.jdbc.Driver"); connect = DriverManager .getConnection("jdbc:mysql://localhost:3306/project?" + "user=root&password=virus"); statement = connect.createStatement(); preparedStatement = connect .prepareStatement("SELECT count(*)FROM information_schema.tables\n" + "WHERE table_schema = 'project' AND

Pyspark socket timeout exception after application running for a while

匆匆过客 提交于 2019-12-30 06:34:55
问题 I am using pyspark to estimate parameters for a logistic regression model. I use spark to calculate the likelihood and gradients and then use scipy's minimize function for optimization (L-BFGS-B). I use yarn-client mode to run my application. My application could start to run without any problem. However, after a while it reports the following error: Traceback (most recent call last): File "/home/panc/research/MixedLogistic/software/mixedlogistic/mixedlogistic_spark/simulation/20160716-1626

Pyspark socket timeout exception after application running for a while

余生长醉 提交于 2019-12-30 06:34:06
问题 I am using pyspark to estimate parameters for a logistic regression model. I use spark to calculate the likelihood and gradients and then use scipy's minimize function for optimization (L-BFGS-B). I use yarn-client mode to run my application. My application could start to run without any problem. However, after a while it reports the following error: Traceback (most recent call last): File "/home/panc/research/MixedLogistic/software/mixedlogistic/mixedlogistic_spark/simulation/20160716-1626

Catching ArgumentTypeError exception from custom action

人走茶凉 提交于 2019-12-30 06:16:08
问题 What is the best practice to throw an ArgumentTypeError exception from my own custom action and let the argparse to catch it for me? It seems that argparse's try/except block does not handle this exception for my custom actions. Though it does that just fine for its built-in actions. class unique_server_endpoints(argparse.Action): """This class avoids having two duplicate OuterIPs in the client argument list""" def __call__(self, parser, namespace, values, option_string=None): ips = set()

C# -Why does System.IO.File.GetLastAccessTime return an expected value when the file is not found?

佐手、 提交于 2019-12-30 05:55:10
问题 Please, explain your thoughts. 1. DateTime dt = System.IO.File.GetLastAccessTime("C:\\There_is_no_such_file.txt"); 2. DateTime dt = System.IO.File.GetLastAccessTime(""); If the file described in the path parameter does not exist, this method returns 12:00 midnight, January 1, 1601 A.D. (C.E.) Coordinated Universal Time (UTC), adjusted to local time. In the second situation argument exception is thrown. Why in first case FileNotFoundException (or smth. simmilar) is not thrown? 回答1: This is

Can finalize be called after a constructor throws an exception?

二次信任 提交于 2019-12-30 03:49:05
问题 Are there any details on whether or not an object is cleaned up using finalize() if that object's constructor thew an exception. When this method is called is notoriously ill defined. According to the manual: The Java programming language does not guarantee which thread will invoke the finalize method for any given object. It is guaranteed, however, that the thread that invokes finalize will not be holding any user-visible synchronization locks when finalize is invoked. If an uncaught

RSA BadPaddingException : data must start with zero

二次信任 提交于 2019-12-30 03:35:09
问题 I try to implement an RSA algorithm in a Java program. I am facing the "BadPaddingException : data must start with zero". Here are the methods used to encrypt and decrypt my data : public byte[] encrypt(byte[] input) throws Exception { Cipher cipher = Cipher.getInstance("RSA/ECB/PKCS1Padding");// cipher.init(Cipher.ENCRYPT_MODE, this.publicKey); return cipher.doFinal(input); } public byte[] decrypt(byte[] input) throws Exception { Cipher cipher = Cipher.getInstance("RSA/ECB/PKCS1Padding");///

Handling Unhandled Exceptions from Winforms components in WPF

∥☆過路亽.° 提交于 2019-12-30 03:18:20
问题 My application is built in WPF but it includes some WinForms components that we have written. When an exception is unhandled in one of the WinForms components it crashes the application. I have implemented DispatcherUnhandledException for WPF events. This is good because it allows me to display an error and mark the exception as Handled to avoid the crash. Can I do something similar with the non-WPF exceptions. I was hoping for the standard WinForms dialog that used to come up and allow the

symfony 1.4: How to pass exception message to error.html.php?

坚强是说给别人听的谎言 提交于 2019-12-30 02:33:05
问题 I tried using special variable $message described here http://www.symfony-project.org/cookbook/1_2/en/error_templates but it seems this variable isn't defined in symfony 1.4, at least it doesn't contain message passed to exception this way throw new sfException('some message') Do you know other way to pass this message to error.html.php ? 回答1: You'll need to do some custom error handling. We implemented a forward to a custom symfony action ourselves. Be cautious though, this action itself

Django: invalid literal for int() with base 10

一曲冷凌霜 提交于 2019-12-30 01:36:14
问题 I am new to Django and trying to pass an author's name to a view and filter out quote objects based on the author's name. here are the codes: models.py class Author(models.Model): author_name = models.CharField(max_length=50, default='unknown') author_info = models.TextField(max_length=1000) class Quote(models.Model): author = models.ForeignKey(Author) quote = models.TextField(max_length=500) category= models.ForeignKey(Category) pub_date = models.DateTimeField('date published') urls.py: url