Search Results

Search found 3844 results on 154 pages for 'detect'.

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

  • How can I detect when a file download has completed in ASP.NET?

    - by Alexis
    I have a popup window that displays "Please wait while your file is being downloaded". This popup also executes the code below to start the file download. How can I close the popup window once the file download has completed? I need some way to detect that the file download has completed so I can call self.close() to close this popup. System.Web.HttpContext.Current.Response.ClearContent(); System.Web.HttpContext.Current.Response.Clear(); System.Web.HttpContext.Current.Response.ClearHeaders(); System.Web.HttpContext.Current.Response.ContentType = fileObject.ContentType; System.Web.HttpContext.Current.Response.AppendHeader("Content-Disposition", string.Concat("attachment; filename=", fileObject.FileName)); System.Web.HttpContext.Current.Response.WriteFile(fileObject.FilePath); Response.Flush(); Response.End();

    Read the article

  • Is it possible to detect when the system is recording a sound and then perform some action on Python

    - by Jorge
    I began learning Python a few days ago, and i was wondering about a practical use for a program. Then i came up with the following: if my brother is in his room recording himself playing guitar, a led plugged to the usb and wired so it's outside his door lights up, and then i'll know he's recording and i'll take care not to make any noises. The main questions are: How Python can detect any recording going on in the system? How would i interface with the usb so i can actually turn the led on?

    Read the article

  • iPhone SDK: How to detect a row-hit while in the editing mode?

    - by Carol
    I've looked everywhere and I can't find it. I have a UITableView that contain rows of "checkmark" cells. The user clicks on a row to check/uncheck it. (It works!!!!) But I also want to allow the user to EDIT the data on that row. ... so I have an "EDIT" button at the top. The user hits it and is allowed to DELETE any rows. (That works too!!!!) But how do I also detect a "tap" on that row. Where is there some kind of a didSelectRowAtIndexPathWhileInEditMode ???? (Is that really the best way to do this: Allow "selections", and "deletions", and "editing" of each row?)

    Read the article

  • How to detect that a server had closed the socket / crashed in the client side ?

    - by Spredzy
    Hi all, I am developing a Client/Server application. I would like to know how can I detect that a server had closed the socket or had crashed in the client side (my android App) I am running on one side my android app, that is connected. On the other side I am running netcat (for testing purpose). I Would like to know what signal is sent to my client socket or what happen when I kill netcat. Because now, I immediately get an error message that impose me to "Force Close" my application. How can I handle it properly ? Thank you

    Read the article

  • Set a script to automatically detect character encoding in a plain-text-file in Python?

    - by Haidon
    I've set up a script that basically does a large-scale find-and-replace on a plain text document. At the moment it works fine with ASCII, UTF-8, and UTF-16 (and possibly others, but I've only tested these three) encoded documents so long as the encoding is specified inside the script (the example code below specifies UTF-16). Is there a way to make the script automatically detect which of these character encodings is being used in the input file and automatically set the character encoding of the output file the same as the encoding used on the input file? findreplace = [ ('term1', 'term2'), ] inF = open(infile,'rb') s=unicode(inF.read(),'utf-16') inF.close() for couple in findreplace: outtext=s.replace(couple[0],couple[1]) s=outtext outF = open(outFile,'wb') outF.write(outtext.encode('utf-16')) outF.close() Thanks!

    Read the article

  • How do I detect a change of tab page in TabControl prior to SelectedIndexChanged event?

    - by JYelton
    I currently determine what page of a tabcontrol was clicked on via the SelectedIndexChanged event. I would like to detect before the selected index actually changes, for validation purposes. For example, a user clicks a tab page other than the one they are viewing. A dialog is presented if form data is unsaved and asks if it's ok to proceed. If the user clicks no, I'd like to remain on the current tab. Currently I have to remember the previous tab page and switch back to it after an answer of 'no.' I considered MouseDown (and the assorted calculation logic), but I doubt that's the best way. (This is in .NET C# 3.5)

    Read the article

  • What's a good way to detect wrap-around in a fixed-width message counter?

    - by Kristo
    I'm writing a client application to communicate with a server program via UDP. The client periodically makes requests for data and needs to use the most recent server response. The request message has a 16-bit unsigned counter field that is echoed by the server so I can pair requests with server responses. Since it's UDP, I have to handle the case where server responses arrive out of order (or don't arrive at all). Naively, that means holding on to the highest message counter seen so far and dropping any incoming message with a lower number. But that will fail as soon as we pass 65535 messages and the counter wraps back to zero. Is there a good way to detect (with reasonable probability) that, for example, message 5 actually comes after message 65,000? The implementation language is C++.

    Read the article

  • How do I detect whether a browser supports mouseover events?

    - by Damovisa
    Let's assume I have a web page which has some onmouseover javascript behaviour to drop down a menu (or something similar) Obviously, this isn't going to work on a touch device like the iPad or smartphones. How can I detect whether the browser supports hover events like onmouseover or onmouseout and the :hover pseudotag in CSS? Note: I know that if I'm concerned about this I should write it a different way, but I'm curious as to whether detection can be done. Edit: When I say, "supports hover events", I really mean, "does the browser have a meaningful representation of hover events". If the hardware supports it but the software doesn't (or vice versa), there's no meaningful representation. With the exception of some upcoming tech, I don't think any touch devices have a meaningful representation of a hover event.

    Read the article

  • How do you detect when the mouse leaves the stage in ActionScript 2?

    - by Theo
    I have the bad luck of having to downport some ActionScript 3 code to ActionScript 2 and I have a problem with detecting when the mouse leaves the stage. In ActionScript 3 there is an event called Event.MOUSE_LEAVE, which can be used to detect when the mouse leaves the stage, but there is no equivalent in ActionScript 2 as far as I can see. How would you best emulate the same functionality? Listening for mouse movement and checking the mouse coordinates against the bounds of the stage doesn't work because the mouse coordinates stop updating when the mouse leaves the stage.

    Read the article

  • How do you get Windows Mobile Device Center to detect a Windows Phone 7 Series emulator?

    - by sweeney
    Hello, I'm running some tests and need to be able to get Windows Phone 7 Series emulator synced with an exchange account or local Outlook account via the Device Center. I'm using the unlocked version of the emulator so that i actually have a reasonable set of software on the phone to work with. When the emulator launches i expect the Device Center to detect it and start syncing (or prompt me for settings). This does not happen. I've tried adjusting the Connection Settings (COM2 and DMA) in the Device Center with no luck. Is this possible? Has anyone done it? Thanks in advance!

    Read the article

  • How can I get Perl to detect the bad UTF-8 sequences?

    - by gorilla
    I'm running Perl 5.10.0 and Postgres 8.4.3, and strings into a database, which is behind a DBIx::Class. These strings should be in UTF-8, and therefore my database is running in UTF-8. Unfortunatly some of these strings are bad, containing malformed UTF-8, so when I run it I'm getting an exception DBI Exception: DBD::Pg::st execute failed: ERROR: invalid byte sequence for encoding "UTF8": 0xb5 I thought that I could simply ignore the invalid ones, and worry about the malformed UTF-8 later, so using this code, it should flag and ignore the bad titles. if(not utf8::valid($title)){ $title="Invalid UTF-8"; } $data->title($title); $data->update(); However Perl seems to think that the strings are valid, but it still throws the exceptions. How can I get Perl to detect the bad UTF-8?

    Read the article

  • How to detect if google chrome rss plugin is installed-php?

    - by zeina
    I'm working on a word press project. I noticed that rss is not working fine on google chrome. After I googled about it, it turned out that I need to install a plugin for google chrome so rss works. I want to know how to detect if the plugin is installed or not in case the user is using chrome browser. Currently I'm doing the following: function is_chrome() { return(eregi("chrome", $_SERVER['HTTP_USER_AGENT'])); } if(is_chrome()) { // I want to check if plugin installed or not here. }

    Read the article

  • How to Detect Trusted Connection in Crystal Reports using VB.NET?

    - by Michael
    I have some Crystal Reports connecting to a Sql Server db that I would like to detect whether the connection is trusted or whether I need to supply the log on info (reports are not supplied by me so I can't control the connect method). If I just blindly supply login credentials, it won't connect if it is a trusted connection. The following does not work: oRpt = oCR.OpenReport("C:\MyReport.rpt") if oRpt.Database.Tables(1).ConnectionProperties.Item("Integrated Security") = True then 'trusted connection else 'supply login credentials end if It gives the following error: Operator '=' is not defined for type 'IConnectionProperty' and type 'Boolean'. I cannot find how create a construct in vb.net for IConnectionProperty. I can't find any documents from Crystal that explain it. I am using Crystal Reports XI - Developer

    Read the article

  • How do I detect a click event on a google maps PolyLine overlay?

    - by Tom
    It seems to me that I should be able to do the following to detect a click event on a line on a google map: var line = new GPolyline( ... ); map.addOverlay(line); GEvent.addListener(line, "click", function(latlng){ alert("clicked"); }); The api reference says this is available in version 2.88, which was released in 2007(!?), so I'm assuming that's what I'm using, but I don't know how to confirm that. I also tried setting the {clickable:true} option explicitly (it's supposed to be the default.) I've tested in FireFox 3 and Opera 9.6 so doubt it's browser specific. I'm also using jQuery on the page. I have plenty of code detecting clicks on markers that works fine, clicking on lines would be really nice, can anyone enlighten me?

    Read the article

  • Can you detect if and excel find and replace is active during worksheet_change()?

    - by John Griffiths
    Hi I've just crashed excel using amazon spreadsheet to update feed. When doing find and replace [replace all] with 2 cells selected after the first replacement the worksheet_change() function finished with the whole spreadsheet selected. This meant that the replacements took place outside of the original area. Unfortunatly the replcement text included the find text and each replacement re-selected the entire area excel ran until it ran out of space then crashed. Pressing control-break brings up the vba dialog STOP/CONTINUE/DEBUG. DEBUG is greyed out as amazon had protected the sheet. STOP would stop one run but would then continue to crash. CONTINUE would switch back to the current change and continue to crash. Is there any way to detect if a find&replace operation is in action whilst executing excel vba? Regards John

    Read the article

  • Can I detect unused extra parameters passed to javascript methods?

    - by Pablojim
    In Javascript I can call any method with more than the necessary amount of parameters and the extra parameters are silently ignored. e.g. letters = ['a','b','c'] //correct letters.indexOf('a') //This also works without error or warning letters.indexOf('a', "blah", "ignore me", 38) Are there ways to detect cases where this occurs? My motivation is that in my experience cases where this occurs are usually bugs. Identification of these by code analysis or at runtime would help track these errors down. These cases are especially prevalent where people are expecting alterations to base types which may not have occurred. Logging a warning where this happens e.g. Date.parse('02--12--2012', 'dd--MM--YYYY') Notes: To be clear I would like a solution that doesn't involve me sprinkling checks all over my code and other peoples' code.

    Read the article

  • How can I detect when the .NET Framework feature is "turned off" in Windows 7 / Vista?

    - by John Myczek
    My application requires the .NET Framework version 3.5. I recently ran into a customer that had the .NET Framework installed but turned off on Windows Vista (also applies to Windows 7). In this case, my installer (InstallShield 2009) does not prompt the user to install the Framework (because it is already installed) and when my application runs it crashes immediately. I tried another .NET application and it also crashes immediately. Is there any way to detect this situation and handle it more gracefully? Just detecting this during install is not ideal since the .NET Framework can be turned off at any time. Ideally, the application would be able to check and display a friendly message to the user telling them they need to turn on the .NET Framework. EDIT: "Turning off" the .NET Framework in Windows Vista or Windows 7 is not the same as uninstalling it. The Framework can be simply turned back on without reinstalling: http://windows.microsoft.com/en-US/windows-vista/Turn-Windows-features-on-or-off

    Read the article

  • Problem with NHibernate and saving - NHibernate doesn't detect changes and uses old values.

    - by Vilx-
    When I do this: Cat x = Session.Load<Cat>(123); x.Name = "fritz"; Session.Flush(); NHibernate detects the change and UPDATEs the DB. But, when I do this: Cat x = new Cat(); Session.Save(x); x.Name = "fritz"; Session.Flush(); I get NULL for name, because that's what was there when I called Session.Save(). Why doesn't NHibernate detect the changes - or better yet, take the values for the INSERT statement at the time of Flush()?

    Read the article

  • Detect if NSString contains a URL and generate a "link" to open inside the app a Safari View

    - by Cy
    I have am reading a twitter feed in my iPhone application and can do it correctly, but I'd like to evolve it in a way to detect if the whole NSString contains any URL or URLs and create a "link" that will open a UIWebView within the same application. Can you guide me on how to perform this task? -(void) setTextTwitter:(NSString *)text WithDate:(NSString*)date { [text retain]; [textTwitter release], textTwitter = nil; textTwitter = text; [date retain]; [dateTwitter release], dateTwitter = nil; dateTwitter = date; [self setNeedsDisplay]; }

    Read the article

  • How do detect that transaction has already been started?

    - by xelurg
    I am using Zend_Db to insert some data inside a transaction. My function starts a transaction and then calls another method that also attempts to start a transaction and of course fails(I am using MySQL5). So, the question is - how do I detect that transaction has already been started? Here is a sample bit of code: try { Zend_Registry::get('database')->beginTransaction(); $totals = self::calculateTotals($Cart); $PaymentInstrument = new PaymentInstrument; $PaymentInstrument->create(); $PaymentInstrument->validate(); $PaymentInstrument->save(); Zend_Registry::get('database')->commit(); return true; } catch(Zend_Exception $e) { Bootstrap::$Log->err($e->getMessage()); Zend_Registry::get('database')->rollBack(); return false; } Inside PaymentInstrument::create there is another beginTransaction statement that produces the exception that says that transaction has already been started.

    Read the article

  • How do you detect an area that can be filled in in a bitmap in ActionScript 3?

    - by 1.21 gigawatts
    I am having a tough time figuring this out. I need to be able to detect a fill area for something similar to a coloring book picture. The user will click inside the area that needs to be filled. The image is user created bitmap content and so the fill area must be detected at runtime. Any help would be tremendously appreciated! Posting Flex 4 code for review: <fx:Script> <![CDATA[ protected function myImage_clickHandler(event:MouseEvent):void { myImage.imageDisplay.bitmapData.floodFill(event.localX,event.localY,0xFFFFFF); } ]]> </fx:Script> <s:Image id="myImage" click="myImage_clickHandler(event)" source="/images/square.gif"/>

    Read the article

  • How to detect padding on an integer and treat it as a string?

    - by Sirber
    I have this function to prepare variable to be used in a SQL query: function sqlize($mInput) { if (!isset($mInput)) $mInput = "null"; elseif (strtolower($mInput) == "null") { } elseif (is_numeric($mInput)) { } elseif (is_string($mInput)) { $mInput = trim($mInput); $mInput = addslashes($mInput); $mInput = '"' . $mInput . '"'; } else $mInput = "null"; return $mInput; } I have a string "0004", which is going in a "varchar field", is cought by is_numeric, and is saved as "4" and not "0004". Is there a way to detect the padding and process it as a string? Thank you!

    Read the article

  • Most optimal way to detect if black (or any color pixels) exist in an image file?

    - by Zando
    What's the best and most flexible algorithm to detect any black (or colored pixel) in a given image file? Say I'm given an image file that could, say, have a blue background. And any non blue pixel, including a white pixel, is counted as a "mark". The function returns true if there are X number of pixels that deviate from each other at a certain threshold. I thought it'd be fastest to just simply iterate through every pixel and see if its color matches the last. But if it's the case that pixel (0,0) is deviant, and every other pixel is the same color (and I want to allow at least a couple deviated pixels before considering an image to be "marked), this won't work or be terribly efficient.

    Read the article

  • Can you use Javascript to detect a file download window created server side?

    - by Zacho
    I have a jQuery plugin I use to dynamically create and render a form on a default.aspx asp.net page, then submit it. The page it gets submitted to is a pdf.aspx page. The page builds a PDF then uses Response.Write to write the file (application/pdf) to the browser. I use the same method to render XLSX files to the browser as well. It works really great, but I need a callback or some event to tell the button when to stop spinning. This prevents the user from continuously clicking the Excel or PDF buttons. Does anyone know a way to detect the file dialog window when it was not created using javascript? I am also open to other methods of callback from the server side as well.

    Read the article

  • How detect length of a numpy array with only one element?

    - by mishaF
    I am reading in a file using numpy.genfromtxt which brings in columns of both strings and numeric values. One thing I need to do is detect the length of the input. This is all fine provided there are more than one value read into each array. But...if there is only one element in the resulting array, the logic fails. I can recreate an example here: import numpy as np a = np.array(2.3) len(a) returns an error saying: TypeError: len() of unsized object however, If a has 2 or more elements, len() behaves as one would expect. import numpy as np a = np.array([2.3,3.6]) len(a) returns 2 My concern here is, if I use some strange exception handling, I can't distinguish between a being empty and a having length = 1.

    Read the article

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