Aug 22
Put Image Size Into Filename
icon1 Seweryn Niemiec | icon2 Java | icon4 08 22nd, 2008| icon3No Comments »

Sometimes it is useful to have image size written in filename (I needed it when I was browsing my collection of wallpapers). I could not find any tool which would automate this process, so I have decided to write one. Probably it is job for bash or Python but I like Java most, so it is Java CLI tool. I have used ImageInfo class to get image parameters.

That’s what it does:

  • scans all parameters for options – there is only one valid option: -p which switches the tool from the dry mode (tool only shows what should be done) to the working mode
  • for every non-option parameter:
    • check if it is path to an image
    • read image width and height from the file
    • check if the file name already contains valid info about the image size
    • if need be, remove invalid info from the file name
    • put WIDTHxHEIGHT string at the beginning of the file name

Use it like this:


# to preview changes:
$  java -jar /some-path/into-filename.jar file1 file2 ... # you can use full file paths
# to rename files:
$  java -jar /some-path/into-filename.jar -p file1 file2 ...

And here is the jar: into-filename (Public Domain License)

Jul 2

This solution is for those who use also GMF. In one of your plug-ins (or create a new empty plug-in for that) add following section to plugin.xml:


<extension point="org.eclipse.emf.ecore.extension_parser">
   <parser type="MY_SEMANTIC_MODEL_FILE_EXTENSION"
      class="org.eclipse.gmf.runtime.emf.core.resources.GMFResourceFactory">
   </parser>
</extension>

It will make EMF use GMFResourceFactory for XMI [de]serialization. GMFResourceFactory enables usage of UUIDs. Don’t forget to replace MY_SEMANTIC_MODEL_FILE_EXTENSION with your own file extension.

Feb 7

Currently I’m writing NetFlow analyser as a Rich Internet Application. After long consideration and evaluation of available open-source technologies I have concluded that GWT will be the best shot in this case (now I’m not so sure any more, but this is another story). To make building nice user interface easier I have decided to equip user side CLASSPATH with GWT-Ext library. GWT-Ext reuses ExtJS and ExtJS needs some underlying JavaScript framework. A lot of people use YUI as base for ExtJS, so automatically I have started to use it too. And this is where the first problems arose.
Read the rest of this entry »