Educating the world

Our blog has over 10,000 readers a month

Creating a unique backup file name under Unix

July 16th, 2012

Before updating a system file I’ll take a backup copy of it. The less imaginative of you will choose a backup name like file.bak or file2. Some of you will use your initials, especially if you work in an environment where you might run into your colleagues working on the same platform. Some of you who are a bit cleverer will incorporate the date in the backup file name. Sure you can see the date from the timestamp on the file but that information can be lost when you copy the file or restore it from an archive.

For files that I might be testing configuration, I might make lots of copies as I try different things. I use a full date time stamp e.g. httpd.conf-2012-07-16--13-03-00. It takes a bit of time to read the clock and write the full backup file name. I started doing it using the date command to generate the time and date string like so:

cp httpd.conf `date '+%Y-%m-%d–%H-%M-%S'`-httpd.conf

But then I thought why remember the magic percent sequence of the date? So if you edit your ~/.bash_profile and add the following line:

export d="date +%Y-%m-%d–%H-%M-%S”

Now you can create a backup file name really easily:

cp httpd.conf `$d`-httpd.conf

or if you prefer the date at the end of the file:

cp httpd.conf httpd.conf-`$d`

Rerunning the above command line creates different file names which are guaranteed not to overwrite each other. You also might want to add a reason for the backup

cp httpd.conf httpd.conf-`$d`-before-add-bigsoft-virtual-host

Movie releases in your GMail Calendar

July 3rd, 2012

If you have a GMail account you can get new movie releases to appear in your calendar. It’s really easy too!

  1. Log into your GMail account.
  2. Go to:
  3. When the page loads you will see an example of the calendar in the centre of the page.
  4. At the bottom of the calender panel there is a (+) Google Calendar icon. Click it.
  5. Your web browser will open a new window taking you to your Google calendar page.
  6. A dialogue box will appear asking you to confirm the addition of the new calendar so click Yes, add this calendar.
  7. It took a brief moment and the calendar updated with all the new movie releases.

I can’t wait for Dark Knight Rises in a couple of weeks!

Obtaining the CORBA IOR and connecting to the ZonePortal

June 21st, 2012

It’s all very well to talk to these CORBA objects floating around the network but how do you get your first one; how do you get into the system? The Quantel Broadcast System uses an Interoperable Object Reference (IOR) in a well known location. The IOR is nothing more, than just a series of characters making up a locator string. In the example below I’ve wrapped the lines but in real life this is just one line:


The IOR “string” is a formally serialised object that can be converted back to a real CORBA object. We can see the data contained in the IOR string by using the dior command (decode IOR) from the JacORB bin folder we looked at in the previous article:

cd D:\blog\jacorb-3.0rc1\bin
dior -i IOR:00000000000…

Gives the output:

TypeId : IDL:Q_Quentin/Q_InternalPortal:1.0
  Profile Id:             0
  IIOP Version:           1.2
  Port:                   20100
  Object key (URL):       638361439/%05%17%23%0C%1FH%3E%23F%23
  Object key (hex):       0x36 33 38 33 36 31 34 33 39 2F 05 17 23 0C 1F 48 3E 23 46 23
  -- Found 2 Tagged Components--
     Type: 1245790976 (JacORB)
     ForChar native code set Id: ISO8859_1
     Char Conversion Code Sets: UTF8
     ForWChar native code set Id: UTF16
     WChar Conversion Code Sets: UTF8, UCS2

As you can see the IOR string contains all the information needed to talk to a particular object in the CORBA system. It includes everything from IP address and port number to protocol version and text encoding type.

Quantel has made it easy to obtain the IOR from the ISA Manager by delivering it through the built-in web server. The ISA Manager is a critical component to the Quantel Broadcast System. As a consequence there is an ISA Manager and an ISA Slave for fail-over and redundancy. Each ISA delivers the IOR of the manager so you don’t have to worry about tracking which one of the ISAs is in control of the system.

For the largest part we don’t really care what’s is in IOR we just get it, convert it and make calls on it. So let’s continue with that in mind and start with a simple client to read the IOR string from http://isa-manager/ZonePortal.ior


URL loc = new URL("");
InputStream is = loc.openStream();
BufferedReader br = new BufferedReader (new InputStreamReader(is));
String ior = br.readLine();

From the output of the dior program (above) we can see the that underlying type of the IOR object is Q_Quentin/Q_InternalPortal:1.0. However this is a bit useless because we don’t have the interface definitions for that. We, as users, must be told that we can cast a Q_Quentin/Q_InternalPortal:1.0 into a Quentin/ZonePortal:1.0.

Casting is a computer language term which means to take the same bit of memory where an object lives and treat it as a different type. It only works if the 2 types are related. In CORBA terms 2 classes might share the same interface but may be totally different classes. In this case CORBA coins the term narrowing to convert one type into another. It almost always requires a bit of extra knowledge that says that 2 items are related on an interface level: this is where the Object Request Broker (ORB) comes in.

The ORB knows about the relationships between the CORBA interfaces and will allow you to convert between them. Your local ORB will ask the remote ORB to do the narrowing for us because we might not have the full interface definitions, i.e. we have no way to find out what a Q_Quentin/Q_InternalPortal:1.0 is or how to convert it into a Quentin/ZonePortal:1.0.

This part is somewhat CORBA implementation specific. In this example I’m using Java and JacORB but it would look similar if you were using a different implementation.

Setting up the CORBA sub-system is a bit like creating Sockets for network communications in that there are lots of options and documentation about those options but after going through all of it, you inevitably end up with the same couple of lines of code!

The CORBA interfaces are built into the Java Standard libraries so all we need to do is tell Java to use the JacORB implementation, which is simply a case of telling it which class to use. The args and props variables give you the opportunity to add extra configuration options from the command line and configuration files respectively.


Properties props = new java.util.Properties ();
props.setProperty ("org.omg.CORBA.ORBClass", "org.jacorb.orb.ORB");
props.setProperty ("org.omg.CORBA.ORBSingletonClass", "org.jacorb.orb.ORBSingleton");
org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init (args, props);

Once the ORB is set up we can use it to narrow the IOR into a ZonePortal.


org.omg.CORBA.Object rawo = orb.string_to_object (ior);
ZonePortal portal = ZonePortalHelper.narrow (rawo);

Now that we have our very own ZonePortal we can test it with a simple get version call:


String x = portal.getProperty (PropertiesOperations.softwareVersion);
System.out.println ("This ISA Manager is version " + x);

So let’s put it all together.


import java.util.Properties;
import com.quantel.quentin.PropertiesOperations;
import com.quantel.quentin.ZonePortal;
import com.quantel.quentin.ZonePortalHelper;
class OrbExample
static org.omg.CORBA.ORB orb;
static org.omg.PortableServer.POA poa;
  public static void main (String[] args) throws Exception
    // read ior
    URL loc = new URL ("http://isa-manager/ZoneManager.ior");
    InputStream is = loc.openStream ();
    BufferedReader br = new BufferedReader (new InputStreamReader (is));
    String ior = br.readLine ();
    br.close ();
    // Initialisation properties
    Properties props = new java.util.Properties ();
    props.setProperty ("org.omg.CORBA.ORBClass", "org.jacorb.orb.ORB");
    props.setProperty ("org.omg.CORBA.ORBSingletonClass", "org.jacorb.orb.ORBSingleton");
    // create orb
    orb = org.omg.CORBA.ORB.init (args, props);
    org.omg.CORBA.Object rawo = orb.string_to_object (ior);
    ZonePortal portal = ZonePortalHelper.narrow (rawo);
    String x = portal.getProperty (PropertiesOperations.softwareVersion);
    System.out.println ("This ISA Manager is version " + x);

Searching Lotus Notes Mail

June 12th, 2012

I should start off by saying that Lotus Notes is a piece of shit but unfortunately I still have to use it from time-to-time.

But, I have too so I have to at entries to my blog to help me remember how to do all the trivial tasks I need to like searching email folders or creating mail lists, operations that in other mail client applications are so simple there’s no need to write additional blogs.

This one is to help me remember how to search a mail folder. You’d have thought it’s something like right-click on the folder and select search or select the binoculars from the toolbar when the folder is highlighted but ooohhh nnoooo!

  1. Complain to your boss again about how awful Lotus Notes is.
  2. First select the folder you would like to search, just the one mind!
  3. From the menu bar select View -> Search This View.
  4. This will open the Search in View dialogue box.
  5. In the Search for box enter your criterion.
  6. Click the Search button to begin the search.
  7. To exit the search just click the ‘X’ in the top right corner.

Simple instructions for recording a clip using Quantel Dummy Server

June 6th, 2012

You have just finished Installing a Quantel ISA Manager with DummyServers for test development and now we are going to look at launching the ISA Manager and recording a test clip.

Running the ISA System is really simple now:

  1. Navigate to C:\Data\QuentinV3.
  2. Double click manage.bat.
  3. This will launch the ISA Manager. The window is titled Quentin Manager: Execute mode. In the centre of the window you will see a list of pools: Pool 11, Pool 12 and Pool 13. They all appear in red which indicates they are currently down.
  4. Back to Explorer and change directory to C:\Data\QuentinV3\DummyZones.
  5. Double click DummyZone1.bat.
  6. A window titled Dummy Zone 1 will appear. It contains 3 Dummy Servers called Dummy 1100, Dummy 1200 and Dummy 1300 which hold pools 11, 12 and 13 respectively.
  7. Switch back the the Quentin Manager and you will see that all the pools are now listed in blue which indicates that they are available.

Now that all the servers are up we can launch the controller to …erm control the system! Now let’s do a record. Make sure the Dummy Zone is visible on your desktop. As we use the controller we’ll be able to see the effects in real time.

  1. Navigate back to C:\Data\QuentinV3.
  2. Double click ctrl.bat.
  3. Choose the System tab.
  4. Select Dummy 1100 and then double click Channel S1100C0 (Server 1100, channel 0).
  5. Click Record. The server record panel will open in the controller and the first port on Dummy 1100 will switch from colour bars to a dummy feed.
  6. Click the button next to Initial Frames, it should have a number on it. Enter the number of frames you would like to record. To help with the sums, if you set the system up as PAL it’ll be 25 frames per second and if you set it up as NTSC it’ll be 30 frames a second. Then click ok.
  7. Click Initial Frames to acquire the space and set up the record.
  8. When you are ready click Start. You will see the pattern change for each frame. The view port in the controller will match the port on the Dummy Server.
  9. In the Save Data section of the controller enter a title and click save. You have just recorded and saved a clip.
  10. We can make another smaller clip from the same rush. Hover the mouse pointer over the gap between frame 6 and frame 7 and double click. The green In point will be set. Move the slider to the other end and do the same between frames 83 and 84. This time a red Out point will be set. Add a new title and click save again.
  11. One of the cool things about the Quantel system is that you can create as many sub clips as you like and it won’t take up any more space on your server!
  12. Click the Release button in the server control panel at the top of the controller window, to make the port available to the system again.
  13. Click the Zone Dummy 1000 (local) tab.
  14. Click Search and you will see your new clips.
  15. You can select any of the entries in the search results with the usual click/control+click/shift+click to select more than one and then click Delete at the bottom of the controller window.

Congratulations you have successfully recorded a clip, searched for that clip and deleted it.