Twitter Weekly Updates for 2012-01-29
- New post as http://t.co/q0Q9Y0TS – : To restore a "plain" postgresql backup … http://t.co/EZWaiR7B #twittertools #
Powered by Twitter Tools
Powered by Twitter Tools
New post as http://t.co/q0Q9Y0TS – : To restore a “plain” postgresql backup … http://t.co/EZWaiR7B #twittertools
1. Drop/Recreate the target database using PGAdmin
2. Be sure to add logins to all roles that are referenced in the backup script. This should only be necessary the first time. The phonesystem db references the following logins… phonesystem, phoneadmin, logsreader.
3. From a terminal window run the following command
sudo psql -d phonesystem -U seths -f “<path-to-backup>”
Seth
I was not looking forward to describing this problem until I found another forum web site with the EXACT SAME question I need answered (but with no answer.) So with credit to this guy here is my question...
We have a large Windows .Net application (winform executable) that gets installed on the client's desktop. This application calls web services on a server in a different timezone. Virtually all date oriented components detect the timezone difference and automatically adjust the datetime values (returned in dataSets generated by SQL queries), which is generally desirable in most applications but causing problems with accounting related applications that are "date" not "datetime" oriented. We are only interested in the "date" portion. However, a date of 1/1/2003 GMT-5 is automatically converted to 12/31/2002 11:00 GMT-6 on the client. Rather than going through all of the code and extracting the UniversalTime to get back to 1/1/2003 for visual purposes we would like to simply "fake" the timezone for the client-side executable by making it think it's in the same timezone as the server.
Question: Can we set the TimeZone programmatically for the currently running instance only, rather than the global setting?
I really don't have much to add because it is our EXACT issue. In our case we have ActiveReports that are fetching remote SQL data into a datasets and then binding the report to the dataset. So, for example, birthdays are wrong because we are storing the Date for them and X hours are subtracting for the date in the western time zones? So the birthdates are off by minus 1.
Any thoughts?
Thanks!
Seth
I have a winforms app that is making asyncronous WebClient calls with a callback procedures as follows...
using (var wc = new WebClient())
{
wc.DownloadFileCompleted += new AsyncCompletedEventHandler(DownloadCompleted);
wc.DownloadProgressChanged+=new DownloadProgressChangedEventHandler(DownloadProgressCallback);
//other stuff
wc.DownloadFileAsync(uri, fullLocalPath);
}
I want to create a global exception handler so I have defined an application event for it...
[STAThread]
static void Main()
{
Application.ThreadException += new ThreadExceptionEventHandler(ApplicationThreadException);
//other stuff
Application.Exit();
}
private static void ApplicationThreadException(object sender, ThreadExceptionEventArgs e)
{
// Do logging or whatever here
Application.Exit();
}
I believe that I am correct that application errors that are raised by the Callback event will not be caught by the Application.ThreadException? So what is the best way of insuring that the callback exceptions are handled?
I have seen on other SO posts that you can also create a handler for AppDomain.CurrentDomain.UnhandledException. Is that the best way to handle the callback exceptions?
I am just looking for best practices when using asyncronous callbacks in a winforms app.
EDIT
Nicholas...thanks for your answer. So can I put the whole callback into a try catch and then do a throw in the catch. Or do I have to explicitly check the AsyncCompletedEventArgs.error property for a non-null value.
If it IS non-null...can you tell me how to cause the callback error to bubble up to my global exception handler?
I think I would do it like this...
private void DownloadCompleted(object sender, AsyncCompletedEventArgs e)
{
if (e.Error != null)
{
throw e.Error;
}
if (DownloadHasCompleted == null) return;
File.Copy(this.RemoteIniFilePath, this.CurrentIniFilePath, true);
DownloadHasCompleted(this, e);
}
Seth