Search Results

Search found 19541 results on 782 pages for 'event handling'.

Page 106/782 | < Previous Page | 102 103 104 105 106 107 108 109 110 111 112 113  | Next Page >

  • Handling Session ID with Spring

    - by Max
    Hi, I'm trying to build a Spring server for GWT (you can think of it as of Javascript AJAX client). But I can't decide on one point of architecture. How should session be created and used? The obvious easiest way - is to use HTTP sessions (cookies and stuff). Looks fine, but I think that sending session ID separate from the headers would be better (SOAP style). So, what is better: getMyPetsName(String sessionID, int petID) or getMyPetsName(int petID) + session ID through HTTP header (cookies or something). Another question is, if I use the first way (which I like more) - how do I handle session in Spring? I'm really newbie in Spring, and googling did not help. What I mean is: String getMyPetsName(String sessionID, int petID) { Session s = someWayToGetItById(sessionID); } Thanks in advance.

    Read the article

  • PHP: Handling Multiple Submit Buttons

    - by sebb
    Would like to get a consensus as to what the best practice is in this scenario: Muliple submit buttons, is it better to handle this by having separate FORMS for each one of the submits, OR is it okay to have one form and check which button was pressed? thank you for your input :D

    Read the article

  • Handling input from a keyboard wedge

    - by JDibble
    Following on from the question asked by Mykroft Best way to handle input from a keyboard “wedge” http://stackoverflow.com/questions/42437/best-way-to-handle-input-from-a-keyboard-wedge. I need to write a class that intercepts key strokes, if the input is determined to be from the keyboard wedge (as described in the above post) the data will be directed to POS classes to handle, otherwise they keystrokes must be passed on to be handled in windows in the normal manner. This raises two questions How can I intercept key strokes when not in a WinForm. How can I pass on the keypresses to windows. Thanks JDibble

    Read the article

  • Javascript tr click event with newly created rows

    - by yalechen
    I am very new to web development. I am currently using tablesorter jquery plugin to create a dynamic table, where the user can add and delete rows. I am having trouble with changing the background color of newly created rows upon clicking. It works fine with rows that are hard coded in html. Here is the relevant code: $(document).ready( function() { $('table.tablesorter td').click( function (event) { $(this).parent('tr').toggleClass('rowclick'); $(this).parent('tr').siblings().removeClass('rowclick'); }); } ) rowclick is a css class here: table.tablesorter tbody tr.rowclick td { background-color: #8dbdd8; } I have tried adding the following to my javascript function that adds a new row: var createClickHandler = function(newrow) { return function(event) { //alert(newrow.cells[0].childNodes[0].data); newrow.toggleClass('rowclick'); newrow.siblings().removeClass('rowclick'); }; } row.onclick = createClickHandler(row); The alert correctly displays the text in the first column of the row when I click the new row. However, my new rows do not respond to the css class. Anyone have any ideas? Thanks in advance.

    Read the article

  • SQL Server stored procedure return code oddity

    - by gbn
    Hello The client that calls this code is restricted and can only deal with return codes from stored procs. So, we modified our usual contract to RETURN -1 on error and default to RETURN 0 if no error If the code hits the inner catch block, then the RETURN code default to -4. Where does this come from, does anyone know...? IF OBJECT_ID('dbo.foo') IS NOT NULL DROP TABLE dbo.foo GO CREATE TABLE dbo.foo ( KeyCol char(12) NOT NULL, ValueCol xml NOT NULL, Comment varchar(1000) NULL, CONSTRAINT PK_foo PRIMARY KEY CLUSTERED (KeyCol) ) GO IF OBJECT_ID('dbo.bar') IS NOT NULL DROP PROCEDURE dbo.bar GO CREATE PROCEDURE dbo.bar @Key char(12), @Value xml, @Comment varchar(1000) AS SET NOCOUNT ON DECLARE @StartTranCount tinyint; BEGIN TRY SELECT @StartTranCount = @@TRANCOUNT; IF @StartTranCount = 0 BEGIN TRAN; BEGIN TRY --SELECT @StartTranCount = 'fish' INSERT dbo.foo (KeyCol, ValueCol, Comment) VALUES (@Key, @Value, @Comment); END TRY BEGIN CATCH IF ERROR_NUMBER() = 2627 --PK violation UPDATE dbo.foo SET ValueCol = @Value, Comment = @Comment WHERE KeyCol = @Key; ELSE RAISERROR ('Tits up', 16, 1); END CATCH IF @StartTranCount = 0 COMMIT TRAN; END TRY BEGIN CATCH IF @StartTranCount = 0 AND XACT_STATE() <> 0 ROLLBACK TRAN; RETURN -1 END CATCH --Without this, we'll send -4 if we hit the UPDATE CATCH block above --RETURN 0 GO --Run with RETURN 0 and fish line commented out DECLARE @rtn int EXEC @rtn = dbo.bar 'abcdefghijkl', '<foobar />', 'testing' SELECT @rtn; SELECT * FROM dbo.foo DECLARE @rtn int EXEC @rtn = dbo.bar 'abcdefghijkl', '<foobar2 />', 'testing2' --updated OK but we get @rtn = -4 SELECT @rtn; SELECT * FROM dbo.foo --uncomment fish line DECLARE @rtn int EXEC @rtn = dbo.bar 'abcdefghijkl', '<foobar />', 'testing' --Hit outer CATCH, @rtn = -1 as expected SELECT @rtn; SELECT * FROM dbo.foo

    Read the article

  • I have an Errno 13 Permission denied with subprocess in python

    - by wDroter
    The line with the issue is ret=subprocess.call(shlex.split(cmd)) cmd = /usr/share/java -cp pig-hadoop-conf-Simpsons:lib/pig-0.8.1-cdh3u1-core.jar:lib/hadoop-core-0.20.2-cdh3u1.jar org.apache.pig.Main -param func=cat -param from =foo.txt -x mapreduce fsFunc.pig The error is. File "./run_pig.py", line 157, in process ret=subprocess.call(shlex.split(cmd)) File "/usr/lib/python2.7/subprocess.py", line 493, in call return Popen(*popenargs, **kwargs).wait() File "/usr/lib/python2.7/subprocess.py", line 679, in __init__ errread, errwrite) File "/usr/lib/python2.7/subprocess.py", line 1249, in _execute_child raise child_exception OSError: [Errno 13] Permission denied Let me know if any more info is needed. Any help is appreciated. Thanks.

    Read the article

  • Sending an email when an Exception is Thrown

    - by hariubc
    Hi: I have written a java class where if a method throws an exception, an email is sent, via java mail, with a report to the administrators. It works - my question is w.r.t elegance - to catch the exception thrown by the main method, the sendEmail() method resides in the catch block of the main method. The sendEmail() method has its own try-catch block. In effect - it looks like below - is there a more beautiful way of writing this? try { foo; } catch { try{ sendEmail(); } catch { log(e.message); } }

    Read the article

  • Asp.net error object not set to a reference

    - by Frank
    Hi all, Because I rush in development (a lot of whip cracking here) and declare my objects at the top of the function and instantiate inside my try-catch block, I get a lot of the good old "object not set to an instance of an object" errors while doing TDD, and later if I do miss a branch that object was used in (doing VB now, would prefer C#) or just in every day coding, object not set to an instance of an object is a bit vague. Sure the stack trace sends me to the line the error occured at, but it would be nice if I could modify my logging to either name the object or its type because sometimes I have multiple objects on the same line. It's not the end of the world, but in the end it would save me a few minutes each day. Any ideas on how I can pass the info on which object wasn't set? Thanks

    Read the article

  • Confused by this PHP Exception try..catch nesting

    - by Domenic
    Hello. I'm confused by the following code: class MyException extends Exception {} class AnotherException extends MyException {} class Foo { public function something() { print "throwing AnotherException\n"; throw new AnotherException(); } public function somethingElse() { print "throwing MyException\n"; throw new MyException(); } } $a = new Foo(); try { try { $a->something(); } catch(AnotherException $e) { print "caught AnotherException\n"; $a->somethingElse(); } catch(MyException $e) { print "caught MyException\n"; } } catch(Exception $e) { print "caught Exception\n"; } I would expect this to output: throwing AnotherException caught AnotherException throwing MyException caught MyException But instead it outputs: throwing AnotherException caught AnotherException throwing MyException caught Exception Could anyone explain why it "skips over" catch(MyException $e) ? Thanks.

    Read the article

  • Handling auto-incrementing IDENTITY SQL Server fields with LINQ to SQL in C#

    - by Maxim Z.
    I'm building an ASP.NET MVC site that uses LINQ to SQL to connect to SQL Server, where I have a table that has an IDENTITY bigint primary key column that represents an ID. In one of my code methods, I need to create an object of that table to get its ID, which I will place into another object based on another table (FK-to-PK relationship). At what point is the IDENTITY column value generated and how can I obtain it from my code? Is the right approach to: Create the object that has the IDENTITY column Do an InsertOnSubmit() and SubmitChanges() to submit the object to the database table Get the value of the ID property of the object

    Read the article

  • Displaying and capturing c# exceptions

    - by Frank Meulenaar
    I have a c# program which throws a NullReferenceException(). When I start this on my Vista machine, it gives the familiar screen "Foo has stopped working". I can easily click on 'details' to see what went wrong. On one XP machine there's no warning at all: the program just quits, and on another XP I get the "Foo has encountered a problem..." message. Is there a way I can change this (XP's) setting? Furthermore, I would like to have this error message written to a log file, so I can see what went wrong if somebody else uses my program. Is there a way I can send the uncaught exceptions to a file?

    Read the article

  • Catching error caused by InitialContext.lookup

    - by Martin Schröder
    I'm developing a command line client (Java SE6) that now needs to talk to a Glassfish 2.1 server. The code for setting up this connection is try { final InitialContext context = new InitialContext(); final String ejbName = GeneratorCancelledRemote.class.getName(); generatorCancelled = (GeneratorCancelledRemote) context.lookup(ejbName); } catch (Throwable t) { System.err.println("--> Could not call server:"); t.printStackTrace(System.err); runWithOutEJB = true; } I'm now testing it without a running server and the client (when run from Eclipse 4.2) just bombs with 31.10.2012 10:40:09 com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl WARNUNG: "IOP00410201: (COMM_FAILURE) Connection failure: socketType: IIOP_CLEAR_TEXT; hostname: localhost; port: 3700" org.omg.CORBA.COMM_FAILURE: vmcid: SUN minor code: 201 completed: No at com.sun.corba.ee.impl.logging.ORBUtilSystemException.connectFailure(ORBUtilSystemException.java:2783) at com.sun.corba.ee.impl.logging.ORBUtilSystemException.connectFailure(ORBUtilSystemException.java:2804) at com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.(SocketOrChannelConnectionImpl.java:261) at com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.(SocketOrChannelConnectionImpl.java:274) at com.sun.corba.ee.impl.transport.SocketOrChannelContactInfoImpl.createConnection(SocketOrChannelContactInfoImpl.java:130) at com.sun.corba.ee.impl.protocol.CorbaClientRequestDispatcherImpl.beginRequest(CorbaClientRequestDispatcherImpl.java:192) at com.sun.corba.ee.impl.protocol.CorbaClientDelegateImpl.request(CorbaClientDelegateImpl.java:184) at com.sun.corba.ee.impl.protocol.CorbaClientDelegateImpl.is_a(CorbaClientDelegateImpl.java:328) at org.omg.CORBA.portable.ObjectImpl._is_a(ObjectImpl.java:112) at org.omg.CosNaming.NamingContextHelper.narrow(NamingContextHelper.java:69) at com.sun.enterprise.naming.SerialContext.narrowProvider(SerialContext.java:134) at com.sun.enterprise.naming.SerialContext.getCachedProvider(SerialContext.java:259) at com.sun.enterprise.naming.SerialContext.getRemoteProvider(SerialContext.java:204) at com.sun.enterprise.naming.SerialContext.getProvider(SerialContext.java:159) at com.sun.enterprise.naming.SerialContext.lookup(SerialContext.java:409) at javax.naming.InitialContext.lookup(InitialContext.java:392) at com.werkii.latex.generator.Generator.main(Generator.java:344) Caused by: java.lang.RuntimeException: java.net.ConnectException: Connection refused: connect at com.sun.enterprise.iiop.IIOPSSLSocketFactory.createSocket(IIOPSSLSocketFactory.java:347) at com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.(SocketOrChannelConnectionImpl.java:244) ... 14 more Caused by: java.net.ConnectException: Connection refused: connect at sun.nio.ch.Net.connect(Native Method) at sun.nio.ch.SocketChannelImpl.connect(SocketChannelImpl.java:532) at com.sun.corba.ee.impl.orbutil.ORBUtility.openSocketChannel(ORBUtility.java:105) at com.sun.enterprise.iiop.IIOPSSLSocketFactory.createSocket(IIOPSSLSocketFactory.java:332) ... 15 more It's o.k. for now (while I'm still in development) that it bombs, but it does this repeatedly and the catch clause is never reached (even though I'm catching Throwable) - the message is not printed. So how can I handle connection errors during lookup in my program?

    Read the article

  • c source code to remove subset transactions form text file

    - by user324887
    I have a file containing data as follows 10 20 30 40 70 20 30 70 30 40 10 20 29 70 80 90 20 30 40 40 45 65 10 20 80 45 65 20 I want to remove all subset transaction from this file. output file should be like follows 10 20 30 40 70 29 70 80 90 20 30 40 40 45 65 10 20 80 Where records like 20 30 70 30 40 10 20 45 65 20 are removed because of they are subset of other records.

    Read the article

  • When is it appropriate to use C++ exceptions?

    - by krebstar
    I'm trying to design a class that needs to dynamically allocate some memory.. I had planned to allocate the memory it needs during construction, but how do I handle failed memory allocations? Should I throw an exception? I read somewhere that exceptions should only be used for "exceptional" cases, and running out of memory doesn't seem like an exceptional case to me.. Should I allocate memory in a separate initialization routine instead and check for failures and then destroy the class instance gracefully? Or should I use exceptions instead? The class won't have anything useful to do if these memory allocations should fail.. EDIT: The consensus seems to be that running out of memory IS an exceptional case. Will see how to go about this.. Thanks.. :)

    Read the article

  • php error reporting - having trouble matching local & web server settings

    - by Andrew Heath
    I'm trying to add a custom error handler to my site, but in doing so have discovered that my webhost's PHP error reporting settings and those of my localhost (default XAMPP) vary considerably. While I thought I was programming to E_STRICT like a good little boy, adding the error handler to my webhost revealed craploads of Runtime Notices. Example: Runtime notice strtotime() [function.strtotime]: It is not safe to rely on the system's timezone settings. Please use the date.timezone setting, the TZ environment variable or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/Chicago' for 'CST/-6.0/no DST' instead In /home/... Clearly this isn't a red-alert, showstopping error. But what bothers me is that it doesn't show up on my localhost. I'd certainly like to improve my code by addressing these sorts of issues if I could see them! I've looked through both php.ini files, and my webhost's setting is error_reporting = E_ALL & ~E_NOTICE whereas mine was error_reporting = E_STRICT, which I had thought was better. However, changing mine to match and rebooting the server doesn't seem to have accomplished anything. Could someone please point me in the right direction?

    Read the article

  • error handling strategies in C?

    - by Leo
    Given the code below: typedef struct {int a;} test_t; arbitrary_t test_dosomething(test_t* test) { if (test == NULL) { //options: //1. print an error and let it crash //e.g. fprintf(stderr, "null ref at %s:%u", __FILE__, __LINE__); //2. stop the world //e.g. exit(1); //3. return (i.e. function does nothing) //4. attempt to re-init test } printf("%d", test->a); //do something w/ test } I want to get a compiler error if test is ever NULL, but I guess that's not possible in C. Since I need to do null checking at runtime, what option is the most proper way to handle it?

    Read the article

  • Using a general class for execution with try/catch/finally?

    - by antirysm
    I find myself having a lot of this in different methods in my code: try { runABunchOfMethods(); } catch (Exception ex) { logger.Log(ex); } What about creating this: public static class Executor { private static ILogger logger; public delegate void ExecuteThis(); static Executor() { // logger = ...GetLoggerFromIoC(); } public static void Execute(ExecuteThis executeThis) { try { executeThis(); } catch (Exception ex) { logger.Log(ex); } } } And just using it like this: private void RunSomething() { Method1(someClassVar); Method2(someOtherClassVar); } ... Executor.Execute(RunSomething); Are there any downsides to this approach? (You could add Executor-methods and delegates when you want a finally and use generics for the type of Exeception you want to catch...)

    Read the article

  • Catching errors in ANTLR and finding parent

    - by Andreas
    I have found out that I can catch errors during parsing by overwriting displayRecognitionError, but how do I find the parent "node" of this error? ex. if I have the grammar: prog: stat expr; stat: STRING; expr: INTEGER; And give it the input "abc def". Then I will get an error at "def" which should be an integer. At this point I then want to get the parent which is "expr" (since it fails inside the INTEGER part) and it's parent "prog". Kind of like printing stack trace in java. I tried to look at the node from RecognitionException parsed to displayRecognitionError, but it is null, and using CommonErrorNode the parent is null. Should I maybe take a completely different approach?

    Read the article

  • TextArea component is null on applicationComplete event

    - by Alan G.
    I have a weird issue (weird because it is specific to one component) with applicationComplete in a fairly simple application. All the UI components are declared in MXML. I can access them all in applicationComplete, but not a spark.components.TextArea component, named taStatus here; it is null in the handler. MXML looks sort of like this (there are lots of other components, but nothing special) <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="710" minHeight="640" applicationComplete="onApplicationComplete(event)" width="710" height="640"> <mx:TabNavigator left="15" right="15" top="15" bottom="340" paddingTop="0"> <s:NavigatorContent label="General" width="100%" height="100%"> <s:Label x="93" y="71" text="Label" id="lblTest"/> </s:NavigatorContent> <s:NavigatorContent label="Status" width="100%" height="100%"> <s:TextArea id="taStatus" width="100%" height="100%" text="Startup." editable="false"/> </s:NavigatorContent> </mx:TabNavigator> <fx:Script source="main.as" /> </s:Application> Here is the handler in main.as protected function onApplicationComplete(event: FlexEvent) : void { lblTest.text = 'abc789'; // OK taStatus.text = 'abc789'; // Fail } TypeError: Error #1009: Cannot access a property or method of a null object reference. So taStatus is null... What is so special about this TextArea?

    Read the article

  • How can I process a form's events in another class in VB.NET?

    - by CowKingDeluxe
    Here's my code: Public Class Form1 End Class Public Class Form1Handler Inherits Form1 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click MsgBox("I") End Sub End Class I'm trying to get Form1Handler to process Form1's events automatically. How can I do this? Should I use a module instead? I'm doing this in VB 2010.

    Read the article

< Previous Page | 102 103 104 105 106 107 108 109 110 111 112 113  | Next Page >