May 31, 2009

Advertising

The advertising revenue model for websites is a common one, even if the intention is to make enough to pay for hosting costs only. An alternative source of funding is direct sponsorship. When you build a site and advertising is your chosen revenue model you may want to implement one or both of these.

Some points worth mentioning:

  • Google's AdSense is a widely used service, but to make money from it you need to have a lot of ad clicks.
  • Sponsorship deals may come and go, but revenue from sponsorship can be significant and particularly appropriate for your site. There is often some great synergy to be found.
I'm looking at developing some start up sites (on my own and with others) and I have been weighing up advertising solutions from a business and technical point of view.
  • I want to be flexible; sponsorship is possible but in the absence of such deals I want to fall back to Google AdSense or self-advertising or something else; and
  • I want all the typical advertising features and customization; and
  • I don't really want to write one myself.
Looking around at the Open Source options I didn't see anything that particularly caught my eye in the Microsoft space. It was a quick look admittedly, but usually the best options float to the surface quickly. During my search I came across the OS software OpenX. And this is where things start to get interesting.

OpenX is a collection of advertising options.
  • It is an Open Source ad server that you can download and begin to play with. You can host it yourself and, from my own experience with ad servers, it is a fully feature one.
  • It's not the ASP.NET/SQL Server solution I started looking for. (Check out the details on Ohloh.)
  • They offer hosted advertising using the same ad server
  • It comes with a simple interface for configuring customers, websites, campaigns, banners. It literally took miniutes to get a campaign up and running.
  • I can use it to deliver Google AdSense and they provide instructions for setting this up.
  • Incorporating it onto my site is simply a matter of including some JavaScript. To ensure good performance you can have a single calll returning multiple ads per page.
  • You can slice how your ads are delivered; "geographically" is a key one for me. I can also specify custom logic.
  • The ad server has an API and is extensible.
  • They have a service called the OpenX Market which seems to be a way of increasing your ad revenue in a competitive but safe fashion. I'm yet to delve into this.
  • And the cool thing is it's free for up to 100 million ad impressions per month. Ample for the start up sites I'm looking at.
OpenX is currently attracting a lot of investment interest. Check out this article from TechCrunch. It has some strong players and is going forward strongly.

OpenX and its range of solutions sounds, looks and feels like a winner to me. It meets all the requirements I have in mind (apart from the technology platform - I favour the Microsoft stack) . It easily meets the flexibility I require for the sites that I have in mind.

May 14, 2009

Cross Page Postback to new window

I recently had to post to the same page in a new window for a project I was working on. This post got me halfway through but I had to vary it to work with my scenario task.

Setting onclientclick="target='blank'" successfully lets me post to the same page and have it appear in a different tabbed window. But subsequent button clicks on the same page will also send the output to different windows.

Joteke's post uses JavaScript to remember the original onclientclick information and the uses a timeout to reset the target of the form.

Rather than use the JavaScript methods he provided I simply use the same trick to reset the form's target back to "target=''".

runat="server" Text="Button" PostBackUrl="~/Default2.aspx" />

runat="server" Text="Button" PostBackUrl="~/Default1.aspx" />


Problem solved. And thanks to Joteke, of course.

May 2, 2009

CSS Grid Layout

A colleague recently told me about some CSS techniques I was completely unaware of. My way of saying thanks is to point you at his blog.

One technique, in particular, is the CSS Grid Layout. The grid layout has been around for decades, but it has only recently come into fashion in the web world.

The CSS Grid Layout is all about breaking your layout into columns using defined styles. Use of a layout will enable faster mocking and prototyping, greater consistency and shorter development. These benefits will increase if you work on multiple projects and use the same grid layout.

This encouraged me to investigate a few options out there with the follwoing requirements:
  • lightweight
  • easy to use
  • flexible
  • cross-browser
And certainly nothing complex that will cause me to dream about it at night.

I came across these two that meet my requirements. I'm sure there are more so feel free to let me know of your experiences and views.

http://www.blueprintcss.org/
http://960.gs/

I've opted for 960's implementation because:
  • the examples on the page looked good
  • there was a short example
  • there is mathematical appeal in the use of "960"
  • it delievers what it says it will
As I finish this short post I have just found that Jeff Attwood as already posted on this. In 2007! I'm only two years late to the party. But looking around and at my own work experience I think a lot of people don't know the party has started!


April 18, 2009

Mac, VMWare, Visual Studio and Remote SQL Server 2008

All my nocturnal development is done on a Mac + VMware Fusion + Vista rig. VMWare runs Vista using NAT. This is basically a note to remind myself how to configure remote SQL Server access over port 1433.

I need to do this so I can run aspnet_regsql.exe and Visual Studio's server explorer against a remote SQL Server 2008 database.

In the terminal:
cd /Library/Application\ Support/VMware\ Fusion/vmnet8
sudo chmod o+rw nat.conf
sudo vim nat.conf

Under the [incomingtcp] section add the line ("i" to insert a new line and ":wq" to save and quit):

1433 = 127.0.0.1:80 // Use the IP address of your VM here.

sudo /Library/Application\ Support/VMware\ Fusion/boot.sh --restart

And voila! Talking to SQL Server over 1433 works. (This final command does not restart the VM itself.)

April 5, 2009

ASP.NET MVC: Which view engine

I'm about to start work on several ASP.NET MVC web applications. I'm debating whether to use the default view engine or another. Before I begin I'll point you at Scott Hanselman's blog post on this. He goes into technical detail on two I am considering. I'm not going to reproduce his work, just let you know which view engine I've decided to use and why.

(I'm also writing this blog from the hip. I just want my thoughts to fall onto the paper and see how it turns out. It's a style I'm trying out...)

Option 1 | Standard ASP.NET MVC Rendering Engine

This one is closest to the Web Forms rendering engine and closest to the look and feel of HTML. The only thing that bothers me is I feel as though I am forever writing HTML. Then the HTML helper methods come along and it feels like I switch from markup to code.
  • It's safe and easy to sell.
  • It's no different to writing HTML, really.
  • You can't really apply logic to the HTML you want to render.
Option 2 | NHAML

NHAML has gone for a much more code-like approach to rendering HTML.
  • It has scope when it comes to HTML elements meaning you don't have to close them, just like in C#.
  • Calls to the MVC HTML helpers are much "closer" meaning I can go from UI to code smartly. As a coder I rather like this.
  • From a high level this looks like code more than it looks like HTML.
Option 3 | Spark

Spark is a new implementation that is still being worked on. Insofar as far as I understand, the HTML is the framework into which you inject logic to control the display of the HTML.

  • It looks more like HTML from a distance.
  • There are a lot of angle brackets about the place.
  • The code integrates with the HTML rather siting outside.
The Choice

So which one shall I go for? Bear in mind that I haven't actually used NHAML or Spark for a commercial project. NHAML appeals becuase it is more codey. Spark appeals because it quite cleverly integrates code logic and HTML together. Both let you use lgoic to deal with what you want to render.

I also have to weigh up which I am likely to use in commercial development. The no-brainer is the default rendering engine, but I want to be able to propose alternatives to customers. I think NHAML would be a hard sell to architects and developers alike it looks more complex and different to what they are used to. Spark on the other hand looks easier because it looks more familar even though it seems to have quite a bit of power behind it.

[A short ponder later...]

It will be Spark. It it's different. I can do more than the default rendering engine. It looks more like I can sell it into a company. And it feels edge, slightly more exciting than the alternatives.

April 2, 2009

NUnit in the Shadows

I was working on a suite of tests using NUnit recently. One of the libraries I was testing has files that are copied to a folder relative to itself. The NUnit test verifying access failed but when run as part of the application everything worked as expected.

The code causing the issue was building the file path using the the assembly's Location property.

Assembly.GetExecutingAssembly().Location

In normal usage this was working as expected; a file URI was being returned that I could parse using the Uri class and pull out the directory. Under NUnit usage this was giving me a completely different location that did not have the expected files. It turns out that NUnit employs a .NET feature called Shadow Copying.

"Shadow copying allows assemblies that are used in an application domain to be updated without unloading the application domain. This is particularly useful for applications that must be available continuously, such as ASP.NET sites." -
MSDN

NUnit uses this mechanism to allow assemblies to be reloaded easily as part of the edit and debug process. You can get an indication of whether the assembly has been shadow copied using the following boolean property (see MSDN).

AppDomain.CurrentDomain.ShadowCopyFiles

If true you can use the CodeBase property in place of Location.

Assembly.GetExecutingAssembly().Codebase

An alternative option is to disable shadow copying in NUnit although the NUnit site seems to discourage this so I suspect there are some downstream effects (see NUnit).

January 16, 2009

My McBook

When I ordered my last laptop, an Alienware, it took months to arrive. I did, during that period, travel to Japan and Tahiti. By the time I received it I was majorly underwhelmed.

I ordered a custom Apple Macbook lat weekend. Within a week it was with me. Check out the tracking...


Suffice to say, I am super excited.

January 9, 2009

Dare to Dream Different Challenge

Last year I entered a Microsoft competition to promote the .NET Micro Framework. The entrance site is still there at http://dreamdifferentcontest.com. Well, I entered in the professional category and just found out today that I made it to the semi-finals.

Strictly speaking, I am just a "potential" semi-finalist and I need to sign a few forms and submit some photos first. Then they send me the development kit. Hopefully my new laptop will have arrived by then.

The idea is to create a prototype for a low-cost home security network that anyone can install and at the same time take advantage of commodity wireless routers.

The solution itself will include the .NET Micro Framework, Azure services and Live Services. The solution I have in mind should see these integrate quite nicely and at the same time provide for quite a lean solution.

Wish me luck!

August 20, 2008

Ohloh

Having recently bought a house in the sticks I have the opportunity to listen to podcasts once again on my commute. A favourite is Scott Hanselman. One of the topics he regularly discusses is the reading (and understanding) of code to improve one's own ability and skill in this craft.

This is something I intend to pursue. But what should I go for? Well, I was recently introduced to Ohloh. It is a site that trawls across Open Source projects and gathers various metrics about the projects and reports on them.

I get a lot of geek-pleasure programming C#so my first prt of call was to the C# projects that are there. I was quite pleased to see a few hundred C# projects out there with a very encouraging upward trend.

C# doesn't seem to be "up there" at the moment, but there are some big and very well-known projects in the way (FireFox, Ubuntu, Subversion, etc).

Projects that I think will be interesting to look through include Spring.NET, CruiseControl.NET, Mono (the highest ranked C# project).

As I was trawling through it did occur to me that writing a Linq to Subversion library would be fun and a great way to get into LINQ in a serious fashion. I've made a note to investigate this and pursue further. :D

So, I have a few things to look into. Now to make sure time to pursue them.

March 15, 2008

The Pragmatic Programmer

After almost 10 years of commercial software development I am sorry to say that I started reading "The Pragmatic Programmer" by Hunt and Thomas. Sorry. Because I should have read it 9-10 years ago.

The piece of pragmatic advice they offer that resounded the most with me was kind of hidden away compared to lots of other great advice on offer. It's in the section 'Stone Soup and Boild Frogs'. It goes, "Be a Catalyst for Change". They also provide a quote attributed to Rear Admiral Dr. Grace Hopper:

"It's easier to ask forgiveness than it is to get permission."

I'm sure, that as a Rear Admiral, he would not do something that was contrary to the greater good, contrary to the cause he was fighting, beyond appropriate timeframes and without risks suitably mitigated. With these holding true, then what a great way to proceed.