Search Results

Search found 4077 results on 164 pages for 'throw'.

Page 90/164 | < Previous Page | 86 87 88 89 90 91 92 93 94 95 96 97  | Next Page >

  • Why does casting a NaN to a long yeild a valid result?

    - by brainimus
    In the sample code below I am dividing by zero which when I step through it with the debugger the (dividend / divisor) yeilds an Infinity or NaN (if the divisor is zero). When I cast this result to a long I get a valid result, usually something like -9223372036854775808. Why is this cast valid? Why doesn't it stop executing (throw an exception for example) rather than assign an arbitrary value? double divisor = 0; double dividend = 7; long result = (long)(dividend / divisor);

    Read the article

  • What's a good place to unregister an observer from the notification center?

    - by mystify
    When I add an observer to the default notification center, where would I unregister that? Example: I have a UIView subclass which lives inside a view controller. That subclass is an observer for the FooBarNotification. If this notification is posted, that view will get it. But now, the view controller decides to throw away the view. Is the best place the -dealloc method of the view itself? Are there any rules like memory management rules? For example: Must I unregister an observer where I registered it? i.e. the view registers itself in it's init method, so it should unregister itself in it's -dealloc method? (not talking about push notifications, but NSNotificationCenter)

    Read the article

  • Oracle curcular join sometimes give duplicates, but sometimes does not

    - by Kaushik
    By mistake I wrote a query like this: select * from a,b,c where a.col=b.col and b.col2=c.col2 and c.col3=a.col4 So there is a circular join here. Now the thing is sometimes this query returns duplicate result, sometimes it returns unique(correct) results. I am trying to understand why it does not give duplicate results always. Also if circular joins are not allowed, how come Oracle does not throw an error. EDIT: This is the actual query. After reading ti carefully, I am not sure anymore if this is a circular join or not.It does not seem so...but why I get duplicates only sometime? select * from a,b,c,d where a.col=b.col and b.col=c.col and c.col2=d.col2 and d.col2 =a.col2

    Read the article

  • Can my tortoise vs. hare race be improved?

    - by FredOverflow
    Here is my code for detecting cycles in a linked list: do { hare = hare.next(); if (hare == back) return; hare = hare.next(); if (hare == back) return; tortoise = tortoise.next(); } while (tortoise != hare); throw new AssertionError("cyclic linkage"); Is there a way to get rid of the code duplication inside the loop? Am I right in assuming that I don't need a check after making the tortoise take a step forward? As I see it, the tortoise can never reach the end of the list before the hare (contrary to the fable). Any other ways to simplify/beautify this code?

    Read the article

  • how to generate large image in compact framework

    - by Buthrakaur
    I need to generate large images (A4 image at 200 DPI, PNG format would be fine) in my compact framework application. This is impossible to do in standard way due to memory limitations (such big image will throw OOMException). Is there any library which offers file-backed stream image generation? Or I could generate many smaller stripes of images (each stripe representing a row of the large image) using standard Bitmap approach, but I need to merge them together afterwards - is there any method how to merge many smaller images into one large without having to instantiate large Bitmap instance (which would again cause OOM)?

    Read the article

  • How to warn for the use of unset variables in a korn shell script

    - by Lepu
    Is there any way to throw errors or warnings in a korn shell script to prevent the use of unset variables ? Let's assume I have a temporary folder that I want to remove. TEMP_FILES_DIR='/app/myapp/tmp' rm -Rf $TEMP_FILE_DIR #notice the misspelling How to prevent this kind of mistakes before they actually happen? I know the script should check for file existence and empty string before attempting to remove, this is just a silly example to illustrate a mistake that could have been avoided with some warnings. I don't know if this feature exists in ksh. If it does exist, how do you turn it on?

    Read the article

  • inconsistency between Sun JRE javac and Eclipse java compiler?

    - by Jason S
    This confuses me. The following compiles fine under Eclipse. package com.example.gotchas; public class GenericHelper1 { static <T> T fail() throws UnsupportedOperationException { throw new UnsupportedOperationException(); } /** * just calls fail() * @return something maybe */ public boolean argh() { return fail(); } public static void main(String[] args) { // TODO Auto-generated method stub } } But if I try to do a clean build with ant, or at the command line with javac, I get this: src\com\example\gotchas\GenericHelper1.java:14: type parameters of <T>T cannot be determined; no unique maximal instance exists for type variable T with upper bounds boolean,java.lang.Object public boolean argh() { return fail(); } ^ 1 error what gives, and how do I fix it?

    Read the article

  • Cannot move ckeditor 4 selection to beginning

    - by Gary Hillerson
    I've been exploring numerous solutions in stackoverflow and elsewhere to try to get ckeditor 4 to scroll to the top after I've programmatically added a number of pages to it, using CKEditor's InsertHtml function. After adding my html, which looks fine, I want to position the cursor at the beginning. Here's one of a variety of things I've tried without success: function MoveCaretToStart(myEditor) { var range = new CKEDITOR.dom.range( editor.document ); range.selectNodeContents(editor.document.getBody()); range.moveToElementEditStart(range.root); // also tried range.collapse(true); range.select(); } ... MoveCaretToStart(CKEDITOR.instances['myEditor']); // which already has contents in it This doesn't throw any errors, but also doesn't move the cursor position (it remains at the end of the doc). I thought this one would be easy, but it sure hasn't been. Any help appreciated.

    Read the article

  • How to see variable in calling function in visual studio?

    - by carter-boater
    Hi all, Does anyone know how to watch a variable in calling function. For example: C#: void fn a() { int myVar=9; b(); } b() { Throw new Exception(); } How can I watch myVar when I get the exception in function b?? I have a really big recursive function with in a loop and get an exception in one iteration. I don't know which iteration it belongs to$%^&*(. The thing I did was to promote my intersted variable to global so I can watch them anywhere. However, I don't think that's a good idea only for debug. Thanks everyone!

    Read the article

  • iPhone SDK : Spinner not Working

    - by iPhone Developer
    I would like to use a spinner. But, this code below does not display a spinner and I'm not sure why. How to make this work? BTW, It is being called from a submit button I created. //spinner declared in .h file UIActivityIndicatorView *aSpinner; //throw up spinner from submit btn we created aSpinner = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge]; [self.view addSubview:aSpinner]; [aSpinner release]; [aSpinner startAnimating]; //send blocking request [request startSynchronous]; //get rid of spinner when finished delegate is fired - (void)requestFinished:(ASIHTTPRequest *)request { NSLog(@"REQUEST FINISHED"); [aSpinner stopAnimating]; //[aSpinner release]; }

    Read the article

  • Android: heavy traffic on server causes app to force close

    - by user522559
    I have developed an app to communicate with my own server and published it. However, sometimes the app force closes. I know there is no bug in the code because the app works properly most of the time, but sometimes it is waiting for an answer from the server forever. I think this is due to the fact that so many people are using the app, and the app refreshes every 1 second or so, so this heavy traffic causes the server to take a large amount of time to respond. So how do you take care of such a use case? should I have a use case where if the server does not respond after some time you just stop the app and throw a message saying that the server is not responding or something like that?

    Read the article

  • wamp magento no admin page

    - by Mortgage Ms
    I have a live magento website hosted in Bluehost, I just installed wamp and tried to clone the live website to local wamp server. After some configuration changed from live server to local, the site is working with no problem, however, there is no admin page! If I go to localhost/magento/admin, it takes me to 404 page and throw error: The requested URL /magento/admin was not found on this server. How do I fix this? Thanks lots. Server info: wampserver2.2e-php5.4.3-httpd2.2.22-mysql5.5.24-32b

    Read the article

  • Cygwin GCC + WinXP cmd.exe does nothing

    - by Stephen Friederichs
    My basic problem is that if I run GCC from the windows command line (cmd.exe in Windows XP) and it does nothing: no .o files are created, no error messages, nothing. It will only throw an error message if I use DOS-style paths, but nothing else. When I run from the Cygwin shell then it will throws error messages as appropriate for the errors in the source and produces the .o files as it needs. Using 'make' from the DOS command line doesn't work either. Has anyone encountered this behavior before?

    Read the article

  • SQL Compact Edition 3.5 SP 1 - LockTimeOutException - how to debug?

    - by Bob King
    Intermittently in our app, we encounter LockTimeoutExceptions being throw from SQL CE. We've recently upgraded to 3.5 SP 1, and a number of them seem to have gone away, but we still do see them occasionally. I'm certain it's a bug in our code (which is multi-threaded) but I haven't been able to pin it down precisely. Does anyone have any good techniques for debugging this problem? The exceptions log like this (there's never a stack trace for these exceptions): SQL Server Compact timed out waiting for a lock. The default lock time is 2000ms for devices and 5000ms for desktops. The default lock timeout can be increased in the connection string using the ssce: default lock timeout property. [ Session id = 6,Thread id = 7856,Process id = 10116,Table name = Product,Conflict type = s lock (x blocks),Resource = DDL ] Our database is read-heavy, but does seldom writes, and I think I've got everything protected where it needs to be. EDIT: SQL CE already automatically uses NOLOCK http://msdn.microsoft.com/en-us/library/ms172398(sql.90).aspx

    Read the article

  • Referencing control on one form from another form VB.NET

    - by Tom
    My gosh man, why is this so complicated in VB.NET? As you can guess, I'm kind of new to .NET and just want to reference a control on one form from another. Usually I would just do Form.Control.Property but that doesn't work and every example I've found through Google doesn't work for me. It just seems overly complicated with public classes, etc. Is there a more simpler way to do this? I'm ready to throw in the towel and just use a global variable at this point. I have the form containing the control I want to reference, frmGenerate which has a textbox called txtCustomerNo. From this form through a button's click event I want to show another form, frmCustomers, and have that form reference the value in txtCustomerNo. frmCustomers.ShowDialog() It has to be something simple that I'm just not grasping. Thanks.

    Read the article

  • Web Service returning object with null fields

    - by Xaiter
    Never seen this one before. WebService.Implementation imp = new WebService.Implementation(); WebService.ImplementationRequest req = new WebService.ImplementationRequest(); return imp.GetValue(req); The object that imp returns is not null. It's returning an ImplementationResponse, as expected. But all of the fields in that object are null. Which is not expected. The WebService, currently, just returns some constant dummy data. We've tested this on another developer's machine, works just fine. I suppose I should also note that the WebService should throw an exception if I pass null into the GetValue method. It doesn't. Not for me. Any idea what could be wrong with my environment that could make a WebService return an object, but make every value in that object null? And somehow 'magically' return this mystery object when it should be throwing an exception?

    Read the article

  • problem-configure-jboss-to-work-with-jndi(3)

    - by Spiderman
    Sorry for opening new thread every time for the same problem. It's just that I'd like to refine my question during my investigation and it's hard to do it in stackoverflow structure on the same question (maybe on purpose). Anyway, in continuation to this thread http://stackoverflow.com/questions/2843218/problem-configure-jboss-to-work-with-jndi2 I discovered that when running an application that is deployed on my JBoss 4.2.3.GA, when I perform: Context initialContext = new InitialContext(); Object dataSource = initialContext.lookup("java:/DefaultDS"); I get null as a return value even though DefaultDS is the default datasource that comes with Jboss installation. and generally, how come initialContext return null value? if the datasource is not found it should throw NamingException and in other case it should return real object. What can I do with null? isn't it a bad error handling of javax.naming.InitialContext ???

    Read the article

  • How to rate a connect four game situation in java

    - by MrPink
    Hey, I am trying to write a simple AI for a "Get four" game. The basic game principles are done, so I can throw in coins of different color, and they stack on each other and fill a 2D Array and so on and so forth. until now this is what the method looks like: public int insert(int x, int color) //0 = empty, 1=player1 2=player2" X is the horizontal coordinate, as the y coordinate is determined by how many stones are in the array already, I think the idea is obvious. Now the problem is I have to rate specific game situations, so find how many new pairs, triplets and possible 4 in a row I can get in a specific situation to then give each situation a specific value. With these values I can setup a "Game tree" to then decide which move would be best next (later on implementing Alpha-Beta-Pruning). My current problem is that I can't think of an efficient way to implement a rating of the current game situation in a java method. Any ideas would be greatly appreciated! greetings from Germany Mr. Pink

    Read the article

  • Model's method not being recognized when called

    - by Brian Roisentul
    I'm using ruby on rails 2.3.2 and also using the acts_as_taggable_on puglin. That generated me two db tables: tags and taggings. As I didn't need anything more from those, I didn't create a Tag model, for example. Now the project is more mature, I need to create some methods for tags, so I created a Tag model with some methods in it. The model looks something like this: class Tag < ActiveRecord::Base def self.get_parent parent = Tag.find(self.parent_id) return parent end end When I call it from a controller, it won't find the method. This is the code: tag = Tag.find(tag_id) the_parent = tag.get_parent This will throw an error saying: undefined method `get_parent' for #<Tag id: 13, name: "Historia", parent_id: 12> I don't know what's wrong. Any help will be appreciated.

    Read the article

  • Why does System.Threading.Timer callback successfully update UI?

    - by Geo P
    I have several System.Threading.Timers on my form application with callbacks that update the UI...successfully - i.e. without throwing errors. I had built these earlier, before I knew that UI should not be updated on any thread other than the UI thread. Now I am confused as to why it does not throw cross-thread exceptions when I am updating UI on these separate threading.timer threads? I will be changing these callbacks so that the UI updates are invoked on UI thread, but I am curious as to why this works. Edit: My application is a WinForms Application.

    Read the article

  • What is wrong with my JPGEncoder

    - by hitek
    Here is my code if (event.target.content is Bitmap) { infotext.text = "got something"; var image:Bitmap = Bitmap(event.target.content); var bitmapData:BitmapData = image.bitmapData; this.addChild(image); var j:JPGEncoder = new JPGEncoder(100); var bytes:ByteArray = new ByteArray(); bytes=j.encode(bitmapData); } else { throw new Error("What the heck bob?"); } When I run a debug session everything works fine till it reaches to the line bytes=j.encode(bitmapData); after that nothing happens and my program just goes into limbo Please help

    Read the article

  • Anonymous iterator blocks in Clojure?

    - by Checkers
    I am using clojure.contrib.sql to fetch some records from an SQLite database. (defn read-all-foo [] (with-connection *db* (with-query-results res ["select * from foo"] (into [] res)))) Now, I don't really want to realize the whole sequence before returning from the function (i.e. I want to keep it lazy), but if I return res directly or wrap it some kind of lazy wrapper (for example I want to make a certain map transformation on result sequence), SQL-related bindings will be reset and connection will be closed after I return, so realizing the sequence will throw an exception. How can I enclose the whole function in a closure and return a kind of anonymous iterator block (like yield in C# or Python)? Or is there another way to return a lazy sequence from this function?

    Read the article

  • Visual Studio 2010 debug minidump

    - by Snake
    Hi all, Consider the following code (written with Visual Studio 2010 and .NET 4.0) using System; namespace DumpTester { class Program { static void Main(string[] args) { int test = new Random().Next(); Console.WriteLine(test + new Random().Next()); Test(); } private static void Test() { throw new Exception(); } } } When running outside of Visual Studio you get this nice window of Microsoft Windows 7 that it is looking for a solution. Obviously, since this is my app, there is none. At that point I create a full dump file of my application with for example Process Explorer. I then open that dmp file from its location and try to debug. But whatever I try, it can't find the location of the source symbols. I tried putting the pdb next to the dump but it just doesn't find it. What am I doing wrong?

    Read the article

  • c++: strange syntax in what() method of std::exception

    - by Patrick Oscity
    When i am inheriting from std::exception in order to define my own exception type, i need to override the what() method, which has the following signature: virtual const char* what() const throw(); This definitely looks strange to me, like if there were two method names in the signature. Is this some very specific syntax, like with pure virtual methods, e.g.: virtual int method() const = 0; or is this a feature, that could somehow be used in another context, too? And if so, for what could it be used?

    Read the article

  • "input cannot be resolved" when added a try..catch

    - by Mark
    I originally tried to get my throw statement to work without a try catch and the userInput = input.nextInt(); line worked fine. But when I tried adding the try..catch it didn't like my input saying it cannot be resolved. I don't think my try..catch is correct yet but I am planning on tackling that after I can get this input to be recognized but I would appreciate any feedback on things you see with that as well. Thanks import java.util.Scanner; public class Program6 { public static void main(String[] args) { final int NUMBER_HIGH_LIMIT = 100; final int NUMBER_LOW_LIMIT = 10; int userInput; try { System.out.print("Enter a number between 10 and 100: "); userInput = input.nextInt();//Says input cannot be resolved Verify v = new Verify(NUMBER_HIGH_LIMIT, NUMBER_LOW_LIMIT); } catch(NumberHighException exception) { userInput = 0; } catch(NumberLowException exception) { userInput = 0; } } }

    Read the article

< Previous Page | 86 87 88 89 90 91 92 93 94 95 96 97  | Next Page >