Daily Archives

Articles indexed Wednesday March 17 2010

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

  • No output from exception

    - by Grasper
    Why does this code not print an exception stack trace? import java.util.concurrent.Executors; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.TimeUnit; public class Playground { /** * @param args */ public static void main(String[] args) { startThread(); } private static void startThread() { ScheduledExecutorService timer = Executors .newSingleThreadScheduledExecutor(); Runnable r = new Runnable() { int dummyInt = 0; boolean dummyBoolean = false; @Override public void run() { dummyInt = Integer.parseInt("AAAA"); if (dummyBoolean) { dummyBoolean= false; } else { dummyBoolean= true; } } }; timer.scheduleAtFixedRate(r, 0, 100, TimeUnit.MILLISECONDS); } } How can I get it to? I would expect to see this: java.lang.NumberFormatException: For input string: "AAAA" at java.lang.NumberFormatException.forInputString(Unknown Source) at java.lang.Integer.parseInt(Unknown Source) at java.lang.Integer.parseInt(Unknown Source) at Playground$1.run(Playground.java:25) at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) at java.util.concurrent.FutureTask$Sync.innerRunAndReset(Unknown Source) at java.util.concurrent.FutureTask.runAndReset(Unknown Source) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(Unknown Source) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodic(Unknown Source) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source)

    Read the article

  • Does Java Spring 3.0 MVC support annotation/attribute based client side validation like Asp.net MVC

    - by Athens
    In Asp.Net MVC 2.0, at least in the beta, you could decoration your model classes with data annotation attributes and enable client side validation that leverages that criteria defined in your model data annotation attibutes. Is there anything similar for Java Spring MVC 3.0? Is it possible to inject a component into the response pipeline that can inspect the model's annotated properties and render client side validation logic to complement the server side validation logic that is invoked prior to the controller handling the request?

    Read the article

  • flash cs4: how to convert symbol to flex component?

    - by ufk
    Hiya I've read on the net that there is the flex component kit for flash that allows me to convert flash symbol to flex component or container. I tried installing Flex_Skins_12_05.mxp that suppose to enable these features in flash cs4 but under the commands tab i can't see any commands related to flex conversion. can someone please forward me to the appropriate plugin to install in flash cs4 in order to convert it's symbols to be usable with flex ? thanks

    Read the article

  • Hibernate MySQL transaction configuration issue

    - by James
    I'm having trouble starting a transaction with Hibernate and MySQL while running in JUnit. I'm getting a HibernateException which states: "No TransactionManagerLookup specified". I believe this error is because I don't have a proper configuration setting for hibernate.transaction.manager_lookup_class. I see that under the namespace of org.hibernate.transaction there are quite a few different lookup classes that I could use. All of the documentation that I could find on these was very vague. My question is what is the appropriate one for MySQL?

    Read the article

  • Load CoreData objects' string property into UIPickerView

    - by OscarTheGrouch
    Hello Currently I have an entity named "Events" in a CoreData app. "Events" has one string property named "eventName". In the -(void)viewDidLoad I am trying to Fetch all the "Events" objects and load their "eventName" by alphabetical order into a UIPickerView. The ultimate end goal is through the use of a textField, buttons and the pickerView being add new objects in and remove unwanted objects out. Basically turning the UIPickerView into a UITableView. Currently I am able to save objects to the CoreData store, but am not able to pull them/their properties out into the UIPickerView. I am willing and able to share the project source code to anyone who wants it, or is willing to look at it to help out. thanks Chris

    Read the article

  • iPhone Frameworks

    - by Kevin
    What is a strong iPhone framework to start out developing with, besides the SDK from Apple? Are there any that exist to speed up development time?

    Read the article

  • How to edit a link within a contentEditable div

    - by Travis
    Does anyone have any suggestions on how to edit an link in a contentEditable div? It would be ideal once the link is either clicked with mouse, or the cursor hits the link, that the a small prompt would pop up and allow the user to change the href property of the link. The prompt isn't the issue, but how is it possible to detect the link has been either clicked or that the cursor has arrived at the link? onfocus doesn't seem to work in a contentEditable div on Firefox & Safari. Any ideas?

    Read the article

  • xcode/iphone Code templates

    - by vilo
    Is there some tool in xcode that allows me to store snippets of code I often reuse in various applications so I do not have to retype it each time? I am talking about things like all the code that goes into defining Table Delegate Methods and Table Source Methods, UIAlertViews code and such. I just would like to have my own private repository where I can put snippets of code I think I may need in the future in other apps. Is there anything like that? Thanks for any help.

    Read the article

  • STAThread and Process output capture in c#

    - by alex
    Hi: This is a strange problem I encountered. I have an window application written in c# to do testing. It has a MDI parent form that is hosting a few children forms. One of the forms launch test cripts by creating processes and capture the scripts output to a text box. Another form open serial port and monitoring the status of the device I am working on(like a shell). If I ran both of them together, the output of the script seems only appear in the text box after the test is done. However, If I don't open the serial port form, the output of the script is captured in real time. Does anyone knows what's causing the problem? I notice the onDataReceived even handler for serial port form has a [STAThread] header to it. Will this cause the serial port thread having higher priority than other processes? Thanks in advance.

    Read the article

  • Changing view size when orientation changes

    - by Eyal Redler
    I want my UIView subclass to behave so that when it is fitted in portrait orientation is has a certain size and another size when fitted in landscape mode. Is it possible to have the view indicate to the view controller that's resizing it when the orientation changes that it has this "ideal size"? To clarify, I'm confident that this is not something that can be done with the autoresizing mask. I also thought that sizeThatFits: would be what I need but I didn't see it get called when the orientation changed. I'm also aware that I can get this done by overriding layoutSubviews of the superview (or maybe some other method of the view controller but I would like to have this behavior embedded in the view to facilitate reuse.

    Read the article

  • T4MVC Add-In to auto run template

    T4MVC is a fantastic solution to avoid 'Magic Strings' in ASP.NET MVC. Thanks to David Ebbo for this contribution which has made its way to MVCContrib. Must keep T4 template open and save it once.This has been the only negative thing about the template. I thought about writing an Add-In for VS to do this and even taked to David about doing it. Well, his latest post has inspired me to...Did you know that DotNetSlackers also publishes .net articles written by top known .net Authors? We already have over 80 articles in several categories including Silverlight. Take a look: here.

    Read the article

  • Multiple INET sockets (mulple IP's too) connected to UNIX sockets

    - by Andrew
    HOST = same host all the time, accepts multiple connection. I have a dedicated server and I will buy extra IP's. Socket 1 connects to HOST:PORT, from IP-1 Socket 2 connects to HOST:PORT, from IP-1 Socket 3 connects to HOST:PORT, from IP-1 Socket 4 connects to HOST:PORT, from IP-2 Socket 5 connects to HOST:PORT, from IP-2 Socket 6 connects to HOST:PORT, from IP-2 After creating all sockets I want to access them easy as UNIX sockets from PHP. /sys/socket1 /sys/socket2 /sys/socket3 /sys/socket4 /sys/socket5 /sys/socket6 I want the sockets to work in background (like daemon) and I want to be able to connect from PHP to any of this sockets and RECV/SEND whatever I want. I saw "socat" and I think that's the solution for me, please tell me how to use socat, or how to do it other way. Thankyou!

    Read the article

  • Use UdpClient with IPv4 and IPv6?

    - by mazzzzz
    A little while ago I created a class to deal with my LAN networking programs. I recently upgraded one of my laptops to windows 7 and relized that windows 7 (or at least the way I have it set up) only supports IPv6, but my desktop is still back in the Windows xp days, and only uses IPv4. The class I created uses the UdpClient class, and is currently setup to only work with IPv4.. Is there a way to modify my code to allow sending and receiving of IPv6 and IPv4 packets?? It would be hard to scrap the classes code, a lot of my programs rely on this class. I would like to keep the class as close to its original state, so I don't need to modify my older programs, only switch out the old class for the updated one. Thanks for any and all help, Max Send: using System.Net.Sockets;UdpClient tub = new UdpClient (); tub.Connect ( new IPEndPoint ( ToIP, ToPort ) ); UdpState s = new UdpState (); s.client = tub; s.endpoint = new IPEndPoint ( ToIP, ToPort ); tub.BeginSend ( data, data.Length, new AsyncCallback ( SendCallBack ),s); private void SendCallBack ( IAsyncResult result ) { UdpClient client = (UdpClient)( (UdpState)( result.AsyncState ) ).client; IPEndPoint endpoint = (IPEndPoint)( (UdpState)( result.AsyncState ) ).endpoint; client.EndSend ( result ); } Receive: UdpClient tub = new UdpClient (ReceivePort); UdpState s = new UdpState (); s.client = tub; s.endpoint = new IPEndPoint ( ReceiveIP, ReceivePort ); s.callback = cb; tub.BeginReceive ( new AsyncCallback ( receivedPacket ), s ); public void receivedPacket (IAsyncResult result) { UdpClient client = (UdpClient)( (UdpState)( result.AsyncState ) ).client; IPEndPoint endpoint = (IPEndPoint)( (UdpState)( result.AsyncState ) ).endpoint; Byte[] receiveBytes = client.EndReceive ( result, ref endpoint ); ReceivedPacket = new Packet ( receiveBytes ); client.Close(); //Do what ever with the packets now }

    Read the article

  • Is there something like a "long running offline transaction" for NHibernate or any other ORM?

    - by Vilx-
    In essence this is a followup of this question. I'm beginning to feel that I should give up the whole idea, but I'll give it one more shot. What I want is pretty much like a DB transaction. It should track my changes to the DB and then in the end allow me to either commit or rollback them. If I insert an object, I should get it back in my next (appropriate) SELECT query. If I delete it, future SELECT queries should not return it. Etc. But there is one catch - this transaction would be very long running. It would start when the user opened a form (I'm talking about Windows Forms here), and the commit/rollback would be when the user closed it(with OK/Cancel). So it could take anywhere between seconds and days. This requirement rules out a standard DB transaction because that would lock the tables/rows it touched, and other users wouldn't be able to use the system. Also the transaction should not commit ANY changes to the DB until it was really committed. So if one user makes some changes, others don't see them until OK button is hit. This prevents errors in case the computer crashes or is disconnected from the network. I'm quite OK if the solution puts constraints on my model (I'm using MSSQL 2008, btw). I can design the DB/code any way I like. I'm also fine with the idea that a commit could fail because someone already modified one of the objects my transaction touched. Is there anything like this? I looked at NHibernate.Burrow, but I'm not sure that that's the thing I want. Added: It's the very beginning of the project so I'm not tied to NHibernate. I started out with it but I can still change easily.

    Read the article

  • What was "The Next Big Thing" when you were just starting out in programming?

    - by Andrew
    I'm at the beginning of my career and there are lots of things which are being touted as "The Next Big Thing". For example: Dependency Injection (Spring, etc) MVC (Struts, ASP.NET MVC) ORMs (Linq To SQL, Hibernate) Agile Software Development These things have probably been around for some time, but I've only just started out. And don't get me wrong, I think these things are great! So, what was "The Next Big Thing" when you were starting out? When was it? Were people sceptical of it at first? Why? Did you think it would catch on? Did it pan out and become widely accepted/used? If not, why not? EDIT It's been nearly a week since I first posted this question and I can safely say that I did not expect such explosive interest. I asked the question so that I could gain a perspective of what kinds of innovations in programming people thought were most important when they were starting out. At the time of writing this I have read ~95% of all answers. To answer a few questions, the "Next Big Things" I listed are ones that I am currently really excited about and that I had not really been exposed to until I started working. I'm hoping to implement some or all of these in the near future at my current workplace. To many people they are probably old news. In regards to the "is this a real question" debate, I can see that obviously hasn't been settled yet. I feel bad whenever I read a comment saying that these kinds of questions take away from the real meaning of SO. I'm not wholly convinced that it doesn't. On the other hand, I have seen a lot of comments saying what a great question it is. Anyway, I have chosen "The Internet!" as my answer to this question. I don't think (in my very humble opinion, and, it seems many SOers opinions) that many things related to programming can compare. Nowadays every business and their dog has a website which can do anything from simply supplying information to purchasing goods halfway around the world to updating your blog. And of course, all these businesses need people like us. Thanks to everyone for all the great answers!

    Read the article

  • New functional languages

    - by AnnaR
    Functional programming has been around since at least 1958 (creation of Lisp), but is experiencing a renaissance now with old functional languages being dusted off and new functional languages being created. Which functional languages are there that are newly developed or are in the making? I realize that you can write purely functional programs in most high level languages, so with functional languages I imply languages that are specifically designed for functional programming such as F#. If you have links to tutorials, wikis or code examples I encourage you to add them to your answer!

    Read the article

  • Entity Framework - Why does EF use LEFT OUTER JOIN's in a 1-to-1 join?

    - by Taylor L
    Why does .NET Entity Framework produce SQL that uses a subquery and left outer join on a simple 1-to-1 relationship? I expected to see a simple join on the two tables. I'm using Devart Dotconnect for Oracle. Any ideas? Below is the output I see courtesy of the EFTracingProvider: SELECT 1 AS C1, "Join1".USER_ID1 AS USER_ID, ... FROM "MY$NAMESPACE".MYTABLE1 "Extent1" INNER JOIN (... FROM "MY$NAMESPACE".MYTABLE2 "Extent2" LEFT OUTER JOIN "MY$NAMESPACE".MYTABLE1 "Extent3" ON "Extent2".OTHER_ID = "Extent3".OTHER_ID ) "Join1" ON "Extent1".OTHER_ID = "Join1".OTHER_ID1 WHERE "Extent1".USER_ID = :EntityKeyValue1 -- EntityKeyValue1 (dbtype=String, size=6, direction=Input) = "000000"

    Read the article

  • CSS to Replace Table Layout for Forms

    - by Erick
    I've looked at other questions and am unable to find the solution to this. Consider this image: I want to wrap divs and stack them vertically. The GREEN div would be a wrapper on a line. The BLUE div would contain an html label and maybe icon for a tooltip. The ORANGE div would contain some sort of entry (input, select, textarea). Several of these would be stacked vertically to make up a form. I am doing this now, but I have to specify a height for the container div and that really needs to change depending on the content - considering any entry could land there. Images and other stuff could land here, as well. I have a width set on the BLUE div and the ORANGE is float:left. How can I get rid of the height on divs and let that be determined by content? Is there a better way? Changing all to something else would be difficult and would prefer a way to style all elements or something. The code I'm using is like: <div class=EntLine> <div class=EntLbl> <label for="Name">Name</label> </div> <div class=EntFld> <input type=text id="Name" /> </div> </div> The CSS looks like: .EntLine { height: 20px; position: relative; margin-top: 2px; text-align: left; white-space: nowrap; } .EntLbl { float: left; width: 120px; padding: 3px 0px 0px 3px; min-width: 120px; max-width: 120px; vertical-align: text-top; } .EntFld { float: left; height: 20px; padding: 0px; width: 200px; } Thanks!

    Read the article

  • Compile redeclaration error of global variable in C++, but not in C.

    - by coelhudo
    Suppose that I have those three files: a.h //a.h header #include <stdio.h> int int_variable; void a_f() { printf("int_variable: %d\n", int_variable) int_variable++; } b.h //b.h header #include <stdio.h> int int_variable; void b_f() { printf("int_variable: %d\n", int_variable) int_variable++; } main.c //main.c #include "a.h" #include "b.h" int main() { a_f(); b_f(); return 0; } Why compiling in C++ generates redefinition error, but in C doesn't? I am C++ developer, then in C++ makes sense to me, but why in C this is not an error? When I executed the C generated code, the output was: int variable: 0 int variable: 1 Thanks

    Read the article

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