 |
 |
Index ‹ java-programmer
|
- Previous
- 1
- Run Excel Macro from JavaI want to run the macro present inside the excel sheet using the Java
code. Is is possible using Java code? Please help
- 4
- Junit tests, setting up tests without having to create a billion methodsJames McGill wrote:
> On Wed, 2006-02-15 at 19:42 +0000, Andrew McDonagh wrote:
>
>>email***@***.com wrote:
>>
>>>Is there a more dynamic way of setting up tests? We have legacy test
>>>code that we are trying to convert to junit.
>
>
> I really enjoyed using Fitnesse. A whole different idiom for testing,
> but very flexible and accessible to nonprogrammers.
>
> http://fitnesse.org/
>
>
> Anyway, it sounds like you're working backwards. You've already written
> the code you want to test, which is backwards from TDD, which sort of
> means JUnit isn't exactly the right tool for what you're doing. Still
> it occurs to me that you should be able to automatically generated
> wrappers for your legacy tests, and put those into a testsuite, and be
> done with the legacy stuff and move forward with JUnit.
>
>
>
Hi James,
You seem have have attributed the OPs remarks to me...
That being said, the OP is specifically talking about the case where we
have a legacy code base which wasn't tested with Junit - not that it
wasn't tested. There's no mention of whether TDD was used or not -
though I think we both suspect it wasn't and that the code base was
merely Unit Tested.
Unfortunately, working with legacy code is currently the most common
starting point on projects that adopt TDD. Greenfield projects using TDD
are still rare.
Also, keep in mind, whilst JUnit was developed as a tool to Aid TDD,
Beck et al do realise that some people won't or can't do TDD but still
need a decent Unit Testing tool.
As I'm sure you know - but as an aid for others - TDD is not Unit Testing.
TDD is actually a design methodology that happens to use unit tests to
describe the design. Much like RUP uses UML, etc. In fact this usage of
the term Test has causes so many to concentrate on the testing side of
TDD that some are now starting to question whether a better name could
be found.
e.g.
Behavior Driven Development (http://behaviour-driven.org/)
Specification Driven Development
etc.
Andrew
- 5
- Casting Object[]Hi :o)
I've created a useful routine that "appends" an Object on to the end of an
array of Object, creating a new array with slack space if there is not
enough space available (sort of like a light-weight Vector):
public static final Object[] append(Object[] buf, int buf_len, Object addxn,
int slack)
{
Object[] ptr = buf;
if (buf == null || (buf_len + 1) > buf.length)
{
ptr = new Object[buf_len + 1 + slack];
if (buf != null) System.arraycopy(buf, 0, ptr, 0, buf_len);
}
ptr[buf_len] = addxn;
return ptr;
}
Anyway, this works fine, no probs, etc.
I am having problems, however, casting Object[] onto String[] or any other
such cast. Even if, obviously, all the elements of the array are String.
Now, I can state straight off where the problem lies. If I choose a large
enough String[] buffer so that the appended String fits inside it, then the
returned array can be cast back onto String[] - however, if the buffer is
exceeded, and line 6 is executed (creating a new buffer) then it can no
longer be cast back onto String[].
Does that make sense?
Anyway, the question! Is there any way of creating an Object[] array
generically which is of the same type as the original array. In other words,
it would create a new String[] array or Color[] or Rectangle[] or whatever
as appropriate?
Is there a way of doing it by reflection??? (perhaps)
Cheers :o)
And if you don't understand what I going on about, just shout! (hehe) and
I'll try and explain better!
Will
- 7
- looking for some hands on experience... i have bought and read LEARNING JAVA by niemeyer
i loved it but find i need some hands on experience.
any help?
kevin
--
Sometimes I'm in a good mood.
Sometimes I'm in a bad mood.
When all my moods have cum to pass
i hope they bury me upside down
so the world can kiss me porcelain,
white, Irish bottom.
- 9
- What is a type error?Marshall <email***@***.com> wrote:
> David Hopwood wrote:
> > Marshall wrote:
> > > Mightn't it also be possible to
> > > leave it up to the programmer whether a given contract
> > > was compile-time or runtime?
> >
> > That would be possible, but IMHO a better option would be for an IDE to give
> > an indication (by highlighting, for example), which contracts are dynamically
> > checked and which are static.
> >
> > This property is, after all, not something that the program should depend on.
> > It is determined by how good the static checker currently is, and we want to be
> > able to improve checkers (and perhaps even allow them to regress slightly in
> > order to simplify them) without changing programs.
>
> Hmmm. I have heard that argument before and I'm conflicted.
>
> I can think of more reasons than just runtime safety for which I'd
> want proofs. Termination for example, in highly critical code;
> not something for which a runtime check will suffice. On the
> other hand the points you raise are good ones, and affect
> the usability of the language.
There doesn't seem to be a point of disagreement here. Programmers
often need to require certain properties to be checked at compile-time.
Others could go either way. There is no property that a program would
rationally desire to *require* be checked at runtime; that would only
occur because the compiler doesn't know how to check it at compile time.
--
Chris Smith - Lead Software Developer / Technical Trainer
MindIQ Corporation
- 9
- 12
- Open source Java on the way! (Re: BEA Weblogic blows away .NET, other J2EE servers in review by PC magazine)"codewriter" <email***@***.com> wrote in message news:<Swd1b.4631$email***@***.com>...
> Java days are numbered. Dot Net is going to take over. This is the reality.
> So, you guys better get some C# books before it is too late.
> Amen.
ROTFLOL!
how many times did i hear this from j++ guys awhiles back, and even
from some ASP and COM jocks in AT&T (where i worked) in 1997(?) or so.
guess what happened? i'm still laughing my way to the bank and they're
trying to figure out c#/vb.net - the old microsoft treadmill,
methinks....
http://www.angrycoder.com/article.aspx?cid=1&y=2003&m=7&d=17
believe me, java will still be here years from now when microsoft has
moved on to the next BIG THING (dragging along all the developer
baggage for the ride - most of whom will be c#/vb.net developers in
india, no doubt).
in the meantime, some interesting news:
it seems sun may not be so stupid after all, and is working very
closely with open source organizations like apache and red hat to
spread java.
after apache announced a few weeks ago that it would be creating its
own open source J2EE app server, red hat announced that it was
planning on an open source java, with sun's blessing.
http://www.freeroller.net/page/kalimantan/20030822#red_hat_and_sun_to
methinks microsoft is in very big trouble.
- 12
- 12
- JMF video frame sizeI need to know dimension of the media file played by
javax.media.bean.playerbean.MediaPlayer
I use the code you can see below:
FormatControl formatControl = (FormatControl)
this.mediaPlayer.getControl ("javax.media.control.FormatControl");
VideoFormat videoFormat = (VideoFormat) formatControl.getFormat();
return videoFormat.getSize();
mediaPlayer is known object from another class.
But I get formatControl == null.
It's very very strange, but just one time this code did work.
So I have no idea ... Someone else?
- 13
- US-CA: Senior Software Engineers (Java) wanted Immediately!Cataphora is an award winning software company providing technology and
services for high end litigations and investigations. Its customers
include Fortune 500 companies, governmental agencies, and top American
law firms. We pride ourselves on having been funded from the start
entirely by revenues, with no venture capital investment. At Cataphora,
your creativity and versatility will be focused on a wide variety of
software development challenges and developing cutting-edge algorithms
for analyzing very large datasets. We are more than 80 people strong,
and continue to grow our employee-owned San Francisco Bay area company
by providing superior technology to meet the needs of our customers.
This is an excellent growth opportunity for the right candidate in a
rapidly growing, self-funded pre-IPO start-up.
Required Skills
- At least 4 years experience dealing with middleware or enterprise
software applications
- 3 years of Java experience
- Strong analytical and problem solving skills
Desired Skills
- Strong database experience
- Demonstrated ability to develop algorithms for solving complex
problems
- Development experience with a web-based application using J2EE
technologies
To apply, please send your resume (inline preferred; RTF, Word Doc or
PDF otherwise) to: email***@***.com - subject: "EU-DE-M09".
If you have any questions, feel free to contact me:
email***@***.com
Regards,
Markus Morgenroth
- 13
- Simple While Loop problemJohn wrote:
> ththx.
>
> the code is wrong. months will be determined by the loan amount not just an
> arbitary number
>
>
> cheers
>
>
Can you not top-post please, John? It makes threads very hard to follow...
alex
- 13
- Returning a reference to an objectHi,
I've created a class to implement a state machine, so it's got a State
attribute. It has algo got a private java.util.Stack attribute.
In order to work, State classes need to access the stack to push and pop
data, etc.
To access it from State, I have wrote a method called getStack() which
returns a reference to the stack, but I think this is not recommended
beacause all objects sharing the reference can modify it, and led to errors
difficult to debug, etc. Returning a stack's clone is not valid solution,
as I have to make changes on the real one.
So my question is, is there a cleaner way to do this?
Thank you very much
--
PGR
- 15
- [POLL] Dropping support for old SpiderMonkeysHi,
as JavaScript.pm development is moving again I'm considering dropping
support for older SpideyMonkey and focusing on 1.7 and later (the one
used in FF 2.0).
Instead on having to download and install SM manually I was planning
on putting up a source release of the SM 1.7 engine on my server and
add the possibility for Makefile.PL to download and install it.
Alternatively I can bundle the source with JavaScript.pm. You will
still however have the possibility to build against your own SM src.
This way we can better control availability of utf8, threading and
e4x (and future stuff too).
Does this sound like a good idea?
Thanks
/Claes
- 16
- eclipse, integrating crystal reports plugin with rcp appHello,
I have got a problem, I have to integrate Crystal Reports plugin with
my RCP app. I want Crystal Reports perspective aviable in my
application.
I've downloaded crystal reports plugin, and unpacked it to my_rcp_app
\plugins,
and I've run eclipse with -clear flag. but crystal reports plugin
isn't visible in Plug-In details window.
How can I cope with that problem ?
Is the any tutorial, or sth. about integrating plugins with RCP app ?
thanks a lot for any help
- 16
- encrypted source file support in jdk?Hi
I an wondering if anybody knows if its possible to extend the
functionality of the sun java compiler/vm in jdk6, with for example
plugins or similar? or if the jdk supports something similar already?
What I am looking for is to set up a jdk environment where the source
code is ecrypted at the file level. This requires javac to be able to
en-/decrypt the source files. For further protection, the jvm would need
such support as well.
some details:
To answer the typical question first. For this scenario I am not
interrested in encrytpted filesystems, because it still leaves the
files vulnerable as long as the filesystem is mounted. The secrecy of
the files can still be compromised from hacking, virus, trojans, skype,
xss and all other sorts of system hacking. With encrypted files the
information in the files are still protected, even in the case a trojan
sends a file by email to somebody on the internet. Enctrypted
filesystems only help protect the integrity of the local system and the
disk while the system/disk is not running. Encrypted files help protect
the information during use as well.
I know there are many other issues as well, I'll be working throuhg it.
here is the list of the issues of most importance:
- en-/decryption support in
- ide / editor
- compiler
- code searching tools
- disassembler/debugger
- remove excess information from class files
- how to handle static content files
- html, css, jsp, configuration files for libraries and frameworks etc
- if class files are also encrypted
- en-/decryption support in the jvm runtime, covers tomcat, jboss etc.
- possible encrypted jar/war/ear files etc
- debugger
- information about classes must also be protected from prying
eyes who have obtained the class files and using the debugger to get
information.
|
| Author |
Message |
Mike

|
Posted: 2003-6-28 6:05:00 |
Top |
java-programmer, jigsaw's jdbm
I like that I can use the jigsaw outside if jdbm. For
writing j2me (personal java) that don't have any sort
of record manager on the device I want to also use
jdbm there. However jdbm requires some of the file
classes that are not universally available within
j2me. I don't have the error posting just now (stupid
me) from javac to show what's missing. Has anyone
worked through this or have another idea for an
embedded data (flatfile) manager for j2me?
Mike
|
| |
|
| |
 |
| |
 |
Index ‹ java-programmer |
- Next
- 1
- JVM sourcesHi,
Where can I find C sources for JVM 1.4 for Windows ?
Thanks
Xavier
- 2
- Ethernet ID and system Info in JavaHi,
I want to know if there is a way to get system level information using Java.
I am mostly interested in things like Ethernet ID and serial number of Hard
disk. Some of the values when you type "ipconfig /all" on windows.
I know we can do all this using JNI with the main routines written in C. But
is there a way to do it using Java alone?. I have not seen any API to help
me get such deep system level information.
Thanking you,
- 3
- Python and cellular automata (It works this time!)I thought people would be interested in this little script I wrote to
reproduce the 256 simple automata that is shown in the first chapters
of "A New Kind of Science". You can see a few results without running
the script, at http://cooper-j.blogspot.com . And here is the code (You
will need PIL (Python Imaging Library)):
<code>
import Image
# Contract:
# To simulate simple cellular automata.
class calculations:
def __init__(self,which):
self.against = self.array_maker_2()[which]
self.check = self.array_maker_1()
self.array = self.array_maker_3(311)
self.calculator()
def binary(self, n, size): ## This is the Int -> str(BINARY)
converter
assert n >= 0
bits = []
while n:
bits.append('01'[n&1])
n >>= 1
bits.reverse()
result = ''.join(bits) or '0'
for iteration in range(len(result),size):
result = "0" + result
return result
def array_maker_1(self): # This makes the array that represents the
8 different permutations of 3 cells. Itself, its left and its right.
return [self.binary(n, 3) for n in range(8)]
def array_maker_2(self): # This makes the array that represents
every single different rule. If for instance the second element in one
# of these rules is 1, then the corresponding permutation that may
be found in the result array (array_maker_3), will be 1 (black).
return [self.binary(n, 8) for n in range(256)]
def array_maker_3(self, y): # This is the array for all the
results. The automaton starts from the middle of the first row
x = [["0" for x in range((2*y)+1)] for n in range(y)]
x[0][(2*y+1)/2] = "1"
return x
def calculator(self): # This cycles over all of the cells, and
scans one row at a time, and changes the next row according to the
current cell.
self.buff_result = ["0","0","0"] # This is the current permutation
buffer to be checked against the corresponding arrays.
for i in range(len(self.array)-1):
for j in range(1, len(self.array[0])-1):
self.step1(j,i)
self.step2(j,i)
self.step3(j,i)
y = self.check.index(''.join(self.buff_result))
self.array[i+1][j] = self.against[y]
# The steps update the result buffer.
def step1(self, step, y):
self.buff_result[0] = self.array[y][step-1]
def step2(self, step, y):
self.buff_result[1] = self.array[y][step]
def step3(self, step, y):
self.buff_result[2] = self.array[y][step+1]
for number in range(256):
objo = calculations(number)
x = objo.array
y = []
for num,zo in enumerate(x):
for com,wo in enumerate(zo):
x[num][com] = int(wo)
nim = Image.new("1", (623,311))
for n in x: #converting the array of arrays into a single array so
putdata can take it.
for p in n:
y.append(p)
nim.putdata(y)
nim.resize((6230/2,3110/2)).save("output" + str(number) + ".png")
print number
</code>
- 4
- Axis e Web ServiceSalve,
sto realizzando un applicazione Java che utilizza un Web Service con
Eclipse 3.2.
Questo Web Service ha il compito di salvare un oggetto su database
MySQL facendo uso delle librerie di Hibernate 3.1.3.
L'applicazione gira su un server Tomcat 5.5 che fa uso delle librerie
j2sdk1.4.2_10 e utilizza librerie di Axis 1.4 per i Web Service.
L'applicazione ?in realt?costituita da un applicazione client che
richiama il Web Service ed un applicazione server che si preoccupa di
salvare gli oggetti sul database. Eseguendo il client ottengo il
seguente errore:
AxisFault
faultCode:
{http://schemas.xmlsoap.org/soap/envelope/}Server.userException
faultSubcode:
faultString: java.lang.reflect.InvocationTargetException
faultActor:
faultNode:
faultDetail:
{http://xml.apache.org/axis/}hostname:notebook-pc
java.lang.reflect.InvocationTargetException
at
org.apache.axis.message.SOAPFaultBuilder.createFault(SOAPFaultBuilder.java:222)
at
org.apache.axis.message.SOAPFaultBuilder.endElement(SOAPFaultBuilder.java:129)
at
org.apache.axis.encoding.DeserializationContext.endElement(DeserializationContext.java:1087)
at org.apache.crimson.parser.Parser2.maybeElement(Parser2.java:1712)
at org.apache.crimson.parser.Parser2.content(Parser2.java:1963)
at org.apache.crimson.parser.Parser2.maybeElement(Parser2.java:1691)
at org.apache.crimson.parser.Parser2.content(Parser2.java:1963)
at org.apache.crimson.parser.Parser2.maybeElement(Parser2.java:1691)
at org.apache.crimson.parser.Parser2.parseInternal(Parser2.java:667)
at org.apache.crimson.parser.Parser2.parse(Parser2.java:337)
at
org.apache.crimson.parser.XMLReaderImpl.parse(XMLReaderImpl.java:448)
at javax.xml.parsers.SAXParser.parse(SAXParser.java:345)
at
org.apache.axis.encoding.DeserializationContext.parse(DeserializationContext.java:227)
at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:696)
at org.apache.axis.Message.getSOAPEnvelope(Message.java:435)
at
org.apache.axis.handlers.soap.MustUnderstandChecker.invoke(MustUnderstandChecker.java:62)
at org.apache.axis.client.AxisClient.invoke(AxisClient.java:206)
at org.apache.axis.client.Call.invokeEngine(Call.java:2784)
at org.apache.axis.client.Call.invoke(Call.java:2767)
at org.apache.axis.client.Call.invoke(Call.java:2443)
at org.apache.axis.client.Call.invoke(Call.java:2366)
at org.apache.axis.client.Call.invoke(Call.java:1812)
at source.Start.main(Start.java:42)
In particolare ho notato che questo si verifica nel momento in cui si
invoca un metodo chiamato "save" messo a disposizione da Hibernate. Se
commetto la riga corrispondente a tale istruzione, richiedendo al web
service di restituire semplicemente una stringa, l'applicazione
funziona correttamente. Suppongo che il problema derivi dal database
MySQL, ma non capisco di cosa si tratta. Avete qualche idea?
- 5
- Read the index of item with X value.On Mar 26, 10:42 pm, "Mariano" <email***@***.com> wrote:
> I've a ComboBox ..
>From where? There is no ComboBox in the JSE.
Are you perhaps referring to java.awt.Choice,
or javax.swing.JComboBox?
..
> How could I resolve?
1) Be specific about the classes used, rather
than simply 'making the names up, as you go along'
2) ..
Andrew T.
- 6
- Applet as DSO in Browser example? MSIE only?Hi,
Recently on the web I came across documentation discussing Data Source
Objects (DSO) in relation to browser and html functionality (in particular
the ability to declare a Java applet as a data source that can be used with
any or the HTML tags that take the src="" attribute). I find it interesting
and potentially *very* useful and would like to know more, so if anyone can
answer any of the following questions that would be great: -
1) Do you have an example of an Applet functioning as an applet to something
like a <Table> that I can see?
2) Is this a MicrosoftIE-only feature? I can't find it in other html tag
reference sites. (I'm using w3schools as a sort of yardstick; is that less
than optimal?) What do other browsers do? Is Microsoft deprecating this
along with other Java stuff?
3) I've searched in c.l.j.p/c.l.javascript and the only references to DSOs
appear to be server based (or data sources other than Applet) I'm guessing
they're entirely different beasts; is that correct?
4) Anyone ever passed a BufferedImage over to Javascript for display on a
web page? (I know it'd be single threaded and all those little .GIFs and
.JPEGs are designed for parallel http webservers, but think of a blob in a
database that has an employee photo of geological survey or something. . .)
Thanks for any help!
Regards Richard Maher
PS. I am already passing result set <options>s back to a <select> list quite
happily; it's the tighter integration between the html tags and my socket
that I'm striving for here.
One of the places I've been looking: -
http://msdn.microsoft.com/library/default.asp?url=/workshop/author/databind/datasources.asp
- 7
- Hibernate, connection pool and firewall questionAn odd combination of topics, to be sure.
My current web application (Tomcat hosted) has a custom-rolled
connection pool. The Informix DB I connect to is across a firewall
that terminates existing connections after 120 minutes, regardless of
their current activity. My pool handles this by detecting the
creation date of a connection it wants to reuse. If that connection
was created > 60 minutes ago it closes the connection and fetches a
replacement to use in the pool.
Simply using a connection until the 120 minute barrier is reached
isn't acceptable because the DB isn't smart enough to realize that the
firewall has stopped the connection's use. The explicit release after
60+ minutes releases the connection and keeps the simultaneous
connection use down (we are licensed by the number of simultaneous
connections).
When I look at Hibernate and its connection pools (DBCP and C3P0,
there might be others) I'd like to use their stuff instead of my
home-grown pool. But I don't really see a parameter like "only use
this connection for 60 minutes" or such. Can I find such a parameter
in one of the pool possibilities?
TIA,
Jerome.
- 8
- TRYING TO CREATE A SIMPLE FORM. HELP HELP HELP!!!!trying to make a simple form, just an empty window with no button.
ive tried this
import javax.swing.*;
import java.awt.*;
import java.util.List;
import java.util.*;
public class Canvas
{
private static Canvas canvasSingleton;
public static Canvas getCanvas()
{
if(canvasSingleton == null) {
canvasSingleton = new Canvas("BlueJ Shapes Demo", 300, 300,
Color.white);
}
canvasSingleton.setVisible(true);
return canvasSingleton;
}
}
but it doesnt work :( any ideas guys?
- 9
- Java application help?????????????How do you create a pause in a Java application that requires you to
press a key to continue until the conditional statement is complete?
The folowing is what I have so far..
class Count{
public static void main(String[] arguments) throws Exception {
int a = 100;
int b = 20;
int x;
for (x = 0;x < a;x++) {
System.out.println((x+1) + "." + "Message goes here to be displayed
100 times.");
}
I would like the application to display 1 - 20 then pause and display
20 more and 20 more and so on. I tried to use System.in.read();, but
it only displayed two at a time. Please Help.
- 10
- Getting ready for 1.5I'd like to prepare for JDK 1.5. I know that generics/templates
will be in there. Will standard Java classes be retofitted to
use this new feature as appropriate? I'm thinking of course
about the collections, but also wondering about stuff such as
the clone interface.
I also know that enums will be in there. (Because the bug status
changed to closed/fixed.) But in what form? There were at least
two JSRs for that last time I checked.
Thanks!
-Wayne
- 11
- Licence code storing for java appHello,
I want to create a app which will have something similar to licence
(i.e. user have to enter licence code to run the app). The problem
arises when I want to make it that user have to specify it only once.
So I need to store somewhere the information, that the app has already
been activated. I am thinking about main jar file (as something which
can work ,although it is nothing sophisticated), but when I add extra
characters at the end then my jar was corrupted :(. Do you know any
nice way to do this:)? Thank you!
Regards, mark
- 12
- URL.openConnection bug in 1.6??If a bug report I got is correct, under some conditions JDK 1.6
URL.openConnection returns null without throwing an IOException.
--
Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.
- 13
- Faster JPEG Decoder?On 19 Aug 2005 16:14:17 -0700, email***@***.com wrote or quoted :
>Currently we use JPEGImageDecoder which is the fastest of the three but
>still it takes up a lot of CPU time.
>
>Any suggestion? Thanks in advanced.
The obvious thing to consider is to predigest your images into some
other format that does not require so much processing to fluff it up.
They will probably be bigger.
When you create the jpg images you can control the
compression/quality. Presumably lower quality images will display
faster.
If you are displaying them or scrolling over them, then you might look
into what speedups are possible with VolatileImage.
--
Canadian Mind Products, Roedy Green.
http://mindprod.com Again taking new Java programming contracts.
- 14
- RSA encrypt session keyDoes anyone know how to encrypt a secret key with a public key algorithm
to transmit it to another computer securely. Have tried using RSA and
have had no look in the following code:
public byte[] encryptSessionKey(SecretKey sKey, PrivateKey pKey, String
algorithm)
{
System.out.println("linex");
Cipher cipher = Cipher.getInstance(algorithm+"/ECB/PKCS#1");
System.out.println("liney");
cipher.init(Cipher.WRAP_MODE, pKey);
System.out.println("linez");
return cipher.wrap(sKey);
}
It prints out liney but not linez which suggests the Cipher object can
not encrypt a session key in wrap mode.
Thanks.
- 15
|
|
|