Search Results

Search found 36003 results on 1441 pages for 'try catch'.

Page 81/1441 | < Previous Page | 77 78 79 80 81 82 83 84 85 86 87 88  | Next Page >

  • SQl Server: serializable level not working

    - by Zé Carlos
    I have the following SP: CREATE PROCEDURE [dbo].[sp_LockReader] AS BEGIN SET NOCOUNT ON; begin try set transaction isolation level serializable begin tran select * from teste commit tran end try begin catch rollback tran set transaction isolation level READ COMMITTED end catch set transaction isolation level READ COMMITTED END The table "test" has many values, so "select * from teste" takes several seconds. I run the sp_LockReader at same time in two diferent query windows and the second one starts showing test table contents without the first one terminates. Shouldn't serializeble level forces the second query to wait? How do i get the described behaviour? Thanks

    Read the article

  • Inserting records in Mysql with INSERT IGNORE and NULL values

    - by Homer1980ar
    I have a partitioned table InnoDB with several fields. I'm trying to avoid duplicates on insert. Let's say: Field1 int null Field2 int null Field3 int null Field4 int null Field5 int null I have created a UNIQUE index on those fields. I try to insert some records with NULL values and then try to reinsert them with IGNORE feature on MySql. Unfortunately it seems to replicated the records when using NULL values. If I try with zeros instead of NULL cases everything works, but I do need the nulls there. Any idea? Thanks, Leonardo

    Read the article

  • ...may not be used in this context...while serialization

    - by phenevo
    Hi, I've webservice and WebMethod [webMethod] public object GetObjects(Cars[] cars) { return Translator.ToObjects(Facade.GetObjects(cars); } public static object GetObjects(Cars cars) { List<Car> cars =new List<Country(...fillingcollection) return cars.ToArray(), } public static object ToObjects(object collection) { if(collection is Car[]) { return ConvertModelCarsToContractCars(collection), } public ModelCar[] ConvertModelCarsToContractCars(Cars[] collection) { ...there is rewriting pool... } And I get exception at side of client: There was an error generating the XML document. I'm using this function to check collection which I would send to the client and it works, doesn't return exceptions: public static void SerializeContainer(object obj) { try { // Make sure even the construsctor runs inside a // try-catch block XmlSerializer ser = new XmlSerializer(typeof(object)); TextWriter w = new StreamWriter(@"c:\list.xml"); ser.Serialize(w, obj); w.Close(); } catch (Exception ex) { DumpException(ex); } } Interesting is when collection has only One element [webmethod] works fine, but when is more it brokes

    Read the article

  • JavaMe Bluetooth service registration

    - by NoGlue
    Hello, I am trying to develope an application that offers a service via bluetooth. Everything works fine in the emulator but as soon I install it on a real device (6120/X6 Nokia) the service cannot be found. If I search for already registered services such as OBEX they are found. So I think it has something to do with the registration. This is how I register the service, all of this happens in its own thread. try { LocalDevice.getLocalDevice().setDiscoverable(DiscoveryAgent.GIAC); } catch (BluetoothStateException e) { } try { notifier = (StreamConnectionNotifier) Connector.open(m_url); ServiceRecord sr = local.getRecord(notifier); StreamConnection conn = notifier.acceptAndOpen(); } catch (IOException e) { } And this is what m_url looks like: "btspp://localhost:" + 0x1116 + ";name=BlueMatch"; Thanks for your time. Best regards

    Read the article

  • Android HTTP Connection

    - by Ubersoldat
    Can anybody tell my why this doesn't work in the Android emulator? From the browser I have access and the server is internal. All I can think of is that I'm missing some configuration on my app so it can access the network layer. try { InetAddress server = Inet4Address.getByName("thehost"); //Doesn't work either //or InetAddress server2 = Inet4Address.getByAddress(new String("192.168.1.30").getBytes()); if(server.isReachable(5000)){ Log.d(TAG, "Ping!"); } Socket clientsocket = new Socket(server, 8080); } catch (UnknownHostException e) { Log.e(TAG, "Server Not Found"); } catch (IOException e) { Log.e(TAG, "Couldn't open socket"); } Throws an UnknownHostException Thanks

    Read the article

  • ASP.NET MVC2 - specific fields in form pass via a specific object?

    - by ile
    In database I have Contacts table: ContactID (int) FirstName (varchar) LastName (varchar) ... XmlFields (xml) // This field is xml type To create a new contact, I created two classes - one for regular fields and other to display fields from XmlFields field. In Controller, I have following: public ActionResult Create(Contact contact, FormCollection collection) ... Regular field I catch with contact object and those that need to be stored as xml in XmlFields I try to catch with collection object. Problem is that collection object catches all fields, so I wonder if it is possible to isolate xml fields when posting to a specific object so that I can easily manipulate with them. I need this in separated objects because these xml fields are going to be generated dynamically and will be different for every user. Thanks in advance, Ile

    Read the article

  • Why can I not print from Google Chrome?

    - by David Faux
    When I try to print any page from Chrome on my Windows 7 machine, I get the following message. click to enlarge By the way, the gray text in the middle reads Google Chrome cannot show the print preview when the built-in PDF viewer is disabled. In order to see the preview please visit chrome//plugins/, enable the Chrome PDF Viewer, and try again. When I check my plugins, I find that Chrome PDF Viewer is already enabled. Why can't I print?

    Read the article

  • In Java, does return trump finally?

    - by jonny five
    If I have a try/catch block with returns inside it, will the finally block be called? For example: try { something(); return success; } catch (Exception e) { return failure; } finally { System.out.println "i don't know if this will get printed out." } I know I can just type this in an see what happens (which is what I'm about to do, actually) but when I googled for answers nothing came up, so I figured I'd throw this up as a question. Thanks!

    Read the article

  • PHP: Ajax ignores line foldings in the text

    - by ilnur777
    I don't understand why my AJAX script ignores all line foldings. I first type text to the textarea and then put onclick to send button. Here is my AJAX realization: // creating ajax object // ==================== function createRequestObject(){ try { return new XMLHttpRequest() } catch(e) { try { return new ActiveXObject('Msxml2.XMLHTTP') } catch(e) { try { return new ActiveXObject('Microsoft.XMLHTTP') } catch(e) { return null; } } } } // message options (save, cancel) // ============================== function form1(text){ var http = createRequestObject(); if(http){ http.open("GET", "my_script.php?text=" + text); http.onreadystatechange = function (){ if(http.readyState == 4){ alert("Ok!"); } } http.send(null); } else { document.location = "my_script.php?text=" + text; } } html form <p align="justify" style="margin-right:10; margin-left:10;"> <table style="margin-right:10; margin-left:10;" align="center" border="0" cellpadding="0" cellspacing="0" width="680"> <TBODY> <form name="fgform"> <tr> <td width="680" height="100" colspan="2"><p><textarea id="edit_text1" name="edit_text" rows="3" style="width: 680; height: 100;"></textarea></p></td> </tr> <tr> <td width="340"><p><input type="button" id="saveB" value="Save Text" style="color:rgb(0,204,0); background-color:white; border-width:1; border-color:rgb(225,218,202); border-style:solid; width:100;" onclick="form1(document.getElementById('edit_text1').value);"></p></td> <td width="340"><p align="right">&nbsp;</p></td> </tr> </form> </TBODY> </table>

    Read the article

  • Inline assembler getaddress of pointer Visual Studio

    - by Joe
    I have a function in VS where I pass a pointer to the function. I then want to store the pointer in a register to further manipulate. How do you do that? I have tried void f(*p) { __asm mov eax, p // try one FAIL __asm mov eax, [p] // try two FAIL __asm mov eax, &p // try three FAIL } Both 1 and 2 are converted to the same code and load the value pointed to. I just want the address. Oddly, option 1 works just fine with integers. void f() { int i = 5; __asm mov eax, i // SUCCESS? }

    Read the article

  • What coding standards do you follow?

    - by Mark Szymanski
    I was just curious what coding standards people followed. I for one use the following: Brackets ALWAYS go on the next line. For instance: int main() { //Blah... } I never use code folding. (Yes my IDE's do support it (Xcode and Eclipse). Put related functions/methods single-spaced, otherwise double space. Here is an example: int foo = 0; printf("%d",foo); those are related while these are not: printf("Hello, World!"); return(0); I don't put else statements on the same line as the closing bracket for the preceding if statement. Most of the time in Java if a program needs multiple try catch statements I will just put the whole thing in one try catch.

    Read the article

  • USB mouse shuts down the laptop!

    - by Ryan
    For the past two days, whenever I plug in my USB mouse (which has been working for a long time, previously) into the laptop, my computer restarts! I tried changing mice, but the same thing happens. I have 3 ports, usually, I try one port and the laser does not come on, then I try another one and the laser comes and and off, then I again take out and put it in any port and the damn thing just turns off the computer. Specs: Windows 7 Ultimate 64-bit, 4GB RAM, Fujitsu 532ah i5 laptop

    Read the article

  • IO Exception on invoking execute() method of HttpGet class

    - by AndroidNoob
    Why I'm getting IOException in this peace of code? Thanks. HttpClient httpclient = new DefaultHttpClient(); HttpGet httpget = new HttpGet("http://www.google.com/"); HttpResponse response; try { response = httpclient.execute(httpget); } catch (ClientProtocolException e) { Toast.makeText(this, "ClientProtocolEx", Toast.LENGTH_LONG).show(); e.printStackTrace(); } catch (IOException e) { Toast.makeText(this, "IOEx", Toast.LENGTH_LONG).show(); e.printStackTrace(); }

    Read the article

  • Ajax doesn't work on remote server .

    - by Nuha
    Hello . when I Implemented chatting Function , I use Ajax to send messages between file to another . so , it is working well on local host . but , when I upload it in to remote server it doesn't work. can U tell me ,why ? is an Ajax need Special configuration ? Ajax code : function Ajax_Send(GP,URL,PARAMETERS,RESPONSEFUNCTION){? var xmlhttp? try{xmlhttp=new ActiveXObject("Msxml2.XMLHTTP")}? catch(e){? try{xmlhttp=new ActiveXObject("Microsoft.XMLHTTP")}? catch(e){? try{xmlhttp=new XMLHttpRequest()}? catch(e){? alert("Your Browser Does Not Support AJAX")}}}? ? err=""? if (GP==undefined) err="GP "? if (URL==undefined) err +="URL "? if (PARAMETERS==undefined) err+="PARAMETERS"? if (err!=""){alert("Missing Identifier(s)\n\n"+err);return false;}? ? xmlhttp.onreadystatechange=function(){? if (xmlhttp.readyState == 4){? if (RESPONSEFUNCTION=="") return false;? eval(RESPONSEFUNCTION(xmlhttp.responseText))? }? }? ? if (GP=="GET"){? URL+="?"+PARAMETERS? xmlhttp.open("GET",URL,true)? xmlhttp.send(null)? }? ? if (GP="POST"){? PARAMETERS=encodeURI(PARAMETERS)? xmlhttp.open("POST",URL,true)? xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded")? xmlhttp.setRequestHeader("Content-length",PARAMETERS.length)? xmlhttp.setRequestHeader("Connection", "close")? xmlhttp.send(PARAMETERS)? }? }

    Read the article

  • cannot change theme and desktop background in ubuntu 10.04

    - by Nrew
    I tried to follow this tutorial frome ghacks.net. But I end up with a bug. Everytime I try to change the desktop background or the theme. It opens up lots of folders. And then close it back again. So I cannot do anything when I try to change the background or the theme to the default. Here is the tutorial And I can't even shutdown my machine now, please help.

    Read the article

  • How to write a jUnit test for this class?

    - by flash
    Hi, I would like to know what's the best approach to test the method "pushEvent()" in the following class with a jUnit test. My problem is, that the private method "callWebsite()" always requires a connection to the network. How can I avoid this requirement or refactor my class that I can test it without a connection to the network? class MyClass { public String pushEvent (Event event) { //do something here String url = constructURL (event); //construct the website url String response = callWebsite (url); return response; } private String callWebsite (String url) { try { URL requestURL = new URL (url); HttpURLConnection connection = null; connection = (HttpURLConnection) requestURL.openConnection (); String responseMessage = responseParser.getResponseMessage (connection); return responseMessage; } catch (MalformedURLException e) { e.printStackTrace (); return e.getMessage (); } catch (IOException e) { e.printStackTrace (); return e.getMessage (); } } }

    Read the article

  • Explicit call of Runnable.run

    - by klaudio
    Hi, I have a question. Somebody, who was working on my code before me, created some method and passed Runnable as parameter, more likely: void myMethod(Runnable runnable){ runnable.run(); } Then calling myMethod out of main looks like: public static void main(String args[]) { try { myMethod(new Runnable(){ public void run() { //do something...; }}); } catch (Throwable t) { } } So, to supply parameter to myMethod I need to instantiate object of (in this case anonymous) class implementing Runnable. My question is: is it necessary to use Runnable in this example? Can I use any different interface? I mean I can create new interface with single method i.e. interface MyInterface{ void doThis(); } then change look of myMethod: void myMethod(MyInterface myObject){ myObject.doThis(); } And of course client too: public static void main(String args[]) { try { myMethod(new MyInterface (){ public void doThis() { //do something...; }}); } catch (Throwable t) { } } Or maybe something is about Runnable?!

    Read the article

  • How do I programmatically nullify a File Attachment in InfoPath Forms

    - by Doctor Zinda
    Howdy all, I'm running into a problem with some InfoPath C# code while trying to remove an attachment from a form. Basically the process is: User opens form User clicks button File attachment is cleared I've tried adding a blank attachment to my schema that never becomes populated, then setting the original field's value equal to that value by the method below. When debugging the form I catch an error: Schema validation found non-data type errors. Any tips here would be appreciated. public void BTN_ClearAttachment_Clicked(object sender, ClickedEventArgs e) { try { _OriginalAttachment.SetValue(_BLANK_ATTACHMENT.Value); } catch (Exception ex) { _ErrorField.SetValue(ex.Message + " : " + ex.StackTrace); } } Thanks, Dr Z Edit - P.S. I should clear up that both _OriginalAttachment & _ErrorField are both XPathNavigators, pointing at different schema elements. I've verified that these XPathNavigators are both pointing at valid schema elements.

    Read the article

  • Windows XP: How to delete files that cannot be deleted?

    - by glenneroo
    I have a backup copy of my previous Documents and Settings folder which only contains my original user and within that, 2 directories (Favorites and Local Settings) which are visible in cmd shell but when I try to delete them, Windows gives me this error: If I try to delete the Documents and Settings folder, I receive this warning: I tried doing this in a cmd shell: attrib *.* -r -a -s -h /s But it did not help, nor did it return any errors/warnings. Unlocker 1.8.5 returns: No Locking handle found. Any ideas?

    Read the article

  • Exception durin processing XSLT transformation!

    - by Artic
    I'm usin such code to generate contents file. try { StreamResult result = new StreamResult(); TransformerFactory tf = TransformerFactory.newInstance(); for (String item: groups){ item = item.replaceAll(" ", "-").toLowerCase(); result.setOutputStream(new FileOutputStream(path+item+".html")); Templates templ = tf.newTemplates(xsltSource); Transformer transf = templ.newTransformer(); transf.clearParameters(); transf.setParameter("group", item); transf.transform(xmlSource, result); } } catch (TransformerConfigurationException e) { throw new SinkException(e.getMessage()); } catch (TransformerException e) { throw new SinkException(e.getMessage()); } But on second iteration I have an exception ERROR: javax.xml.transform.TransformerException: com.sun.org.apache.xml.internal.utils.WrappedRuntimeException: Read error Cann't understand what is the reason?

    Read the article

  • .NET threading: how can I capture an abort on an unstarted thread?

    - by Groxx
    I have a chunk of threads I wish to run in order, on an ASP site running .NET 2.0 with Visual Studio 2008 (no idea how much all that matters, but there it is), and they may have aborted-clean-up code which should be run regardless of how far through their task they are. So I make a thread like this: Thread t = new Thread(delegate() { try { /* do things */ System.Diagnostics.Debug.WriteLine("try"); } catch (ThreadAbortException) { /* cleanup */ System.Diagnostics.Debug.WriteLine("catch"); } }); Now, if I wish to abort the set of threads part way through, the cleanup may still be desirable later on down the line. Looking through MSDN implies you can .Abort() a thread that has not started, and then .Start() it, at which point it will receive the exception and perform normally. Or you can .Join() the aborted thread to wait for it to finish aborting. Presumably you can combine them. http://msdn.microsoft.com/en-us/library/ty8d3wta(v=VS.80).aspx To wait until a thread has aborted, you can call the Join method on the thread after calling the Abort method, but there is no guarantee the wait will end. If Abort is called on a thread that has not been started, the thread will abort when Start is called. If Abort is called on a thread that is blocked or is sleeping, the thread is interrupted and then aborted. Now, when I debug and step through this code: t.Abort(); // ThreadState == Unstarted | AbortRequested t.Start(); // throws ThreadStartException: "Thread failed to start." // so I comment it out, and t.Join(); // throws ThreadStateException: "Thread has not been started." At no point do I see any output, nor do any breakpoints on either the try or catch block get reached. Oddly, ThreadStartException is not listed as a possible throw of .Start(), from here: http://msdn.microsoft.com/en-us/library/a9fyxz7d(v=VS.80).aspx (or any other version) I understand this could be avoided by having a start parameter, which states if the thread should jump to cleanup code, and foregoing the Abort call (which is probably what I'll do). And I could .Start() the thread, and then .Abort() it. But as an indeterminate amount of time may pass between .Start and .Abort, I'm considering it unreliable, and the documentation seems to say my original method should work. Am I missing something? Is the documentation wrong? edit: ow. And you can't call .Start(param) on a non-parameterized Thread(Start). Is there a way to find out if a thread is parameterized or not, aside from trial and error? I see a private m_Delegate, but nothing public...

    Read the article

  • Cant get sub-domain created by Plesk working

    - by RN
    Apache 2.2 CentOS Plesk 9.x I am using Plesk to manage my domain names on my virtual host.and GoDaddy for DNS I have created a new sub-domain blog. I can see the httpd.include for example has a new virtualhost entry for blog.example.com I can also see folders have been created for the subdomain blog vhost\example.com folder But when I try to go to blog.example.com - I get an error - basically the host is not getting resolved My site - example.com is working fine otherwise Any idea what could I be missing ? I did try restarting the apache web server as well

    Read the article

  • Install MacAfee And Node32

    - by hosseinsinohe
    Hi All I Have a Computer With Windows Xp Service Pack 3 as an Operating System.This Computer is In the Network With The MacAfee Update Server.This Server Will be Install And Update MacAfee Client Version In The All Computers in The Network.When I Install And Runing 'Eset Node32 Smart Security or AntiVirus' in My Computer,The Computer will be Hang And Freeze And I Can Not Work with Computer.I Restart The Computer And Try Again And Try With Safe Mode To Fix This Problem(Unistall Node32 For Fix:-) ),But I Can Not Fix This Problem.How Can I Fix This Problem And Install Node32 And MaCAfee On This Computer 's Network?

    Read the article

  • What common routines do you put in your Program.cs for C#

    - by Rick
    I'm interested in any common routine/procedures/methods that you might use in you Program.cs when creating a .NET project. For instance I commonly use the following code in my desktop applications to allow easy upgrades, single instance execution and friendly and simple reporting of uncaught system application errors. using System; using System.Diagnostics; using System.Threading; using System.Windows.Forms; namespace NameoftheAssembly { internal static class Program { /// <summary> /// The main entry point for the application. Modified to check for another running instance on the same computer and to catch and report any errors not explicitly checked for. /// </summary> [STAThread] private static void Main() { //for upgrading and installing newer versions string[] arguments = Environment.GetCommandLineArgs(); if (arguments.GetUpperBound(0) > 0) { foreach (string argument in arguments) { if (argument.Split('=')[0].ToLower().Equals("/u")) { string guid = argument.Split('=')[1]; string path = Environment.GetFolderPath(Environment.SpecialFolder.System); var si = new ProcessStartInfo(path + "\\msiexec.exe", "/x" + guid); Process.Start(si); Application.Exit(); } } //end of upgrade } else { bool onlyInstance = false; var mutex = new Mutex(true, Application.ProductName, out onlyInstance); if (!onlyInstance) { MessageBox.Show("Another copy of this running"); return; } AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException; Application.ThreadException += ApplicationThreadException; Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new Form1()); } } private static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e) { try { var ex = (Exception) e.ExceptionObject; MessageBox.Show("Whoops! Please contact the developers with the following" + " information:\n\n" + ex.Message + ex.StackTrace, " Fatal Error", MessageBoxButtons.OK, MessageBoxIcon.Stop); } catch (Exception) { //do nothing - Another Exception! Wow not a good thing. } finally { Application.Exit(); } } public static void ApplicationThreadException(object sender, ThreadExceptionEventArgs e) { try { MessageBox.Show("Whoops! Please contact the developers with the following" + " information:\n\n" + e.Exception.Message + e.Exception.StackTrace, " Error", MessageBoxButtons.OK, MessageBoxIcon.Stop); } catch (Exception) { //do nothing - Another Exception! Wow not a good thing. } } } } I find these routines to be very helpful. What methods have you found helpful in Program.cs?

    Read the article

< Previous Page | 77 78 79 80 81 82 83 84 85 86 87 88  | Next Page >