James Ellis

Ranch Hand
+ Follow
since Oct 14, 2004
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by James Ellis

>>You ideally would want to cluster the two app servers.
I do not understand how that helps. Presumably the cached objects are stored in JVM memory which would not be shared in a cluster (correct me if I'm wrong...but I don't see how it could).

>>Other option would be to retrieve the object from the db every time you do some operation so you are ensured the data is fresh.
Doesn't that defeat the point of caching?

I have no real hibernate or ibatis (or any real ORM experience), but I am starting to learn ibatis. I have a general question on ORM caching. My assumption is that the objects are cached in java memory. So...in a typical environment (multiple app servers, one database) how do you clear cache across all app servers programatically?

2 app servers, serverA and serverB
one object is cached on serverA...we'll call it InventoryList (list of available inventory)
serverA gets a call to updateInventory service which clears cache of InventoryList object on serverA

doesn't serverB still have the cached old object still there (not purged)?

Update - according to wikipedia the name=value is first...

Cookie attributes
Example of an HTTP response from google.com, which sets a cookie with attributes.

Beside the name/value pair, a cookie may also contain an expiration date, a path, a domain name, and whether the cookie is intended only for encrypted connections. RFC 2965 also specifies that cookies must have a mandatory version number, but this is usually omitted. These pieces of data follow the name=newvalue pair and are separated by semicolons. For example, a cookie can be created by the server by sending a line Set-Cookie: name=newvalue; expires=date; path=/; domain=.example.org.


Can anyone else verify?
I have code in place which creates an HttpUrlConnection and then needs to read the cookies. I've noticed that if I iterate through the headers returned:

...the cookie name=value always appears first in the string hdrString (as opposed to path=/; domain=.whatever.com )

Does anyone know if this is a requirement? That the cookie name=value always appears first? If so I am going to write my code to rely on that...

It seems I don't need to do this anyway...i misinterpreted the PHP code.

The PHP code does the following:

$bucket=((crc32($key)>>16)&0x7fff) % $this->bucketcount;

...and I thought that crc32 was returning a string...it turns out its returning a number.

Now if I could only find a java CRC32 class that returned a number that matches the results of the PHP crc32 function...

Would you happen to know any java CRC32 classes?
12 years ago
I am trying to reverse engineer some PHP. This PHP code does a right bit shift operator on a string variable.

All the right bit shifts I have seen are for integers. Can I perform a right bit shift operator on a String in Java?

12 years ago
It looks like this is the winner:

X.509 Certificate (PEM) .crt extension

12 years ago

Do you have any specific advice I can pass on to the DBA such as "please turn off XYZ service which is preventing remote JDBC connections"? Otherwise, I think the DBA group is going to tell my code is the problem.

I have a website that uses a self signed certificate and some java code that needs to use HttpsUrlConnection to access the site.

I know I need to get the certificate imported into cacerts but I am not sure exactly which certificate I should be importing. Rather, I have an export problem. In firefox, there is a plugin that lets you export the certificate in all sorts of formats:

X.509 Certificate (PEM) .crt extension

X.509 Certificate with chain (PEM) .crt extension

X.509 Certificate (DER) .der extension

X.509 Certificate (PKCS#7) .p7c extension

X.509 Certificate with chain (PKCS#7) .p7c extension

Which one should I choose if I want to then use keytool to import the certificate into cacerts?

12 years ago
Actually nobody gave me a cert...in fact I didn't think that certs were even in the equation in JDBC until I saw that stack trace. All I did was type in a standard jdbc URL for a thin driver (nothing funky in it) and connecting to this one particular DB always gives me this stack trace that includes a message about certificates. That's why I was asking, how/when/why are certificates used in JDBC or is this just stack trace about certs just a red herring?
I inherited a system and I need to do some work on cacerts (import some certificates). So first thing I want to do is change password from the default "changeit"

bash-3.00# /usr/jdk/instances/jdk1.5.0/jre/bin/keytool -storepasswd -keystore /usr/jdk/instances/jdk1.5.0/jre/lib/security/cacerts -new newpassword
Enter keystore password: changeit
keytool error: java.io.IOException: Keystore was tampered with, or password was incorrect

...so it looks like the password isn't "changeit". If I try with a blank password:

...I get the NPE above. So...does that mean the password has already been changed? If so, is there a way for me to "override" what is already there?

12 years ago
I am coding a java class to connect to a remote database via jdbc. The code is pretty straightforward:

If I change the jdbc URL to a different database, I am able to connect to it and query it. If I try to connect to the real database I am getting the following error:

This is really killing me. Does anyone know how / if / why jdbc uses CA's or certs?
Is there a dependable JavaScript implementation of a symmetric encryption algorithm (password based) that has a counterpart in Java?

What I mean is...if I encrypt some data in JavaScript using DES.encrypt("data to encrypt!!", randomkey)

...will DES.decrypt(data_to_decrypt, randomkey) from JAVA always return the correctly decrypted data (the exact same info that was encrypted in Javascript)?

(yes I know, there is the obvious "why are you designing it like this in the first place" but I am up against some pretty odd and immovable infrastructure/design requirements)
13 years ago
I have some code where in certain cases I need to response.sendRedirect to another site.

The problem is...the response.sendRedirect is not immediate. In other words:

...the updateCount is still called bc the response.sendRedirect is not immediate.

If I have a "return" statement right after the response.sendRedirect my code won't compile because "This method must return a result of type ActionForward".

Sure...I could just move all the rest of the code in the page into an else block after the if statement, but isn't there a way to return immediately after the response.sendRedirect in struts?
13 years ago

Shouldn't your serverside validation catch that before it goes into the database?

Also you probably would be better off using encodeURIComponent and not escape.

Yes this is true - but in order to persuade management that the JavaScript is the culprit, I need to be able to prove that the function "GV" described above can actually have an exception that returns the value as "null" which is then inserted into the database.

At the moment they think it could either be the Javascript or some weird Java/Database code interaction.

I am of the opinion there's no way the latter is the case - but a good working example of the Javascript escape function throwing an exception speaks a thousand words.