Starting again, and some other ideas

It’s been awhile since this blog was last really active.

I’m still getting comment spam, but that’s already become a “normal” thing for most bloggers these days.

Have been doing a bit of reflection in regards to the future direction of my blogging. For a brief moment I did consider just leaving this place to die.
But then I thought, maybe I can just focus on other things? Not just tech.

I’m also spending a lot of my time on Twitter lately. Which does get updated much more often than this blog. I’ve setup an account on Swurl to aggregate a few things that I update (twitter/flickr/

Another thought that came up was to start blogging about food, or in particular, about Vegetarian foods that I eat. Admittedly i’m not much of a cook (but i’m learning bit by bit). The not much of a cook part is what’s holding that idea up, not that it’s going to stop me :)

I’ve been inspired by two Melbourne based food blogs i’ve been subscribed to over the past few months, one by Mel Bedgood the other by Cindy & Michael called “where’s the beef?”. My other inspiration to start posting about Vegetarian foods is the questions I often get asked when I tell people that i’m a Vegetarian which is “so what do you eat?” and “so do you get enough Vitamins?”

It’d probably be quite easy to just direct people to the plethora of Vegetarian recipe websites and blogs and other resources, but it’s never quite that easy to define. Different individuals will have different ways of achieving the same means.

What I eat will be vastly different to many other Vegetarian individuals out there. You’d think being an Aussie with a Chinese background most of my food at home is going to be Chinese, right? Well, no.

What I do end up eating at home is a mixture from my parents’ upbringing and mums’ penchant for the local libraries cookbook section.
My mum was actually born in Luang Prabang in Laos, and dad was born in Vietnam (but are Chinese).

An example of something I may have for dinner might be Vietnamese Rice Paper wraps (Banh Cuon) with some salads (sweet potato based vermicelli noodles, cracked sesame seeds, ground pepper) with some honey/lemon and ginger dipping sauce.

Or it could be something else during summer when the Aussie mangoes are ripe and sliced on top of freshly steamed sticky rice. Then a sprinkling of lightly fried sesame seeds which had been cracked slightly in a pestle and mortar on top. There is just something about sticky rice I can’t get enough of, but hey, I grew up eating the stuff! :)

As you can see, I think there is great variety of foods available to anyone who is a Vegetarian (or even those who aren’t but like the idea of eating less meat for whatever reason they may have). So i’m hoping I can share a bit of that here.

Fixing Visual Studio’s System.OutOfMemoryException

Over the last little while Visual Studio 2005 has been crashing seemingly “randomly”. Sometimes it would happen when just trying to open a source file, other times when trying to debug a web app. A few co-workers asked if I wanted to try ReSharper, so I installed that. After installation crashing seemed much more frequent, so I went into Add-in Manager and disabled ReSharper.

My machine at work has 4GB of memory, and is running Windows XP. So I had assumed I had more than enough memory available for VS 2005 to use.

I had almost given up on fixing the issue, but yesterday came across the following blog post by Steven Harman titled Hacking Visual Studio to Use More Than 2Gigabytes of Memory.

Basically the solution was to boost the user-mode memory from 2GB to 3GB in XP via adding the /3GB to your BOOT.ini file, then making Visual Studio “Large Address” aware using the editbin command.

Paging the DataList

A few days ago I looked at various solutions to enhance an exhisting DataList control at work.

The DataList brings back a fair bit of data from several different tables and seemed a bit bloated.

The first solution I looked at was data paging and only showing rows as needed. The DataList doesn’t come with built in Paging capabilities, so you’ll need to write your own. Scott Guthrie has a great post about Efficient Data Paging with the DataList control.

Although that is a great solution, in this current environment of Ajaxifying everything you can get your fingers upon I found a great open source product named Ajax Data Controls (or ADC for short) and their DataList Paging example. You can download the controls from their CodePlex page.

The controls are basically an Ajaxified replacement for the exhisting ASP.NET 2.0 Data Controls (GridView/DataList/Repeater), with a few minor differences.

One of the authors, Kazi Manzur Rashid has a great blog post on how to use their GridView control.

A third solution is to use the PagedDataSource, which comes with ASP.NET 2.0. Sreejith Thathanattu has posted a good example of using the PagedDataSource on CodeProject with the DataList. If you decide to go down this path, consider assigning a Cached version of your DataSource to PagedDataSource as that will help with performance (you’ll be hitting the Database less).

Blank Comment Spam

There seems to be a lot of comment spam at the moment where the content is just a pair of <a>  </a> tags with no other content.

The common point linking most of them is their email address being usually an, and a handful with Or more specifically, the following:

There’s been about 76 of these that I’ve found, and they’ve started appearing on Saturday March 15th. To say the least, they are quite unusual compared to the regular spam I’ve been getting. I’m sure with time they may vary those addresses, or something else is going to be launched with this being just a simple system test-run.

Doing a little quick investigation via Google indicates that these aren’t new email spam addresses.

Internet Explorer 8 Beta 1 – Changes for Devs

The IE Team have just announced the availability of Beta 1 of IE8 for developers. You can read more about that on their blog.

Obviously as a web developer, the mind immediately turns to “so, what’s in it for me?”.

Picked up the following points from an MSDN Doc on what’s new for IE8:

Oh, and IE8 Whitepapers.

And finally, for those who want to try IE8 with no risks, you can download a Virtual PC image with IE8 from here.

Using Reports locally in ASP.NET 2.0

I was asked recently to develop reports for an internal ASP.NET app, after doing some research found that the best solution was to use the ASP.NET ReportViewer control set in LocalMode.

One of my big restrictions was the inability to upgrade from SQL Server 2000 to 2005, which meant avoiding I needed to avoid MS SQL Reporting Services. After much research into third party reporting components such as the Telerik Reporting Control as well as the SharpDevelop Reports, in the end I found a CodeProject article on Using the ASP.NET 2.0 ReportViewer in Local Mode which sounded perfect for my requirements.

Another requirement was to have the reports emailed out to respective contacts within the system, with PDF being the preferred format. My initial thought was to export to a temporary file on the system and attach it to the system generated email.

Found some code on the MSDN Forums about Printing Local Reports in ASP.NET which contained a useful looking ReportPrinterHelper class. Reading the code I noticed that it called the ReportViewer’s LocalReport.Render() function, and passed “PDF” as a parameter and also returned a byte[] array. An aha! moment struck, I could create a MemoryStream from the Byte[] array and attach that to an email as a PDF file.

Here’s my new RenderToPDFBytes function:

public static byte[] RenderToPDFBytes(ReportViewer reportViewer, ExportType exportType) 
  if (exportType == ExportType.Pdf) 
    Warning[] warnings; 
    string mimeType, encoding, fileNameExtension; 
    string[] streams; 
    byte[] pdfContent = reportViewer.LocalReport.Render("PDF", null, out mimeType, out encoding, out fileNameExtension, out streams, out warnings); 
    return pdfContent; 
  else if (exportType == ExportType.Xls) 
    // Implement if needed, just change PDF to XLS 
  return new byte[0]; 

Just place that into your ReportPrinterHelper class and reference it in your code as follows:

// Render our ReportViewer control to PDF format as bytes 
byte[] data = ReportPrinterHelper.RenderToPDFBytes(rptViewer1, ExportType.Pdf); 
// Transform our byte[] into a format suitable for attaching to an email. 
// Eg: Either in memory, or as a file on the system. 
MemoryStream ms = new MemoryStream(data); 
// Now to email it out as an attachment 
  MailMessage mm = new MailMessage(); 
  mm.From = new MailAddress("", "Ex Corp"); 
  mm.To.Add(new MailAddress("", "Bob Code")); 
  mm.Subject = "Daily Random Report"; 
  mm.Body = "Please find attached your Daily Report";    

  // Add our attachment to the MailMessage 
  mm.Attachments.Add(new Attachment(ms, "random.pdf", "application/pdf"));    

  // Set to your relevant SMTP Host 
  SmtpClient smtp = new SmtpClient(""); 
catch (System.Exception e) 
  // catch error and do something with it. 

Note: The ReportViewer control is only available as part of Visual Studio 2005 and is not a part of ASP.NET. As such, you’ll need Visual Studio installed to work with it.

Random Links

Okay, I just need to unload a whole bunch of links that have been open in various tabs in IE7.

Improve your wireless network in ten different ways via
Managing The Madness: What you need to know about covering the NCAA Tournament via Strobist.
Ace your next phone interview via
How to find free eBooks for your cellphone or PDA via
Tech support with VNC reverse connections via
Speed up your hard drive defrag via
Data Encryption Toolkit for Mobile PCs via

And one more link, for those using IE7. It’s an add-in called IE7Pro, which has a few interesting features such as crash recovery and tab history.

Making your blog photos look better

Did you ever wish that your blog photographs looked better?

Now i’m no professional photographer, but some other people are.

I came across a blog late last year called

Strobist to the rescue! Check out David’s how to article on DIY $10 Macro Photo studio.

I created a similar setup last year to play around with, here’s what I came up with.
LightBox Photo Setup

And here’s a few photos taken using this setup:
Toying with the lightbox/wireless flash mmm... Choccies!

There’s also a follow up article on Strobist suggesting some improvements to DIY Macro Studio.

Of course, I had to try this out myself. So I did, and here’s one of my results:
A Nikon branded Compact Flash card

My setup differs a bit, but uses many of those ideas. Rather than using a reflective black tile, I use a black piece of cardboard on the base of my lightbox and found a 2mm thick piece of plastic to place on top of that.

What the plastic does is create a reflective surface, and the black piece of paper underneath the plastic creates my “shiny” reflective black surface. My only issue is that the plastic is bigger than the base of the box, and I found that it gives me a funky reflection on my background as you can see in the top left of the following photo.

Vroom vroom

For the background, I’ve placed a single A4 sheet of blue paper.

You might think it’d be a weird look, a black surface with a blue background, but you’d be wrong. What happens is whatever colour your background is, that will be the colour of your surface. The black shiny surface basically acts a bit like a mirror and will reflect both your subject, as well as the background.

Change the background regularly, surprise yourself and goodluck! :)