Search Results

Search found 5259 results on 211 pages for 'interrupt handling'.

Page 55/211 | < Previous Page | 51 52 53 54 55 56 57 58 59 60 61 62  | Next Page >

  • error handling in asp.net

    - by user98454
    Hi How can i pass the different types of errors from Data access layer to presentation layer? suppose if we take the northwind database scenario I want to delete the customer, so i selected one customer in ui and clicked the "delete" button.It internally calls the "delete" in data access layer. The prerequisite for deleting the customer is that the customer doesn't have any orders.So in data access layer we wil check whether that customer has any orders.If the customer has orders how can we pass the message from dal to presentation layer that the customer has orders and we don't delete. Am i doing right?is there any other ways to deal with this type? Thanks in advance

    Read the article

  • Handling close-to-impossible collisions on should-be-unique values

    - by balpha
    There are many systems that depend on the uniqueness of some particular value. Anything that uses GUIDs comes to mind (eg. the Windows registry or other databases), but also things that create a hash from an object to identify it and thus need this hash to be unique. A hash table usually doesn't mind if two objects have the same hash because the hashing is just used to break down the objects into categories, so that on lookup, not all objects in the table, but only those objects in the same category (bucket) have to be compared for identity to the searched object. Other implementations however (seem to) depend on the uniqueness. My example (that's what lead me to asking this) is Mercurial's revision IDs. An entry on the Mercurial mailing list correctly states The odds of the changeset hash colliding by accident in your first billion commits is basically zero. But we will notice if it happens. And you'll get to be famous as the guy who broke SHA1 by accident. But even the tiniest probability doesn't mean impossible. Now, I don't want an explanation of why it's totally okay to rely on the uniqueness (this has been discussed here for example). This is very clear to me. Rather, I'd like to know (maybe by means of examples from your own work): Are there any best practices as to covering these improbable cases anyway? Should they be ignored, because it's more likely that particularly strong solar winds lead to faulty hard disk reads? Should they at least be tested for, if only to fail with a "I give up, you have done the impossible" message to the user? Or should even these cases get handled gracefully? For me, especially the following are interesting, although they are somewhat touchy-feely: If you don't handle these cases, what do you do against gut feelings that don't listen to probabilities? If you do handle them, how do you justify this work (to yourself and others), considering there are more probable cases you don't handle, like a supernonva?

    Read the article

  • Handling Corrupted JPEGs in C#

    - by ddango
    We have a process that pulls images from a remote server. Most of the time, we're good to go, the images are valid, we don't timeout, etc. However, every once and awhile we see this error similar to this: Unhandled Exception: System.Runtime.InteropServices.ExternalException: A generic error occurred in GDI+. at System.Drawing.Image.Save(Stream stream, ImageCodecInfo encoder, EncoderPa rameters encoderParams) at ConsoleApplication1.Program.Main(String[] args) in C:\images\ConsoleApplic ation1\ConsoleApplication1\Program.cs:line 24 After not being able to reproduce it locally, we looked closer at the image, and realized that there were artifacts, making us suspect corruption. Created an ugly little unit test with only the image in question, and was unable to reproduce the error on Windows 7 as was expected. But after running our unit test on Windows Server 2008, we see this error every time. Is there a way to specify non-strictness for jpegs when writing them? Some sort of check/fix we can use? Unit test snippet: var r = ReadFile("C:\\images\\ConsoleApplication1\\test.jpg"); using (var imgStream = new MemoryStream(r)) { using (var ms = new MemoryStream()) { var guid = Guid.NewGuid(); var fileName = "C:\\images\\ConsoleApplication1\\t" + guid + ".jpg"; Image.FromStream(imgStream).Save(ms, ImageFormat.Jpeg); using (FileStream fs = File.Create(fileName)) { fs.Write(ms.GetBuffer(), 0, ms.GetBuffer().Length); } } }

    Read the article

  • better way of handling nested list

    - by laspal
    Hi, I have list my_list = [ [1,2,3,4,5,6], [1,3,4],[34,56,56,56]] for item in my_list: var1,var2,var3,var4,var5,var6 = None if len(item) ==1: var1 = item[0] if len(item) == 2: var1 = item[0] var2 = item[1] if len(item) == 3: var1 = item[0] var2 = item[1] var3 = item[2] if len(item) == 4: var1 = item[0] var2 = item[1] var3 = item[2] var4 = item[3] fun(var1,var2,var3,var4,var5,var6) I have a function def fun(var1, var2 = None, var3 = None, var4 = None, var5=None, var6= None) Depending upon the values in my inner list. I am passing it to function. I hope I made it clear. Thanks

    Read the article

  • Proper handling of confirmation page in PHP

    - by wnoveno
    Hi, I have a sign up page written in php, that goes to a confirmation page after processing. In the confirmation/ thank you page there is a 3rd party script that counts the number of successful registrants. how would I limit the script to be loaded per successful registration?

    Read the article

  • problem in handling menu - submenu based on spring security

    - by Nirmal
    Hi All... I have configured spring security core plugin using requestmap table inside the database.. Now inside requestmap table I have all the possible urls and it's equivalent roles who can access that url... Now I want to generate menus and submenus based on the urls stored in requestmap table... So my requirement is to check the urls of menu & submenus against the logged in users privileges... And if logged in user has any one privilege then I need to display that main menu and the available submenus.... For e.g. I have a menu in my project called user which has a following submenus : **Users (main menu)** Manage Users (sub menu) Import Users (sub menu) Now inside my header.gsp I have successfully achieved the above requirement using if else condition, like : if ( privs.contains("/users/manageUsers") || privs.contains("/users/importUsers")) here privs are the list of urls from requestmap table for logged in user. But I want to achieve these using spring security tag lib, so for comparing urls I have find following tag from spring security core documentation : <sec:access url="/users/manageUsers"> But i am bit confuse that how I can replace or condition using tag library.. Is there any tag available which checks from multiple urls and evaluate it to true or false ? Of course I can do using sec:access tag with some flag logic, but is there any tags available which can fulfill my requirement directly ? Thanks in advance...

    Read the article

  • Manipulating a NSTextField via AppleScript

    - by Garry
    A little side project I'm working on is a digital life assistant, much like project JARVIS. What I'm trying to do is speak to my mac, have my words translated to text and then have the text interpreted by my program. Currently, my app is very simple, consisting of a single window containing a single wrapped NSTextView. Using MacSpeech Dictate, When I say the custom command "Jeeves", MacSpeech ensures that my app is frontmost, highlights any text in the TextField and clears it, then presses the Return key to trigger the textDidEndEditing method of NSTextField. This is done via Applescript. MacSpeech then switches to dictation mode and the next sentence I say will appear in the NSTextField. What I can't figure out is how to signify that I have finished saying a command to my program. I could simply say another keyword like "execute" or something similar that would send an AppleScript return keystroke to my app (thereby triggering the textDidEndEditing event) but this is cumbersome. Is there a notification that happens when text is pasted into a NSTextField? Would a timer work that would fire after maybe three seconds once my program becomes frontmost (three seconds should be sufficient for me to say a command)? Thanks,

    Read the article

  • handling activity destruction in multithreaded android app

    - by Jayesh
    Hi, I have a multithreded app where background threads are used to load data over network or from disk/db. Every once in a while user will perform some action e.g. fetch news over network, which will spawn a background AsyncTask, but for some reason user will quit the app (press back button so that activity gets destroyed). In most such scenarios, I make appropriate checks in the background thread after it returns from n/w i/o, so that it won't crash by accessing members of the activity that is destroyed by now. However some corner cases are left where crashes happen, because the background thread would access some member of activity that is now null. Do other Android developers have some generic/recommended framework to handle such scenarios? These are the times when I wish android would have guaranteed termination of all threads when activity destroys (in the same way that regular linux process cleans up when it's quit)... but I guess Android devs had good reasons for not exposing process lifetimes through the api.

    Read the article

  • Javascript handling textarea

    - by bbenton
    Hi all, I'm a bit new to Javascript and am trying to create a delimited string from a textare. The problem is when passing in the textarea, it adds newlines for each row on the textarea. I need to have the entire textarea parsed into a string with a delimiter for each line (replacing the newline char). So for example, if you passed in a textarea with the following lines (which is also how it looks when using the alert function): abcd efgh ijkl It would look like: abcd-efgh-ijkl after parsing. function submitToForm(form) { var param_textarea = form.listofplugins.value; var test = param_textarea.replace(/\\r?\\n/, /:/) alert(test); } Thanks a lot!

    Read the article

  • web service exception handling

    - by Jack
    I have a WebMethod that recevives following types of parameters: [WebMethod] User(long userid,int number) When Client send parameter with different types, I have to catch this error and write to database etc.. How can I solve this? Thanks.

    Read the article

  • Handling hundreds of dependencies with ant

    - by Roberto
    Hi guys, I have to refactor an ant xml file. Basicly I have one big task that checkouts (using cvs) a lot of dependencies, build them, and then copy all the jar/wsdl generated by building them to a directory that I specify. If one dependency version changes, I have to change the name in at least 3 places on the xml file (cvs checkout, build, copy). What I'd like to have is just a single place where I can specify my dependencies name, without having to search & replace the dependency name through the code. One of the problems is that the cvs project could be /path1/path2/project with tag=v12 but then the jars generated by the single project build could be several with different names, so it seems to be a bit complicated. Do you have any idea on how I can get this done?

    Read the article

  • How can I intercept an exception occurred during serialization in WCF?

    - by bonomo
    I have a legit data object with all data contract / data member attributes. For some reason the WCF service crashes after the operation has completed and the result is passed as a return value. I believe it has something to do with WCF not being able to serialize that result properly. The test client doesn't say anything specific: The underlying connection was closed: The connection was closed unexpectedly. Server stack trace: at System.ServiceModel.Channels.HttpChannelUtilities.ProcessGetResponseWebException(WebException webException, HttpWebRequest request, HttpAbortReason abortReason) at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout) at System.ServiceModel.Channels.RequestChannel.Request(Message message, TimeSpan timeout) at System.ServiceModel.Dispatcher.RequestChannelBinder.Request(Message message, TimeSpan timeout) at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout) at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation) at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message) Exception rethrown at [0]: at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg) at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type) at IFacade.PickSecurities(String pattern, Int32 atMost) at FacadeClient.PickSecurities(String pattern, Int32 atMost) Inner Exception: The underlying connection was closed: The connection was closed unexpectedly. at System.Net.HttpWebRequest.GetResponse() at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout) I am in control of creating the instance of the service using a customized service host factory. I know I can set up trace listeners and check the logs, but it's a lot of hassle to do. So I would rather handle it explicitly on the server at the time it happens. So I how can I intercept that exception programmatically and return an appropriate fault meassage?

    Read the article

  • Google JavaScript CAPTCHA handling

    - by Sam
    I am using Google API's to provide maps on a web page, however, Google frequently prompts for a CAPTCHA (I only know this from going into Firebug, users just get a JavaScript error) for requests for its javascript API's (e.g. http://maps.google.co.uk/maps?file=api&v=2&key=xxxx). However, this prevents visitors from our network (a very large (UK wide) WAN) using Google Maps etc from using these sites with it on. This is likely due to the fact the IP is shared by many people, so Google sees it as spam. I don't see any way of contacting Google about this, so was wondering if there is any way of intercepting these failing JavaScript requests since they return a 403 status code? Perhaps by opening a new window, although that would not be user friendly (they will see the JavaScript after the CAPTCHA, so would be a cause of confusion and would need to refresh the page in question).

    Read the article

  • Is there a browser-agnostic way to detect client-side script errors with Watin?

    - by Michael
    We're using WatiN to test our web portals. During the course of an E2E test, we'll occasionally see client-side script errors on the IE status bar. I'd like to chain a handler onto the script error event and record the error for later analysis and bug filing. Problem is, I don't know that there's a global script error event or how to chain into it. And if there's not a browser-agnostic way to accomplish this, I can create MyIE and MyFF subclasses but then this becomes two browser-specific questions. In essence, I'm thinking of something like this entirely made-up call: browser.ScriptEngine.SetCustomErrorHandler(LogScriptingError); ... where LogScriptErrors is my code that does the obvious. Many of our client-side scripting errors don't necessarily prevent the test from continuing (a pretty UI element didn't animate, for example, but the underlying form is still submittable), so I'd like to log the error and forge ahead in most cases.

    Read the article

  • What exactly does it mean when $_FILES is empty?

    - by Mike
    I am working on an upload script and when testing my error checks, I attempted to upload a 17MB TIFF file. When I do this the $_FILES array is empty. The script works fine for what I need it to do, which is to upload JPEG files. My solution is to test if $_FILES is empty or not before continuing with the upload script. Can anybody explain why $_FILES is empty when a TIFF is attempted to be uploaded? Is my solution, to check if $_FILES is empty or not, an okay one?

    Read the article

  • ASP.Net Treeview - Client side event handling (jQuery??)

    - by The Great Gonzo
    I have a Treeview (bog standard ASP.Net Treeview) that is bound to an Xml source which allows the user to navigate to various parts of our system. Nothing special.... However, I wanted to generate a breadcrumb for use in the main content area on the client side when the user clicks a node in the Treeview control. I know there are mechanisms available for breadcrumb generation (such as site maps) but for various reasons I need to do it when a node is clicked. So far hooking up a click event using the document ready function available as part of jQuery is easy. However, having spent sometime looking I can not see how I navigate back up the tree nodes to get to each parent nodes text value to build the breadcrumb. I have been playing with .parent(), .parents() and .closest() available via jQuery but don't seem to be getting anywhere. Has anyone done anything like this or can anyone provide a better method? Thanks in advance....

    Read the article

  • Strange problem with Random Access Filing in C++

    - by sam
    This is a simple random access filing program . The problem arises where i want to write data randomly. If I write any where in the file the previous records are set to 0. the last 1 which is being entered currently holds the correct value all others =0. This is the code #include <iostream> #include<fstream> #include<string> using namespace std; class name { int id; int pass; public: void writeBlank(); void writedata(); void readdata(); void readall(); int getid() { return id; } int getpass() { return pass; } void setid(int i) { id=i; } void setpass(int p) { pass=p; } }; void name::writeBlank() { name person; person.setid(0); person.setpass(0); int i; ofstream out("pass.txt",ios::binary); if ( !out ) { cout << "File could not be opened." << endl; } for(i=0;i<10;i++) //make 10 records { cout<<"Put pointer is at: "<<out.tellp()<<endl; cout<<"Blank record "<<i<<" is: "<<person.getid()<<" "<<person.getpass()<<" and size: "<<sizeof(person)<<endl; cout<<"Put pointer is at: "<<out.tellp()<<endl; out.write(reinterpret_cast< const char * >(&person),sizeof(name)); } } void name::writedata() { ofstream out("pass.txt",ios::binary|ios::out); name n1; int iD,p; cout<<"ID?"; cin>>iD; n1.setid(iD); cout<<"Enter password"; cin>>p; n1.setpass(p); if (!out ) { cout << "File could not be opened." << endl; } out.seekp((n1.getid()-1)*sizeof(name),ios::beg); //pointer moves to desired location where we have to store password according to its ID(index) cout<<"File pointer is at: "<<out.tellp()<<endl; out.write(reinterpret_cast<const char*> (&n1), sizeof(name)); //write on that pointed location } void name::readall() { name n1; ifstream in("pass.txt",ios::binary); if ( !in ) { cout << "File could not be opened." << endl; } in.read( reinterpret_cast<char *>(&n1), sizeof(name) ); while ( !in.eof() ) { // display record cout<<endl<<"password at this index is:"<<n1.getpass()<<endl; cout<<"File pointer is at: "<<in.tellg()<<endl; // read next from file in.read( reinterpret_cast< char * >(&n1), sizeof(name)); } // end while } void name::readdata() { ifstream in("pass.txt",ios::binary); if ( !in ) { cout << "File could not be opened." << endl; } in.seekg((getid()-1)*sizeof(name)); //pointer moves to desired location where we have to read password according to its ID(index) cout<<"File pointer is at: "<<in.tellg()<<endl; in.read((char* )this,sizeof(name)); //reads from that pointed location cout<<endl<<"password at this index is:"<<getpass()<<endl; } int main() { name n1; cout<<"Enter 0 to write blank records"<<endl; cout<<"Enter 1 for new account"<<endl; cout<<"Enter 2 to login"<<endl; cout<<"Enter 3 to read all"<<endl; cout<<"Enter 9 to exit"<<endl; int option; cin>>option; while(option==0 || option==1 || option==2 || option==3) { if (option == 0) n1.writeBlank(); if(option==1) { /*int iD,p; cout<<"ID?"; cin>>iD; n1.setid(iD); cout<<"Enter password"; cin>>p; n1.setpass(p);*/ n1.writedata(); } int ind; if(option==2) { cout<<"Index?"; cin>>ind; n1.setid(ind); n1.readdata(); } if(option == 3) n1.readall(); cout<<"Enter 0 to write blank records"<<endl; cout<<"Enter 1 for new account"<<endl; cout<<"Enter 2 to login"<<endl; cout<<"Enter 3 to read all"<<endl; cout<<"Enter 9 to exit"<<endl; cin>>option; } } I Cant understand Y the previous records turn 0.

    Read the article

  • Error debugging - Conversion from String to Double

    - by Jamie Taylor
    I'm doing some error debugging trying to get the errors on our website down to a minimum and there seems to be an error that is popping up quite a lot Conversion from string "" to type 'Double' is not valid. I'm unable to replicate this problem but I can see that it is happening. I've been looking through the code in one of the pages and strolled across this Dim varWeek As String If varWeek < 10 Then 'Do something' End If Could this be causing the problem as it is trying to see if a String is less than 10 which is an Integer? As I said before as I am unable to see this error in the first place so changing this to an Integer doesn't change anything on my system. Thanks.

    Read the article

  • In a client-server relationship, should the server always rethrow the exception to the client?

    - by dotnetdev
    I have a set of web services (the server), and an app which consumes this (client). In this sort of relationship, should the server always throw exceptions (ie in the throw block, rethrow the caught exception), and the client catch this. Exceptions which the server can handle, it will deal with and not rethrow, but everything else will be thrown to the calling layer for further action (the consuming app can raise a msg box or whatever). Is this a good example of an exception that can be dealt with: A file cannot be written because the directory requires special privileges, so if this raises an exception, the file is written somewhere which does not require admin rights. Thanks

    Read the article

  • Replacing objects, handling clones, dealing with write logs

    - by Alix
    Hi everyone, I'm dealing with a problem I can't figure out how to solve, and I'd love to hear some suggestions. [NOTE: I realise I'm asking several questions; however, answers need to take into account all of the issues, so I cannot split this into several questions] Here's the deal: I'm implementing a system that underlies user applications and that protect shared objects from concurrent accesses. The application programmer (whose application will run on top of my system) defines such shared objects like this: public class MyAtomicObject { // These are just examples of fields you may want to have in your class. public virtual int x { get; set; } public virtual List<int> list { get; set; } public virtual MyClassA objA { get; set; } public virtual MyClassB objB { get; set; } } As you can see they declare the fields of their class as auto-generated properties (auto-generated means they don't need to implement get and set). This is so that I can go in and extend their class and implement each get and set myself in order to handle possible concurrent accesses, etc. This is all well and good, but now it starts to get ugly: the application threads run transactions, like this: The thread signals it's starting a transaction. This means we now need to monitor its accesses to the fields of the atomic objects. The thread runs its code, possibly accessing fields for reading or writing. If there are accesses for writing, we'll hide them from the other transactions (other threads), and only make them visible in step 3. This is because the transaction may fail and have to roll back (undo) its updates, and in that case we don't want other threads to see its "dirty" data. The thread signals it wants to commit the transaction. If the commit is successful, the updates it made will now become visible to everyone else. Otherwise, the transaction will abort, the updates will remain invisible, and no one will ever know the transaction was there. So basically the concept of transaction is a series of accesses that appear to have happened atomically, that is, all at the same time, in the same instant, which would be the moment of successful commit. (This is as opposed to its updates becoming visible as it makes them) In order to hide the write accesses in step 2, I clone the accessed field (let's say it's the field list) and put it in the transaction's write log. After that, any time the transaction accesses list, it will actually be accessing the clone in its write log, and not the global copy everyone else sees. Like this, any changes it makes will be done to the (invisible) clone, not to the global copy. If in step 3 the commit is successful, the transaction should replace the global copy with the updated list it has in its write log, and then the changes become visible for everyone else at once. It would be something like this: myAtomicObject.list = updatedCloneOfListInTheWriteLog; Problem #1: possible references to the list. Let's say someone puts a reference to the global list in a dictionary. When I do... myAtomicObject.list = updatedCloneOfListInTheWriteLog; ...I'm just replacing the reference in the field list, but not the real object (I'm not overwriting the data), so in the dictionary we'll still have a reference to the old version of the list. A possible solution would be to overwrite the data (in the case of a list, empty the global list and add all the elements of the clone). More generically, I would need to copy the fields of one list to the other. I can do this with reflection, but that's not very pretty. Is there any other way to do it? Problem #2: even if problem #1 is solved, I still have a similar problem with the clone: the application programmer doesn't know I'm giving him a clone and not the global copy. What if he puts the clone in a dictionary? Then at commit there will be some references to the global copy and some to the clone, when in truth they should all point to the same object. I thought about providing a wrapper object that contains both the cloned list and a pointer to the global copy, but the programmer doesn't know about this wrapper, so they're not going to use the pointer at all. The wrapper would be like this: public class Wrapper<T> : T { // This would be the pointer to the global copy. The local data is contained in whatever fields the wrapper inherits from T. private T thisPtr; } I do need this wrapper for comparisons: if I have a dictionary that has an entry with the global copy as key, if I look it up with the clone, like this: dictionary[updatedCloneOfListInTheWriteLog] I need it to return the entry, that is, to think that updatedCloneOfListInTheWriteLog and the global copy are the same thing. For this, I can just override Equals, GetHashCode, operator== and operator!=, no problem. However I still don't know how to solve the case in which the programmer unknowingly inserts a reference to the clone in a dictionary. Problem #3: the wrapper must extend the class of the object it wraps (if it's wrapping MyClassA, it must extend MyClassA) so that it's accepted wherever an object of that class (MyClass) would be accepted. However, that class (MyClassA) may be final. This is pretty horrible :$. Any suggestions? I don't need to use a wrapper, anything you can think of is fine. What I cannot change is the write log (I need to have a write log) and the fact that the programmer doesn't know about the clone. I hope I've made some sense. Feel free to ask for more info if something needs some clearing up. Thanks so much!

    Read the article

  • Better way to ignore exception type: multiple catch block vs. type querying

    - by HuBeZa
    There are situations that we like to ignore a specific exception type (commonly ObjectDisposedException). It can be achieved with those two methods: try { // code that throws error here: } catch (SpecificException) { /*ignore this*/ } catch (Exception ex) { // Handle exception, write to log... } or try { // code that throws error here: } catch (Exception ex) { if (ex is SpecificException) { /*ignore this*/ } else { // Handle exception, write to log... } } What are the pros and cons of this two methods (regarding performance, readability, etc.)?

    Read the article

< Previous Page | 51 52 53 54 55 56 57 58 59 60 61 62  | Next Page >