Search Results

Search found 13112 results on 525 pages for 'exception duck'.

Page 69/525 | < Previous Page | 65 66 67 68 69 70 71 72 73 74 75 76  | Next Page >

  • Try/Catch with jquery ajax request

    - by Anthony
    I am trying to build a Google Chrome extension that makes an ajax request. Something similar to the GMail Checker extension. The problem is that when I do the request using jquery, and I put in the wrong username/password, it fails silently, with the error callback function ignored. If I move the ajax call out of the background.html script (where I can't see the requests in the developer window), to the options.html script, I get a dialog box to re-authenticate. If I hit cancel, THEN the jquery error callback fires. But in the original model extension (again, the Gmail checker), they use plain (non-jquery) ajax calls with a try/catch, and if I put in the wrong credentials, I get an alert saying as much. I tried wrapping the entire jquery call in a try/catch, like so: try { $.ajax({ type: "POST", url: someurl, contentType : "text/xml", data: somedata, username: user, password: pass, success: function(data,status,xhr){ alert("Hurrah!"); }, error: function(xhr, status, error){ alert("Error!" + xhr.status); }, dataType: "xml" }); } catch(e) { alert("You messed something up!"); } But still nothing. Is the error due to it being asynchronous, or is Chrome not returning the request as an error since it wants to re-prompt for credentials? Or do I just not know how to use try/catch? Update Here is a very slimmed down version of how the model code does the request: var req = new XMLHttpRequest(); req.onreadystatechange = function() { try { if ( req.readyState == 4 ) { //Do some stuff with results } } catch (ex) { alert('Error parsing response.'); } } try { req.send (data); } catch (ex) { alert ('Something went wrong with the request.'); }

    Read the article

  • Python Glade could not create GladeXML Object

    - by Peter
    Hey, I've created a simple window GUI in Glade 3.6.7 and I am trying to import it into Python. Every time I try to do so I get the following error: (queryrelevanceevaluation.py:8804): libglade-WARNING **: Expected <glade-interface>. Got <interface>. (queryrelevanceevaluation.py:8804): libglade-WARNING **: did not finish in PARSER_FINISH state Traceback (most recent call last): File "queryrelevanceevaluation.py", line 17, in <module> app = QueryRelevanceEvaluationApp() File "queryrelevanceevaluation.py", line 10, in __init__ self.widgets = gtk.glade.XML(gladefile) RuntimeError: could not create GladeXML object My Python Code: #!/usr/bin/env python import gtk import gtk.glade class QueryRelevanceEvaluationApp: def __init__(self): gladefile = "foo.glade" self.widgets = gtk.glade.XML(gladefile) dic = {"on_buttonGenerate_clicked" : self.on_buttonGenerate_clicked} self.widgets.signal_autoconnect(dic) def on_buttonGenerate_clicked(self, widget): print "You clicked the button" app = QueryRelevanceEvaluationApp() gtk.main() And the foo.glade file: <?xml version="1.0"?> <interface> <requires lib="gtk+" version="2.16"/> <!-- interface-naming-policy project-wide --> <object class="GtkWindow" id="windowRelevanceEvaluation"> <property name="visible">True</property> <property name="title" translatable="yes">Query Result Relevance Evaluation</property> <child> <object class="GtkVBox" id="vbox1"> <property name="visible">True</property> <property name="orientation">vertical</property> <child> <object class="GtkHBox" id="hbox2"> <property name="visible">True</property> <child> <object class="GtkLabel" id="labelQuery"> <property name="visible">True</property> <property name="label" translatable="yes">Query:</property> </object> <packing> <property name="expand">False</property> <property name="padding">4</property> <property name="position">0</property> </packing> </child> <child> <object class="GtkEntry" id="entry1"> <property name="visible">True</property> <property name="can_focus">True</property> <property name="invisible_char">&#x25CF;</property> </object> <packing> <property name="padding">4</property> <property name="position">1</property> </packing> </child> </object> <packing> <property name="position">0</property> </packing> </child> <child> <object class="GtkFrame" id="frameSource"> <property name="visible">True</property> <property name="label_xalign">0</property> <child> <object class="GtkAlignment" id="alignment1"> <property name="visible">True</property> <property name="left_padding">12</property> <child> <object class="GtkHButtonBox" id="hbuttonbox1"> <property name="visible">True</property> <child> <object class="GtkRadioButton" id="radiobuttonGoogle"> <property name="label" translatable="yes">Google</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">False</property> <property name="active">True</property> <property name="draw_indicator">True</property> </object> <packing> <property name="expand">False</property> <property name="fill">False</property> <property name="position">0</property> </packing> </child> <child> <object class="GtkRadioButton" id="radiobuttonBing"> <property name="label" translatable="yes">Bing</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">False</property> <property name="active">True</property> <property name="draw_indicator">True</property> </object> <packing> <property name="expand">False</property> <property name="fill">False</property> <property name="position">1</property> </packing> </child> <child> <object class="GtkRadioButton" id="radiobuttonBoden"> <property name="label" translatable="yes">Boden</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">False</property> <property name="active">True</property> <property name="draw_indicator">True</property> </object> <packing> <property name="expand">False</property> <property name="fill">False</property> <property name="position">2</property> </packing> </child> <child> <object class="GtkRadioButton" id="radiobuttonCSV"> <property name="label" translatable="yes">CSV</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">False</property> <property name="active">True</property> <property name="draw_indicator">True</property> </object> <packing> <property name="expand">False</property> <property name="fill">False</property> <property name="position">3</property> </packing> </child> </object> </child> </object> </child> <child type="label"> <object class="GtkLabel" id="labelFrameSource"> <property name="visible">True</property> <property name="label" translatable="yes">&lt;b&gt;Source&lt;/b&gt;</property> <property name="use_markup">True</property> </object> </child> </object> <packing> <property name="position">1</property> </packing> </child> <child> <object class="GtkFrame" id="frame1"> <property name="visible">True</property> <property name="label_xalign">0</property> <child> <object class="GtkHBox" id="hbox3"> <property name="visible">True</property> <child> <object class="GtkLabel" id="labelResults"> <property name="visible">True</property> <property name="label" translatable="yes">Number Results:</property> </object> <packing> <property name="expand">False</property> <property name="position">0</property> </packing> </child> <child> <object class="GtkSpinButton" id="spinbuttonResults"> <property name="visible">True</property> <property name="can_focus">True</property> <property name="invisible_char">&#x25CF;</property> </object> <packing> <property name="padding">4</property> <property name="position">1</property> </packing> </child> </object> </child> <child type="label"> <object class="GtkLabel" id="labelFrameResults"> <property name="visible">True</property> <property name="label" translatable="yes">&lt;b&gt;Results&lt;/b&gt;</property> <property name="use_markup">True</property> </object> </child> </object> <packing> <property name="padding">2</property> <property name="position">2</property> </packing> </child> <child> <object class="GtkButton" id="buttonGenerateResults"> <property name="label" translatable="yes">Generate!</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">True</property> </object> <packing> <property name="position">3</property> </packing> </child> </object> </child> </object> </interface> foo.glade and the above python script are in the same directory, and I have tried using a fully-qualified path but still get the same error (I am certain that the path is correct!). Any ideas? Cheers, Pete

    Read the article

  • ASP.NET MVC stack overflow exception when calling a partial view from master page

    - by quakkels
    Hey there everyone, I'm getting a stack overflow error when I try to call a partial view from the master. The Partial View: <%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl" %> <form action="/members/TestLoginProcess/" method="post"> U: <input type="text" name="mUsername" /><br /> P: <input type="password" name="mHash" /><br /> <button type="submit">Log In</button> </form> The Action in the "Members" controller [ChildActionOnly] public ActionResult TestLogin() { return PartialView(); } Then I call the partial view from the master page: <!--Excerpt from wopr.master--> <%= Html.Action("TestLogin", "Members")%> When I go into debug mode the master page returns this error: {Cannot evaluate expression because the current thread is in a stack overflow state.} I don't understand how this error is getting triggered. any help would be much appreciated!

    Read the article

  • Access Violation Exception when trying to perform WTSVirtualChannelRead

    - by Scott Chamberlain
    I am trying to write a hello world type program for using virtual channels in the windows terminal services client. public partial class Form1 : Form { public Form1() { InitializeComponent(); } IntPtr mHandle = IntPtr.Zero; private void Form1_Load(object sender, EventArgs e) { mHandle = NativeMethods.WTSVirtualChannelOpen(IntPtr.Zero, -1, "TSCRED"); } private void button1_Click(object sender, EventArgs e) { int bufferSize = 1024; byte[] buffer = new byte[bufferSize]; int bytesRead = 0; NativeMethods.WTSVirtualChannelRead(mHandle, 0, buffer, bufferSize, ref bytesRead); if (bytesRead != 0) { MessageBox.Show("Got no Data"); } else { MessageBox.Show("Got data: " + bytesRead); } } protected override void Dispose(bool disposing) { if (mHandle != System.IntPtr.Zero) { NativeMethods.WTSVirtualChannelClose(mHandle); } base.Dispose(disposing); } } internal static class NativeMethods { [DllImport("Wtsapi32.dll")] public static extern IntPtr WTSVirtualChannelOpen(IntPtr server, int sessionId, [MarshalAs(UnmanagedType.LPStr)] string virtualName); [DllImport("Wtsapi32.dll", SetLastError = true)] public static extern bool WTSVirtualChannelRead(IntPtr channelHandle, long timeout, byte[] buffer, int length, ref int bytesReaded); [DllImport("Wtsapi32.dll")] public static extern bool WTSVirtualChannelClose(IntPtr channelHandle); } On NativeMethods.WTSVirtualChannelRead(mHandle, 0, buffer, bufferSize, ref bytesRead); I get the following error every time. System.AccessViolationException was unhandled by user code Message=Attempted to read or write protected memory. This is often an indication that other memory is corrupt. Source=RemoteForm StackTrace: at RemoteForm.NativeMethods.WTSVirtualChannelRead(IntPtr channelHandle, Int64 timeout, Byte[] buffer, Int32 length, Int32& bytesReaded) at RemoteForm.Form1.button1_Click(Object sender, EventArgs e) in E:\Visual Studio 2010\Projects\RemoteForm\Form1.cs:line 31 at System.Windows.Forms.Control.OnClick(EventArgs e) at System.Windows.Forms.Button.OnClick(EventArgs e) at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent) at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks) at System.Windows.Forms.Control.WndProc(Message& m) at System.Windows.Forms.ButtonBase.WndProc(Message& m) at System.Windows.Forms.Button.WndProc(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m) at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) InnerException: I am sending the data from the MSTSC COM object and ActiveX controll. public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { rdp.Server = "schamberlainvm"; rdp.UserName = "TestAcct"; IMsTscNonScriptable secured = (IMsTscNonScriptable)rdp.GetOcx(); secured.ClearTextPassword = "asdf"; rdp.CreateVirtualChannels("TSCRED"); rdp.Connect(); } private void button1_Click(object sender, EventArgs e) { rdp.SendOnVirtualChannel("TSCRED", "This is a test"); } } //Designer code // // rdp // this.rdp.Enabled = true; this.rdp.Location = new System.Drawing.Point(12, 12); this.rdp.Name = "rdp"; this.rdp.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("rdp.OcxState"))); this.rdp.Size = new System.Drawing.Size(1092, 580); this.rdp.TabIndex = 0; Any help on this would be greatly appreciated.

    Read the article

  • Handling two WebException's properly

    - by baron
    Hi Everyone, I am trying to handle two different WebException's properly. Basically they are handled after calling WebClient.DownloadFile(string address, string fileName) AFAIK, so far there are two I have to handle, both WebException's: The remote name could not be resolved (i.e. No network connectivity to access server to download file) (404) File not nound (i.e. the file doesn't exist on the server) There may be more but this is what I've found most important so far. So how should I handle this properly, as they are both WebException's but I want to handle each case above differently. This is what I have so far: try { using (var client = new WebClient()) { client.DownloadFile("..."); } } catch(InvalidOperationException ioEx) { if (ioEx is WebException) { if (ioEx.Message.Contains("404") { //handle 404 } if (ioEx.Message.Contains("remote name could not") { //handle file doesn't exist } } } As you can see I am checking the message to see what type of WebException it is. I would assume there is a better or a more precise way to do this? Thanks

    Read the article

  • java.sql.Exception ClosedConnection

    - by john
    I am getting the following error: java.sql.SQLException: Closed Connection at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112) at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:146) at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:208) at oracle.jdbc.driver.PhysicalConnection.getMetaData(PhysicalConnection.java:1508) at com.ibatis.sqlmap.engine.execution.SqlExecutor.moveToNextResultsSafely(SqlExecutor.java:348) at com.ibatis.sqlmap.engine.execution.SqlExecutor.handleMultipleResults(SqlExecutor.java:320) at com.ibatis.sqlmap.engine.execution.SqlExecutor.executeQueryProcedure(SqlExecutor.java:277) at com.ibatis.sqlmap.engine.mapping.statement.ProcedureStatement.sqlExecuteQuery(ProcedureStatement.java:34) at com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryWithCallback(GeneralStatement.java:173) at com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryForList(GeneralStatement.java:123) at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(SqlMapExecutorDelegate.java:614) at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(SqlMapExecutorDelegate.java:588) at com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.queryForList(SqlMapSessionImpl.java:118) at org.springframework.orm.ibatis.SqlMapClientTemplate$3.doInSqlMapClient(SqlMapClientTemplate.java:268) at org.springframework.orm.ibatis.SqlMapClientTemplate.execute(SqlMapClientTemplate.java:193) at org.springframework.orm.ibatis.SqlMapClientTemplate.executeWithListResult(SqlMapClientTemplate.java:219) at org.springframework.orm.ibatis.SqlMapClientTemplate.queryForList(SqlMapClientTemplate.java:266) at gov.hud.pih.eiv.web.authentication.AuthenticationUserDAO.isPihUserDAO(AuthenticationUserDAO.java:24) at gov.hud.pih.eiv.web.authorization.AuthorizationProxy.isAuthorized(AuthorizationProxy.java:125) at gov.hud.pih.eiv.web.authorization.AuthorizationFilter.doFilter(AuthorizationFilter.java:224) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:246) at I am really stumped and can't figure out what could be causing this error. I am not able to reproduce the error on my machine but on production it is coming a lot of times. I am using iBatis in the whole application so there are no chances of my code not closing connections. We do have stored procedures that run for a long time before they return results (around 15 seconds). does anyone have any ideas on what could be causing this? I dont think raising the # of connections on the application server will fix this issue buecause if connections were running out then we'd see "Error on allocating connections"

    Read the article

  • Exception with Subsonic 2.2, SQLite and Migrations

    - by Holger Amann
    Hi, I'm playing with Migrations and created a simple migration like public class Migration001 : Migration { public override void Up() { TableSchema.Table testTable = CreateTableWithKey("TestTable"); } public override void Down() { } } after executing sonic.exe migrate I'm getting the following output: Setting ConfigPath: 'App.config' Building configuration from c:\tmp\MigrationTest\MigrationTest\App.config Adding connection to SQLiteProvider Found 1 migration files Current DB Version is 0 Migrating to 001_Init (1) There was an error running migration (001_Init): SQLite error near "IDENTITY": syntax error Stack Trace: at System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] argum ents, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner) at System.RuntimeMethodHandle.InvokeMethodFast(Object target, Object[] argume nts, Signature sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwn er) at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invoke Attr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisib ilityChecks) at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invoke Attr, Binder binder, Object[] parameters, CultureInfo culture) at SubSonic.CodeRunner.RunAndExecute(ICodeLanguage lang, String sourceCode, S tring methodName, Object[] parameters) in D:\@SubSonic\SubSonic\SubSonic.Migrati ons\CodeRunner.cs:line 95 at SubSonic.Migrations.Migrator.ExecuteMigrationCode(String migrationFile) in D:\@SubSonic\SubSonic\SubSonic.Migrations\Migrator.cs:line 177 at SubSonic.Migrations.Migrator.Migrate() in D:\@SubSonic\SubSonic\SubSonic.M igrations\Migrator.cs:line 141 Any hints?

    Read the article

  • OutOfMemory exception when loading an image in .Net

    - by Ben
    Hi, Im loading an image from a SQL CE db and then trying to load that into a PictureBox. I am saving the image like this: if (ofd.ShowDialog() == DialogResult.OK) { picArtwork.ImageLocation = ofd.FileName; using (System.IO.FileStream fs = new System.IO.FileStream(ofd.FileName, System.IO.FileMode.Open)) { byte[] imageAsBytes = new byte[fs.Length]; fs.Read(imageAsBytes, 0, imageAsBytes.Length); thisItem.Artwork = imageAsBytes; fs.Close(); } } and then saving to the Db using LINQ To SQL. I load the image back like so: using (FileStream fs = new FileStream(@"C:\Temp\img.jpg", FileMode.CreateNew ,FileAccess.Write )) { byte[] img = (byte[])encoding.GetBytes(ThisFilm.Artwork.ToString()); fs.Write(img, 0, img.Length); } but am getting an OutOfMemoryException. I have read that this is a slight red herring and that there is probably something wrong with the filetype, but i cant figure what. Any ideas? Thanks picArtwork.Image = System.Drawing.Bitmap.FromFile(@"C:\Temp\img.jpg");

    Read the article

  • NLog: Force BufferingTargetWrapper to empty on AppDomain UnhandledException

    - by Superdumbell
    I have NLog configured in my application to to use the BufferingTargetWrapper for sending emails with the MailTarget. The problem I'm running into is I can not find a way to force NLog to empty the BufferingTargetWrapper before the application exits from Unhandled Exceptions. I tried calling LogManager.Flush() and LogManager.DisableLogging() from the Current App Domain's UnhandledException Event but it does not seam to work. What would I need to do to make it send the emails?

    Read the article

  • Windows Service Webbrowser object invalid cast exception error

    - by Sam Youtsey
    Hi all, I'm having a bit of trouble with a Windows Service webbrowser object. It's attempting to load in values of username and password to a site but keeps failing and throwing the following error: System.InvalidCastException: Specified cast is not valid. at System.Windows.Forms.UnsafeNativeMethods.IHTMLDocument2.GetLocation() at System.Windows.Forms.WebBrowser.get_Document() at MyWindowsService.MyDataProcessor.login() The code that I'm using to make this call is: MyWebBrowser.Document.All["Login"].SetAttribute("Value", username); MyWebBrowser.Document.All["Password"].SetAttribute("Value", password); MyWebBrowser.Document.All["submit"].InvokeMember("Click"); Any ideas as to why it keeps failing? Thanks in advance for the help.

    Read the article

  • An unhandled exception of type 'System.StackOverflowException' occurred in mscorlib.dll

    - by mazhar
    Ok the thing is that I am using asp.net mvc with linq to sql. I have a scenario where there are two tables group and features with many to many relationship with the third table groupfeatures. I have drag and drop all three table in the dbml file. The thing is that it runs fine with group but when I call the Feature things the above error occured and the compilers stops at this line in ((())). public partial class EgovtDataContext : System.Data.Linq.DataContext { private static System.Data.Linq.Mapping.MappingSource mappingSource = new AttributeMappingSource(); #region Extensibility Method Definitions partial void OnCreated(); partial void InsertGroup(Group instance); partial void UpdateGroup(Group instance); partial void DeleteGroup(Group instance); partial void InsertFeature(Feature instance); partial void UpdateFeature(Feature instance); partial void DeleteFeature(Feature instance); partial void InsertGroupFeature(GroupFeature instance); partial void UpdateGroupFeature(GroupFeature instance); partial void DeleteGroupFeature(GroupFeature instance); #endregion (((public EgovtDataContext() : base(global::System.Configuration.ConfigurationManager.ConnectionStrings["egovtsConnectionString"].ConnectionString, mappingSource)))) The code in both the controller Group and features file is ditto copied. Note the group things are working, the features things are not. FeaturesRepository.cs public IQueryable<Feature> FindAllFeatures() { return db.Features; } FeaturesController.cs FeaturesRepository FeatureRepository = new FeaturesRepository(); public ActionResult Index() { var Feature = FeatureRepository.FindAllFeatures(); return View(Feature); } So what could be wrong?

    Read the article

  • Help with InvalidCastException

    - by Robert
    I have a gridview and, when a record is double-clicked, I want it to open up a new detail-view form for that particular record. As an example, I have created a Customer class: using System; using System.Data; using System.Configuration; using System.Collections.Generic; using System.ComponentModel; using System.Data.SqlClient; using System.Collections; namespace SyncTest { #region Customer Collection public class CustomerCollection : BindingListView<Customer> { public CustomerCollection() : base() { } public CustomerCollection(List<Customer> customers) : base(customers) { } public CustomerCollection(DataTable dt) { foreach (DataRow oRow in dt.Rows) { Customer c = new Customer(oRow); this.Add(c); } } } #endregion public class Customer : INotifyPropertyChanged, IEditableObject, IDataErrorInfo { private string _CustomerID; private string _CompanyName; private string _ContactName; private string _ContactTitle; private string _OldCustomerID; private string _OldCompanyName; private string _OldContactName; private string _OldContactTitle; private bool _Editing; private string _Error = string.Empty; private EntityStateEnum _EntityState; private Hashtable _PropErrors = new Hashtable(); public event PropertyChangedEventHandler PropertyChanged; private void FirePropertyChangeNotification(string propName) { if (PropertyChanged != null) { PropertyChanged(this, new PropertyChangedEventArgs(propName)); } } public Customer() { this.EntityState = EntityStateEnum.Unchanged; } public Customer(DataRow dr) { //Populates the business object item from a data row this.CustomerID = dr["CustomerID"].ToString(); this.CompanyName = dr["CompanyName"].ToString(); this.ContactName = dr["ContactName"].ToString(); this.ContactTitle = dr["ContactTitle"].ToString(); this.EntityState = EntityStateEnum.Unchanged; } public string CustomerID { get { return _CustomerID; } set { _CustomerID = value; FirePropertyChangeNotification("CustomerID"); } } public string CompanyName { get { return _CompanyName; } set { _CompanyName = value; FirePropertyChangeNotification("CompanyName"); } } public string ContactName { get { return _ContactName; } set { _ContactName = value; FirePropertyChangeNotification("ContactName"); } } public string ContactTitle { get { return _ContactTitle; } set { _ContactTitle = value; FirePropertyChangeNotification("ContactTitle"); } } public Boolean IsDirty { get { return ((this.EntityState != EntityStateEnum.Unchanged) || (this.EntityState != EntityStateEnum.Deleted)); } } public enum EntityStateEnum { Unchanged, Added, Deleted, Modified } void IEditableObject.BeginEdit() { if (!_Editing) { _OldCustomerID = _CustomerID; _OldCompanyName = _CompanyName; _OldContactName = _ContactName; _OldContactTitle = _ContactTitle; } this.EntityState = EntityStateEnum.Modified; _Editing = true; } void IEditableObject.CancelEdit() { if (_Editing) { _CustomerID = _OldCustomerID; _CompanyName = _OldCompanyName; _ContactName = _OldContactName; _ContactTitle = _OldContactTitle; } this.EntityState = EntityStateEnum.Unchanged; _Editing = false; } void IEditableObject.EndEdit() { _Editing = false; } public EntityStateEnum EntityState { get { return _EntityState; } set { _EntityState = value; } } string IDataErrorInfo.Error { get { return _Error; } } string IDataErrorInfo.this[string columnName] { get { return (string)_PropErrors[columnName]; } } private void DataStateChanged(EntityStateEnum dataState, string propertyName) { //Raise the event if (PropertyChanged != null && propertyName != null) { PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); } //If the state is deleted, mark it as deleted if (dataState == EntityStateEnum.Deleted) { this.EntityState = dataState; } if (this.EntityState == EntityStateEnum.Unchanged) { this.EntityState = dataState; } } } } Here is my the code for the double-click event: private void customersDataGridView_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { Customer oCustomer = (Customer)customersBindingSource.CurrencyManager.List[customersBindingSource.CurrencyManager.Position]; CustomerForm oForm = new CustomerForm(); oForm.NewCustomer = oCustomer; oForm.ShowDialog(this); oForm.Dispose(); oForm = null; } Unfortunately, when this code runs, I receive an InvalidCastException error stating "Unable to cast object to type 'System.Data.DataRowView' to type 'SyncTest.Customer'". This error occurs on the very first line of that event: Customer oCustomer = (Customer)customersBindingSource.CurrencyManager.List[customersBindingSource.CurrencyManager.Position]; What am I doing wrong?... and what can I do to fix this? Any help is greatly appreciated. Thanks!

    Read the article

  • Understanding try..catch in Javascript

    - by user295189
    I have this try and catch problem. I am trying to redirect to a different page. But sometimes it does and some times it doesnt. I think the problem is in try and catch . can someone help me understand this. Thanks var pg = new Object(); var da = document.all; var wo = window.opener; pg.changeHideReasonID = function(){ if(pg.hideReasonID.value == 0 && pg.hideReasonID.selectedIndex > 0){ pg.otherReason.style.backgroundColor = "ffffff"; pg.otherReason.disabled = 0; pg.otherReason.focus(); } else { pg.otherReason.style.backgroundColor = "f5f5f5"; pg.otherReason.disabled = 1; } } pg.exit = function(pid){ try { if(window.opener.hideRecordReload){ window.opener.hideRecordReload(pg.recordID, pg.recordTypeID); } else { window.opener.pg.hideRecord(pg.recordID, pg.recordTypeID); } } catch(e) {} try { window.opener.pg.hideEncounter(pg.recordID); } catch(e) {} try { window.opener.pg.hideRecordResponse(pg.hideReasonID.value == 0 ? pg.otherReason.value : pg.hideReasonID.options[pg.hideReasonID.selectedIndex].text); } catch(e) {} try { window.opener.pg.hideRecord_Response(pg.recordID, pg.recordTypeID); } catch(e) {} try { window.opener.pg.hideRecord_Response(pg.recordID, pg.recordTypeID); } catch(e) {} try { window.opener.window.parent.frames[1].pg.loadQualityMeasureRequest(); } catch(e) {} try { window.opener.pg.closeWindow(); } catch(e) {} parent.loadCenter2({reportName:'redirectedpage',patientID:pid}); parent.$.fancybox.close(); } pg.hideRecord = function(){ var pid = this.pid; pg.otherReason.value = pg.otherReason.value.trim(); if(pg.hideReasonID.selectedIndex == 0){ alert("You have not indicated your reason for hiding this record."); pg.hideReasonID.focus(); } else if(pg.hideReasonID.value == 0 && pg.hideReasonID.selectedIndex > 0 && pg.otherReason.value.length < 2){ alert("You have indicated that you wish to enter a reason\nnot on the list, but you have not entered a reason."); pg.otherReason.focus(); } else { pg.workin(1); var n = new Object(); n.noheaders = 1; n.recordID = pg.recordID; n.recordType = pg.recordType; n.recordTypeID = pg.recordTypeID; n.encounterID = request.encounterID; n.hideReasonID = pg.hideReasonID.value; n.hideReason = pg.hideReasonID.value == 0 ? pg.otherReason.value : pg.hideReasonID.options[pg.hideReasonID.selectedIndex].text; Connect.Ajax.Post("/emr/hideRecord/act_hideRecord.php", n, pg.exit(pid)); } } pg.init = function(){ pg.blocker = da.blocker; pg.hourglass = da.hourglass; pg.content = da.pageContent; pg.recordType = da.recordType.value; pg.recordID = parseInt(da.recordID.value); pg.recordTypeID = parseInt(da.recordTypeID.value); pg.information = da.information; pg.hideReasonID = da.hideReasonID; pg.hideReasonID.onchange = pg.changeHideReasonID; pg.hideReasonID.tabIndex = 1; pg.otherReason = da.otherReason; pg.otherReason.tabIndex = 2; pg.otherReason.onblur = function(){ this.value = this.value.trim(); } pg.otherReason.onfocus = function(){ this.select(); } pg.btnCancel = da.btnCancel; pg.btnCancel.tabIndex = 4; pg.btnCancel.title = "Close this window"; pg.btnCancel.onclick = function(){ //window.close(); parent.$.fancybox.close(); } pg.btnHide = da.btnHide; pg.btnHide.tabIndex = 3; pg.btnHide.onclick = pg.hideRecord; pg.btnHide.title = "Hide " + pg.recordType.toLowerCase() + " record"; document.body.onselectstart = function(){ if(event.srcElement.tagName.search(/INPUT|TEXT/i)){ return false; } } pg.workin(0); } pg.workin = function(){ var n = arguments.length ? arguments[0] : 1; pg.content.disabled = pg.hideReasonID.disabled = n; pg.blocker.style.display = pg.hourglass.style.display = n ? "block" : "none"; if(n){ pg.otherReason.disabled = 1; pg.otherReason.style.backgroundColor = "f5f5f5"; } else { pg.otherReason.disabled = !(pg.hideReasonID.value == 0 && pg.hideReasonID.selectedIndex > 0); pg.otherReason.style.backgroundColor = pg.otherReason.disabled ? "f5f5f5" : "ffffff"; pg.hideReasonID.focus(); } }

    Read the article

  • South migration error: NoMigrations exception for django.contrib.auth

    - by danpalmer
    I have been using South on my project for a while, but I recently did a huge amount of development and changed development machine and I think something messed up in the process. The project works fine, but I can't apply migrations. Whenever I try to apply a migration I get the following traceback: danpalmer:pest Dan$ python manage.py migrate frontend Traceback (most recent call last): File "manage.py", line 11, in <module> execute_manager(settings) File "/Library/Python/2.6/site-packages/django/core/management/__init__.py", line 362, in execute_manager utility.execute() File "/Library/Python/2.6/site-packages/django/core/management/__init__.py", line 303, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/Library/Python/2.6/site-packages/django/core/management/base.py", line 195, in run_from_argv self.execute(*args, **options.__dict__) File "/Library/Python/2.6/site-packages/django/core/management/base.py", line 222, in execute output = self.handle(*args, **options) File "/Library/Python/2.6/site-packages/South-0.7-py2.6.egg/south/management/commands/migrate.py", line 102, in handle delete_ghosts = delete_ghosts, File "/Library/Python/2.6/site-packages/South-0.7-py2.6.egg/south/migration/__init__.py", line 182, in migrate_app applied = check_migration_histories(applied, delete_ghosts) File "/Library/Python/2.6/site-packages/South-0.7-py2.6.egg/south/migration/__init__.py", line 85, in check_migration_histories m = h.get_migration() File "/Library/Python/2.6/site-packages/South-0.7-py2.6.egg/south/models.py", line 34, in get_migration return self.get_migrations().migration(self.migration) File "/Library/Python/2.6/site-packages/South-0.7-py2.6.egg/south/models.py", line 31, in get_migrations return Migrations(self.app_name) File "/Library/Python/2.6/site-packages/South-0.7-py2.6.egg/south/migration/base.py", line 60, in __call__ self.instances[app_label] = super(MigrationsMetaclass, self).__call__(app_label_to_app_module(app_label), **kwds) File "/Library/Python/2.6/site-packages/South-0.7-py2.6.egg/south/migration/base.py", line 88, in __init__ self.set_application(application, force_creation, verbose_creation) File "/Library/Python/2.6/site-packages/South-0.7-py2.6.egg/south/migration/base.py", line 159, in set_application raise exceptions.NoMigrations(application) south.exceptions.NoMigrations: Application '<module 'django.contrib.auth' from '/Library/Python/2.6/site-packages/django/contrib/auth/__init__.pyc'>' has no migrations. I am not that experienced with South and I haven't met this error before. The only helpful mention I can find online about this error is for pre-0.7 I think and I am on South 0.7. I ran 'easy_install -U South' just to make sure. Thanks for any help that you can provide. I really appreciate it.

    Read the article

  • Registry in .NET: DeleteSubKeyTree says the subkey does not exists, but hey, it does!

    - by CharlesB
    Hi, Trying to delete a subkey tree: HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.hdr. .hdr subkey has one subkey, no values. So I use this code: RegistryKey FileExts = Registry.CurrentUser.CreateSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\FileExts"); RegistryKey faulty = FileExts.OpenSubKey(".hdr"); Debug.Assert (faulty != null && faulty.SubKeyCount != 0); faulty.Close(); FileExts.DeleteSubKeyTree(".hdr"); And I get the ArgumentException with message "Cannot delete a subkey tree because the subkey does not exist." WTF? I checked and asserted it did exist?

    Read the article

  • Questions regarding ordering of catch statements in catch block - compiler specific or language stan

    - by Andy
    I am currently using Visual Studio Express C++ 2008, and have some questions about catch block ordering. Unfortunately, I could not find the answer on the internet so I am posing these questions to the experts. I notice that unless catch (...) is placed at the end of a catch block, the compilation will fail with error C2311. For example, the following would compile: catch (MyException) { } catch (...) { } while the following would not: catch (...) { } catch (MyException) { } a. Could I ask if this is defined in the C++ language standard, or if this is just the Microsoft compiler being strict? b. Do C# and Java have the same rules as well? c. As an aside, I have also tried making a base class and a derived class, and putting the catch statement for the base class before the catch statement for the derived class. This compiled without problems. Are there no language standards guarding against such practice please?

    Read the article

  • What is weird about wrapping setjmp and longjmp?

    - by Max
    Hello. I am using setjmp and longjmp for the first time, and I ran across an issue that comes about when I wrap setjmp and longjmp. I boiled the code down to the following example: #include <stdio.h> #include <setjmp.h> jmp_buf jb; int mywrap_save() { int i = setjmp(jb); return i; } int mywrap_call() { longjmp(jb, 1); printf("this shouldn't appear\n"); } void example_wrap() { if (mywrap_save() == 0){ printf("wrap: try block\n"); mywrap_call(); } else { printf("wrap: catch block\n"); } } void example_non_wrap() { if (setjmp(jb) == 0){ printf("non_wrap: try block\n"); longjmp(jb, 1); } else { printf("non_wrap: catch block\n"); } } int main() { example_wrap(); example_non_wrap(); } Initially I thought example_wrap() and example_non_wrap() would behave the same. However, the result of running the program (GCC 4.4, Linux): wrap: try block non_wrap: try block non_wrap: catch block If I trace the program in gdb, I see that even though mywrap_save() returns 1, the else branch after returning is oddly ignored. Can anyone explain what is going on?

    Read the article

  • DataTableReader is invalid for current DataTable 'TempTable'

    - by Sk93
    Hi, I'm getting the following error whenever my code creates a DataTableReader from a valid DataTable Object: "DataTableReader is invalid for current DataTable 'TempTable'." The thing is, if I reboot my machine, it works fine for an undertimed amount of time, then dies with the above. The code that throws this error could have been working fine for hours and then: bang. you get this error. It's not limited to one line either; it's every single location that a DataTableReader is used. Also, this error does NOT occur on the production web server - ever. This is an example of one of the lines where it falls over: If I step over this line, I get this: However, if I do this in the immediate window: I get no problems. Same goes if I actually use that line in the code. This has been driving me nuts for the best part of a week, and I've failed to find anything on Google that could help (as I'm pretty positive this isn't a coding issue). Some technical info: DEV Box: Vista 32bit (with all current windows updates) Visual Studio 2008 v9.0.30729.1 SP dotNet Framework 3.5 SP1 SQL Server: Microsoft SQL Server 2005 Standard Edition- 9.00.4035.00 (X64) Windows 2003 64bit (with all current windows updates) Web Server: Windows 2003 64bit (with all current windows updates) any help, ideas, or advice would be greatly appreciated! Cheers, Ian

    Read the article

  • Rendering a control generates security exception in .Net 4

    - by Jason Short
    I am having a problem with code that worked fine in .Net 2 giving this error under .Net 4. Build (web): Inheritance security rules violated while overriding member: 'Controls.RelatedPosts.RenderControl(System.Web.UI.HtmlTextWriter)'. Security accessibility of the overriding method must match the security accessibility of the method being overriden. This is in DotNetBlogEngine. There were several other security demands in the code that .Net 4 didn't seem to like. I followed some of the advice I found on blogs (and here) and got rid of all the other errors. But this one still eludes me. The Main blogengine core dll is not set for security demands anylonger and is compiled for .Net 4 as well. This error is in the website side attempting to use the dll. There are controls that call a RenderControl method taking an HtmlTextWriter. Apparently the text writer now has some soft of security attributes set on it. Each of the controls implements a custom interface ( public interface ICustomFilter ), there are no security permissions present or demands. The site is running full trust on my local dev machine.

    Read the article

  • C# Win Forms Access Violation Exception

    - by Goober
    I keep getting the following error: System.AccessViolationException was unhandled Message="Attempted to read or write protected memory. This is often an indication that other memory is corrupt." Source="FEDivaNET" StackTrace: at Diva.Handles.FEDivaObject.dropReference() at Diva.Handles.FEDivaObject.!FEDivaObject() at Diva.Handles.FEDivaObject.Dispose(Boolean ) at Diva.Handles.FEDivaObject.Finalize() InnerException: Any ideas what the issue could be? - I'm using a library that is written in C++ and isn't designed for multithreading, yet I'm hammering it about 3000 times with requests every 6 minutes. CODE delegate void SetTextCallback(string mxID, string text); public void UpdateLog(string mxID, string text) { //lock (thisLock) //{ if (listBoxProcessLog.InvokeRequired) { SetTextCallback d = new SetTextCallback(UpdateLog); this.BeginInvoke(d, new object[] { mxID, text }); } else { //Get a reference to the datatable assigned as the datasource. //DataTable logDT = (DataTable)listBoxProcessLog.DataSource; //logDT.Rows.Add(DateTime.Now + " - " + mxID + ": " + text); if (text.Contains("COMPLETE") || (text.Contains("FAILED"))) { if (progressBar1.Value <= progressBar1.MaxValue) { progressBar1.Value += 1; } } } //} } Baring in mind that even when the Lock and the DataTable weren't commented out, the error still occurred!

    Read the article

  • exception with Linq to SQL using sdf file

    - by Ben
    Hi, I've set up a project with an SDF local database file and am trying to access it using an LINQ To SQL (".dbml") file. I have used the connection string provided by the sdf file and can instanciate the object with out a problem: thisDataContext = new MyDataContext(GetConnectionString()); However, whenever i try to access any information from it eg var collection = (from MyObject p in thisDataContext.MyTable select p); I get the error - "The table name is not valid. [ Token line number (if known) = 2,Token line offset (if known) = 14,Table name = Person ]" I am using Visual Studio 2008 SP1 .Net 3.5 and SQL 2008 CE. I gather something similar happened for SQL 2005 CE and a Hotfix was released, but i would have thought the fix would have been fixed in this version before release. Does anyone know the fix for this? Thanks

    Read the article

  • Changing the message (or exception) in WPF ValidatesOnException binding

    - by Emad
    I have a WPF application using MVVM. I am using binding to a POCO object. The Textbox is bound to a property in the object like: <TextBox.Text> <Binding Path="CertainProperty" Mode="TwoWay" > <Binding.ValidationRules> <ExceptionValidationRule/> </Binding.ValidationRules> </Binding> </TextBox.Text> Now this property is a a int property and when the user tried to enter a non-numeric value, they get the "input string was not in a correct format". What I need to do is customize this message to a more user friendly one. How can I do that ?

    Read the article

  • Exception while trying to reference LINQ namespace

    - by MarceloRamires
    While trying to use linq in a .NET 2.0 winforms project I got: Namespace or type specified in the Imports 'System.Linq' doesn't contain any public member or cannot be found. Make sure the namespace or the type is defined and contains at least one public member. Make sure the imported element name doesn't use any aliases In both the lines that reference the following namespaces: System.Linq; System.Xml.Linq; How could I get these namespaces to work on .NET 2.0 without referencing an external DLL or anything ?

    Read the article

  • Exception Specification

    - by atch
    Hi, guys I know that this feature will be depracated in c++0x, but for me as a total novice it seems like a good idea to have it. Could anyone explain to me why isn't a good idea? Thanks in advance. P.S. I know I've said it but I'll say it again: formating in this forum really pisses me off. Why can't I have ENTER as end of line but instead of I have to press space twice?

    Read the article

< Previous Page | 65 66 67 68 69 70 71 72 73 74 75 76  | Next Page >