Search Results

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

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

  • Handling hitboxes

    - by TheBroodian
    So I have an issue that I'm laughing at myself about, because it really seems like it should be something that I should be able to figure out pretty quickly. I am designing a 2D action platformer; I have a playable character, and a dummy 'punching bag' character for testing purposes that I've created. I've just gotten enough of both of them done that I can start prototyping and testing them in runtime. Then I realized- neither of them have references of each other (intentionally so), so how do I check for hitboxes stored within my playable character from my dummy character? Long story short, how do I make my dummy know when he's been punched by my hero?

    Read the article

  • Handling Constraint Violations and Errors in SQL Server

    The database developer can, of course, throw all errors back to the application developer to deal with, but this is neither kind nor necessary. How errors are dealt with is dependent on the application, but the process itself isn't entirely obvious. Compress live data by 73% Red Gate's SQL Storage Compress reduces the size of live SQL Server databases, saving you disk space and storage costs. Learn more.

    Read the article

  • Handling Deadlocks in SQL Server

    In this excerpt from his book Troubleshooting SQL Server: A Guide for the Accidental DBA, Jonathan Kehayias provides a guide to identifying the causes, reacting to, and ultimately preventing the dreaded deadlock. What are your servers really trying to tell you? Find out with new SQL Monitor 3.0, an easy-to-use tool built for no-nonsense database professionals.For effortless insights into SQL Server, download a free trial today.

    Read the article

  • Recursive function with for loop python

    - by user134743
    I have a question that should not be too hard but it has been bugging me for a long time. I am trying to write a function that searches in a directory that has different folders for all files that have the extension jpg and which size is bigger than 0. It then should print the sum of the size of the files that are in these categories. What I am doing right now is def myFuntion(myPath, fileSize): for myfile in glob.glob(myPath): if os.path.isdir(myFile): myFunction(myFile, fileSize) if (fnmatch.fnmatch(myFile, '*.jpg')): if (os.path.getsize(myFile) > 1): fileSize = fileSize + os.path.getsize(myFile) print "totalSize: " + str(fileSize) THis is not giving me the right result. It sums the sizes of the files of one directory but it does not keep suming the rest. For example if I have these paths C:/trial/trial1/trial11/pic.jpg C:/trial/trial1/trial11/pic1.jpg C:/trial/trial1/trial11/pic2.jpg and C:/trial/trial2/trial11/pic.jpg C:/trial/trial2/trial11/pic1.jpg C:/trial/trial2/trial11/pic2.jpg I will get the sum of the first three and the the size of the last 3 but I won´t get the size of the 6 together, if that makes sense. Thank you so much for your help!

    Read the article

  • The system is running in low graphics mode error before ubuntu gets installed

    - by hellodear
    I am using Bootable USB for installing Ubuntu with Windows 8.1. I have put pendrive and then booting my USB. When it shows me to try Ubuntu or install Ubuntu. Then I press Try ubuntu and then it says" "The system is running in low graphics mode". Then I press Ok. Then it shows 4 options. Then again I click Ok. Then it shows a black screen and nothing happens. I have tried all possible answers provided in AU. What should I do? Please help. I am using Windows 8.1 with dedicated graphic card (Video card - AMD Radeon HD 8670M). Installing 12.04 LTS with pre-installe Windows 8.1 in a Dell Laptop 3537 inspiron.

    Read the article

  • Best practice- handling images on website

    - by Steve
    I am porting an old eCommerce site to MVC 3 and would like to take advantage of design improvements. The site currently has product images stored in 3 sizes: thumbnail, medium (for display in a list) and expanded for a zoomed look. Right now we are having to upload 3 separate images that are sized exactly right, provide 3 different names that match what the site expects, etc., it is a pain. I'd like to upload just 1 file, the large one, then let the site reduce it to needed sizes, and I'd like the flexibility to change the thumbnail and list sizes depending on user preferences, form factor (e.g. mobile, iPad, desktop), etc. so might need many copies of the same image. My question is should the image be reduced then saved several times upon upload and if so what is a good storage/naming convention? The other idea is to store just the single image but resize it programmatically before serving it to the client. Has anybody done this and what are the tradeoffs besides a few more machine cycles? How do you pass a temporary image in memory to the client (there is no URL)?

    Read the article

  • Any good reason to open files in text mode?

    - by Tinctorius
    (Almost-)POSIX-compliant operating systems and Windows are known to distinguish between 'binary mode' and 'text mode' file I/O. While the former mode doesn't transform any data between the actual file or stream and the application, the latter 'translates' the contents to some standard format in a platform-specific manner: line endings are transparently translated to '\n' in C, and some platforms (CP/M, DOS and Windows) cut off a file when a byte with value 0x1A is found. These transformations seem a little useless to me. People share files between computers with different operating systems. Text mode would cause some data to be handled differently across some platforms, so when this matters, one would probably use binary mode instead. As an example: while Windows uses the sequence CR LF to end a line in text mode, UNIX text mode will not treat CR as part of the line ending sequence. Applications would have to filter that noise themselves. Older Mac versions only use CR in text mode as line endings, so neither UNIX nor Windows would understand its files. If this matters, a portable application would probably implement the parsing by itself instead of using text mode. Implementing newline interpretation in the parser might also remove some overhead of using text mode, as buffers would need to be rewritten (and possibly resized) before returning to the application, while this may be less efficient than when it would happen in the application instead. So, my question is: is there any good reason to still rely on the host OS to translate line endings and file truncation?

    Read the article

  • Handling large integers in python [migrated]

    - by Sushma Palimar
    I had written a program in python to find b such that a prime number p divides b^2-8. The range for b is [1, (p+1)/2]. For small integers it works, say only up to 7 digits. But not for large integers, say for p = 140737471578113. I get the error message for i in range (2,p1,1): MemoryError I wrote the program as #!/usr/bin/python3 p=long(raw_input('enter the prime number:')) p1=long((p+1)/2) for i in range (2,p1,1): s = long((i*i)-8) if (s%p==0): print i

    Read the article

  • Returning status code where one of many errors could have occured

    - by yttriuszzerbus
    I'm developing a PHP login component which includes functions to manipulate the User object, such as $User->changePassword(string $old, string $new) What I need some advice with is how to return a status, as the function can either succeed (no further information needs to be given) or fail (and the calling code needs to know why, for example incorrect password, database problem etc.) I've come up with the following ideas: Unix-style: return 0 on success, another code on failure. This doesn't seem particularly common in PHP and the language's type-coercion messes with this (a function returning FALSE on success?) This seems to be the best I can think of. Throw an exception on error. PHP's exception support is limited, and this will make life harder for anybody trying to use the functions. Return an array, containing a boolean for "success" or not, and a string or an int for "failure status" if applicable. None of these seem particularly appealing, does anyone have any advice or better ideas?

    Read the article

  • Difference between '\n' and '\r\n'

    - by sukhbir
    Yes yes, I am aware that '\n' writes a newline in UNIX while for Windows there is the two character sequence: '\r\n'. All this is very nice in theory, but my question is why? Why the carriage return character is extra in Windows? If UNIX can do it in \n why does it take Windows two characters to do this? I am reading David Beazley's Python book and he says: For example, on Windows, writing the character '\n' actually outputs the two- character sequence '\r\n' (and when reading the file back, '\r\n' is translated back into a single '\n' character). Why the extra effort? I will be honest. I have known the difference for a long time but have never bothered to ask WHY. I hope that is answered today. Thanks for your time.

    Read the article

  • Key Handling mechanics

    - by Max
    I am new to game development and am working on my first game using OpenGL and C++. I have a game class which handles everything necessary in an update() function. Now i want to handle keyboard inputs. I use GLFW which supports key callbacks. However i wonder how to deal with inputs. Should i record the keys pressed and poll on it the next time my game updates or should the callback immediately perform the necessary actions? And why? Thanks :)

    Read the article

  • What is the best practice for reading a large number of custom settings from a text file?

    - by jawilmont
    So I have been looking through some code I wrote a few years ago for an economic simulation program. Each simulation has a large number of settings that can be saved to a file and later loaded back into the program to re-run the same/similar simulation. Some of the settings are optional or depend on what is being simulated. The code to read back the parameters is basically one very large switch statement (with a few nested switch statements). I was wondering if there is a better way to handle this situation. One line of the settings file might look like this: #RA:1,MT:DiscriminatoryPriceKDoubleAuction,OF:Demo Output.csv,QM:100,NT:5000,KP:0.5 //continues... And some of the code that would read that line: switch( Character.toUpperCase( s.charAt(0) ) ) { case 'R': randSeed = Integer.valueOf( s.substring(3).trim() ); break; case 'M': marketType = s.substring(3).trim(); System.err.println("MarketType: " + marketType); break; case 'O': outputFileName = s.substring(3).trim() ; break; case 'Q': quantityOfMarkets = Integer.valueOf( s.substring(3).trim() ); break; case 'N': maxTradesPerRound = Integer.valueOf( s.substring(3).trim() ); break; case 'K': kParameter = Float.valueOf( s.substring(3).trim() ); break; // continues... }

    Read the article

  • When should I decline to make a requested change?

    - by reuscam
    I work on the software side of a company that provides custom hardware with software running on top of it. Often times the hardware is not engineered well. In those cases, I am often asked first to troubleshoot the problem - of course the symptom is always "your software crashed" or something along those lines. Just recently we had another one of these incidents where power on a USB line is not reliable, and it causes a USB device to fail. This causes a usability problem in one of our applications. I have been asked by upper management to handle this better - continually monitor the USB device, and if it disappears, then reboot, or try to reset it. Doing either of these is not guaranteed to fix anything. Ultimately, the real fix is to correct the reliability of the device from the hardware side. I could improve performance, but not to 100%, and of course I would be using my already limited time to bloat code and add yet another device monitoring thread. So with all that said, how do I make a good decision about when to say that this needs to be a hardware fix, and only a hardware fix? Can I approach this quantitatively, and come up with some sort of definitive yes/no test? I'm sure its not that easy.

    Read the article

  • Handling Backups for Rapid Resilience

    The backup and restore system in SQL Server hasn't changed a great deal over the years despite a huge growth in the typical size of databases. When disaster strikes, and an important service is taken offline while a restore is performed, there is often time to reflect on whether it might be possible to design databases for a more rapid recovery of the most critical parts of a database application. Uncover the flexibility of custom metricsKeep up to date from anywhere with SQL Monitor, and monitor the most important data for your servers and applications. Download a free trial.

    Read the article

  • Handling timeout in network application

    - by user2175831
    How can I handle timeouts in a network application. I'm implementing a provisioning system on a Linux server, the code is huge so I'm going to put the algorithm, it works as like this Read provisioning commands from file Send it to another server using TCP Save the request in hash. Receive the response then if successful response received then remove request from hash if failed response received then retry the message The problem I'm in now is when the program didn't receive the response for a timeout reason then the request will be waiting for a response forever and won't be retried. And please note that I'll be sending hundreds of commands and I have to monitor the timeout commands for all of them. I tried to use timer but that didn't help because I'll end up with so many waiting timers and I'm not sure if this is a good way of doing this. The question is how can I save the message in some data structure and check to remove or retry it later when there is no response from the other end? Please note that I'm willing to change the algorithm to anything you suggest that could deal with the timeouts.

    Read the article

  • Multiple joysticks event handling

    - by hbaktir
    I want to make a game which is totally same idea with "Who pressed the button answers the question" I got 2 joysticks and both connected to a pc.My application will be Winforms and i will develop it on Visual studio 2012 . I 've used SlimDX,Sharpx so far i ' ve nothing for multiple joysticks.I can get the pressed button with timer . All i want to know is which joystick / gamepad pressed 1 button first.Then my problem will be solved Any idea how can i achive this or somebody did it before

    Read the article

  • Duplicate DNS Zones (Error 4515 in Event Log )

    - by Campo
    I am getting these two error in the DNS Event log (errors at end of question). I have confirmed I do have duplicate zones. I am wondering which ones to delete. The DomainDNSZone contains all of our DNS records but it does not have the _msdcs zone.... that is in the ForestDNSZone with the duplicates that are not in use. here is a picture of that 3 Questions. I understand the advantages of having DNS in the ForestDNSZone. so... Why is DNS using the DomainDNSZone and is that acceptable considering _msdcs... is in the ForestDNSZone? If so, should I just delete the DC=1.168.192.in-addr.arpa and DC=supernova.local from the ForestDNSZone? Or should I try to get those to be the ones in use? What are those steps? I understand how to delete. That is simple but if i must move zones some info would be appreaciated there. Just to confirm. from my understanding. I can delete the two duplicates in the ForestDNSZone and leave the _msdcs.supernova.local as thats required there. This will resolve the erros I see. Just fyi when I look in those folders from the ForestDNSZone they have just 2 and 1 entries respectively. So obviously not in use compared to the others. I am pretty sure I understand the steps to complete this. But if you would like to provide that info, bonus points! Event Type: Warning Event Source: DNS Event Category: None Event ID: 4515 Date: 1/4/2011 Time: 2:14:18 PM User: N/A Computer: STANLEY Description: The zone 1.168.192.in-addr.arpa was previously loaded from the directory partition DomainDnsZones.supernova.local but another copy of the zone has been found in directory partition ForestDnsZones.supernova.local. The DNS Server will ignore this new copy of the zone. Please resolve this conflict as soon as possible. If an administrator has moved this zone from one directory partition to another this may be a harmless transient condition. In this case, no action is necessary. The deletion of the original copy of the zone should soon replicate to this server. If there are two copies of this zone in two different directory partitions but this is not a transient caused by a zone move operation then one of these copies should be deleted as soon as possible to resolve this conflict. To change the replication scope of an application directory partition containing DNS zones and for more details on storing DNS zones in the application directory partitions, please see Help and Support. For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp. Data: 0000: 89 25 00 00 %.. AND Event Type: Warning Event Source: DNS Event Category: None Event ID: 4515 Date: 1/4/2011 Time: 2:14:18 PM User: N/A Computer: STANLEY Description: The zone supernova.local was previously loaded from the directory partition DomainDnsZones.supernova.local but another copy of the zone has been found in directory partition ForestDnsZones.supernova.local. The DNS Server will ignore this new copy of the zone. Please resolve this conflict as soon as possible. If an administrator has moved this zone from one directory partition to another this may be a harmless transient condition. In this case, no action is necessary. The deletion of the original copy of the zone should soon replicate to this server. If there are two copies of this zone in two different directory partitions but this is not a transient caused by a zone move operation then one of these copies should be deleted as soon as possible to resolve this conflict. To change the replication scope of an application directory partition containing DNS zones and for more details on storing DNS zones in the application directory partitions, please see Help and Support. For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp. Data: 0000: 89 25 00 00 %..

    Read the article

  • ReSharper C# Live Template for Read-Only Dependency Property and Routed Event Boilerplate

    - by Bart Read
    Following on from my previous post, where I shared a Live Template for quickly declaring a normal read-write dependency property and its associated property change event boilerplate, here's an unsurprisingly similar template for creating a read-only dependency property.        #region $PROPNAME$ Read-Only Property and Property Change Routed Event        private static readonly DependencyPropertyKey $PROPNAME$PropertyKey =                                             DependencyProperty.RegisterReadOnly(             "$PROPNAME$", typeof ( $PROPTYPE$ ), typeof ( $DECLARING_TYPE$ ),             new PropertyMetadata( $DEF_VALUE$ , On$PROPNAME$Changed ) );       public static readonly DependencyProperty $PROPNAME$Property =                                           $PROPNAME$PropertyKey.DependencyProperty;        public $PROPTYPE$ $PROPNAME$         {             get { return ( $PROPTYPE$ ) GetValue( $PROPNAME$Property ); }             private set { SetValue( $PROPNAME$PropertyKey, value ); }         }       public static readonly RoutedEvent $PROPNAME$ChangedEvent   =                                           EventManager.RegisterRoutedEvent(           "$PROPNAME$Changed",           RoutingStrategy.$ROUTINGSTRATEGY$,           typeof( RoutedPropertyChangedEventHandler< $PROPTYPE$ > ),           typeof( $DECLARING_TYPE$ ) );       public event RoutedPropertyChangedEventHandler< $PROPTYPE$ > $PROPNAME$Changed       {           add { AddHandler( $PROPNAME$ChangedEvent, value ); }           remove { RemoveHandler( $PROPNAME$ChangedEvent, value ); }       }        private static void On$PROPNAME$Changed(           DependencyObject d, DependencyPropertyChangedEventArgs e)         {             var $DECLARING_TYPE_var$ = d as $DECLARING_TYPE$;            var args = new RoutedPropertyChangedEventArgs< $PROPTYPE$ >(               ( $PROPTYPE$ ) e.OldValue,               ( $PROPTYPE$ ) e.NewValue );           args.RoutedEvent    = $DECLARING_TYPE$.$PROPNAME$ChangedEvent;           $DECLARING_TYPE_var$.RaiseEvent( args );$END$        }        #endregion The only real difference here is the addition of the DependencyPropertyKey, which allows your implementation to set the value of the dependency property without exposing the setter code to consumers of your type. You'll probably find that you create read-only dependency properties much less often than read-write properties, but this should still save you some typing when you do need to do so. Technorati Tags: resharper,live template,c#,dependency property,read-only,routed events,property change,boilerplate,wpf

    Read the article

  • C#/.NET: WinForms - "KeyPress" event for textbox is missing?

    - by eibhrum
    Hi, I am trying to add an "KeyPress" event in a textbox (WinForm) this.textBox1.KeyPress += new System.Windows.Forms.KeyPressEventHandler(CheckKeys); and here's inside the 'CheckKeys': private void CheckKeys(object sender, System.Windows.Forms.KeyPressEventArgs e) { if (e.KeyChar == (char)13) { // Enter is pressed - do something } } The idea here is that once a textbox is in focus and the 'Enter' button was pressed, something will happen... However, my machine cannot find the 'KeyPress' event. Is there something wrong with my codes? I need a little help on this one. Thanks.

    Read the article

  • When writing to the Windows Event Log, is it possible to create a custom link text for URLs?

    - by thomasnguyencom
    I'm just using the vanilla EventLog.WriteEntry method: EventLog.WriteEntry(EVENT_SOURCE, message, EventLogEntryType.Error, id); Here's how the message shows up in the Event Log, with the links in the parenthesis working just fine, but it's ugly: Example 1: Please contact us via email (mailto:[email protected]) or online (http://example.com). Here's how the message shows up in the Event Log, with the HTML "markup", doesn't even handle it: Example 2: Please contact us via <a href="mailto:[email protected]">email</a> or <a href="http://example.com">online</a>. This is how I would like the message to show up, but with "email" and "online" as the link texts: Example 3: Please contact us via email or online. I've tried the <a href>...</a> HTML tags with no success.

    Read the article

  • Is there a better way to minimize this C# event repetition?

    - by Damien Wildfire
    I have a lot of code like this: public class Microwave { private EventHandler<EventArgs> _doorClosed; public event EventHandler<EventArgs> DoorClosed { add { lock (this) _doorClosed += value; } remove { lock (this) _doorClosed -= value; } } private EventHandler<EventArgs> _lightbulbOn; public event EventHandler<EventArgs> LightbulbOn { add { lock (this) _lightbulbOn += value; } remove { lock (this) _lightbulbOn -= value; } } // ... } You can see that much of this is boilerplate. In Ruby I'd be able to do something like this: class Microwave has_events :door_closed, :lightbulb_on, ... end Is there a similar shorter way of removing this boilerplate in C#?

    Read the article

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