Saturday, 13 March 2010

Streaming video from Ubuntu to Xbox 360 via BT Home Hub

Before my PS3 shit a brick and I replaced it with a Xbox 360, I tried to get Mediatomb streaming video from my Ubuntu machine to my PS3. Although it worked to some extent, there seemed to be a buffering issue. Videos would play for a few minutes then stop to load up more of the video.

While trying to set up uShare I came across the same problem. The obvious constant here was my router so while dicking around with the settings of my BT Home Hub I managed to solve the problem.

Here's what I did.
  1. Open the home hub's web page. The ip address should be
  2. Click on Basic Config.
  3. Click on Wireless.
  4. Under "Wireless channel" change Channel selection to "Manual" and Channel to "11".
That's it. Give it a minute then crank up uShare.

Thursday, 11 March 2010

Using awk as a floor function

I was searching the internet trying to find out if awk had a floor function when I realised awk IS a floor function.

graham@graham-laptop:~$ x=3.5
graham@graham-laptop:~$ echo $x | awk -F. '{print $1}'

You could always change $1 for $2 and it becomes a mod function.

Thursday, 4 March 2010

Selecting beginning of financial year in Oracle

I recently had to work out how to return the beginning of the financial year from an Oracle database. After trawling the internet, everything looked rather complicated for what I was after.

Below is what I came up with. It's pretty simple to change. If April is not the month you want to return, change the +4 at the end to the number of the month you want to return.

select trunc(add_months(sysdate, - (12 + to_char(sysdate,'MM'))+4),'MM')
from dual