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!

Thursday, May 17, 2012

Internet Explorer 6 hacks, fixes etc

If you are unfortunate enough to have to support Internet Exploder (euphemistically known as Internet Explorer), that piece of garbage that MS inflicted on the world, here are some useful links that will help you.
IE7.js, IE8.js and IE9.js are JavaScript libraries to make Microsoft Internet Explorer5/6 behave like a standards-compliant browser. They fix many HTML and CSS issues and make transparent PNG work correctly under IE5 and IE6.

Visit this site for some interesting reading on the above scripts and the (then) imminent release of Internet Exploder 7

Wednesday, May 2, 2012

Monitor your Website’s Uptime with Google Docs

Here is a great GDocs script that will email you when your site goes down/up.

http://www.labnol.org/internet/website-uptime-monitor/21060/

Follow the instructions in the author's page and you will end up with your own copy of the script.
If you want to email multiple recipients instead of just the one, here are the changes I made to support that:

from line 47 onwards:

ScriptProperties.setProperty("status", code);

var recipients = email.split(";");
for (r in recipients) {
if (recipients[r] != "") {
MailApp.sendEmail(recipients[r], msg, error);
}
}
// end of code changes

Many thanks to the author +Amit Agarwal


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

Tuesday, October 18, 2011

NeoniQ/Geniatech/Asiapads ATV1000 firmware updates etc

I bought one of the above Android-based media players and had a hard time getting it to play movies properly. The interface wasn't exactly the easiest to live with.


I have since found a newer version of the firmware (09Sep2011) *and* a version of the Android Market!!!

Download the above and then do the following:
1) copy the new firmware onto an SD card (not a USB disk!!!),
2) rename it to update.zip
3) On the media player, press F2 to go to the home screen, the F1 to bring up the options at the bottom of the screen. Select Settings, Privacy, Update firmware. It will reboot and install the new firmare.

Repeat this process for the market zip too.


Note: There have been a few updates since the above was written.
The first one is update_eng_0916 and the second one is update_Australia_0927

Update_eng_0916 is very similar to the original 09Sep2011 one, with a few more apps in it, as well as Flash player v10.2

The 'australian' one comes with Flash player v10.3


I am using the 'eng' version and, apart for the extra junk apps, it works very well.

The above updates do not include the HDMI switcher that came with the original firmware.
To get it back, do the following:

  • press and hold left mouse button
  • when the menu pops up, select Shortcuts, Settings, Display settings.
  • Done!



Enjoy!

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

Tuesday, October 11, 2011

FileZilla connection issues - MSLD

It looks like somebody cocked up at FileZilla.
The latest version (v3.5.1) refuses to connect to my RedHat server, even though all previous versions of FileZilla did.

Reading some of the threads around the web, the developers decided to use the MLSD command (to get a directory listing) and it seems to cause no end of problems.
They seem to insist that MLSD is a standard command and the people should change their FTP servers instead.
Perhaps those devs should extract their cranium from their anus, instead of telling people to change their (perfectly good FTP servers. We use ProFTPD)

That rant aside, the way to overcome this problem is to not use passive mode.

Use the File/SiteManager menu to find the entry you want to connect to and, under TransferSettings, set the Transfer mode to Active.

Enjoy!

Thursday, September 29, 2011

Why Your JavaScript Developed in Firefox Might Fail in IE

Mitchell Pronschinske has a great article explaining js differences between Firefox and Internet Exploder.

Some of those issues can be bypassed by using jQuery but it still is a great read for all js developers.