Monthly Archives: May 2009

Adding Flash video to your website

If you want to set up a Flash video on your website, and you are using Linux, then this post is for you. I’ll cover the steps one by one. Keep in mind that there are many different solutions and I have only documented one.

1. Istanbul Desktop Session Recorder
Download Istanbul using “sudo apt-get install istanbul”. Istanbul will let you record either complete windows, or regions of the screen, and save them as Ogg media files. Use it to record your desired video.

2. FFmpeg
Download FFmpeg and use it to convert the Ogg file to a Flash video file (.flv).

ffmpeg -i input_file.ogg -f flv output_file.flv

3. Flowplayer
Now all you need is a Flash player to embed into your HTML page and play the Flash video file (this lets users pause, rewind, etc). There are many different options here, but one good option is Flowplayer. Download the package from their website. Place the following files from Flowplayer onto your website:

  • flowplayer-3.1.0.min.js
  • flowplayer-3.1.0.swf
  • flowplayer.controls-3.1.0.swf

Also upload your flash video file (output_file.flv in our example) up to your website. Note that Flowplayer won’t run by default if you try and run it locally. Then just add the following into your HTML page:

<script src="flowplayer-3.1.0.min.js"></script>
<a href="output_file.flv" style="display:block;width:425px;height:300px;" id="player"></a>
<script language="JavaScript">
flowplayer("player", "flowplayer-3.1.0.swf");
</script>

Note that the “player” parameter to flowplayer() must match the id value in the <a> tag. You can change the size around as much as you like.

Australian TLD registration

If you are looking to register an Australian top-level domain (TLD) you have many choices for a registrar and host. Your first stop should be www.whatsinaname.com.au to compare the prices between all the different registrars. Obviously you want to select a registrar and host combination (they may be different) to meet your requirements for support, up-time, cost, and features.

If you already have a host set up (it can be anywhere, not necessarily an Australian host), and you simply want to buy the .com.au TLD and redirect it, I would recommend hostess.com.au. In my experience they were fast and efficient. The signup asked whether I wanted a redirect and what the DNS info was, so there was nothing to configure, and the paperwork (including invoice) was emailed to me within minutes.

Signing jars with a Netbeans Ant script

Digitally signing a jar file is one step among many before releasing your jar to the world. It can help you identify your program as one that genuinely came from you. It can also make it harder for people to alter the program (although not impossible). I recently went through this process with OBZVault where I integrated signing into the build process (Ant scripts generated by NetBeans).

Firstly you should do some background reading. There is a great article at onjava.com that covers Java vs .NET Security mechanisms. If you are familiar with .NET Security this is a very good intro into the Java world. The tool that does the signing of jars is called jarsigner, and key stores are created with keytool.

Next you need to:

a) Create the keystore with keytool.

keytool -genkey -alias -keyalg RSA -keystore -validity 365

The keystore filename is usually a jks file, but you can call it anything. Remember the alias name you used for later. To check that the store is created correctly use the following command to view the contents:

keytool -list -v -keystore

b) Integrate jarsigner into your build system. If you developed your application in NetBeans 6.5 you will have a build.xml file in the root of your project. Add the following targets to build.xml:

<target name="-post-jar" depends="signjar">
</target>

<target name="signjar" depends="">
<echo message="Signing ${dist.dir}/application.jar ..."/>
<exec dir="${work.dir}" executable="jarsigner">
<arg value="-verbose" />
<arg value="-keystore" />
<arg value="keystore_file.jks" />
<arg value="-storepass" />
<arg value="store_password" />
<arg value="-keypass" />
<arg value="keypass" />
<arg value="application.jar" />
<arg value="alias_name" />
</exec>
</target>

That’s all folks. Next time I’ll discuss code obfuscation which can be integrated into build.xml as well.