Back to fencing comps – 55 days to go

Due to a number of factors (Time, Money, Stress etc etc) I had stopped going to fencing comps (and thus deprived my self of the driving force for going to normal fencing), but with the Nationals being this weekend and thus the end of the Season, i think it is time to start to get ready for the next season, so the Bristol Open 19th of September will be the first comp i attend and i REALLY have to get in shape by then,

Exercise target (per Week)
2 x Nights of fencing.
1 x Lesson
3 x Gym Sessions

The Gym stuff is not really ideal (as Steve Paul Says “the best exercise for fencing IS fencing”), but i believe i have finally started to get my priorities in order in my life, fencing is fun and all and i believe the best way to keep fit but im not going to sacrifice personal relationships or work for it, strangely enough i think this might make me better at competitions as i wont be as stressed.

The gym sessions will initially consist of 40 mins sessions with

2k rowing (as level 10 in 8mins)
10 mins punch bag
10 mins Stepper (at level 13 random)
10 mins undetermined!! (yeah yeah)

I feel there may be pain ahead!!

Oi wheres me config docs Oh bugger I dont have a nsf

Here we go with another example of what to do when cruelly ripped from the
bosom of the notes server

This time its config docs, these as we all know are a happy doddle in notes, we
just store them in what ever db (usually the current one) is suitable and pull
then back with a view (personally i don’t like profile documents as they are a
swine to copy around in comparison to normal docs), when faced this same basic
need in Java, and not wanting to use a relation database (feels like a bit of
an over kill for some things) i went searching and found more wonderful people
who have already done the job, this time at
http://commons.apache.org/configuration/
They have a nice little lib that lets you store stuff in xml docs (as well as
many other things), here is an example (lets call it config.xml)

<?xml version="1.0" encoding="ISO-8859-1" ?>
<project-definition>
    <example1>
     <textexample>im a example</textexample>
    </example1>
    <example2>
     <intexample>15</intexample>
     <list1>
      <name>item1,item2,item</name>
     </list1>
    </example2>
</project-definition>

 

I’m going to save this in the root of my Java project, and now on to the code

import org.apache.commons.configuration.ConfigurationException;
import org.apache.commons.configuration.XMLConfiguration;
public class EasyConfigDocs{
       public static void main(String[] args) {
          try {
              XMLConfiguration config = new XMLConfiguration("Config.xml");
            String textconfig = config.getString("example1.textexample");
               //Note: to get an indented value you separate with a "."  
              int numberconfig = config.getInt("example2.intexample");
              List buttons = config.getList("example2.list1.name");
               //Note: on multivalue items the default separator is a "," if 
you want to use a "," in a text string you need to either do "," or change the 
default delimiter (easy to do, its on the site) 
          } catch(ConfigurationException cex) {
             System.out.println("config file not found");
          }
       }
}

 

Nearly as simple as Notes (not that i did any work), it also does all the Edit
and Add stuff, but you can get that off the examples at
http://commons.apache.org/configuration/ if you need it, i just want to save
you the pain on the initial search, Oh!, on that note keep a look out at
http://www.benpoole.com hes on the same track as me and has some good blog
tutorials for notes developers fighting with pure Java coming up.

Old Comments
————
##### John(15/07/2011 13:51:29 GDT)
I don’t really like the way that they have write that code
##### Mark Myers(17/07/2011 17:42:12 GDT)
@john really?, i find it a pleasant and easy going way of doing configs, what way do you prefer?

Doing Scheduled agents When not on a Domino server

When you step outside the warmth and comfort of a domino server a lot of things frighten the willies out of you, things you took for granted are suddenly not there, so i thought each time i have to do a notes equivalent in the cold hard
world, I would share:

Today sprig of joy is scheduled agents in Java (on a JBoss server actually), this is all supplied thanks to the amazing people over at http://www.opensymphony.com/quartz/, its far more powerful than my example, but it easy to understand when you come from notes, and you can expand on it as you see fit (instruction are in the comments), have fun (oh, if the code looks cramped just copy it to a bigger text widow as i left all the proper indenting in)

import org.quartz.CronTrigger;
import org.quartz.JobDetail;
import org.quartz.Scheduler;
import org.quartz.impl.StdSchedulerFactory;
public class JustLikeANotesAgent {
    public static void SetUpNotesTypeAgent(String CronTriggerPram) throws 
Exception {
        // setting up the scheduler which is basically the equivalent of agent 
manager
       Scheduler scheduler = StdSchedulerFactory.getDefaultScheduler();
        // setting up our "Agent" ie giving it a name and linking it to a chunk 
of code
        JobDetail NotesAgent = new JobDetail("NotesAgentName", null, 
AgentCode.class);
        // setting up our schedule ,there are "simple triggers" and 
"Crontriggers"
        // Crontriggers are more powerful and easy to get a handle on if your 
used to notes
        CronTrigger AgentSchedule=new CronTrigger("AgentScheduleName",null
,CronTriggerPram);
        // linking the Agent to its schedule and "enabling" it
        scheduler.scheduleJob(NotesAgentName, AgentScheduleName);
        scheduler.start(); // and off we go, basically "load Agmr"
    }
    public static void main(String[] args) {
           //the following string is a Cron Trigger that runs every 5 mins
           // tutorial on crontriggers can be found HERE
     String CronTriggerPram = "0 0/5 * * * ?";
     try {
      SetUpNotesTypeAgent(CronTriggerPram);
     } catch (Exception e) {
      e.printStackTrace();
     } 
            //scheduler.shutdown(); this is commented out as its basically like 
"tell agmr quit"     
    }
}

After the honeymoon, Tip 1

Its been about 2 months since i started using adobe flex in billable anger, and
even the best platform looses some of its ability to escape criticism in that
time, flex however is proving to be everything that I had hoped for, but you
still bump into the odd thing that domino does much better, so I’m doing a
series of tips and tricks to help you get everything from both systems
(especially when used together).

Todays tip is sortable date columns in flex data grids

Flex data grids are a wonderful thing, with easy sorting and sizeable columns
and such, but one thing sucks on them, and that’s the fact that they only do
TEXT sorting, dates are just treated like text which means that all of the
common date formats wont sort correctly, Booooo!, but we can fix that
surprisingly easily

First you want to output your date data from notes in YYYYMMDD format, why??
because this formats displays the same when sorted textually or chronologically

so in a view that would be (its a bit long as we need to pad the short
days/months (thanks to Ben Poole for pointing this out))

edited by popular vote to a shorted version

@Text(@Year(LossDate)) + @Right(“0” + @Text(@Month(LossDate));2) + @Right(“0” +
@Text(@Day(LossDate));2)

if your using a web service to return that value, the Java code would be

import java.util.Date;
import java.text.DateFormat;
import java.text.SimpleDateFormat;

Item dateitem = doc.getFirstItem(“DateIWant”);
DateTime notesdate = dateitem.getDateTimeValue();

DateFormat dateFormatordered = new SimpleDateFormat(“yyyyMMdd”);

String UpdDtSort=dateFormatordered.format(notesdate);

if you using lotusscript for you webservice then your on your own!!.

Now into flex and define a “Dateformater”, this is my personal fav date format
(is it sad that i have one) and produces dates like “Tue May 04 2009″, which i
find removes many problems with international formats causing confusion.

 

Next you will need your actual datagrid (which you will already have if you
have discovered this problem).

<mx:DataGrid width=”740″ height=”126″ x=”10″ y=”34″ id=”datesortview”
dataProvider=”{mynotesview}” fontFamily=”Arial”>

 

You will notice the “labelFunction” at the end of the date column, that calls
the following function (and passes the parameters automatically).

private function dateLabel(item:Object, column: DataGridColumn) : String {
if (item[column.dataField] != null) {
var TempDate:Date = DateField.stringToDate(item[column.dataField],
“YYYYMMDD”);
return dateFormatternice.format(TempDate);
} else {
return “”;
}
}

This basically just takes in each value in the column, converts it to a date
using a mask, formats to a pretty format and returns it back to the column. it
is MUCH faster than attempting a code based sort solution (as some people use
in flex using “sortCompareFunction” on a datagrid).

your column now has 2 values the underlying data format in the happily sortable
“20090504” and the label format that the user sees in the format “Tue May 04
2009”, yet again a feature we took for granted in notes requires a bit of
coding to get it in other platforms.

8Gb memory in Laptop

As the development I’m doing gets more and more serious, I find myself missing the hideous nature of my old Alienware laptop, its dedicated RAID card was a real boon to multiple vmware images running at once, when the memory ran thin.

However with my latest machine (a badly butchered Compal FL92 which I’m normally very very happy with), there is no dedicated RAID card and the internal space and voltage won’t stand the double/triple height of the raptor 2.5 inch drive, sooo, i have to keep it away from the drive (the processor is fine), but I’m at 4Gb already, surely the little devil will take the latest 8Gb cards, a trip round the forums comes up with a guy with proof that the FL92 will take the Crucial 8Gb set, it’s £258 which is about what I was expecting. Clutching a credit card in my sweaty hands, I make my rash purchase.

Now that I’m committed (Crucial had it delivered to my hand by 9am on Saturday, when I ordered it Friday afternoon and I picked the slow, free postage), time to make it work with the old software EEEEK!, Linux Generic can’t cope with more than 3Gb, and 64 bit is not to be considered, as there is no flash player and lots of other software won’t work Update Vaughan Rivett’s has since corrected me that the 64bit version is just fine and not missing any of the good stuff, so ignore my drivelling End Update, hmmmm, but Linux servers have been running more than 4Gb for ages on 32bit, and indeed they can, using something called Physical Address Extension so I just have to swap out my kernel and it will be OK.

In Linux this is easy – just do the following in the nearest terminal:

$sudo apt-get install linux-restricted-modules-server

$sudo apt-get install linux-headers-server

$sudo apt-get install linux-image-server linux-server

I then had to go into “/boot/grub/menu.lst

and add

title Ubuntu 8.04.2, kernel 2.6.24-24-server
root (hd0,0)
kernel /boot/vmlinuz-2.6.24-24-server root=UUID=24bcaa1c-2860-4171-b760-e1129947958e ro quiet splash acpi_os_name=”Windows 2001 SP2”
initrd /boot/initrd.img-2.6.24-24-server

at the top of the “## ## End Default Options ##” section (I just copied the 4 lines that were previously at the top of that section and changed the “initrd.img-2.6.24-24-server” and “vmlinuz-2.6.24-24-server” values so that they matched the latest changed files in the “/boot/” folder
then restarted.

and LOOK!!!

But would that new memory be passed on to the applications?

Well I’m happy!! (Where’s me copy of WAS??)