Search Results

Search found 4252 results on 171 pages for 'david 85'.

Page 122/171 | < Previous Page | 118 119 120 121 122 123 124 125 126 127 128 129  | Next Page >

  • Java - StackOverflow Error on recursive 2D boolean array method that shouldn't happen.

    - by David W.
    Hey everyone, I'm working on a runnable java applet that has a fill feature much like the fill method in drawing programs such as Microsoft Paint. This is how my filling method works: 1.) The applet gets the color that the user clicked on using .getRGB 2.) The applet creates a 2D boolean array of all the pixels in the window, with the value "true" if that pixel is the same color as the color clicked on or "false" if not. The point of this step is to keep the .getRGB method out of the recursive method to hopefully prevent this error. 3.) The applet recursively searches the 2D array of booleans where the user clicked, recording each adjacent point that is "true" in an ArrayList. The method then changes each point it records to false and continues. 4.) The applet paints every point stored in the ArrayList to a user selected color. All of the above steps work PERFECTLY if the user clicks within a small area, where only a few thousand pixels or so have their color changed. If the user selects a large area however (such as about 360,000 / the size of the applet window), the applet gets to the recursive stage and then outputs this error: Exception in thread "AWT-EventQueue-1" java.lang.StackOverflowError at java.util.ArrayList.add(ArrayList.java:351) at paint.recursiveSearch(paint.java:185) at paint.recursiveSearch(paint.java:190) at paint.recursiveSearch(paint.java:190) at paint.recursiveSearch(paint.java:190) at paint.recursiveSearch(paint.java:190) at paint.recursiveSearch(paint.java:190) at paint.recursiveSearch(paint.java:190) (continues for a few pages) Here is my recursive code: public void recursiveSearch(boolean [][] list, Point p){ if(isValid(p)){ if(list[(int)p.y][(int)p.x]){ fillPoints.add(p); list[(int)p.y][(int)p.x] = false; recursiveSearch(list, new Point(p.x-1,p.y));//Checks to the left recursiveSearch(list, new Point(p.x,p.y-1));//Checks above recursiveSearch(list, new Point(p.x+1,p.y));//Checks to the right recursiveSearch(list, new Point(p.x,p.y+1));//Checks below } } } Is there any way I can work around an error like this? I know that the loop will never go on forever, it just could take a lot of time. Thanks in advance.

    Read the article

  • XmlDocument, XmlResolver and www.w3.org

    - by David Rutten
    One of my users had a single error while opening a file (I'm using standard xml 1.0): The remote name could not be resolved: 'www.w3.org' I found a post here in StackOverflow that deals with this and it suggest setting the XmlResolver property to null. I've tried this, and all my documents still seem to load fine. However, the last thing I want is to break the file-reading mechanism of my app, so is it actually safe to disable the resolver?

    Read the article

  • in ruby, how do you make this nested hash work?

    - by David
    this one creates an error: @settings = { :tab1 => { :name => { :required => true }, :description } } need to change :descrpition to :description = {}, but i don't have any values for :description so i want it to remain as is (without the empty = {}) Would you show me the best way to handle this kind of situation? thanks in advance

    Read the article

  • Sending a large file over network continuously

    - by David Parunakian
    Hello, We need to write software that would continuously (i.e. new data is sent as it becomes available) send very large files (several Tb) to several destinations simultaneously. Some destinations have a dedicated fiber connection to the source, while some do not. Several questions arise: We plan to use TCP sockets for this task. What failover procedure would you recommend in order to handle network outages and dropped connections? What should happen upon upload completion: should the server close the socket? If so, then is it a good design decision to have another daemon provide file checksums on another port? Could you recommend a method to handle corrupted files, aside from downloading them again? Perhaps I could break them into 10Mb chunks and calculate checksums for each chunk separately? Thanks.

    Read the article

  • Symfony form's i18n and add_empty

    - by David
    I have this widget: $this->setWidget('slug', new sfWidgetFormDoctrineChoice(array('model' => 'MyTable', 'method' => 'myMethod', 'key_method' => 'myMethod', 'add_empty' => 'Select option'))); Ok, what should I do to translate the "Select option"? I can't use the __() helper inside the form, and adding that string into my XLIFF file doesn't translate it automatically. If it can't be done, what workaround should I implement? I can't find any way, and neither can't find any tip in the official documentation. Thanks!

    Read the article

  • Should member variables of global objects be made global as well?

    - by David Wong
    I'm developing plugins in Eclipse which mandates the use of singleton pattern for the Plugin class in order to access the runtime plugin. The class holds references to objects such as Configuration and Resources. In Eclipse 3.0 plug-in runtime objects are not globally managed and so are not generically accessible. Rather, each plug-in is free to declare API which exposes the plug-in runtime object (e.g., MyPlugin.getInstance() In order for the other components of my system to access these objects, I have to do the following: MyPlugin.getInstance().getConfig().getValue(MyPlugin.CONFIGKEY_SOMEPARAMETER); , which is overly verbose IMO. Since MyPlugin provides global access, wouldn't it be easier for me to just provide global access to the objects it manages as well? MyConfig.getValue(MyPlugin.CONFIGKEY_SOMEPARAMETER); Any thoughts? (I'm actually asking because I was reading about the whole "Global variable access and singletons are evil" debates)

    Read the article

  • @Unique doesn't have any effect in DataNucleus w/ NeoDatis

    - by David Parks
    Using JDO / DataNucleus / NeoDatis datastore I added @Unique to a field of a persistable object, however I am allowed to create multiple objects which violate the unique constraint. The docs for DataNucleus/NeoDatis suggest that Unique fields are supported. @PersistenceCapable public class User { @Persistent @Unique private String username; //... } If I add multiple objects to the DB with the same username there's no problem doing so. :(

    Read the article

  • LINQ query for tag system: Matching any of several tags?

    - by David Veeneman
    I am just getting started with LINQ. I am creating an Entity Framework app that uses the canonical Post and Tag model. A Post contains an ID, Text, and Tags, and a Tag contains an ID, a Name, and Posts. A previous thread on StackOverflow showed me how to query for a Post that matches all Tag objects (A and B and C) in a search list. But how would I query for a Post that matches any Tag (A or B or C) in the list? Thanks for your help.

    Read the article

  • Android - update widget text

    - by david
    Hi, i have 2 questions about widgets update I have 2 buttons and i need to change one button text when i press the other one, how can i do this? The first time i open the widget it calls the onUpdate method, but it never calls it again. I need to update the widget every 2 seconds and i have this line in the xml. android:updatePeriodMillis="2000" Do i need a service or should it works just with the updatePeriodMillis tag? onUpdate method RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.newswidget); Intent intent = new Intent(context, DetalleConsulta.class); intent.putExtra(DetalleConsulta.CONSULTA_ID_NAME, "3"); PendingIntent pendingIntent = PendingIntent.getActivity(context, 0, intent, 0); views.setOnClickPendingIntent(R.id.btNews, pendingIntent); /* Inicializa variables para llamar el controlador */ this.imei = ((TelephonyManager)context.getSystemService(Context.TELEPHONY_SERVICE)).getDeviceId(); this.controlador = new Controlador(this.imei); try { this.respuestas = this.controlador.recuperarNuevasRespuestas(); if(this.respuestas != null &amp;&amp; this.respuestas.size() &gt; 0){ Iterator&lt;Consulta&gt; iterRespuestas = this.respuestas.iterator(); views.setTextViewText(R.id.btNews, ((Consulta)iterRespuestas.next()).getRespuesta()); } } catch (PersistenciaException e) { //TODO manejar error } appWidgetManager.updateAppWidget(appWidgetIds, views); thx a lot!!!

    Read the article

  • C++ string array from ifstream

    - by David Beck
    I have a program that I need to read in an array of strings from a file. The array must be C type strings (char * or char[]). Using the following code, I get a bad access error: for (i = 0; i < MAX_WORDS && !inputFile.eof(); i++) { inputFile >> words[i]; } words is declared as: char *words[MAX_WORDS];

    Read the article

  • PS: Filter selected rows with only max values as output?

    - by David.Chu.ca
    I have a variable results ($result) of several rows of data or object like this: PS> $result | ft -auto; name value ---- ----- a 1 a 2 b 30 b 20 .... what I need to get all the rows of name and max(value) like this filtered output: PS> $result | ? |ft -auto name value ---- ----- a 2 b 30 .... Not sure what command or filters available (as ? in above) so that I can get each name and only the max value for the name out?

    Read the article

  • C++ online Role Playing Game (RPG)

    - by David
    So I've been learning C++ and SDL to make some basic 2d games. I want to create a game sort of like World of Warcraft but a 2D version. I want it to be on-line and use a database or something to start data like amount of Gold, HP, etc. I was wondering though, if I do this in SDL, would it still work on-line or would the user have to download SDL themselves to play? I just want a game like this but be able to play it with some friends, just for learning purposes you know. I was also looking at DirectX because everyone has that on windows pretty much. Anyways much help is appreciated, thanks!

    Read the article

  • Release variable and assigning it again

    - by David Gonrab
    What is the preferred and/or correct way to release an NSMutableString (or any other class for that matter) instance and assign a new instance to the same variable in Objective-C on the iPhone? Currently I'm using [current release]; current = [NSMutableString new]; but I understand that the following works, too. NSMutableString *new = [NSMutableString new]; [current release]; current = [new retain]; [new release]; The variable current is declared in the interface definition of my class and gets released in dealloc.

    Read the article

  • Confused with objects in Ruby

    - by David
    Ruby Newbie here, I understand that everything is an object in Ruby, one thing that I wasn't sure about was understanding Variables. Variables basically give reference to objects (correct me if I'm wrong). During an instructional video, the teacher did a demonstration which went as below: (irb) a = 100 ==> 100 b = a ==> 100 b ==> 100 This part I get, makes total sense. Then he did a = 50 ==> 50 b ==> 100 If B is supposed to point to what a was set which was a 100, why does b still point to 100 if a has now been set as 50?

    Read the article

  • Dynamic columns in C# rdlc report

    - by Mugume David
    Suppose I have a report that lists employees (as rows) with their respective taxes charged (in columns). It is possible for a new tax to come up. Since my rdlc report file is currently designed (from XML of-course) to statically generate the coulumns. A future shift in events will need me to alter the rdlc file and add in a new column. how can i do this dynamically. I intend to avoid opening the rdlc file and adding XML code.

    Read the article

  • Which CSS identifier is used for the selected tab in tabbed tables in browsers other than IE?

    - by David Navarre
    When you have a table on a form in Notes, you can choose to display only one row at a time (via the Special Table Row Display parameter on the Table Rows tab of the Table properties). In a Notes document displayed using Internet Explorer that contains such a table, a row is displayed with a cell for each "tab". The TD that serves as the tab for the selected "Notes table row" is assigned <td class="dominoSelTopTab">, while the other tabs get <td class="dominoTopTab">. However, when using other browsers, it's not nearly as simple. In Firefox, each "tab" ends up as a single-celled-single-row-table within the table with very little to identify it. <td><table border="1" cellpadding="2"> <tr><td><div align="center"><b>Tab 2</b></div></td></tr> </table></td> A non-selected tab would show as follows: <td><table border="1" cellpadding="2"> <tr><td><div align="center"><a name="1." href="/Projects/MyCSS.nsf/0c3b9489476440c085257a62006d97d6/d482a1767a4af77f85257a62006db064?OpenDocument&amp;TableRow=1.0#1." target="_self">Tab 1</a></div></td></tr> </table></td> So, the question is, how do I identify the selected tabs and the non-selected tabs when not using IE? Note: For those who are not Notes developers, the HTML is auto-generated from the visual design as laid out in the Notes designer client. I would replace it all with manual HTML, except there is so much of it that doing so would consume far too much time.

    Read the article

  • ASP.NET MVC2 - Trim white space from form submits before server-side validation?

    - by David Lively
    If I add a validation attribute: public class ProductDownloadListModel { //xxxxx-xxxxx-xxxxx [Required] [StringLength(17)] public string PSN { get; set; } public DateTime PsnExpirationDate { get; set; } public DataTable Downloads { get; set; } } and the user enters a 17-character string but includes white space on the end, I get a validation error because the string is greater than that specified by the [StringLength(17)] attribute. How can I prevent this? I'd prefer not to have to have javaScript trim the string before submits.

    Read the article

  • How to force Rails to use gem of version X

    - by David Lazar
    I have a rails app with the config/environment.rb line config.gem 'authlogic', :version => '2.1.2' The system gem for authlogic is 2.1.4 The one in my GEM_PATH is 2.1.2 No matter what I try, Rails is only using the 2.1.4 version, which is a problem. How to force rails to use 2.1.2? Thanks

    Read the article

  • named anchors not working in safari

    - by David
    Hi there, can anyone explain why named anchor tags would not work in safari but work fine in other browsers: ie, ff, opera, chrome. I have some links to different areas of the same page and nothing happens when clicking on them in safari only. All the other browsers mentioned take me to that area of the page. I have tried using both the id and the name attribute for the anchors but neither makes any difference.

    Read the article

  • Restricting access to a subdirectory on linux

    - by David
    I'm looking for a way to make a directory accessible only to its parent directories. That is, suppose you have two directories, A and B, at the same level in the file hierarchy. Now suppose that you have a directory A' which is a subdirectory of A. I'd like to enforce that A is able to access the contents of A' but B is not.

    Read the article

  • Sending an int from Java to C using sockets

    - by David Morris
    I was just wondering how to send an int from a Java application to a C application using sockets. I have got different C programs communicating with each other and have got the Java application retrieving data from the C application, but I can't work out sending. The C application is acting as database, the Java application then sends a user id (a 4 digit number) to the C application, if it exists it returns that record's details. In Java I have tried using a printWriter and DataOutputStream to send the data, printWriter produces weird symbols and DataOutputStream produces "prof_agent.so". Any help would be appreciated as I don't have a good grasp of sockets at the moment.

    Read the article

  • how do I iterate through multiple properties in jsp

    - by David
    I'm trying to iterate through a properties file which contains a list of keys like: message.p1 message.p2 message.p3 I don't know how many properties will be in the file, so I want to display any that are present. Is there a standard tag like <fmt:message> that can handle this, or do I need to write some jsp script to handle the loop?

    Read the article

< Previous Page | 118 119 120 121 122 123 124 125 126 127 128 129  | Next Page >