Daily Archives

Articles indexed Sunday April 18 2010

Page 1/77 | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • while loop ignore the event listener

    - by Tamer
    so when i run this code to try to change the background the GUI crashes and gets stuck in a infinite while loop ignoring the event listeners. here is the code: `private Panel getPanel1() { if (panel1 == null) { panel1 = new Panel(); panel1.setLayout(new GridBagLayout()); while(frame.isVisible()){ panel1.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent e) { frame.setVisible(false); } }); int r = (int) (Math.random()*255); int g = (int) (Math.random()*255); int b = (int) (Math.random()*255); Color c = new Color(r, g, b); panel1.setBackground(c); try { Thread.sleep(4000); } catch (InterruptedException e1) { e1.printStackTrace(); } panel1.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent e) { /*panel1.setVisible(false); frame.setVisible(false);*/ System.exit(0); } }); } } return panel1; }` instead of exiting the loop of terminating the program or event changing the background it just displays the panel and does nothing else and i have to force it to quit. what should i do?

    Read the article

  • What's wrong with the analogy between software and building construction?

    - by kuosan
    Many people like to think of building software as constructing a building so we have terms like building blocks and architecture. However, lately I've been to a couple of talks and most people say this analogy is wrong especially around the idea of having a non-coding software architect in a project. In my experience, good software architects are those who also write code so they won't design things that only looks good on paper. I've worked with several Architecture Astronauts, who have either limited or outdated experience in programming. These architecture astronauts quite often missed out critical details in their design and cause more harm than good in a project. This makes me wonder what are the differences between constructing a software and a building? How come in the building industry they can have architects who probably never build a house in their life and purely handles design work but not in the software development field?

    Read the article

  • Threading 101: What is a Dispatcher?

    - by Water Cooler v2
    Once upon a time, I remembered this stuff by heart. Over time, my understanding has diluted and I mean to refresh it. As I recall, any so called single threaded application has two threads: a) the primary thread that has a pointer to the main or DllMain entry points; and b) For applications that have some UI, a UI thread, a.k.a the secondary thread, on which the WndProc runs, i.e. the thread that executes the WndProc that recieves messages that Windows posts to it. In short, the thread that executes the Windows message loop. For UI apps, the primary thread is in a blocking state waiting for messages from Windows. When it recieves them, it queues them up and dispatches them to the message loop (WndProc) and the UI thread gets kick started. As per my understanding, the primary thread, which is in a blocking state, is this: C++ while(getmessage(/* args &msg, etc. */)) { translatemessage(&msg, 0, 0); dispatchmessage(&msg, 0, 0); } C# or VB.NET WinForms apps: Application.Run( new System.Windows.Forms() ); Is this what they call the Dispatcher? My questions are: a) Is my above understanding correct? b) What in the name of hell is the Dispatcher? c) Point me to a resource where I can get a better understanding of threads from a Windows/Win32 perspective and then tie it up with high level languages like C#. Petzold is sparing in his discussion on the subject in his epic work. Although I believe I have it somewhat right, a confirmation will be relieving.

    Read the article

  • Fireing Android Dialogs from another thread without Message Loop

    - by Jox
    In a SurfaceView, I'm dispatching new thread that draws on canvas within standard "LockCanvas-Draw-unlockCanvasAndPost" loop. (note that thread doesn't contains message loop). How to show Android standard Dialog from that thread? As thread doesn't have msg loop, following code doesn't work: Builder builder = new AlertDialog.Builder(this); builder.setTitle("Alert"); builder.setMessage("Stackoverflow!"); builder.setNegativeButton("cancel", null); builder.show();

    Read the article

  • How to fix the endless printing loop bug in Nevrona Rave

    - by Sean B. Durkin
    Nevrona Designs' Rave Reports is a Report Engine for use by Embarcadero's Delphi IDE. This is what I call the Rave Endless Loop bug. In Rave Reports version 6.5.0 (VCL10) that comes bundled with Delphi 2006, there is a nortorious bug that plagues many Rave report developers. If you have a non-empty dataset, and the data rows for this dataset fit exactly into a page (that is to say there are zero widow rows), then upon PrintPreview, Rave will get stuck in an infinite loop generating pages. This problem has been previously reported in this newsgroup under the following headings: "error: generating infinite pages"; Hugo Hiram 20/9/2006 8:44PM "Rave loop bug. Please help"; Tomas Lazar 11/07/2006 7:35PM "Loop on full page of data?"; Tony Chistiansen 23/12/2004 3:41PM reply to (3) by another complainant; Oliver Piche "Endless lopp print bug"; Richso 9/11/2004 4:44PM In each of these postings, there was no response from Nevrona, and no solution was reported. Possibly, the problem has also been reported on an allied newsgroup (nevrona.public.rave.reports.general), to wit: 6. "Continuously generating report"; Jobard 20/11/2005 Although it is not clear to me if (6) is the Rave Endless loop bug or another problem. This posting did get a reply from Nevrona, but it was more in relation to multiple regions ("There is a problem when using multiple regions that go over a page-break.") than the problem of zero widows.

    Read the article

  • Are endless loops in bad form?

    - by rlbond
    So I have some C++ code for back-tracking nodes in a BFS algorithm. It looks a little like this: typedef std::map<int> MapType; bool IsValuePresent(const MapType& myMap, int beginVal, int searchVal) { int current_val = beginVal; while (true) { if (current_val == searchVal) return true; MapType::iterator it = myMap.find(current_val); assert(current_val != myMap.end()); if (current_val == it->second) // end of the line return false; current_val = it->second; } } However, the while (true) seems... suspicious to me. I know this code works, and logically I know it should work. However, I can't shake the feeling that there should be some condition in the while, but really the only possible one is to use a bool variable just to say if it's done. Should I stop worrying? Or is this really bad form. EDIT: Thanks to all for noticing that there is a way to get around this. However, I would still like to know if there are other valid cases.

    Read the article

  • Extending a DropDownList control

    - by Andrew Robinson
    I have a rather large application that has literally a hundred DDLs with Yes / No ListItems. In an attempt to same myself some time, I created a Custom Control that extends the standard DDL. It all seems to work fine but I am having some issues when assigning the SelectedValue property in code where the selected value does not seem to have an affect on the control. I wonder if I should be adding my items during Init or PagePreLoad? Should I be calling base.OnInit before or after I add the list items? This mostly works but not 100%. (v3.5) public class YesNoDropDownList : DropDownList { protected override void OnLoad(EventArgs e) { base.OnLoad(e); if (!Page.IsPostBack) { base.Items.Add(new ListItem("Yes", "YES")); base.Items.Add(new ListItem("No", "NO")); } } }

    Read the article

  • Get stacktrace from stuck python process

    - by piquadrat
    I have to run a legacy Zope2 website and have some grievance with it. The biggest issue is that, occasionally, it just locks up, running at 100% CPU load and not answering to requests anymore. While the problem isn't reproducible on a regular basis, one page containing 3 dynamic graphs triggers it sometimes, so I suspect some kind of race condition that leads to an endless loop or a stuck busywait. The problem is, I have not yet found a way to debug this thing. There's nothing in the Zope logs and nothing in the system logs. I tried the suggestions from this question to get a stacktrace, but the only signal that has any effect is SIGKILL. Is there another possibility to find out where exactly the process is when it gets stuck?

    Read the article

  • google android sdk [closed]

    - by user34373
    Possible Duplicate: google android with nmap I am trying to install a port scanner on android sdk which is installed on ubuntu.I have two problems: how to install any linux application on android SDK?? how to copy the data from the local hard drive to the emulator??

    Read the article

  • Is it ethical to let users see the request headers from visitors to a url shortening service?

    - by soniiic
    I'm currently in the progress of making a url shortening service that will let the creator see the http request headers that the browser has made when visitors visit the url. The visitors won't be made aware that they are being tracked, but obviously nothing is personally identifiable. Is there anything I should be made aware of ethically or legally that makes this a bad idea?

    Read the article

  • Importing AutoCAD/Solidworks drawings/objects into winforms?

    - by Dinoo
    Has anybody done anything like that? I need to import 3d objects, done in either AutoCAD or Solidworks, and draw them into a windows form. I only need the object to be viewed in 3D and moved around - no manipulation required. I am assuming I will need 2 libraries at least, one for a very simple 3D engine, and one to actually get what I need from the CAD/SW files. Autodesk has a SDK available for developing AutoCAD plugins using .NET, but I am not sure if you can use it the other way around - loading files into the .NET app. Any help, links, and ideas are appreciated.

    Read the article

  • Unix: how to have delimiter as "\t&\t" in paste-tool?

    - by HH
    Results are in clean files. I want to get them to latex-table format with paste. So how can I have a delimiter "\t&\t"? or is there some Latex tool? Pasting Columnwise to have \t&\t delimiter $ paste -d'\t\&\t' d d_powered_-2 rad 5.0 400.0&384.5 7.5 204.1&184.5 10.0 100.0&115.5 15.0 44.4&58.2 20.0 25.0&45.0 25.0 16.0&38.8 30.0 11.1&33.3 35.0 8.2&34.4 37.0 7.3&34.1 40.0 6.2&34.1 $ paste d d_powered_-2 rad 5.0 400.0 384.5 7.5 204.1 184.5 10.0 100.0 115.5 15.0 44.4 58.2 20.0 25.0 45.0 25.0 16.0 38.8 30.0 11.1 33.3 35.0 8.2 34.4 37.0 7.3 34.1 40.0 6.2 34.1

    Read the article

  • Right-margin marks in VS2010 text editors

    - by nc97217
    In VS2008, you could enable right-margin marks by creating a string registry entry named Guides under HKCU\Software\Microsoft\VisualStudio\9.0\Text Editor. It also worked with the express editions: replace VisualStudio with VCExpress or VCSExpress. The value I had was: RGB(192,192,192) 80, 100 which gave me light gray lines at columns 80 and 100. I've just tried (and failed) to set them up in VC++2010 Express and VC#2010 Express; does anyone know if they're still supported?

    Read the article

  • iPhone Gameloop render update from a separate thread

    - by Rich
    Hi, I'm new to iPhone development. I have a game loop setup as follows. (void)CreateGameTick:(NSTimeInterval) in_time { [NSThread detachNewThreadSelector:@selector(GameTick) toTarget:self withObject:nil]; } My basic game tick/render looks like this (void)GameTick { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; CGRect wrect = [self bounds]; while( m_running ) { [self drawRect: wrect]; } [pool release]; } My render function gets called. However nothing gets drawn (I am using Core Graphics to draw some lines on a derived UIView). If I call my update via a timer then all is well and good. Can you tell me why the render fails when done via threads? And is it possible to make it work via threads? Thanks Rich

    Read the article

  • Google Datastore w/ JDO: Access Times?

    - by Bosh
    I'm hitting what appears (to me) strange behavior when I pull data from the google datastore over JDO. In particular, the query executes quickly (say 100 ms), but finding the size of the resulting List< takes about one second! Indeed, whatever operation I try to perform on the resulting list takes about a second. Has anybody seen this behavior? Is it expected? Unusual? Any way around it? PersistenceManager pm = PMF.getPersistenceManager(); Query q = pm.newQuery("select from " + Person.class.getName() +" order by key limit 1000 "); System.out.println("getting all at " + System.currentTimeMillis()); mcs = (List<Med>) q.execute(); System.out.println("got all at " + System.currentTimeMillis()); int size = mcs.size(); System.out.println("size was " + size + " at " + System.currentTimeMillis()); getting all at 1271549139441 got all at 1271549139578 size was 850 at 1271549141071 -B

    Read the article

  • Reporting a WCF application's status to F5's Big IP products

    - by ng5000
    In a Windows Server 2003 environment with a self hosted .Net 3.5/WCF application, how can an application report its status to a BigIP Local Traffic Manager? Example: One of my services errors. My custom WCF application hosting software (written because Windows Server 2008 is not yet available and I'm using WCF TCP bindings) detects this and wants to report itself as down until it can recover the errant service. It needs to report itself as down to the BigIP LTM so that it is no longer sent client originated requests.

    Read the article

  • WCF, Metadata and BIGIP - Can I force the correct url for the WSDL items?

    - by Yossi Dahan
    We have a WCF service hosted on ServerA which is a server with no-direct Internet access and has a non-Internet routable IP address. The service is fronted by BIGIP which handles SSL encryption and decryption and forwards the unencrypted request to ServerA (at the moment it does NOT actually do any load balancing, but that is likely to be added in the future) on a specific port. What that means is that our clients would be calling the service through https://www.OurDomain.com/ServiceUrl and would get to our service on http://SeverA:85/ServiceUrl through the BIGIP device; When we browse to the WSDL published on https://www.OurDomain.com/ServiceUrl all the addresses contained in the WSDL are based on the http://SeverA:85/ServiceUrl base address We figured out that we could use the host headers setting to set the domain, but our problem is that while this would sort out the domain, we would still be using the wrong scheme – it would use http://www.OurDomain.com/ServiceUrl while we need it to be Https. Also – as we have other services (asmx based) hosted on that server we had some issues setting the host headers, and so we thought we could get away with creating another site on the server (using, say, port 82) and set the host header on that; now, on top of the http/https problem we have an issue as the WSDL contains the port number in all the urls, where BigIP works on port 443 (for the SSL) Is there a more flexible solution than implementing Host Headers? Ideally we need to retain flexibility and ease of supportability. Thanks for any help…

    Read the article

  • iPad UIWebView PDF rendering is giving me weird visual artifacts

    - by ashwhite
    I am having some difficulty using a UIWebView to render PDF files on the iPad. Everything works fine in portrait mode, but turning the device to landscape produces strange visual quirkiness. Zooming in (but not out) even the slightest will correct it, but obviously that's not an ideal workaround. The issue occurs with any PDF file (I have tried several, all stored locally in the bundle, not retrieved from the web). I also created a clone of the project for iPhone, which seems to work just fine, so the problem is iPad-specific. The problem occurs both in the simulator as well as on a physical iPad. Screenshot http://dev.boxkite.net/images/ipad/ipad-pdf.png Code NSString* filePath = [[NSBundle mainBundle] pathForResource:@"test" ofType:@"pdf"]; NSData* data = [NSData dataWithContentsOfFile:filePath]; [self.webView loadData:data MIMEType:@"application/pdf" textEncodingName:@"UTF-8" baseURL:nil]; Thanks so much for your time.

    Read the article

  • WCF Service behind F5 Bigip endpoint issue

    - by John
    we have WCF services hosted on IIS in 4 web servers, these web servers are behind the F5 Bigip load balancing system, SSL accelarator. When the client calls the service it'll be calling https myserver.com/myservices.svc but actually .svc will be in different servers like http web1.mysever.com/myservices.svc, http web2.mysever.com/myservices.svc, etc how do we handle this issue?

    Read the article

  • height worked out dynamically at rendering time

    - by nourdine
    hello I have to make a simple layout in android but have problem with the heigh of the central element. basically I have a header, a body and a footer. header and footer have fixed height but I'd like the body to fill the remaining space. this should be screen size independent so I'd like the height of the body to be dynamically worked out when the layout is being rendered. do you guyz know how I can achieve the result? thanks

    Read the article

1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >