Friday, June 29, 2012

Calculate AUS taxes in GoogleDocs spreadsheet

The following custom function will calculate the tax that needs to be paid for any given salary, for FinYear 2011-12.


function australianTax2011_12(grossSalary) {
var tax = 0.0;
if (grossSalary > 180000) { 
      tax = 54550 + ((grossSalary - 180000) * 0.45); 
 } else if (grossSalary > 80000) { 
      tax = 17550 + ((grossSalary - 80000) * 0.37); 
 } else if (grossSalary > 37000) {
      tax = 4650 + ((grossSalary - 37000) * 0.30); 
 } else if (grossSalary > 6000) {
      tax = 0 + ((grossSalary - 6000) * 0.15); 
 } 

 return tax; 
}

This was created in a couple of minutes, so that I could simply call a function and get the tax figure straight away, instead of doing arithmetic gymnastics in the spreadsheet.
It is not elegant or optimised for speed, size, anything.


Follow the instructions in here on how to create a custom function.

Example use in a cell:   =australianTax2011_12(37000)


Use at own risk! 
I will not be responsible for any erroneous results.




ps: Comments and/or links to this article are most welcome!

Wednesday, June 20, 2012

How to install FreeNas to run from a USB stick, Proliant N40L

You will need the following tools

- A zip extractor, such as WinRAR, WinZip or 7zip

- PhysDiskWrite (at this time, it is physdiskwrite 0.5.2.zip)
This allows you to write the disk image to the USB stick

- The FreeNas ISO image. 
In my case, I downloaded FreeNAS-8.3.0-RC1-x64.img.xz 
This is the newest version at this time. You may find a newer version. 
The important bit is to download a full install version and not an *update*.
For example, do not download FreeNAS-8.3.0-RC1-x64.GUI_Upgrade.xz


1) Create a temp directory, say C:\dooda

2) Extract the contents of physdiskwrite 0.5.2.zip into c:\dooda

3) using your favourite zip extractor, extract the contents of the FreeNas XZ image into c:\dooda

4) rename whatever came out of the XZ file into something simple, say FreeNAS.img.

5) Open a command prompt (as administrator) in c:\dooda

6) type physdiskwrite.exe -u FreeNAS.img and look very carefully at the displayed results. In my case, I see the following
physdiskwrite v0.5.2 by Manuel Kasper <mk@neon1.net>
Searching for physical drives...
Information for \\.\PhysicalDrive0:
   Windows:       cyl: 14593
                  tpc: 255
                  spt: 63
Information for \\.\PhysicalDrive1:
   Windows:       cyl: 243201
                  tpc: 255
                  spt: 63
   C/H/S:         16383/16/63
   Model:         ST2000DM001-9YN164
   Serial number:          
   Firmware rev.: CC4C
Information for \\.\PhysicalDrive2:
   Windows:       cyl: 981
                  tpc: 255
                  spt: 63
Which disk do you want to write? (0..2)  2  
WARNING: that disk is larger than 2 GB! Make sure you're not accidentally
overwriting your primary hard disk! Proceeding on your own risk...
About to overwrite the contents of disk 2 with new data. Proceed? (y/n) y
You need to decide which of the drives shown is the one to dump the FreeNas image on.
Whatever drive you select will be totally overwritten. Totally!
Select carefully!

I can see that drive 2 is the smallest drive (8GB), i.e. my USB stick, so I enter '2' and press ENTphydER.

Please note that there mustn't be any partitions at all on the USB stick.
If there are, you will get an error complaining that it failed to write after 0 bytes (or some such).
To completely empty the USB stick, do the following
1) Open a command prompt (but do so as an admin)

2) Enter diskpart

3) Enter List disk
(this will list your disks and allow you to find the drive number of your USB stick)

4) Enter Select disk N         
(where N is the disk number of the USB stick. See screen dump and notes above)

5) Enter Clean

Done!

You can now install FreeNas on your hardware by booting on your newly-created USB stick.

In my case it is an HP Proliant N40L.
I have updated its BIOS as described in this article.
FreeNas v8 tips and tricks can be found here.
How to mount an external USB disk


Enjoy!


ps: Comments and/or links to this article are most welcome!