Search Results

Search found 5259 results on 211 pages for 'interrupt handling'.

Page 33/211 | < Previous Page | 29 30 31 32 33 34 35 36 37 38 39 40  | Next Page >

  • Using XMLDecoder to cast Encoded XML to List<>

    - by Ender
    I am writing an application that reads in a large number of basic user details in the following format; once read in it then allows the user to search for a user's details using their email: NAME ROLE EMAIL --------------------------------------------------- Joe Bloggs Manager [email protected] John Smith Consultant [email protected] Alan Wright Tester [email protected] ... The problem I am suffering is that I need to store a large number of details of all people that have worked at the company. The file containing these details will be written on a yearly basis simply for reporting purposes, but the program will need to be able to access these details quickly. The way I aim to access these files is to have a program that asks the user for the name of the unique email of the member of staff and for the program to then return the name and the role from that line of the file. I've played around with text files, but am struggling with how I would handle multiple columns of data when it comes to searching this large file. What is the best format to store such data in? A text file? XML? The size doesn't bother me, but I'd like to be able to search it as quickly as possible. The file will need to contain a lot of entries, probably over the 10K mark over time. EDIT: I've decided to go with the XML serialisation method. I've managed to get the code for Encoding working perfectly, but the Decoding code below does not work. XMLDecoder d = new XMLDecoder( new BufferedInputStream(new FileInputStream("data.xml"))); List<Employee> list = (List<Employee>) d.readObject(); d.close(); for(Employee x : list) { if(x.getEmail().equals(userInput)) { // do stuff } } When the program hits List<Employee> list = (List<Employee>) d.readObject(); an exception is thrown claiming that "Employee cannot be cast to java.util.List". I've added a bounty to this and anyone that can help me solve this problem once and for all will get lots of lovely points. EDIT 2: I've looked a bit more into the problem and have come across Serialization as a potential answer. If anyone can look into this for me as I've no experience with Serialization or Deserialization I'd be very grateful. It can provide an Object with no problems whatsoever, but I really need to return it in the same format as it went in (List). EDIT 3: Ugh, this problem is really starting to drive me crazy and to be honest I'm starting to think that it's an unsolvable problem. If possible, could someone take a look at the code and help provide a solution for me?

    Read the article

  • WTL Child window event handling

    - by Rushi
    I am developing window application in that I am having 2 child windows on left and right side. I want to handle input events for both windows separately. How to achieve it? My code: class EditorWindow : public DxWindow { public: CSplitterWindow m_vSplit; CPaneContainer m_lPane; CPaneContainer m_rPane; PropertyDialog m_propertyWnd; DECLARE_WND_CLASS(_T("Specific_Class_Name")) BEGIN_MSG_MAP(EditorWindow) MESSAGE_HANDLER(WM_CREATE, OnCreate) MESSAGE_HANDLER(WM_DESTROY, OnDestroy) MESSAGE_HANDLER(WM_LBUTTONDOWN, KeyHandler) MESSAGE_HANDLER(WM_KEYUP, KeyHandler) MESSAGE_HANDLER(WM_LBUTTONDOWN, KeyHandler) END_MSG_MAP() LRESULT OnCreate(UINT, WPARAM, LPARAM, BOOL&) { CRect rcVert; GetClientRect(&rcVert); m_vSplit.Create(m_hWnd, rcVert, NULL, WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN); m_vSplit.SetSplitterPos(rcVert.Width()/1.4f); // from left m_lPane.Create(m_vSplit.m_hWnd); m_vSplit.SetSplitterPane(0, m_lPane); //m_lPane.SetTitle(L"Left Pane"); m_rPane.Create(m_vSplit.m_hWnd); m_vSplit.SetSplitterPane(1, m_rPane); m_rPane.SetTitle(L"Properties"); m_propertyWnd.Create(m_rPane.m_hWnd); //m_vSplit.SetSplitterPane(SPLIT_PANE_LEFT, md.m_hWnd); return 0; } LRESULT OnDestroy( UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled ) { PostQuitMessage(0); bHandled = FALSE; return 0; } LRESULT KeyHandler( UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled ) { return 0; } };

    Read the article

  • Wrong line number on stack trace

    - by Claudio Redi
    Hi! I have this code try { //AN EXCEPTION IS GENERATED HERE!!! } catch { SqlService.RollbackTransaction(); throw; } Code above is called in this code try { //HERE IS CALLED THE METHOD THAT CONTAINS THE CODE ABOVE } catch (Exception ex) { HandleException(ex); } The exception passed as parameter to the method "HandleException" contains the line number of the "throw" line in the stack trace instead of the real line where the exception was generated. Anyone knows why this could be happening?

    Read the article

  • AsyncTask, RejectedExecutionException and Task Limit

    - by Samuh
    I am fetching lots of thumbnails from a remote server and displaying them in a grid view, using AsyncTask. The problem is, my grid view displays 20 thumbnails at a time, so that creates 20 AsyncTasks and starts 20 executes, one per thumbnail. I get RejectedExecution exception in my code. I recall reading somewhere that there is a limit to number of tasks that AsyncTask can have in its queue at a time, i might be hitting that. Was this bar lifted? Is there a way to increase this limit? Is it safe to just ignore this exception?(by having an empty catch(RejectedException e){} block?) I am running this code on Android 1.6 emulator and the API level in my code(minSDKVersion is 3). [EDIT: Added SDK and API level info]

    Read the article

  • Cost of creating exception compared to cost of logging it

    - by Sebastien Lorber
    Hello, Just wonder how much cost to raise a java exception (or to call native fillInStackTrace() of Throwable) compared to what it cost to log it with log4j (in a file, with production hard drive)... Asking myself, when exceptions are raised, does it worth to often log them even if they are not necessary significant... (i work in a high load environment) Thanks

    Read the article

  • Questions regarding ordering of catch statements in catch block - compiler specific or language stan

    - by Andy
    I am currently using Visual Studio Express C++ 2008, and have some questions about catch block ordering. Unfortunately, I could not find the answer on the internet so I am posing these questions to the experts. I notice that unless catch (...) is placed at the end of a catch block, the compilation will fail with error C2311. For example, the following would compile: catch (MyException) { } catch (...) { } while the following would not: catch (...) { } catch (MyException) { } a. Could I ask if this is defined in the C++ language standard, or if this is just the Microsoft compiler being strict? b. Do C# and Java have the same rules as well? c. As an aside, I have also tried making a base class and a derived class, and putting the catch statement for the base class before the catch statement for the derived class. This compiled without problems. Are there no language standards guarding against such practice please?

    Read the article

  • When to log exception?

    - by Rune
    try { // Code } catch (Exception ex) { Logger.Log("Message", ex); throw; } In the case of a library, should I even log the exception? Should I just throw it and allow the application to log it? My concern is that if I log the exception in the library, there will be many duplicates (because the library layer will log it, the application layer will log it, and anything in between), but if I don't log it in the library, it'll be hard to track down bugs. Is there a best practices for this?

    Read the article

  • What is weird about wrapping setjmp and longjmp?

    - by Max
    Hello. I am using setjmp and longjmp for the first time, and I ran across an issue that comes about when I wrap setjmp and longjmp. I boiled the code down to the following example: #include <stdio.h> #include <setjmp.h> jmp_buf jb; int mywrap_save() { int i = setjmp(jb); return i; } int mywrap_call() { longjmp(jb, 1); printf("this shouldn't appear\n"); } void example_wrap() { if (mywrap_save() == 0){ printf("wrap: try block\n"); mywrap_call(); } else { printf("wrap: catch block\n"); } } void example_non_wrap() { if (setjmp(jb) == 0){ printf("non_wrap: try block\n"); longjmp(jb, 1); } else { printf("non_wrap: catch block\n"); } } int main() { example_wrap(); example_non_wrap(); } Initially I thought example_wrap() and example_non_wrap() would behave the same. However, the result of running the program (GCC 4.4, Linux): wrap: try block non_wrap: try block non_wrap: catch block If I trace the program in gdb, I see that even though mywrap_save() returns 1, the else branch after returning is oddly ignored. Can anyone explain what is going on?

    Read the article

  • Elmah is only logging 15 Errors

    - by Ev
    Hi, I've just starting looking at a site in place at work. They're using Elmah to log errors. It seems to be logging fine, but in the web interface, when I tell Elmah to show me 100 errors per page, it only shows the most recent 15. Then when I click on "Download Log" I only get shown 15 errors in the CSV. Anyone know how I can configure it to keep all the errors? Or can someone point me to some docs on how to do this? Thanks a lot! -Evan

    Read the article

  • How can I log and retrieve error messages from a client-side desktop app?

    - by KeyboardMonkey
    Update: The service-based answers below are most likely the way to go, I am also curious to see if there are any out-the-box solutions anyone has tried in the field. Our system uses a client-server architecture, and with more clients using it I'm thinking of better ways to log client application errors, and get them sent to us. Currently we just show a simple error message, with a button that preps an email (with the default system email client) and the clients send this on to our support address. This contains extra info like the stack trace. We also tried saving errors to a network share in the company, but I'm not too keen on that archaic solution either. Now there are only two businesses that refer to clients as users, and I'm sure some of ours support both lifestyles, as they just ignore the email button, and sends a full screen-shot wrapped nicely in a word document. Some factors I'm thinking of include A solution to log errors, like the contrived one above, A robust solution; Logging to a SQL database won't work; if that fails too, then what? Is at least semi-automated, preferably to the point where the logs reach my side. It copes with load, our client base is growing and the current solution, and our inboxes, won't hold up. Minimise installing extra 3rd party components on clients, I want to keep the SPOF to a min. I'd love to hear about any experience or suggestions you have on how I can implement such a solution. System Details It's a Microsoft .Net 2 based system with a SQL backend. Some users work remotely over the net, so network shares aren't always available (unless they VPN, which is awesomely slow at any rate). We have users across different companies, their DB's are hosted on-site. We have remote access to 90% of them.

    Read the article

  • HttpWebRequest.GetResponse() - what specific status codes cause an exception to be thrown?

    - by H. Morrow
    I've hunted around for some definitive documentation on this but haven't had much luck finding any. Basically - the question is - for which HTTP Status codes coming back from the server will HttpWebRequest.GetResponse() generate a WebException after doing something like say, a POST? Specifically - will it generate a WebException for anything other than status 200 OK? Or will it only generate a WebException for say, 400, 404, and 500 (for the sake of argument). I want to know since, the server I'm communicating with defines anything other than HTTP 200 OK coming back as an error condition - and the key is, can I rely on a WebException being generated for anything other than 200? (I've currently written my code so that it'll actually check the return status code everytime to ensure it's 200 OK and if it's not, take appropriate action - but it's alot of duplication between that, and the catch block for a WebException, and I'm hoping to clean it up...) Any relevant links to documentation would be most appreciated. Thanks!

    Read the article

  • Handling aces and finding a segfault in a blackjack program

    - by Bill Adams
    Here's what i have so far... I have yet to figure out how i'm going to handle the 11 / 1 situation with an ace, and when the player chooses an option for hit/stand, i get segfault. HELP!!! #include <stdio.h> #include <string.h> #include <stdlib.h> #include <time.h> #define DECKSIZE 52 #define VALUE 9 #define FACE 4 #define HANDSIZE 26 typedef struct { int value; char* suit; char* name; }Card; typedef struct { int value; char* suit; char* name; }dealerHand; typedef struct { int value; char* suit; char* name; }playerHand; Card cards[DECKSIZE]; dealerHand deal[HANDSIZE]; playerHand dealt[HANDSIZE]; char *faceName[]={"two","three", "four","five","six", "seven","eight","nine", "ten", "jack","queen", "king","ace"}; char *suitName[]={"spades","diamonds","clubs","hearts"}; void printDeck(){ int i; for(i=0;i<DECKSIZE;i++){ printf("%s of %s value = %d\n ",cards[i].name,cards[i].suit,cards[i].value); if((i+1)%13==0 && i!=0) printf("-------------------\n\n"); } } void shuffleDeck(){ srand(time(NULL)); int this; int that; Card temp; int c; for(c=0;c<10000;c++){ //c is the index for number of individual card shuffles should be set to c<10000 or more this=rand()%DECKSIZE; that=rand()%DECKSIZE; temp=cards[this]; cards[this]=cards[that]; cards[that]=temp; } } /*void hitStand(i,y){ // I dumped this because of a segfault i couldn't figure out. int k; printf(" Press 1 to HIT or press 2 to STAND:"); scanf("%d",k); if(k=1){ dealt[y].suit=cards[i].suit; dealt[y].name=cards[i].name; dealt[y].value=cards[i].value; y++; i++; } } */ int main(){ int suitCount=0; int faceCount=0; int i; int x; int y; int d; int p; int k; for(i=0;i<DECKSIZE;i++){ //this for statement builds the deck if(faceCount<9){ cards[i].value=faceCount+2; }else{ //assigns face cards as value 10 cards[i].value=10; } cards[i].suit=suitName[suitCount]; cards[i].name=faceName[faceCount++]; if(faceCount==13){ //this if loop increments suit count once cards[i].value=11; //all faces have been assigned, and also suitCount++; //assigns the ace as 11 faceCount=0; } //end building deck } /*printDeck(); //prints the deck in order shuffleDeck(); //shuffles the deck printDeck(); //prints the deck as shuffled This was used in testing, commented out to keep the deck hidden!*/ shuffleDeck(); x=0; y=0; for(i=0;i<4;i++){ //this for loop deals the first 4 cards, dealt[y].suit=cards[i].suit; //first card to player, second to dealer, dealt[y].name=cards[i].name; //as per standard dealing practice. dealt[y].value=cards[i].value; i++; y++; deal[x].suit=cards[i].suit; deal[x].name=cards[i].name; deal[x].value=cards[i].value; x++; } printf(" Dealer's hand is: %s of %s and XXXX of XXXX. (Second card is hidden!)\n",deal[0].name,deal[0].suit,deal[1].name,deal[1].suit); printf(" Player's hand is: %s of %s and %s of %s.\n",dealt[0].name,dealt[0].suit,dealt[1].name,dealt[1].suit); printf(" the current value of the index i=%d\n",i); //this line gave me the value of i for testing d=deal[0].value+deal[1].value; p=dealt[0].value+dealt[1].value; if(d==21){ printf(" The Dealer has Blackjack! House win!\n"); }else{ if(d>21){ printf(" The dealer is Bust! You win!\n"); }else{ if(d>17){ printf(" Press 1 to HIT or 2 to STAND"); scanf("%d",k); if(k==1){ dealt[y].suit=cards[i].suit; dealt[y].name=cards[i].name; dealt[y].value=cards[i].value; y++; i++; } }else{ if(d<17){ printf(" Dealer Hits!"); deal[x].suit=cards[i].suit; deal[x].name=cards[i].name; deal[x].value=cards[i].value; x++; i++; } } } } return 0; }

    Read the article

  • DHTML library for handling pictures and videos using AJAX

    - by Cawas
    This is based on my full question. I decided to take it in parts and see if I still can't get any help. What are all the options we've got for client-side frameworks? I've heard mostly about prototype and jquery, but I know there are way too many options out there beyond those two, and I don't know if they handle async download. From all of them which one is the fastest, both on the DHTML (interface) and the AJAX (download)? What are the advantages it has over the others?

    Read the article

  • DHTML library for handling pictures and their caches

    - by Cawas
    This is based on my full question. I decided to take it in parts and see if I still can't get any help. What are all the options we've got for client-side javascript graphical frameworks? I'm not even sure how to call this. Would it be just DHTML? Maybe Ajax? Well, I've heard mostly about prototype and jquery, but I know there are way too many options out there beyond those two. From all of them which one is the fastest for dealing with images? What are the advantages it has over the others?

    Read the article

  • Git & Web-design: handling multiple customized templates

    - by o_O Tync
    I'm developing a CMS (with Django, but that doesn't matter) and have chosen GIT. Installations will vary in: Configs Database contents Media Templates First 3 are not a problem with git: we simply don't need these :) While developing, I have 1 default template with related media. Later, each customer will receive his own design based on default templates (some slight customization). I'm not going to support each of the custom templates as I introduce new features. Modularity helps with this but is not a 100% solution. Do you have any experience to share?

    Read the article

  • Is it possible to handle User Defined Exception using JAX WS Dispatch API ?

    - by snowflake
    Hello, I'm performing dynamic webservices call using following code snippet: JAXBContext jc = getJAXBContext(requestClass, responseClass, jaxbContextExtraClasses); Dispatch<Object> dispatch = service.createDispatch(portQName, jc, Service.Mode.PAYLOAD); Object requestValue = getRequestValue(requestClass, pOrderedParameters); JAXBElement<?> request = new JAXBElement(new QName(serviceQNameStr, pOperationName), requestValue.getClass(), null, requestValue); Object tmpResponse = dispatch.invoke(request); Invocation works perfectly, except if I add a user defined exception on the service (a basic UserException extends java.lang.Exception). First I get: javax.xml.bind.UnmarshalException: unexpected element (uri:"http://schemas.xmlsoap.org/soap/envelope/", local:"Fault"). Expected elements are <{http://my.namespace/}myMethod,<{http://my.namespace/}myResponse Then I added the UserException_Exception JAX-WS generated type to my JAXB Context, and then get: Caused by: com.sun.xml.bind.v2.runtime.IllegalAnnotationsException: 1 counts of IllegalAnnotationExceptions java.lang.StackTraceElement does not have a no-arg default constructor. this problem is related to the following location: at java.lang.StackTraceElement at public java.lang.StackTraceElement[] java.lang.Throwable.getStackTrace() at java.lang.Throwable at java.lang.Exception Only solution available I found are: dispatch directly a Soap message and handle Soap fault directly (this is the way Jboss JAX-WS implementation performs a standard JAX-WS call using services interfaces). This is not an available solution for me, I want to use a high level implementation (the more I get close to Soap message the less dynamic my code can be) usage of JAXBRIContext.ANNOTATION_READER, which is implementation specific and not an available solution for me, in order to annotate annotates java.lang.Exception as @XmlTransient The service with a user defined exception performs well using the JAX-WS generated standard client stubs and using a tool such Soap UI. Problem occurs in deserialization of the message when I have no user defined exception artifact in the JAXB context, and during invocation when I add those non JAXB compatible artifacts in the JAXB context. I'm usign Jboss WS webservice stack within Jboss 4.2.3.GA Any elegant solution to this problem is welcomed !

    Read the article

  • Handling multiple UISwitch controls in a table view without using tag property

    - by Thaurin
    I have a table view controller with multiple UISwitch controls in them. I set the delegate to the table view controller with the same action for all switches. I need to be able to determine what switch was changed, so I create an array of strings that contains the name of each switch. The indexes in the array will be put in the tag property of each UISwitch. However, I'm ready using the tag property for something else, namely to find the right control in the cell in cellForRowAtIndexPath with viewWithTag! (There are several things I need to set within each cell.) So, am I thinking along the right lines here? I feel I'm rather limited in how I find out exactly which UISwitch changed its value, so I can do something useful with it.

    Read the article

  • Handling FormatExceptions using XmlSerializer.Deserialize

    - by qntmfred
    I have a third party web service that returns this xml <book> <release_date>0000-00-00</release_date> </book> I am trying to deserialize it into this class public class Book { [XmlElement("release_date")] public DateTime ReleaseDate { get; set; } } But because 0000-00-00 isn't a valid DateTime, I get a FormatException. What's the best way to handle this?

    Read the article

  • Building the WAR with m2eclipse in combination with WTP (handling webResources)

    - by waxwing
    I have a situation where I have a web application that is built using maven (i.e., maven-war-plugin). For each code modification, we have had to manually launch maven and restart the application server. Now, to reduce build cycle overhead, I want to use WTP to publish the webapp. Now, we have resource processing with Maven, and there are some additional Maven tasks defined in our POM when building the webapp. Therefore m2eclipse seems like a natural solution. I have gotten far enough that the Maven builder is running these tasks and filtering resources correctly. However, when I choose "Run on Server", the WAR file does not look like it would if I built it in Maven. I am guessing that this is because WTP actually builds the WAR, and not the m2eclipse builder. So even though we have configured the maven-war-plugin in our POM, those settings are not used. Below is a snippet with our maven-war-plugin configuration. What is configured under "webResources" is not picked up, it appears: <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-war-plugin</artifactId> <version>2.1-alpha-2</version> <configuration> <outputDirectory>${project.build.directory}</outputDirectory> <workDirectory>${project.build.directory}/work</workDirectory> <webappDirectory>${project.build.webappDirectory}</webappDirectory> <cacheFile>${project.build.webappDirectory}/webapp-cache.xml</cacheFile> <filteringDeploymentDescriptors>true</filteringDeploymentDescriptors> <nonFilteredFileExtensions> <nonFilteredFileExtension>pdf</nonFilteredFileExtension> <nonFilteredFileExtension>png</nonFilteredFileExtension> <nonFilteredFileExtension>gif</nonFilteredFileExtension> <nonFilteredFileExtension>jsp</nonFilteredFileExtension> </nonFilteredFileExtensions> <webResources> <!-- Add generated WSDL:s and XSD:s for the web service api. --> <resource> <directory>${project.build.directory}/jaxws/wsgen/wsdl</directory> <targetPath>WEB-INF/wsdl</targetPath> <filtering>false</filtering> <includes> <include>**/*</include> </includes> </resource> </webResources> </configuration> Do I need to reconfigure these resources to be handled elsewhere, or is there a better solution?

    Read the article

  • FileSystem.GetFiles() + UnauthorizedAccessException error?

    - by OverTheRainbow
    Hello, It seems like FileSystem.GetFiles() is unable to recover from the UnauthorizedAccessException exception that .Net triggers when trying to access an off-limit directory. In this case, does it mean this class/method isn't useful when scanning a whole drive and I should use some other solution (in which case: Which one?)? Here's some code to show the issue: Private Sub bgrLongProcess_DoWork(ByVal sender As System.Object, ByVal e As System.ComponentModel.DoWorkEventArgs) Handles bgrLongProcess.DoWork Dim drive As DriveInfo Dim filelist As Collections.ObjectModel.ReadOnlyCollection(Of String) Dim filepath As String 'Scan all fixed-drives for MyFiles.* For Each drive In DriveInfo.GetDrives() If drive.DriveType = DriveType.Fixed Then Try 'How to handle "Access to the path 'C:\System Volume Information' is denied." error? filelist = My.Computer.FileSystem.GetFiles(drive.ToString, FileIO.SearchOption.SearchAllSubDirectories, "MyFiles.*") For Each filepath In filelist DataGridView1.Rows.Add(filepath.ToString, "temp") 'Trigger ProgressChanged() event bgrLongProcess.ReportProgress(0, filepath) Next filepath Catch Ex As UnauthorizedAccessException 'How to ignore this directory and move on? End Try End If Next drive End Sub Thank you. Edit: What about using a Try/Catch just to have GetFiles() fill the array, ignore the exception and just resume? Private Sub bgrLongProcess_DoWork(ByVal sender As System.Object, ByVal e As System.ComponentModel.DoWorkEventArgs) Handles bgrLongProcess.DoWork 'Do lengthy stuff here Dim filelist As Collections.ObjectModel.ReadOnlyCollection(Of String) Dim filepath As String filelist = Nothing Try filelist = My.Computer.FileSystem.GetFiles("C:\", FileIO.SearchOption.SearchAllSubDirectories, "MyFiles.*") Catch ex As UnauthorizedAccessException 'How to just ignore this off-limit directory and resume searching? End Try 'Object reference not set to an instance of an object For Each filepath In filelist bgrLongProcess.ReportProgress(0, filepath) Next filepath End Sub

    Read the article

  • handling mouseover/mouseout events for dijit.TitlePane's titleNode

    - by Shailesh Kumar
    I have a lot of dijit.TitlePanes stacked up one after another. I wish to handle the onmouseover and onmouseout events for the tile part of the TitlePane. What is the correct way of doing this? Will something like : dojo.connect(titlePane.titleNode, 'onmouseover', function f() {}); work, where titlePane is a reference to some dijit.TitlePane object? Is there some declarative way of setting up such an event handler using "dojo/mehtod"?

    Read the article

  • Context menu event handling error - CS1061

    - by MrTemp
    I am still new to c# and wpf This program is a clock with different view and I would like to use the context menu to change between view, but the error says that there is no definition or extension method for the events. Right now I have the event I'm working on popping up a MessageBox just so I know it has run, but I cannot get it to compile. public partial class MainWindow : NavigationWindow { public MainWindow() { //InitializeComponent(); } public void AnalogMenu_Click(object sender, RoutedEventArgs e) { /*AnalogClock analog = new AnalogClock(); this.NavigationService.Navigate(analog);*/ } public void DigitalMenu_Click(object sender, RoutedEventArgs e) { MessageBox.Show("Digital Clicked"); /*DigitalClock digital = new DigitalClock(); this.NavigationService.Navigate(digital);*/ } public void BinaryMenu_Click(object sender, RoutedEventArgs e) { /*BinaryClock binary = new BinaryClock(); this.NavigationService.Navigate(binary);*/ } } and the xaml call if you want it <NavigationWindow.ContextMenu> <ContextMenu Name="ClockMenu" > <MenuItem Name="ToAnalog" Header="To Analog" ToolTip="Changes to an analog clock"/> <MenuItem Name="ToDigital" Header="To Digital" ToolTip="Changes to a digital clock" Click="DigitalMenu_Click" /> <MenuItem Name="ToBinary" Header="To Binary" ToolTip="Changes to a binary clock"/> </ContextMenu> </NavigationWindow.ContextMenu>

    Read the article

  • TRY/CATCH_ALL vs try/catch

    - by Tim
    I've been using c++ for a while, and I'm familiar with normal try/catch. However, I now find myself on Windows, coding in VisualStudio for COM development. Several parts of the code use things like: TRY { ... do stuff } CATCH_ALL(e) { ... issue a warning } END_CATCH_ALL; What's the point of these macros? What benefit do they offer over the built-in try/catch? I've tried googling this, but "try vs TRY" is hard to search for.

    Read the article

  • Proper way in Python to raise errors while setting variables

    - by ensnare
    What is the proper way to do error-checking in a class? Raising exceptions? Setting an instance variable dictionary "errors" that contains all the errors and returning it? Is it bad to print errors from a class? Do I have to return False if I'm raising an exception? Just want to make sure that I'm doing things right. Below is some sample code: @property def password(self): return self._password @password.setter def password(self,password): # Check that password has been completed try: # Check that password has a length of 6 characters if (len(password) < 6): raise NameError('Your password must be greater \ than 6 characters') except NameError: print 'Please choose a password' return False except TypeError: print 'Please choose a password' return False #Set the password self._password = password #Encrypt the password password_md5 = md5.new() password_md5.update(password) self._password_md5 = password_md5.hexdigest()

    Read the article

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