Posted by Brad | Posted in Ramblings | Posted on 07-08-2009
So I had this problem where we live with rubbish being dumped in the alleyway at the end of our nice garden.
I had a few arguments with the teens and they don’t come anymore, but the mess was still there. I contacted the council and found myself doing that for a week, until I wrote a little automatic email script to run from my server mentioning the case number they gave me and requesting an update… Set this to fire off at 8am every day and today after 4 days I see one cleared alleyway!.
Automate repetitive tasks… You know it makes sense.
Posted by Brad | Posted in Ramblings | Posted on 28-07-2009
Many times in life you find yourself being slowed down by some shit that just does not need to be there, either a person just making work for them self or the result of pretty much the same thing.
Whenever possible, just go around it/them to save yourself time being wasted.

Posted by Brad | Posted in Ramblings | Posted on 30-06-2009
And so the vicious circle of what is healthy this year will kill you next year, and the year after that it will be healthy again goes on.. which strangely has no boundaries except the end of research funding for smart people with nothing better to do with their time.
Now it’s the turn of cycling, until today a GREAT way to get fit (I drive but also ride my bike to work as it’s a WAY more enjoyable commute) – if you’re a man and cycle more than precisely 186 miles a week then your balls are toast.
I will say though that after years of commuting by bike, I became a dad when I decided for myself to lay off the cycling for a bit, and the smoking…
Posted by Brad | Posted in Ramblings | Posted on 26-06-2009
Just tried signing up to a new twitter account, was asked to enter the following two words…. as if…

On a completely different note, today is another one of those days that reminds us we need to take every day to the full as there are only so many of them for each of us, Farrah Fawcett died, Michael Jackson just died, and the father of a dear friend of ours also passed away today – R.I.P. all.
Posted by Brad | Posted in C#, Ramblings | Posted on 23-06-2009
These are the minimum using directives to add at the top of the code behind for building an HTML table from a SQL Server to a SqlDataReader concisely.
using System.Web.UI.HtmlControls;
using System.Data;
using System.Data.SqlClient;
Your table in the aspx file can be as simple as
And the code behind that does the work, taking the value from a dropdown list control called Category, and retrieving data from Northwind is
using(SqlConnection cnn = new SqlConnection("Data Source=YOURSERVER; Database=Northwind; UID=YOURDBUSERID; PWd=YOURDBPASSWORD"))
{
SqlCommand cmd;
SqlDataReader rdr;
HtmlTableRow row = new HtmlTableRow();
HtmlTableCell cell = new HtmlTableCell("th");
cell.InnerText = "Product ID";
row.Cells.Add(cell);
cell = new HtmlTableCell("th");
cell.InnerText = "Product Name";
row.Cells.Add(cell);
cell = new HtmlTableCell("th");
cell.InnerText = "Units in stock";
row.Cells.Add(cell);
Products.Rows.Add(row);
cmd = new SqlCommand("SELECT ProductID, ProductName, UnitsInStock FROM Products WHERE CategoryID = "
+ Category.SelectedValue, cnn);
cnn.Open();
rdr = cmd.ExecuteReader();
while (rdr.Read())
{
row = new HtmlTableRow();
cell = new HtmlTableCell();
cell.InnerText = rdr["ProductID"].ToString();
row.Cells.Add(cell);
cell = new HtmlTableCell();
cell.InnerText = rdr["ProductName"].ToString();
row.Cells.Add(cell);
cell = new HtmlTableCell();
cell.InnerText = rdr["UnitsInStock"].ToString();
row.Cells.Add(cell);
Products.Rows.Add(row);
}
}