I've been moving back into the world of Java after some time with Ruby...surprisingly (to me anyway) Java enums don't have access to static variables within the enum in the enum constructor. For example, this will fail to compile with an illegal forward reference when attempting to use the static constant:
I haven't found a work around for this that I am comfortable with. Defining the static constants elsewhere seems quite ugly.
The same problem occurs if you want to set up a static cache during construction as well. This can be worked around with a static initializer:
Showing posts with label java. Show all posts
Showing posts with label java. Show all posts
Sunday, January 10, 2010
Sunday, October 05, 2008
Picasa Web Album Command Line Upload
I wrote this code some time ago before Picasa Web Albums had a good uploading solution for Linux users. This code uses the the Google Data APIs. While there is a better upload solution for Linux now (Picasa for Linux) some of you, like me, might prefer a command line driven upload method. This allows you to upload a batch of photos by issuing a command like this:
So, for example, you might issue a command like this:
This would initiate an upload of all the jpg files in the current directory to my Picasa Web Albums under an album name of Honolulu with a throttling delay of 3 seconds. The picasa script, which calls my java code, is a simple script as follows:
And finally, the java code that does all the magic, note that you will need to compile / run against some Google Data API jar files as indicated in the comments:
So, for example, you might issue a command like this:
This would initiate an upload of all the jpg files in the current directory to my Picasa Web Albums under an album name of Honolulu with a throttling delay of 3 seconds. The picasa script, which calls my java code, is a simple script as follows:
And finally, the java code that does all the magic, note that you will need to compile / run against some Google Data API jar files as indicated in the comments:
Saturday, July 26, 2008
Applets are Dead? Here's my Crapplet!
Applets are dead.
I decided to put together a little demo that shows the basic building blocks of using applet technology to build a RIA. I call my applet Crapplet. It builds a little GUI, does javascript to applet communications and vice versa, and fetches remote data from the server. The applet can be found here. A directory holding the source complete with a little build script can be found here.
Now if Sun would do something to reduce load times, browsers would make java plugins easy to install, and people would lose the bad memory of dancing icons - maybe this stuff could become useful again.
My applet has a problem though - when I hit refresh on my browser the applet bails. I must not be using init() correctly. I'm done trouble shooting it though ... time to learn Flex.
I decided to put together a little demo that shows the basic building blocks of using applet technology to build a RIA. I call my applet Crapplet. It builds a little GUI, does javascript to applet communications and vice versa, and fetches remote data from the server. The applet can be found here. A directory holding the source complete with a little build script can be found here.
Now if Sun would do something to reduce load times, browsers would make java plugins easy to install, and people would lose the bad memory of dancing icons - maybe this stuff could become useful again.
My applet has a problem though - when I hit refresh on my browser the applet bails. I must not be using init() correctly. I'm done trouble shooting it though ... time to learn Flex.
Subscribe to:
Posts (Atom)