java

Android Settings.ACTION_DISPLAY_SETTINGS not found

I want to adjust display settings in my activity. Intent intent=new Intent(Settings.ACTION_DISPLAY_SETTINGS); startActivity(intent); got exception: 09-24 21:24:35.901: ERROR/AndroidRuntime(5892): android.content.ActivityNotFoundException: No Activity found to handle Intent { action=android.settings.DISPLAY_SETTING...

Hibernate lost reference after calling save. Do you know why ?

Hi, Take a look at the following classes (UNIdirectional @OneToMany) @Entity public class Team { private Integer id = -1; @Id @GeneratedValue public Integer getId() { return this.id; } private List<Player> playerList; @OneToMany @Cascade(CascadeType.SAVE_UPDATE) @JoinColumn(name="TEAM_ID...

Authenticating Windows users in Java server

I'm working on a server written in Java, and a client (a desktop application written in .Net) that runs on Windows machines on the same network. I would like to have some basic authentication so that the server can determine the username of the user running the client, without needing the user to re-enter their Windows password in the c...

check if two integers sum to a third

Ok I'm doing this programming assignment and need a little help. Here is the problem: Given three ints, a b c, return true if it is possible to add two of the ints to get the third. twoAsOne(1, 2, 3) → true twoAsOne(3, 1, 2) → true twoAsOne(3, 2, 2) → false Here's the what I have gotten so far: public boolean twoAsOne(int a, int b,...

Working with a List of Lists in Java

I'm a newbie java programmer and having some difficulties with [Array]List. Specifically, I'm trying to read a CSV file into a list of lists (of strings), pass it around for getting some data from a database, build a new list of lists of new data, then pass that list of lists so it can be written to a new CSV file. I've looked all over a...

type of object references in ruby

Hello, I am new to Ruby and currently trying a few examples from the Ruby book I am using as a guide: class Account attr_accessor :balance def initialize(balance) @balance = balance end end class Transaction def initialize(account_a, account_b) @account_a = account_a @account_b = account_b end def debit(account,amount) a...

Struts Synchronizer Token

If I implement the Synchronizer Token in my struts application, would i need to edit all my forms to add some kind of tag for the token or is that done automatically by struts? ...

Java memory mystery (do I have a leak)?

I have a standalone Java problem running in a linux server. I started the jvm with -Xmx256m. I attached a JMX monitor and can see that the heap never really passes 256Mb. However, on my linux system when I run the top command I can see that: 1) First of all, the RES memory usage of this process is around 350Mb. Why? I suppose this is be...

Hibernate UserType nullSafeSet - how to know if called for insert/update or select

I have a custom UserType which stores a date/time value in a TIMESTAMP field and is updated to the current time 'in UTC' when the record is inserted or updated. (This field is not used for versioning or for id purposes.) The problem is that this works very nicely but if you need to run a query where this field is one of the criteria w...

SQL Server To MY SQL

I got a new project from my teacher to convert database to another. How can I convert a MS SQL database into MYSQL using JAVA ...

change key of mp3 song with java

I know there are a few posts about various media frameworks out there, but I am looking for something a little more specific. I would love to be able to take an mp3 and transpose it to a new key. Any suggestions? ...

Implementing Arp Sweep

I have been playing with libpcap/jpcap. Implementing a arp sweeper. I send a request for all ip's in the block to the broadcast address and read replies. Now i can't think of a way to exit from the listening function. Now i wait 2 secs and assume ever client responded but this just seems dirty. Can anyone recommend a logic to determine i...

How to add button in a row of JTable in Swing java

Hello, I have made one swing GUI which have JTable with some rows and Columns.How should I add a button to row in a JTable ? ...

How do you bind a language (python, for example) to another (say, C++)?

I'm far from a python expert but I hear this one all the time, about its C/C++ bindings. How does this concept work, and how does Python (and Java) bind to C-based APIs like OpenGL? This stuff has always been a mystery to me. ...

Unit test with files system dependency - hidden files

I am writing a "Total Commander" like application in Java. There is quite obvious file system dependency here. I want to unit test it. I created directory structure for test purposes, I keep it in known location in SVN repository. It works great so far. Now, I have a method that should ignore hidden files. How can I go about this? Can...

Insert string in beginning of another string

Hello All, How to insert a string enclosed with double quotes in the beginning of the StringBuilder and String? Eg: StringBuilder _sb = new StringBuilder("Sam"); I need to insert the string "Hello" to the beginning of "Sam" and O/p is "Hello Sam". String _s = "Jam"; I need to insert the string "Hello" to the beginning of "Jam" an...

Any java library for ppt to jpg conversion?

Hi, Do you know any java library for ppt to jpg conversion? I've tried openoffice3 and POI (http://poi.apache.org/slideshow/quick-guide.html). OpenOffice takes quite long to load (full startup), even though I want to convert the slides only. POI-HSLF only generates images for simple slides (created by myself). all the test slides get...

JNA-Mapping Delphi Function

Hi! How do i map this function with JNA: Delphi code: function getData(InData1: PChar; InData2: PChar; Data: TArray16; var OutData1: PChar; var OutData2: PChar): integer; stdcall; with: TArray16 = array[0..15] of char; The int value that is returned can be 0 fo...

Animation in Java ME

How could I implement animation in Java ME? I would want to achieve the following, I want to make a List the items in the List are animated icons with some related text description... I would like to animate all these Icons simultaneously... ...

Multi language testing framework

I need to write two versions of the same application, one in .NET and the other one in Java. So I'd like to write a single test suite, and then use it against both codebases. Which testing tool would you advise me to use? ...