Search Results

Search found 13011 results on 521 pages for 'catch block'.

Page 35/521 | < Previous Page | 31 32 33 34 35 36 37 38 39 40 41 42  | Next Page >

  • Turn off LogEnabled Filter at run time - Logging Enterprise Application Block

    - by Or A
    Hi, so the story go like this: i'm using the Logging Enterprise Application block that provided by microsoft to log events in our application. The goal is to enabled event viewer logging at loading and then turn it off. What i did is to add EventLog TraceListener which write all our logs into the event viewer. What i'm trying to do is to disable it after the application was done loading. The only way that i can thing about is to add a LogEnabled Filter and then turn it off. However, i don't know how to access this filter at run time and disable log on this listener. if you have an idea, please share. Thanks

    Read the article

  • No_data_found exception is propagating to outer block also?

    - by Vineet
    In my code i am entering the salary which is not available in employees table and then again inserting duplicate employee_id in primary key column of employee table in exception block where i am handling no data found exception but i do not why No data found exception in the end also? OUTPUT coming: Enter some other sal ORA-01400: cannot insert NULL into ("SCOTT"."EMPLOYEES"."LAST_NAME") ORA-01403: no data found --This should not come according to logic This is the code: DECLARE v_sal number:=&p_sal; v_num number; BEGIN BEGIN select salary INTO v_num from employees where salary=v_sal; EXCEPTION WHEN no_data_found THEN DBMS_OUTPUT.PUT_LINE('Enter some other sal'); INSERT INTO employees (employee_id)values(100) ; END; EXCEPTION WHEN OTHERS THEN DBMS_OUTPUT.PUT_LINE(sqlerrm); END;

    Read the article

  • Drupal Background Image as Block or Node

    - by Marcy Sutton
    Hi There. I am having trouble wrapping my head around how to make editable background images in my custom Drupal 6 theme. My client wants to have a different background image for each main section (which use multiple content types: page, blog, image gallery)... I am wondering, is there a way to make a custom content type into a dynamic background image block? I am using the Image, Image Cache, Views, CCK, Image Assist, Panels, Filefield, and Imagefield modules. What I'd like to do is add a background image field to various content types that allows a user to reference an image from the content library or upload a new image (similar to ImageAssist), and have it apply to a region in my template. Any suggestions on the best approach for this? Thank you!

    Read the article

  • VS2010 method comment block pretty format.

    - by camelCase
    I have just installed the lastest RC of VS2010, which for me represents a shift from VS2008. A new comment formatting feature that I was looking forward to appears to be missing. About 6 months ago I read a Scott Gu blog post that mentioned a new VS2010 feature that would format /// style method comment blocks into more readable formatted regions inline with other code. The Scott Gu blog did not provide a screen shot but I was expecting the VS2010 editor to remove the XML tags from the /// method comment block and render just the essential text comment. Was this feature pulled during the Beta, or is there an option switch urking somewhere?

    Read the article

  • How can I block based on URL (from address bar) in a safari extension

    - by PerilousApricot
    I'm trying to write an extension that will block access to (configurable) list of URLs if they are accessed more than N times per hour. From what I understand, I need to have a start script pass a "should I load this" message to a global HTML page (who can access the settings object to get the list of URLs), who will give a thumbs up/thumbs down message back to the start script to deny/allow loading. That works out fine for me, but when I use the usual beforeLoad/canLoad handlers, I get messages for all the sub-items that need to be loaded (images/etc..), which screws up the #accesses/hour limit I'm trying to make. Is there a way to synchronously pass messages back and forth between the two sandboxes so I can tell the global HTML page, "this is the URL in the window bar and the timestamp for when this request came in", so I can limit duplicate requests? Thanks!

    Read the article

  • jQuery Find element else do nothing ?

    - by Andrew
    Hi Guys, I am trying to use jQuery to basically wrap a bunch of CSS modifications via jQuery but on pages where the #IDs or Classes dont exist I get errors ? Like jQuery(".class").css(random_stuff) is not a function Any ideas what I can do to either "find" the elements and do nothing or ?

    Read the article

  • Rails: link_to with block and GET params?

    - by bobthabuilda
    How can I achieve query string and URL parameters in a link_to block declaration? Right now, I have this, which works: <%= link_to 'Edit', :edit, :type => 'book', :id => book %> The above works, and outputs: http://localhost:3000/books/edit/1?type=book What I want to do is something like this: <% link_to :edit, :type => 'book', :id => book do %> ... <% end %> But the above format outputs: http://localhost:3000/books/edit/ Which isn't what I'm looking for... I want it to output a URL like the previous example. How can I achieve this?

    Read the article

  • Scroll up/down while selecting multi-page block of text in Vim through putty

    - by shan23
    I'm using vim 6.3.81 on a xterm through putty. When I use set mouse=a , I can scroll through the file , but not select text. When mouse is disabled using set mouse=, I can select text with mouse (automatically copied to a buffer) , but if the text block is over one page long , I can't scroll up/down (and have to select text one screen at a time) !! Is there any way to have the best of both - while selecting text with mouse , if i reach the end of page , it automatically scrolls up/down depending on whether i've reached top/bottom of page and allows me to select text from the next page as well ? I know vim is powerful/flexible enough to do what I want - I just don't know how !! Can anyone help ?

    Read the article

  • Block until an event has completed.

    - by robUK
    Hello, gcc 4.4.2 c89 I have a function that has to run (config_relays). It make a call to a API function called set_relay, then the code has to wait before continuing until the event for set_relay event has completed. The set_relay is any Async call. i.e. void run_processes() { switch() { case EV_RELAY_SET: break; } } void config_relays() { set_relay(); /* Wait until EV_RELAY_SET has fired */ /* Cannot do init_relay until set_relay event has fired - has to block here */ init_relay(); } I guess I could put the init_relay() in the switch. However, that event is used for other things and not just for initializing the relay. I would really like to handle everything in the config_relays function. In C# you can do this by using autoreset. Does C have anything like that. Many thanks for any advice,

    Read the article

  • Exception - Illegal Block size during decryption(Android)

    - by Vamsi
    I am writing an application which encrypts and decrypts the user notes based on the user set password. i used the following algorithms for encryption/decryption 1. PBEWithSHA256And256BitAES-CBC-BC 2. PBEWithMD5And128BitAES-CBC-OpenSSL e_Cipher = Cipher.getInstance(PBEWithSHA256And256BitAES-CBC-BC); d_Cipher = Cipher.getInstance(PBEWithSHA256And256BitAES-CBC-BC); e_Cipher.init() d_Cipher.init() encryption is working well, but when trying to decrypt it gives Exception - Illegal Block size after encryption i am converting the cipherText to HEX and storing it in a sqlite database. i am retrieving correct values from the sqlite database during decyption but when calling d_Cipher.dofinal() it throws the Exception. I thought i missed to specify the padding and tried to check what are the other available cipher algorithms but i was unable to found. so request you to please give the some knowledge on what are the cipher algorithms and padding that are supported by Android? if the algorithm which i used can be used for padding, how should i specify the padding mechanism? I am pretty new to Encryption so tried a couple of algorithms which are available in BouncyCastle.java but unsuccessful. As requested here is the code public class CryptoHelper { private static final String TAG = "CryptoHelper"; //private static final String PBEWithSHA256And256BitAES = "PBEWithSHA256And256BitAES-CBC-BC"; //private static final String PBEWithSHA256And256BitAES = "PBEWithMD5And128BitAES-CBC-OpenSSL"; private static final String PBEWithSHA256And256BitAES = "PBEWithMD5And128BitAES-CBC-OpenSSLPBEWITHSHA1AND3-KEYTRIPLEDES-CB"; private static final String randomAlgorithm = "SHA1PRNG"; public static final int SALT_LENGTH = 8; public static final int SALT_GEN_ITER_COUNT = 20; private final static String HEX = "0123456789ABCDEF"; private Cipher e_Cipher; private Cipher d_Cipher; private SecretKey secretKey; private byte salt[]; public CryptoHelper(String password) throws InvalidKeyException, NoSuchAlgorithmException, NoSuchPaddingException, InvalidAlgorithmParameterException, InvalidKeySpecException { char[] cPassword = password.toCharArray(); PBEKeySpec pbeKeySpec = new PBEKeySpec(cPassword); PBEParameterSpec pbeParamSpec = new PBEParameterSpec(salt, SALT_GEN_ITER_COUNT); SecretKeyFactory keyFac = SecretKeyFactory.getInstance(PBEWithSHA256And256BitAES); secretKey = keyFac.generateSecret(pbeKeySpec); SecureRandom saltGen = SecureRandom.getInstance(randomAlgorithm); this.salt = new byte[SALT_LENGTH]; saltGen.nextBytes(this.salt); e_Cipher = Cipher.getInstance(PBEWithSHA256And256BitAES); d_Cipher = Cipher.getInstance(PBEWithSHA256And256BitAES); e_Cipher.init(Cipher.ENCRYPT_MODE, secretKey, pbeParamSpec); d_Cipher.init(Cipher.DECRYPT_MODE, secretKey, pbeParamSpec); } public String encrypt(String cleartext) throws IllegalBlockSizeException, BadPaddingException { byte[] encrypted = e_Cipher.doFinal(cleartext.getBytes()); return convertByteArrayToHex(encrypted); } public String decrypt(String cipherString) throws IllegalBlockSizeException { byte[] plainText = decrypt(convertStringtobyte(cipherString)); return(new String(plainText)); } public byte[] decrypt(byte[] ciphertext) throws IllegalBlockSizeException { byte[] retVal = {(byte)0x00}; try { retVal = d_Cipher.doFinal(ciphertext); } catch (BadPaddingException e) { Log.e(TAG, e.toString()); } return retVal; } public String convertByteArrayToHex(byte[] buf) { if (buf == null) return ""; StringBuffer result = new StringBuffer(2*buf.length); for (int i = 0; i < buf.length; i++) { appendHex(result, buf[i]); } return result.toString(); } private static void appendHex(StringBuffer sb, byte b) { sb.append(HEX.charAt((b>>4)&0x0f)).append(HEX.charAt(b&0x0f)); } private static byte[] convertStringtobyte(String hexString) { int len = hexString.length()/2; byte[] result = new byte[len]; for (int i = 0; i < len; i++) { result[i] = Integer.valueOf(hexString.substring(2*i, 2*i+2), 16).byteValue(); } return result; } public byte[] getSalt() { return salt; } public SecretKey getSecretKey() { return secretKey; } public static SecretKey createSecretKey(char[] password) throws NoSuchAlgorithmException, InvalidKeySpecException { PBEKeySpec pbeKeySpec = new PBEKeySpec(password); SecretKeyFactory keyFac = SecretKeyFactory.getInstance(PBEWithSHA256And256BitAES); return keyFac.generateSecret(pbeKeySpec); } } I will call mCryptoHelper.decrypt(String str) then this results in Illegal block size exception My Env: Android 1.6 on Eclipse

    Read the article

  • Android - How to tell is someone has pressed a SPINNER but not changed the visible item in it.

    - by andy_spoo
    I have a spinner, which mostly works. If a user selects one of the items in it, the 'onItemSelected' routine catches it just fine. But if a user clicks the same spinner, but does not change from the already visible item that it's currently displaying, the 'onItemSelected' routine just ignores it, and the logs show:- WARN/InputManagerService(577): Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy@437948b0 I there anyway to capture someone doing this? The idea is that my spinner contains a list of names, and when a user selects one from the spinner, it gets added to a listview. I could just add another button to get the name from the spinner, but, screen-space is already lacking and I'd rather not add anymore content.

    Read the article

  • Is it possible to block a page from opening using securityTrimmingEnabled=true

    - by abatishchev
    I have custom SiteMapProvider and RoleProvider that works together properly: IsAccessibleToUser returns false if current user's role isn't mentioned in SiteMapNode.Roles for page requested. So breadcrumbs or menu doesn't show an item. But user still can type now showed URL directly and open a page. How can I block such behavior? Also I have next Web.config settings: <authorization> <allow roles="Admin,Manager,Client" /> <deny users="*" /> </authorization>

    Read the article

  • Does malloc() allocate a contiguous block of memory?

    - by user66854
    I have a piece of code written by a very old school programmer :-) . it goes something like this typedef struct ts_request { ts_request_buffer_header_def header; char package[1]; } ts_request_def; ts_request_buffer_def* request_buffer = malloc(sizeof(ts_request_def) + (2 * 1024 * 1024)); the programmer basically is working on a buffer overflow concept. I know the code looks dodgy. so my questions are: Does malloc always allocate contiguous block of memory ?. because in this code if the blocks are not contiguous , the code will fail big time Doing free(request_buffer) , will it free all the bytes allocated by malloc i.e sizeof(ts_request_def) + (2 * 1024 * 1024), or only the bytes of the size of the structure sizeof(ts_request_def) Do you see any evident problems with this approach , i need to discuss this with my boss and would like to point out any loopholes with this approach

    Read the article

  • Is block style really this important?

    - by Jack Roscoe
    I just watched a video of Douglas Crockford's presentation about his 2009 book JavaScript: The Good Parts. In the video, he explains that the following block is dangerous because it produces silent errors: return { ok: false }; And that it should actually be written like this (emphasising that although seemingly identical the behavioural difference is crucial): return { ok: false }; You can see his comments around 32 minutes into the video here: http://www.youtube.com/watch?v=hQVTIJBZook&feature=player_embedded#!&start=1920 I have not heard this before, and was wondering if this rule still applies or if this requirement in syntax has been overcome by JavaScript developments since this statement was made. I found this very interesting as I have NOT been writing my code this way, and wanted to check that this information was not out of date.

    Read the article

  • Visual Studio 2008 Macro for Building does not block thread

    - by Climber104
    Hello, I am trying to write a macro for Building my application, kicking off an external tool, and ataching the debugger to that external tool. Everything is working except for the building. It builds, but it is not blocking the thread so the external tool gets kicked off before it can finish. Is there a way I can run ExecuteCommand and wait for the thread to finish? Code is below: DTE.ExecuteCommand("ClassViewContextMenus.ClassViewProject.Build") DTE.ExecuteCommand("Tools.ExternalCommand11") Try Dim dbg2 As EnvDTE80.Debugger2 = DTE.Debugger Dim trans As EnvDTE80.Transport = dbg2.Transports.Item("Default") Dim dbgeng(1) As EnvDTE80.Engine dbgeng(0) = trans.Engines.Item("Managed") Dim proc2 As EnvDTE80.Process2 = dbg2.GetProcesses(trans, "MINIPC").Item("_nStep.exe") proc2.Attach2(dbgeng) Catch ex As System.Exception MsgBox(ex.Message) End Try

    Read the article

  • Catchall Router on Exim does not work

    - by Markus
    I have setup a catchall router on exim (used as last router): catchall: driver = redirect domains = +local_domains data = ${lookup{*@$domain}lsearch{/etc/aliases}} retry_use_local_part This works perfectly when sending emails locally. However, if I login to my GMail account and send an email to [email protected], then I get an "Unrouteable Address". Thank you for any hints to solve this issue.

    Read the article

  • Block all other input to an application and control it from a wrapper in Java

    - by Oren
    I have a windows application which has a complex GUI that I would like to hide from users. In order to do this, I would like to create a wrapper with an extremely simple interface that overlays this application and automates a number of actions when a user clicks a single button on the wrapper. (I hope "wrapper" is the proper term.) Is it possible to use Java to block input to the underlying application so that users cannot inadvertently mess up the automation? How would I go about this? Also, how can I automate key presses and clicks to the application without hijacking the mouse? Is this possible in Java? I have looked at java.awt.Robot, but it appears to hijack the mouse. I have also looked at AutoIT, but it too hijacks the mouse and does not integrate with Java. Neither of these options seem powerful enough for what I need, but I do not know how else to proceed.

    Read the article

  • Python continue from the point where exception was thrown

    - by James Lin
    Hi is there a way to continue from the point where exception was thrown? eg I have the following psudo code unique code 1 unique code 2 unique code 3 if I want to ignore the exceptions of any of the unique code statements I will have to do it like this: try: #unique code 1 except: pass try: #unique code 2 except: pass try: #unique code 3 except: pass but this isn't elegant to me, and for the life of me I can't remember how I resolved this kind of problem last time... what I want to have is something like try: unique code 1 unique code 2 unique code 3 except: continue from last exception raised

    Read the article

  • How does one SELECT block another?

    - by Krip
    I'm looking at output of SP_WhoIsActive on SQL Server 2005, and it's telling me one session is blocking another - fine. However they both are running a SELECT. How does one SELECT block another? Shouldn't they both be acquiring shared locks (which are compatible with one another)? Some more details: Neither session has an open transaction count - so they are stand-alone. The queries join a view with a table. They are complex queries which join lots of tables and results in 10,000 or so reads. Any insight much appreciated.

    Read the article

  • Setting an instance variable from a block

    - by c00lryguy
    How would I achieve something like below so that when I set the s variable within the block, it also sets the @subject instance variable in my Topic class? class Topic def subject(&blk) blk.call(@subject) if block_given? @subject unless block_given? end end my_topic = Topic.new p my_topic.subject #=> nil my_topic.subject do |s| s = ['one', 'two', 'three'] s.pop p s #=> ['one', 'two'] end p my_topic.subject #=> nil... want it to be ['one, 'two']

    Read the article

  • .htaccess - Block all referrers but one

    - by HarryBeasant
    I am currently running a file sharing website where all files are stored remotely, they are hot linked on the download buttons (on the main site). The current .htaccess force downloads all files, images etc. <FilesMatch "\.(?i:doc|odf|pdf|rtf|txt|png|jpg|jpeg|mp3|mp4|wav|wmv|gif|bmp|avi|mts)$"> Header set Content-Disposition attachment </FilesMatch> What i am trying to do is make sure people cannot hot link the files. So i was thinking, is there a was i can block all other referrers to the domain that stores the files (it's an IP) apart from the main website (a domain). Thanks!

    Read the article

  • ASP.NET - Update Dataset directly to DB

    - by karthik
    Hi, Description: I wanted to update dataset to database in Asp.NET. Instead of retrieving the entire table, I am retrieving only one record using the following statement :- select * from Products where ProductID=3 Now I wanted to update dataset directly in to DB by using following statements (DAP 4.1) db.UpdateDataSet(ds, ds.Tables[0].TableName, null, cmdupdate, null, UpdateBehavior.Standard); Questions Can I Retrieve only one row from DB while a lot of other records are there and update back using Adapter update? ( In other words, I am not selecting all records from table) I am using Data Application Block 4.1? It will work there right? If anyone can give example for update will be great ( with Procedures). Thanks Ka

    Read the article

  • check whether fgets would block

    - by lv
    Hi, I was just wondering whether in C is it possible to peek in the input buffer or perform similar trickery to know whether a call to fgets would block at a later time. Java allows to do something like that by calling BufferedReader.ready(), this way I can implement console input something like this: while (on && in.ready()) { line = in.readLine(); /* do something with line */ if (!in.ready()) Thread.sleep(100); } this allows an external thread to gracefully shutdown the input loop by setting on to false; I'd like to perform a similar implementation in C without resorting to non portable tricks, I already know I can make a "timed out fgets" under unix by resorting to signals or (better, even though requering to take care of buffering) reimplement it on top of recv/select, but I'd prefer something that would work on windows too. TIA

    Read the article

  • Code won't exit foreach block

    - by Matt
    I've got the following C# code segment that takes a list, finds objects that are ready to update, then shoves them into a temp list, deletes from the main list, and then goes on its merry way. My issue is that the foreach block, which cycles through my main list, won't exit. TempLog.Clear(); //Ensure TempLog is empty foreach (CLogger ready in PlayerLog) { if (ready.UpdateReady == true) // Record is ready to be updated in database { TempLog.Add(ready); // Add record to templog PlayerLog.Remove(ready); // Remove from playerlog } } <---- Never reaches this point if (TempLog.Count > 0) // Just check that templog isn't empty { new Thread(Update).Start(); // Run update code } I've put heaps of debugging in, and I can watch PlayerLog start at 1, TempLog at 0, then it enters the foreach loop, picks up that the record UpdateReady flag is on, TempLog goes to 1, PlayerLog goes to 0, then it just stops.. No errors, just stops.. Thanks for the help :)

    Read the article

  • Cannot Generate ParameterSetMetadata While Programmatically Creating A Parameter Block

    - by Steven Murawski
    I'm trying to programmatically create a parameter block for a function ( along the lines of this blog post ). I'm starting with a CommandMetadata object (from an existing function). I can create the ParameterMetadata object and set things like the ParameterType, the name, as well as some attributes. The problem I'm running into is that when I use the GetParamBlock method of the ProxyCommand class, none of my attributes that I set in the Attributes collection of the ParameterMetadata are generated. The problem this causes is that when the GetParamBlock is called, the new parameter is not annotated with the appropriate Parameter attribute. Example: function test { [CmdletBinding()] param ( [Parameter()] $InitialParameter) Write-Host "I don't matter." } $MetaData = New-Object System.Management.Automation.CommandMetaData (get-command test) $NewParameter = New-Object System.Management.Automation.ParameterMetadata 'NewParameter' $NewParameter.ParameterType = [string[]] $Attribute = New-Object System.Management.Automation.ParameterAttribute $Attribute.Position = 1 $Attribute.Mandatory = $true $Attribute.ValueFromPipeline = $true $NewParameter.Attributes.Add($Attribute) $MetaData.Parameters.Add('NewParameter', $NewParameter) [System.Management.Automation.ProxyCommand]::GetParamBlock($MetaData)

    Read the article

< Previous Page | 31 32 33 34 35 36 37 38 39 40 41 42  | Next Page >