Search Results

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

Page 98/782 | < Previous Page | 94 95 96 97 98 99 100 101 102 103 104 105  | Next Page >

  • dynamically created controls and responding to control events

    - by Dirk
    I'm working on an ASP.NET project in which the vast majority of the forms are generated dynamically at run time (form definitions are stored in a DB for customizability). Therefore, I have to dynamically create and add my controls to the Page every time OnLoad fires, regardless of IsPostBack. This has been working just fine and .NET takes care of managing ViewState for these controls. protected override void OnLoad(EventArgs e) { base.OnLoad(e); RenderDynamicControls() } private void RenderDynamicControls(){ //1. call service layer to retrieve form definition //2. create and add controls to page container } I have a new requirement in which if a user clicks on a given button (this button is created at design time) the page should be re-rendered in a slightly different way. So in addition to the code that executes in OnLoad (i.e. RenderDynamicControls()), I have this code: protected void MyButton_Click(object sender, EventArgs e) { RenderDynamicControlsALittleDifferently() } private void RenderDynamicControlsALittleDifferently() (){ //1. clear all controls from the page container added in RenderDynamicControls() //2. call service layer to retrieve form definition //3. create and add controls to page container } My question is, is this really the only way to accomplish what I'm after? It seems beyond hacky to effectively render the form twice simply to respond to a button click. I gather from my research that this is simply how the page-lifecycle works in ASP.NET: Namely, that OnLoad must fire on every Postback before child events are invoked. Still, it's worthwhile to check with the SO community before having to drink the kool-aid. On a related note, once I get this feature completed, I'm planning on throwing an UpdatePanel on the page to perform the page updates via Ajax. Any code/advice that make that transition easier would be much appreciated. Thanks

    Read the article

  • Capturing USB Plug/Unplug events in Firemonkey

    - by radsdau
    [RAD Studio XE3 / C++] I have a FMX project running in Windows only at this stage, but I need to detect events when USB devices are connected and disconnected. I have a similar VCL app that can do this fine, but the Application-HookMainWindow is not exposed in FMX (only VCL). Is there an elegant way to handle this? Or do I have to hack some VCL stuff into my FMX app to make that work? I'd imagine I have to abstract it so I can support other platforms down the track. For the meantime though I need to get the Windows solution working. If the 'VCL hack' thing is required, how would I reference the vcl::Forms::Application from within my Fmx app? Cheers.

    Read the article

  • Does Delphi really handle dynamic classes better than static?

    - by John
    Hello, I was told more than once that Delphi handles dynamic classes better than static.Thereby using the following: type Tsomeclass=class(TObject) private procedure proc1; public someint:integer; procedure proc2; end; var someclass:TSomeclass; implementation ... initialization someclass:=TSomeclass.Create; finalization someclass.Free; rather than type Tsomeclass=class private class procedure proc1; public var someint:integer; class procedure proc2; end; 90% of the classes in the project I'm working on have and need only one instance.Do I really have to use the first way for using those classes? Is it better optimized,handled by Delphi? Sorry,I have no arguments to backup this hypothesis,but I want an expert's opinion. Thanks in advance!

    Read the article

  • "Unable to open file", when the program tries to open file in /proc

    - by tristartom
    Hi, I try to read file /proc/'pid'/status, using c program. The code is as follows, and even I use sudo to run it, the prompt still keeps throwing "Unable to open file". Please let me know if you have any ideas on how to fix this. thanks Richard ... int main (int argc, char* argv[]) { string line; char* fileLoc; if(argc != 2) { cout << "a.out file_path" << endl; fileLoc = "/proc/net/dev"; } else { sprintf(fileLoc, "/proc/%d/status", atoi(argv[1])); } cout<< fileLoc << endl; ifstream myfile (fileLoc); if (myfile.is_open()) { while (! myfile.eof() ) { getline (myfile,line); cout << line << endl; } myfile.close(); } else cout << "Unable to open file"; return 0; }

    Read the article

  • Is there a way to catch Fatal error in PHP?

    - by Josef Sábl
    I have this line of PHP code: thisFunctionDoesNotExist(); And it stops script execution with: Fatal error: Call to undefined function I tried using set_error_handler and it does help for warning type of errors. But not for fatal errors. As I understand it from various threads on internet it should be possible to handle by set_error_handler, but I cannot make it work. Can you please post working example?

    Read the article

  • Error Messaged and Error Code design

    - by Ved
    We are designing set of web services which will return XML string in response. These are RESTFul services so I will have to send exception inside element. I am planing to design set of Error code which can help me determine where level occured just by looking at the code. For Example 1000 - Application Level 2000 - DB level 3000 - Network level so if I have error message then I can know right away that this was an application level error and it came from 1st business module. I am not very experience in this so I would love to here your thoughts and criticism. Thanks

    Read the article

  • Handling dynamic data from javascript or rails

    - by 99miles
    I have page consisting of a calendar view ( http://code.google.com/p/calendardateselect/ ) as well as divs, each of which contain information about a person. In each div I want to have a link to a new controller and action, and pass the id for the person and the date selected in the calendar. I can think of a one way, but I'm thinking there's likely a better solution: 1) Do something like: =link_to_function "Week", "weekClicked(#{person.id})" Then in the weekClicked() javascript method I get the selected date from the calendar, such as: $('e_date').selected_date; then with javascript I could make a post request as mentioned here: http://stackoverflow.com/questions/133925/javascript-post-request-like-a-form-submit 2) Or, is there a way that I could make each link a button in it's own form and maybe have a hidden field that gets the selected date from the calendar as or before the form is submitted? I tried this too, but couldn't figure it out. This definitely seems like it's more on the right track than #1. Thanks.

    Read the article

  • Handle mysql restart in SQLAlchemy

    - by wRAR
    My Pylons app uses local MySQL server via SQLAlchemy and python-MySQLdb. When the server is restarted, open pooled connections are apparently closed, but the application doesn't know about this and apparently when it tries to use such connection it receives "MySQL server has gone away": File '/usr/lib/pymodules/python2.6/sqlalchemy/engine/default.py', line 277 in do_execute cursor.execute(statement, parameters) File '/usr/lib/pymodules/python2.6/MySQLdb/cursors.py', line 166 in execute self.errorhandler(self, exc, value) File '/usr/lib/pymodules/python2.6/MySQLdb/connections.py', line 35 in defaulterrorhandler raise errorclass, errorvalue OperationalError: (OperationalError) (2006, 'MySQL server has gone away') This exception is not caught anywhere so it bubbles up to the user. If I should handle this exception somewhere in my code, please show the place for such code in a Pylons WSGI app. Or maybe there is a solution in SA itself?

    Read the article

  • Handling Status Bar notification

    - by MAkS
    in my app a background service starts and from that service i want to set Status bar notification, that the service has Started following is the code : Context context = getApplicationContext(); String ns = Context.NOTIFICATION_SERVICE; int icon = R.drawable.icon; CharSequence tickerText = "Hello"; long when = System.currentTimeMillis(); Notification notification = new Notification(icon, tickerText, when); CharSequence contentTitle = "My notification"; CharSequence contentText = "Hello World!"; Intent notificationIntent = new Intent(MyService.this, MyClass.class); notificationIntent.setFlags( Intent.FLAG_ACTIVITY_NEW_TASK); PendingIntent contentIntent = PendingIntent.getActivity(this,0,notificationIntent,0); notification.setLatestEventInfo(context, contentTitle, contentText, contentIntent); NotificationManager mNotificationManager = (NotificationManager) getSystemService(ns); mNotificationManager.notify(1, notification); Notification is displayed in Status bar But whin i click on that MyClass.class is not fired.And in log cat it shows "Input Manager Service Window already focused ignoring focuson ...." so plz provide solution. thanks in advance

    Read the article

  • Handling newline character in input between Windows and Linux

    - by Fazal
    I think this is a standard problem which may have been asked before but I could not get the exact answer so posting the issue. The issue is that our server is running on a linux box. We access the server over the browser on a window box to enter data into field which is supposed to contain multiple lines which user can enter by pressing the enter key after each line Abc Def GHI When this input field (this is a text area),is read on the linux machine, we want to split the data based on new line character. I had three question on this. Does the incoming data contain "\r\n" or "\n" If incoming data does contain "\r\n", the linux line.separator property (vm property) would not work for me as it would say "\n" and therefore may leave "\r" in the data. If "\r" is left in the data, if I open the file on a windows machine, will this mean a newline character? Finally can anyone tell me the standard way to deal with this issue?

    Read the article

  • LINQ method chaining and granular error handling

    - by Clafou
    I have a method which can be written pretty neatly through method chaining: return viewer.ServerReport.GetParameters() .Single(p => p.Name == Convention.Ssrs.RegionParamName) .ValidValues .Select(v => v.Value); However I'd like to be able to do some checks at each point as I wish to provide helpful diagnostics information if any of the chained methods returns unexpected results. To achieve this, I need to break up all my chaining and follow each call with an if block. It makes the code a lot less readable. Ideally I'd like to be able to weave in some chained method calls which would allow me to handle unexpected outcomes at each point (e.g. throw a meaningful exception such as new ConventionException("The report contains no parameter") if the first method returns an empty collection). Can anyone suggest a simple way to achieve such a thing?

    Read the article

  • Has form post behavior changed in modern browsers? (or How are double clicks handled by the browser)

    - by Alex Czarto
    Background: We are in the process of writing a registration/payment page, and our philosophy was to code all validation and error checking on the server side first, and then add client side validation as a second step (un-obstructive jQuery). We wanted to disable double clicks server side, so we wrote some locking, thread-safe code to handle simultaneous posts/race conditions. When we tried to test this, we realized that we could not cause a simultaneous post or race condition to occur. I thought that (in older browsers anyway) double clicking a submit button worked as follows: User double clicks submit button. Browser sends a post on the first click On the second click, browser cancels/ignores initial post, and initiates a second post (before the first post has returned with a response). Browser waits for second post to return, ignoring initial post response. I thought that from the server side it looked like this: Server gets two simultaneous post requests, executes and responds to them both (unaware that no one is listening to the first response). From our testing (FireFox 3.0, IE 8.0) this is what actually happens: User double clicks submit button Browser sends a post for the first click Browser queues up second click, but waits for the response from the first click. Response returns from first click (response is ignored?). Browser sends a post for the second click. So from a server side: Server receives a single post which it executes and responds to. Then, server receives a second request wich it executes and responds to. My question is, has this always worked this way (and I'm losing my mind)? Or is this a new feature in modern browsers that prevents simultaneous posts to be sent to the server? It seems that for server side double click prevention, we don't have to worry about simultaneous posts or race conditions. Only need to worry about queued up posts. Thanks in advance for any feedback / comments. Alex

    Read the article

  • Default .NET exception handler

    - by ajs410
    So the other day my C# application crashed. Usually, with a .NET application, if you have an unhandled exception you get a nice error message with a stack trace. However, this time, I got a different dialog that just told me there was an error and offered to attach a Debugger, but there was no stack trace in the dialog and the machine it was running on had no debugger installed. What gives? Why don't I see the default .NET exception handler?

    Read the article

  • Logical python question - handling directories and files in them

    - by Konstantin
    Hello! I'm using this function to extract files from .zip archive and store it on the server: def unzip_file_into_dir(file, dir): import sys, zipfile, os, os.path os.makedirs(dir, 0777) zfobj = zipfile.ZipFile(file) for name in zfobj.namelist(): if name.endswith('/'): os.mkdir(os.path.join(dir, name)) else: outfile = open(os.path.join(dir, name), 'wb') outfile.write(zfobj.read(name)) outfile.close() And the usage: unzip_file_into_dir('/var/zips/somearchive.zip', '/var/www/extracted_zip') somearchive.zip have this structure: somearchive.zip 1.jpeg 2.jpeg another.jpeg or, somethimes, this one: somearchive.zip somedir/ 1.jpeg 2.jpeg another.jpeg Question is: how do I modify my function, so that my extracted_zip catalog would always contain just images, not images in another subdirectory, even if images are stored in somedir inside an archive.

    Read the article

  • IPhone SDK handling calls

    - by Yasir Hussain
    Is there any way to handle call events in IPhone? i.e. Log calls and sms in my app, block unwanted numbers, etc. I know the IPhone SDK doesn't provide that but I have been googling this and what I got was an app called iBlackList. Although it runs on jail-broken phones but it does my required functionality. I wonder how? Has anyone idea about how these tasks can be accomplished?

    Read the article

  • Handling Datetime with decimal '2010-02-14 20:18:58.313000000'

    - by AaronLS
    In SQL Server I have some textual data in varchar fields I am trying to convert to datetime's. The funny thing is this data at some point was in a datetime field, exported to flat file, and now I am reimporting it. The problem is it is in this format 2010-02-14 20:18:58.313000000 and the conversion to datetime fails. I have no idea how it ended up like this when it was originally extracted from a datetime column. Basically a table was exported to a flat file by someone else. The original table was lost. I am reimporting back from the flatfile. I could just drop the decimal but this would be like throwing out some of the data. I'd like to maintain as much precision as possible. How can I import this data from the varchar column back into a datetime column and preserve as much accuracy as possible?

    Read the article

  • Handling data update/freshness issue in web-app in general (or GWT specifically)

    - by edwin.nathaniel
    In general, how do you guys handle user update/data freshness interaction with the user (UI issue) in web-apps? For example: Multi-users web-app (like project management) Login to a "virtual" space People can update project names, etc How to handle a situation such that: user-A and user-B load a project with title "Project StackOverflow" user-B updates the title to "Project StackExchange" user-A updates the title after user-B update operation to "Project Basecamp" The question I'm asking is from the user perspective (UI) and not about transactional operation. What do most people do in this situation? What would you do after user-B updates the title in user-A screen/view? What happened when user-A tries to update the title after user-B finished his/her update operation? do you inform user-A that the title has changed and he/she has to reload the page? do you go ahead and change the title and let user-B has old data? Do you do some sort of application-level "locking" mechanism? (if someone is updating, nobody else can?) Or fix the application workflow? (who has the access to be able to change things, etc). What would be the simplest solution, but at the same time not annoy the user with more dialog/warning messages. I've encountered this particular problem frequently in a GWT app specifically where domain models are being passed around and refreshing the whole app/client-side isn't the optimal solution in my mind (since it means the whole "loading"/initialization phase must be executed again in this specific environment). Maybe the answer is to stay away from GWT? :) Love to hear options, solutions, and advises from you guys. Thanks

    Read the article

  • cookies handling on webrequest and response

    - by manish patel
    I have created a application that has a function mainpost. It is created to post data on a https sites. Here I want to handle cookies in this function. How can I do this task? public string Mainpost(string website, string content) { // this is what we are sending string post_data = content; // this is where we will send it string uri = website; // create a request HttpWebRequest request = (HttpWebRequest) WebRequest.Create(uri); request.KeepAlive = false; request.ProtocolVersion = HttpVersion.Version10; request.Method = "POST"; // turn our request string into a byte stream byte[] postBytes = Encoding.ASCII.GetBytes(post_data); // this is important - make sure you specify type this way request.ContentType = "application/x-www-form-urlencoded"; request.ContentLength = postBytes.Length; Stream requestStream = request.GetRequestStream(); // now send it requestStream.Write(postBytes, 0, postBytes.Length); requestStream.Close(); // grab te response and print it out to the console along with the status // code HttpWebResponse response = (HttpWebResponse)request.GetResponse(); string str = (new StreamReader(response.GetResponseStream()).ReadToEnd()); Console.WriteLine(response.StatusCode); return str; }

    Read the article

  • how do I get only the stack trace from my app in rails?

    - by codeman73
    The default behavior seems to be printing large stack traces like ArgumentError (too few arguments): app/controllers/players_controller.rb:55:in `format' app/controllers/players_controller.rb:55:in `create' /dh/passenger/lib/phusion_passenger/rack/request_handler.rb:92:in `process_request' /dh/passenger/lib/phusion_passenger/abstract_request_handler.rb:207:in `main_loop' /dh/passenger/lib/phusion_passenger/railz/application_spawner.rb:400:in `start_request_handler' /dh/passenger/lib/phusion_passenger/railz/application_spawner.rb:351:in `handle_spawn_application' /dh/passenger/lib/phusion_passenger/utils.rb:184:in `safe_fork' /dh/passenger/lib/phusion_passenger/railz/application_spawner.rb:349:in `handle_spawn_application' /dh/passenger/lib/phusion_passenger/abstract_server.rb:352:in `__send__' /dh/passenger/lib/phusion_passenger/abstract_server.rb:352:in `main_loop' /dh/passenger/lib/phusion_passenger/abstract_server.rb:196:in `start_synchronously' /dh/passenger/lib/phusion_passenger/abstract_server.rb:163:in `start' /dh/passenger/lib/phusion_passenger/railz/application_spawner.rb:209:in `start' /dh/passenger/lib/phusion_passenger/spawn_manager.rb:262:in `spawn_rails_application' /dh/passenger/lib/phusion_passenger/abstract_server_collection.rb:126:in `lookup_or_add' /dh/passenger/lib/phusion_passenger/spawn_manager.rb:256:in `spawn_rails_application' /dh/passenger/lib/phusion_passenger/abstract_server_collection.rb:80:in `synchronize' /dh/passenger/lib/phusion_passenger/abstract_server_collection.rb:79:in `synchronize' /dh/passenger/lib/phusion_passenger/spawn_manager.rb:255:in `spawn_rails_application' /dh/passenger/lib/phusion_passenger/spawn_manager.rb:154:in `spawn_application' /dh/passenger/lib/phusion_passenger/spawn_manager.rb:287:in `handle_spawn_application' /dh/passenger/lib/phusion_passenger/abstract_server.rb:352:in `__send__' /dh/passenger/lib/phusion_passenger/abstract_server.rb:352:in `main_loop' /dh/passenger/lib/phusion_passenger/abstract_server.rb:196:in `start_synchronously' but I only want to see the stack trace from my app. In this case, it's the top 3 lines, which consist of the actual Error, and then the parts of my app. In this case I'd prefer to see this: ArgumentError (too few arguments): app/controllers/players_controller.rb:55:in `format' app/controllers/players_controller.rb:55:in `create' Is this possible?

    Read the article

  • Javascript code for handling Form behaviour.

    - by Andrew
    Hello, Here's how the situation looks : I have a couple simple forms <form action='settings.php' method='post'> <input type='hidden' name='setting' value='value1'> <input type='submit' value='Value1'> </form> Other small forms close to it have value2, value3, ... for the specific setting1, etc. Now, I have all these forms placed on the settings.php subpage, but I'd also like to have copies of one or two of them on the index.php subpage (for ease of access, as they are in certain situations rather frequently used). Thing is I do not want those forms based on the index.php to redirect me in any way to settings.php, just post the hidden value to alter settings and that's all. How can I do this with JS ? Cheers

    Read the article

  • handling large arrays with array_diff

    - by bigmac
    I have been trying to compare two arrays. Using array_intersect presents no problems. When using array_diff and arrays with ~5,000 values, it works. When I get to ~10,000 values, the script dies when I get to array_diff. Turning on error_reporting did not produce anything. I tried creating my own array_diff function: function manual_array_diff($arraya, $arrayb) { foreach ($arraya as $keya => $valuea) { if (in_array($valuea, $arrayb)) { unset($arraya[$keya]); } } return $arraya; } source: http://stackoverflow.com/questions/2479963/how-does-array-diff-work I would expect it to be less efficient that than the official array_diff, but it can handle arrays of ~10,000. Unfortunately, both array_diffs fail when I get to ~15,000. I tried the same code on a different machine and it runs fine, so it's not an issue with the code or PHP. There must be some limit set somewhere on that particular server. Any idea how I can get around that limit or alter it or just find out what it is?

    Read the article

  • A general question about inheritence in the .NET framework

    - by Grant
    I have a general question about inheritance in the .NET framework, lets say you have 2 classes, the first is called Parent and the second is called Child. Child inherits from Parent. Parent wants to ensure that each instance of child executes a specific piece of code when it loads irrespective of whether the child has their own onLoad code explicitly specified. From my experience, if i handle onLoad in the parent and not in the child, the parents onLoad code will fire but if its handled in both classes only the child's code will fire. Is this correct? and if so how can i ensure the parents code will always fire for the child...

    Read the article

  • onclick event in dropdown

    - by raam
    <html> <head> </style> <script type="text/javascript"> function ram(){ document.write("Hello World!") alert("ok"); } </script> </head> <body> <select id="country"> <option value="India" id="101" onfocus="ram()">India</option> <option value="Autralia" id="102" onClick="ram();">Autralia</option> <option value="England" id="103" onfocus="ram();">England</option> <option value="Ameriaca" id="104" onfocus="ram();">Ameriaca</option> <option value="Pakistan" selected="selected" id="105" onfocus="ram();" >Pakistan</option> </select> </body> </html> In this above code the event will not fire for dropdown. I try by using focus and click event. I can I do this and I want 1 more thing if I select dropdown value as India, I want to create a dropdown with state (elements are TN, DL, etc) updation.

    Read the article

< Previous Page | 94 95 96 97 98 99 100 101 102 103 104 105  | Next Page >