Tuesday, December 14, 2010

Picasa Web Albums Data API

Yesterday, I had the idea to combine my ImageResizer-application with the Picasa Web Albums Data API.

I restructured the GUI and made it very easy to use. The user has to...
  • choose the directory containing the photos,
  • enter an album name of his Google/Picasa account,
  • enter username and password,
  • and click on a button!
The program works in the following steps:
  1. Login to the Google-Account
  2. Get files from the given album (remote)
  3. Get files from the chosen location (local)
  4. For each file, that exists local, but does not exist remotely, resize the file to the given factor and upload it to the given Picasa Web album.
If the Override-Checkbox is checked, however, the following steps are performed:
  1. Login to the Google-Account
  2. Get files from the chosen location (local)
  3. For each of the files, delete the remote version (if there is any), resize the file to the given factor and upload it to the given Picasa Web album.
    This solution seems to be optimal for uploading photos during my journey. There is no need to worry, which fotos I have already uploaded, because the "synchronization" is done by the software.

    Here's a screenshot of the current version:

    Friday, December 10, 2010

    Code-Listings with Syntax-Highlighting - Google Code Prettifier

    Probably I want to post code snippets in future. So I watched out for syntax-highlighters for code listings. The easiest to use was Google Code Prettifier.

    A small tutorial is here.

    Great things about this library:
    • I can use the necessary css and javascript files directly from the SVN repository.
    • It is easy to use, lightweigth and rather small (61KB for the CSS + JavaScript code)
      • I don't even have to specify the language - the prettifier "guesses". However, if a guess fails, it can be supported by specifying the language anyway.
    Here are some tests that should show that it works:

    Java:
    public class Foo {
      private int x = 1;
      private String y = "foo";
    }
    

    Bash:
    #!/bin/bash
    
    # hey, just a test
    echo "hello world"
    cat foo.txt | head -10 | tail -1
    

    HTML (the < and > symbols are HTML-escaped, but I'm not planning to post a lot of HTML/XML code anyway) - by the way: that's the structure of the code I used for the Java code sample above:
    <html> 
     <head> 
      <link href="prettify.css" type="text/css" rel="stylesheet" />
      <script type="text/javascript" src="prettify.js"></script>
     </head>
    
     <body onload='prettyPrint()'> 
       <pre class="prettyprint">
       public class Foo {
         private int x = 1;
         private String y = "foo";
       }
       </pre>
     </body> 
    </html> 
    

    Eclipse Cross-Platform with Delta Pack

    This source describes how to deploy RCP applications for operating systems other than the operating system you are developing on.

    The tutorial is just great and shows how easy cross-platform deployment is!

    Thursday, December 9, 2010

    First Experience with Eclipse RCP / SWT / JFace

    About three years ago, I bought a (german) book about Rich-Client development with the Eclipse RCP, which I did not finish reading, as I did not like it. That's why I searched for Eclipse RCP tutorials on the Internet, and I found some nice ones.
    So I successfully ported my ImageResizer application to Eclipse. Honestly, I did not make use of many of the RCP's features, but there was not much reason for that.

    Things I've learned:
    • Building a GUI with SWT / JFace
      • Basic components, Layouts, Listeners
      • JFace's Viewer mechanism with ContentProvider, LabelProvider and an Input-Object
    • Create a Plugin-Project with Eclipse
      • Layout the Perspective
      • Use the Error-Log-View (org.eclipse.pde.runtime.LogView)
      • Export the Application

    The next things is a cross-operating-system build with the delta pack (download page).
    Probably I will publish source code and/or more detailed instructions when this (small) project is finished.

    The following tutorials are the most important ones I used, and which I can recommend:
     A lot of good information can be found in newsgroups, forums, etc., too.

    Tuesday, December 7, 2010

    Time for new things

    As my master thesis is done, I finally have time for other things.
    The first of these things is this blog. I am going to post topics related to computer science (in the broadest sense). 

    In exactly two months I will start to travel, so the time to catch up with technologies, books, projects, etc, that aroused my interest throughout the past months and years (but had no high priority due to lack of time) is quite limited (so the lack of time might come back soon...).

    However, I want to stay up-to-date with the progresses in the computer world during the journey, and am planning to continue posting to this blog (that's one of the reasons why I started it).

    I am also planning to make a travel blog. For this purpose, I am going to prepare myself by arranging and adjusting software that might support administrating my online resources from Internet caf├Ęs with slow Internet connections.

    Some time ago I have written a simple, small Java program, called ImageResizer.
    It offers to load a directory of JPG files and shrink it to a configurable size into a subdirectory called resized. The software is really trivial and did not take a lot of time to be written. But it helps uploading lots of (small-sized) pictures to the blog, without manually resizing them and having to waste time waiting for slow connections.

    I always was interested in writing an Eclipse RCP application. So I am going to port this small ImageResizer GUI (Java Swing) to an application based on the Eclipse platform.

    The purpose is to improve my skills and learn new technologies, and finally I am going to use the software on my journey.

    My final goal is to have a set of programs (e.g. including ftp clients, ssh clients, etc.) that are a reasonable replacement for my desktop computer.

    P.S.: Yeah, I know, that this is one of the most basic blogger-templates, but I like it, and do not want to spend much time on modifying it.