Installing PHPUnit On Windows With Out PEAR

This is a quick description of how I got PHPUnit working on Windows without installing PEAR

The PHPUnit documentation is a cryptic and sparse when describing how to install PHPUnit on windows.

I am assuming that PHP is already installed and working.

Steps:

  1. Download the latest version of PHPUnit (currently 3.4.9) from here http://pear.phpunit.de/get/
  2. Extract to somewhere (I put it in my PHP directory)
  3. Edit the phpunit.bat file. At the bottom of the file there are two lines:
    set PHPBIN="@php_bin@"
    %PHPBIN% "@bin_dir@\phpunit" %*
  4. Change them to something like this:
    set PHPBIN="C:\Program Files (x86)\PHP\php.exe"
    %PHPBIN% "C:\Program Files (x86)\PHP\phpunit.php" %*
  5. To test if PHPUnit is working run “phpunit --help” from a command  prompt (PHP directory needs to be set in the path environment variable).

Setting Return-Path in PHP

We have a system that needs to send automated emails. But we were having a problems where we were not getting bounce emails from invalid email addresses.

After half a day of digging it turns out the problem was that the Return-Path header was being set to the user that the web server runs as. Which was a non-existent email address.

To set the Return-Path in PHP on a unix environment use:
mail('nobody@example.com', 'the subject', 'the message', null, '-fwebmaster@example.com');

In windows envioronment use:
ini_set('sendmail_from', 'webmaster@example.com);

For more information see: http://www.php.net/manual/en/function.mail.php

First telescope

Quick review/initial thoughts of the SkyWatcher BKP13065EQ2 telescope I just brought.

As the model name suggest its a 130mm (5.1″) Newtonian Reflecting telescope. It has a focal length of 650mm and a focal ratio of F/5. For more detailed spesifications see the  SkyWatcher BKP13065EQ2 page. The scope cost $500 NZD before shipping.

The first thing to note is how easy the setup was. I found instructions very easy to understand and follow and had the telescope setup under and hour (all tools were provided in the box). And seeing as this was the first time I’ve setup a telescope I don’t think thats to bad. The instructions are well written with easy to follow diagrams. They also contain details on how to polar align the scope, collimating the optics, even calculating the magnification and true field of view.

The scope looks nice all in black with a slight sparkle to it.

It comes with 2 eye pieces, a 25mm and a 10mm. These are probably fine for a first telescope, but I’ll likely want to pick up some more and maybe some filters at a later date.

The mount feels quite sturdy, with adjustable height. Seems to manage the scope and 3.5 kg counter weight easily (once balanced correctly).  One of the main criteria I was looking for a first telescope was portability. Once fully assembled the whole thing is difficult to move around, but can easily be broken down to manageable pieces in a couple of minutes.

I can’t really comment on the viewing experience as I haven’t had a chance to do any night viewing yet. I’ve only had the scope for one night and it was clouded out. Expect a follow up

Conclusion:
I can’t really find a fault with the SkyWatcher BKP13065EQ2 telescope. It looks good, has excellent instructions, simple to setup and reasonably portable.

Move Music Into Artist Folders

I like my music in artist folders so I created this little VB Script to move music albums into single folders.
It takes a folder full of albums in the format “Artist – Album” and creates a folder for each artist, then moves the Albums into that folder.

For example if you have a folder C:\Music and sub folders in the format “Artist – Album” like below:

C:\Music\Artist1 – Album1
C:\Music\Artist1 – Album2
C:\Music\Artist2 – Album1

It will turn it into:

C:\Music\Artist1\Artits1 – Album1
C:\Music\Artist1\Artist1 – Album2
C:\Music\Artits2\Artits2 – Album1

Just copy the below code into a text file, rename it something like “music mover.vbs” put it in your root music directory (C:\Music\ in my example) and run it. Your music should now be in folders by artist.

Script is:

Dim fso, folderObj, folders, outputFile, currentDir, newFolder, dashPos, folderName

Set fso = CreateObject("Scripting.FileSystemObject")
currentDir = fso.GetAbsolutePathName(".") + "\"

Set outputFile = fso.CreateTextFile(currentDir&"\FileList.txt", True) 'file for loging things
Set folderObj = fso.GetFolder(currentDir)

Set folders = folderObj.SubFolders

For each folderIdx In folders
	newFolder = ""
	dashPos = InStr(folderIdx.Name, "-")
	folderName = currentDir + folderIdx.Name

	if dashPos <> 0 then 'we found a dash in the folder name (asuming that there are no artists or albums with dashes in their names the format is Artist - Album)

		newFolder = currentDir + Trim(Left(folderIdx.Name, dashPos-1))

		if not fso.FolderExists(newFolder) then
			fso.CreateFolder(newFolder)
			outputFile.WriteLine("Created new folder (" + Trim(Left(folderIdx.Name, dashPos-1)) + ")")
		else
			outputFile.WriteLine("Folder already exists (" + Trim(Left(folderIdx.Name, dashPos-1)) + ")")
		End If		

		outputFile.WriteLine(" - Added (" + folderIdx.Name + ")")
		Call fso.MoveFolder(folderName, newFolder + "\\")

	End If
Next

outputFile.Close

If I feel like it I might write a script that does the opposite, takes Music\Artist\Artist – Album and moves them to Music\Artist – Album.

More Lotus Notes table problems

Sort of an addition to my previous post, Notes doesn’t like large tables being created with AppendTable().

You get this error “Illegal column width – check Left and Right margins”. The work around is to create the table with only one row and the desired columns and then use AddRow() to add up to 255 rows.

See the IBM technote for more infomation.

Hard limit on Lotus Notes rich text table rows

Some times Lotus Notes frustrates the hell out of me. Someone decided that it would be a good idea to put a hard limit (or at least a tiny limit) on the number of rows that a table can have

I’m not using composite applications introduced in Lotus Notes 8, I assume it handles this kind of thing a lot better. But the java client is to heavy weight and all our database (Applications) and they use the standard design elements anyway.

If you try and create a table with more than 255 rows you will get the error:

“Table can have only 255 rows”

List of Domino limits

Solution:
The solution is to basically keep creating new tables when you hit the row limit. The only problem is that it creates a gap between the tables which may mess up the layout a little.

Here is a simple function I wrote to break up an array into multiple tables if there are to many rows and add it to rich text field

rtField – the field you want to add the tables to
tableData – a 2D array that gets converted into a table (this holds the table data)
rows – the number of rows in the tableData array
cols – the number of columns in the tableData array

Sub CreateTable(rtField As NotesRichTextItem, tableData As Variant, rows As Integer, cols As Integer)
    numFullTablesToAdd% = 0
    numFullTablesToAdd% = Fix(rows/255)
    ‘add tables first
    For i%=1 To numFullTablesToAdd%
        Call rtField.AppendTable(255, cols) ‘ max row tables
    Next   
    Call rtField.AppendTable(rows Mod 255, cols) ‘ whats left
    Dim rtnav As NotesRichTextNavigator
    Set rtnav = rtField.CreateNavigator
    ‘Dim rtTable As NotesRichTextTable
    Call rtnav.FindFirstElement(RTELEM_TYPE_TABLECELL)
    For r%=0 To rows-1
        For c%=0 To cols-1
            Call rtField.BeginInsert(rtnav)
            Call rtField.AppendText(tableData(r%, c%))
            Call rtField.EndInsert
            Call rtnav.FindNextElement(RTELEM_TYPE_TABLECELL)
        Next
    Next
End Sub

There maybe a way to instead create a table with HTML but I haven’t worked out out yet. Will update if I find a better solution

Beginner Astronomer

I’ve finally decided to take the next step in my astronomy interest. List night I went to the first meeting of the Palmerston North Astronomical Society up at the Palmerston North observatory. Half the time was mainly meeting formalities and a short presentation by the Chairman on a gathering they have each year called “Star Date”. After the we moved up to the telescope dome to get some viewing done. I can’t remember the exact size of telescope the dome housed bit it had an aperture of around 60cm (24 inches). This was the first time I had looked through a telescope of this size, even though it was very old I was pleasantly impressed. We viewed 4 objects that night I can’t remember what the first object was, I remember it was a nebula. The second was Barnard’s Loop (I think). This is where the Horse Head Nebula and Orion Nebula can be found although the telescope wasn’t able to resolve the Horse Head.  Then we had a look at the comet Lulin that is at its nearest pass at the moment, it was still very faint though. And lastly we pointed the telescope at Saturn, at the time it was close to the horizon, so we were getting a lot of atmospheric interference. There’s something about seeing an things in the night sky through a telescope with your own eyes that make it all that more awe-inspireing.

I think my next step is to pick up a pair of binoculors or a cheep telescope and get out there myself

Follow

Get every new post delivered to your Inbox.