Search Results

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

Page 16/1441 | < Previous Page | 12 13 14 15 16 17 18 19 20 21 22 23  | Next Page >

  • how to detect sql server timeout from .NET application without using catch Exception

    - by haditeo
    Hi, In my current application, i am performing an update by invoking T-SQL Update command. The problem is when the same record is locked by other users at that time. At .NET application, the application will wait until SQL Server timeout, then it will throw the SqlException timeout. Is it possible to perform a check first whether a particular record is locked by other process rather than catching the exception ? Thanks, hadi teo Update : The SQL Server version used are 2000 and 2008

    Read the article

  • How catch "Resource not found" warnings in WPF / Visual studio

    - by Sdry
    I am working on a project, in which I am changing themes, by doing this there are some warnings being issued, and I am wondering how to prevent them from beeing issued, or reaching the debug output. `System.Windows.ResourceDictionary Warning: 9 : Resource not found`; It happens when I do Application.Current.Resources.MergedDictionaries.Clear(); Application.Current.Resources.MergedDictionaries.Add(theme.ResourceDictionary); I perfectly understand why there is a warning, I would just like to stop it being outputted (while debugging)

    Read the article

  • ASP.NET MVC Catch All

    - by rkrauter
    The ignore route is defined like this: routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); Why not routes.IgnoreRoute("{resource}.axd/{*}"); What is the significance of pathInfo? Thanks.

    Read the article

  • Does a C# using statement perform try/finally?

    - by Lirik
    Suppose that I have the following code: private void UpdateDB(QuoteDataSet dataSet, Strint tableName) { using(SQLiteConnection conn = new SQLiteConnection(_connectionString)) { conn.Open(); using (SQLiteTransaction transaction = conn.BeginTransaction()) { using (SQLiteCommand cmd = new SQLiteCommand("SELECT * FROM " + tableName, conn)) { using (SQLiteDataAdapter sqliteAdapter = new SQLiteDataAdapter()) { sqliteAdapter.Update(dataSet, tableName); } } transaction.Commit(); } } } The C# documentation states that with a using statement the object within the scope will be disposed and I've seen several places where it's suggested that we don't need to use try/finally clause. I usually surround my connections with a try/finally, and I always close the connection in the finally clause. Given the above code, is it reasonable to assume that the connection will be closed if there is an exception?

    Read the article

  • Subprocess fails to catch the standard output

    - by user343934
    I am trying to generate tree with fasta file input and Alignment with MuscleCommandline import sys,os, subprocess from Bio import AlignIO from Bio.Align.Applications import MuscleCommandline cline = MuscleCommandline(input="c:\Python26\opuntia.fasta") child= subprocess.Popen(str(cline), stdout = subprocess.PIPE, stderr=subprocess.PIPE, shell=(sys.platform!="win32")) align=AlignIO.read(child.stdout,"fasta") outfile=open('c:\Python26\opuntia.phy','w') AlignIO.write([align],outfile,'phylip') outfile.close() I always encounter with these problems Traceback (most recent call last): File "<string>", line 244, in run_nodebug File "C:\Python26\muscleIO.py", line 11, in <module> align=AlignIO.read(child.stdout,"fasta") File "C:\Python26\Lib\site-packages\Bio\AlignIO\__init__.py", line 423, in read raise ValueError("No records found in handle") ValueError: No records found in handle

    Read the article

  • Catch $.getJSON error

    - by Switz
    I've been trying to figure this out for hours. I have a DYNAMIC youtube search, which I use Youtube's JSON api for. It works usually, but there are times that it won't find anything. Is there a way to figure out if it finds nothing, and then end the function because otherwise it stops the entire code. I tried jsonp, but that didn't seem to be correct. Somewhere I read that error catching is built into the newest jQuery getJSON, but I couldn't find it. The code is really tedious so I'd rather not post it unless it comes to that. I'd appreciate any help! Thanks guys. error showing that json didn't return anything jquery-1.4.4.min.js:32 TypeError: Result of expression 'j' [undefined] is not an object.

    Read the article

  • Flex Catch Keydown

    - by Antilogic
    I want to handle the keydown event globally in my application and as such have added the event handler to the top most DisplayObject in the display list. However, the event doesn't seem to fire unless the cursor focus is on a Textbox or Datagrid or the like. How can I have key presses handled globaly by the application?

    Read the article

  • Generic transparent Qt widget that can catch clicks?

    - by Pieter
    I've figured out how to use QPainter to draw rectangles. Now I want to have a drawing area where if the user clicks, a 1x1 rectangle is drawn where the mouse pointer is. To accomplish this, I assume I need a transparent Qt widget that supports the clicked() signal. How do I make such a transparent widget? Or is there something else I can use? Perhaps I can only use the window's clicked() signal?

    Read the article

  • jQuery catch paste input

    - by Christoffer Winterkvist
    I'm looking for a way to sanitize input that I paste into the browser, is this possible to do with jQuery? I've managed to come up with this so far: $(this).live(pasteEventName, function(e) { // this is where i would like to sanitize my input return false; } Unfortunately my development has come to a screeching hold because of this "minor" issue. I would really make me a happy camper if someone could point me to the right direction. Thanks in advance.

    Read the article

  • How to catch this type of exceptions ?

    - by Lukas Šalkauskas
    I'm starting getting tired of this exception. Can't handle it, even so I'm using this: AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException); Still no success, Can anyone explain me, how I should handle it in a nice way. Or how to detect that it have fired this message and close the application, because I'm starting it automatically everytime it closes.

    Read the article

  • php - regex - catch string inside multiple tags

    - by aSeptik
    Hi all guys! still on regex! ;-))) Assuming we have an html file with a lot of <tr> rows with same structure like this below, where (.*?) is the content i need to extract! <tr align= # ><th width= # ><a OnClick="(.*?)"href= # >(.*?)</a><td width= # >(.*?)<td width= # align= # >(.*?)</td></tr> maybe with a nice preg_match_all() ? thanks for the time! Luca Filosofi!

    Read the article

  • How to catch YouTube embed code and turn into URL

    - by Jonathan Vanasco
    I need to strip YouTube embed codes down to their URL only. This is the exact opposite of all but one question on StackOverflow. Most people want to turn the URL into an embed code. This question addresses the usage patttern I want, but is tied to a specific embed code's regex ( Strip YouTube Embed Code Down to URL Only ) I'm not familiar with how YouTube has offered embeds over the years - or how the sizes differ. According to their current site, there are 2 possible embed templates and a variety of options. If that's it, I can handle a regex myself -- but I was hoping someone had more knowledge they could share, so I could write a proper regex pattern that matches them all and not run into endless edge-cases. The full use case scenario : user enters content in web based wysiwig editor backend cleans out youtube & other embed codes; reformats approved embeds into an internal format as the text is all converted to markdown. on display, appropriate current template/code display for youtube or other 3rd party site is generated At a previous company, our tech-team devised a plan where YouTube videos were embedded by listing the URL only. That worked great , but it was in a CMS where everyone was trained. I'm trying to create a similar storage, but for user-generated-content.

    Read the article

  • Catch access to undefined property in JavaScript

    - by avri
    The Spider-Monkey JavaScript engine implements the noSuchMethod callback function for JavaScript Objects. This function is called whenever JavaScript tries to execute an undefined method of an Object. I would like to set a callback function to an Object that will be called whenever an undefined property in the Object is accessed or assigned to. I haven't found a noSuchProperty function implemented for JavaScript Objects and I am curios if there is any workaround that will achieve the same result. Consider the following code: var a = {}; a.__defineGetter__("bla", function(){alert(1);return 2;}); alert(a.bla); It is equivalent to [alert(1);alert(2)] - even though a.bla is undefined. I would like to achieve the same result but to unknown properties (i.e. without knowing in advance that a."bla" will be the property accessed)

    Read the article

  • Can't catch newConnection() signal from QTcpServer

    - by Bob
    I am trying to make a simple server thread in QT to accept a connection, however although the server is listening (I can connect with my test app) I can't get the newConnection() signal to be acted on. Any help as to what I'm missing here would be much appreciated! class CServerThread : public QThread { Q_OBJECT protected: void run(); private: QTcpServer* server; public slots: void AcceptConnection(); }; void CServerThread::run() { server = new QTcpServer; QObject::connect(server, SIGNAL(newConnection()), this, SLOT(AcceptConnection())); server-listen(QHostAddress::Any, 1000); // Any port in a storm exec(); // Start event loop } void CServerThread::AcceptConnection() { OutputDebugStringA("\n***** INCOMING CONNECTION"); // This is never called! }

    Read the article

  • Catch Id (INT AUTO INCREMENT) of a Record after INSERT INTO Statement

    - by Johannes
    This is my first time I use MySQL as datastorage for my C# Application, as I've seen that there is no UNIQUEIDENTIFIER type as in SQL server I decieded to use INT with AUTO_INCREMENT, my problem is now if I execute a INSERT, how may I get the ID of the Record I just added. My quick and dirty solution has been to execute a SELECT MAX(ID) FROM table Statement. But this doesn't seem consistent. I belive there is a better solution something like mysql_insert_id() (PHP). Any Idea how to resolve this in C#?

    Read the article

  • iphone animation - catch notification

    - by satyam
    I'm using following lines of code to animate: CATransition *animation = [self getAnimation:dirString]; [[self view] exchangeSubviewAtIndex:0 withSubviewAtIndex:1]; [[[self view] layer] addAnimation:animation forKey:kAnimationKey]; After end of animation, I want to play sound. How can I get notification when animation is completed?

    Read the article

  • Catch a PHP Object Instantiation Error

    - by Rob Wilkerson
    It's really irking me that PHP considers the failure to instantiate an object a Fatal Error (which can't be caught) for the application as a whole. I have set of classes that aren't strictly necessary for my application to function--they're really a convenience. I have a factory object that attempts to instantiate the class variant that's indicated in a config file. This mechanism is being deployed for message storage and will support multiple store types: DatabaseMessageStore FileMessageStore MemcachedMessageStore etc. A MessageStoreFactory class will read the application's preference from a config file, instantiate and return an instance of the appropriate class. It might be easy enough to slap a conditional around the instantiation to ensure that class_exists(), but MemcachedMessageStore extends PHP's Memcached class. As a result, the class_exists() test will succeed--though instantiation will fail--if the memcached bindings for PHP aren't installed. Is there any other way to test whether a class can be instantiated properly? If it can't, all I need to do is tell the user which features won't be available to them, but let them continue one with the application. Thanks.

    Read the article

  • (Android) How to catch a "ring" event?

    - by rockit
    Hi android developers! I'm clearly a newb, and I was wondering if anyone knows how I can detect a "ring" event on my cellphone through the android sdk? Generally I want to do something with the phone when it begins ringing! Any thoughts? If you want to simply point me to a page in the api documents that would be a good answer for me, I just don't know how to start my research!

    Read the article

  • UIView animation does not animate at first try?

    - by Bacalso Vincent
    Considering that my _palette's frame is like this: _palette.frame = CGRectMake(0,480,320,200); I have this code here to slide up/down a UIView: if(![_pallete superview]) { [self.view addSubview:_pallete]; [self.view insertSubview:_tempViewPaletteListener belowSubview:_pallete]; [UIView animateWithDuration:0.3 animations:^{ _pallete.top -= kPaletteHeight; } completion:^(BOOL isFinished) { }]; } else { [UIView animateWithDuration:0.3 animations:^{ _pallete.top += kPaletteHeight; } completion:^(BOOL isFinished) { [_tempViewPaletteListener removeFromSuperview]; [_pallete removeFromSuperview]; }]; } *the _tempViewPaletteListener is just a view with a tap gesture use to dismiss the palette* The problem is when I first try to run code here, the _palette view will just stiffly display right away. What I expected is, it should slide up the _palette view. Though it works fine after the first try

    Read the article

  • How to catch unintentional function interpositioning with GCC?

    - by SiegeX
    Reading through my book Expert C Programming, I came across the chapter on function interpositioning and how it can lead to some serious hard to find bugs if done unintentionally. The example given in the book is the following: my_source.c mktemp() { ... } main() { mktemp(); getwd(); } libc mktemp(){ ... } getwd(){ ...; mktemp(); ... } According to the book, what happens in main() is that mktemp() (a standard C library function) is interposed by the implementation in my_source.c. Although having main() call my implementation of mktemp() is intended behavior, having getwd() (another C library function) also call my implementation of mktemp() is not. Apparently, this example was a real life bug that existed in SunOS 4.0.3's version of lpr. The book goes on to explain the fix was to add the keyword static to the definition of mktemp() in my_source.c; although changing the name altogether should have fixed this problem as well. This chapter leaves me with some unresolved questions that I hope you guys could answer: Should our software group adopt the practice of putting the keyword static in front of all functions that we don't want to be exposed? Does GCC have a way to warn about function interposition? We certainly don't ever intend on this happening and I'd like to know about it if it does. Can interposition happen with functions introduced by static libraries? Thanks for the help.

    Read the article

< Previous Page | 12 13 14 15 16 17 18 19 20 21 22 23  | Next Page >