typemismatch

just a projection of my own imagination

  • You are here: 
  • Home
  • 2008 October

Setting up a Windows image in Amazon’s EC2

Posted on October 24th, 2008

Signing up is a real no brainer, if you can’t get past that – time for a new day job :)

http://aws.amazon.com/ec2

The first problem was – what next? There really isn’t a clear next steps but after a little digging this is the path that I took.

You will first need to get your X502 certificate, it is all done via their website so that was pretty easy. I stored it in a folder called EC2\Keys – both public and private. Remember to backup those keys!!

Next you need to download the tools. These are a set of command files and java libraries so yes, you need to have a Java runtime installed.

http://docs.amazonwebservices.com/AWSEC2/latest/GettingStartedGuide/setting-up-your-tools.html

Set your JAVA_HOME to the Java installed folder and not the /Bin folder. Make sure to setup the rest of those variables. If you already had a java runtime installed, don’t assume the java home path is set.

Next I followed the instructions on this page to setup a keypair and run a default image.

http://docs.amazonwebservices.com/AWSEC2/latest/GettingStartedGuide/

http://docs.amazonwebservices.com/AWSEC2/latest/GettingStartedGuide/running-an-instance-windows.html

Once you have this all done and a image running you’re done – this is a server just for you. Install whatever software you want and get hosting! Overall not too bad :) You will need to bundle the instance before ever shutting it down otherwise you will loose OS changes. Once bundled you get your own AMI to relaunch clone instances.

Don’t forget if you TURN OFF, SHUTDOWN, TERMINATE any running images they are gone forever! only attached storage volumes persist.

Tags:
Filed under General | No Comments »

Amazon goes live with Windows in the Cloud

Posted on October 24th, 2008

Yes finally!! :) If you aren’t a fun of cloud completing you should be. It is extremely cost effective, reliable and easy to use. I’ve been dying to get really hands on with Amazon’s EC2 but since launch it has only supported Linux images.

Today they have turned on support for Windows! including SQL Server and the licenses are bundled in the image. You can also store information directly in their S3 service.

I’ll be posting results here from testing and pricing as I spend the next month getting some applications deployed in their cloud.

It was interesting to see that Rackspace is going to try compete – albeit too late to the party but we’ll see what they come up with. I can’t blame them – cloud competing is a huge threat to traditional hosting companies however it took Amazon a long time to get EC2 ready so it isn’t something you just dive into.

Tags:
Filed under General | No Comments »

Silverlight Tip – Initialize!

Posted on October 20th, 2008

Wow, who said learning new stuff wasn’t fun! :) Here is another little gem I found which will change your understanding of how Silverlight applications work.

I had a little application that was working great, it even had a bunch of nifty video things taking place in the code behind. I wanted to redo my layout and so cleaned out the old code, built my new layout and then something went wrong.

I just got a blank web page with no errors, compiler error or warnings – just no Silverlight control. I checked and checked and recompiled and cleaned cache and had a beer – still nothing.

So I created a new project and test xaml page and that worked fine – then I looked at the code behind and spotted the issue. The code below is added by default and IS required – I had accidentally removed it when cleaning up, must be getting old ;-)

You must have the following in your code behind page (user control class)

public Page()
{
    InitializeComponent();
}

Pretty simple but something you can delete and not notice until nothing works :) Silly me.

Tags:
Filed under Software | No Comments »

Silverlight Tip – Grid layouts

Posted on October 20th, 2008

Just a simple tip if you haven’t already tried to use these layout controls.

When you are creating content (controls) to add to the grid via a Row and Column number it would help if you knew the index is 0 (Zero) based …. that would be Column 0, Row 0 for the top left corner and not 1,1 as it should be :)

Enjoy!

Tags:
Filed under Software | No Comments »

Selecting a single LINQ2SQL Entity

Posted on October 19th, 2008

Linq2SQL is fast becoming one of my favorite frameworks for throwing quick sites together. I used to use a lot of object relational mappers but this is free and built in so .. yay :)

I’ve noticed recently a lack of understanding in trying to return a single entity from a collection. Many times when you fetch data you know there will only be 1 row but you get a collection or have to request First from an IQueryable type.

Lets say you have a Customers table. You want to fetch 1 row of type Customer.

Customer myCustomer = (from c in dataContext.Customers
                      where c.CustomerId = 1
                      select c).Single<Customer> ();           

myCustomer will now be of type Customer – nice and clean :)

 


A good all around LINQ book, not just L2SQL but Link to everything.
image

Tags:
Filed under Software | No Comments »

What kind of error handling is this?

Posted on October 17th, 2008

You’d be surprised the things that can be found during basic code reviews :) Once I found a pen I thought I’d lost … :) in all seriousness though, nothing drives me more crazy than seeing the following.

try
{
  // some code
}
catch (Exception e)
{
  throw e;
}

I could scream! and actually it wouldn’t be the first time either. I don’t have a lot of patience for things like this.

image

If you aren’t sure what is wrong, let us take a closer look. For one, I came across this while actually hunting for a memory leak but I could never see an exception on any line except “throw e;” – because no matter what went wrong, the exception was caught and just thrown again and since the last line responsible is always the throw, I had to attach a debugger to find the real error.

The second problem is you haven’t actually accomplished anything, nada, zip, less than $2c of quality code here people – it doesn’t do anything. If you’re going to catch an error then DEAL with it.

I have seen some developers catch an error, log various details and then throw some kind of error again. Maybe there is a need for that but I doubt it can be justified very often. If something goes wrong you need to try fix the problem and continue normal operations so you users are unaware and if you can’t then fail gracefully.

Make sure too that you LOG errors – use any means necessary but just make sure the stack trace and some information about system state is recorded so you can fix fix fix :) – since its probably your fault it broke to start with.

And if you don’t have any error handling, get too it! Nothing could be worse than your users getting the yellow? screen of death :)

Here is something if you’re just beginning – I’ve always found these books pretty good for getting started, including some basics like the above.


image
Beginning Microsoft Visual C# 2008 (Wrox Beginning Guides)

Tags: ,
Filed under .NET | No Comments »

Silverlight and Google searches

Posted on October 15th, 2008

Well unless you’ve been living under a rock you’d know that Silverlight 2.0 has now been released. Why do you care? … Assuming the rock you were under wasn’t too big :) you’d know that the first release of Silverlight was really intended for designers and not developers although, there was technically nothing stopping you from creating anything you wanted. It was just extremely painful. Think pencil in ear.

Silverlight 2.0 brings all the goodies that we’ve come to expect as good little Microsoft developers. We have better looking user controls, layout controls and a host of 3rd party controls from companies like Telerik and ComponentArt.

And so the great move to Silverlight begins, anyone that has any half decent web application is going to want it redone in Silverlight and most new projects will want to take advantage of the hype around this technology. Please note (pretty please?) I don’t really like the word “hype” since the technology truly is amazing .. anyway with the CYA out the way I too started on a new design for some of my own products.

One of these is my Mafooku shared store system. This site, like many, requires that Google can do a good job searching for content since there are thousands of products for sale. Then it hit me. How is Google going to search my content when it’s embedded in a control … I’m sure many of you are already shouting – but just emit the same content and hide it … nah, not really practical on many sites and a waste of bandwidth.

You probably hoping there is some great solution – nah … nothing yet. I’m thinking there needs to be some interface added for search engines to find the exact content you’re displaying but I am unaware of anything as yet. I’m not saying there isn’t :) I just haven’t found it yet.

I did want to share a link to a short blog post about a transform you can add, that a search engine can use to get a form of rendered and readable content which can be searched.

Content Transform

It did also just occur to me that creating external links like

http://somelink/?id=x

need a way to be interpreted by the Silverlight application so that the correct content can be displayed … fun :) I’m sure it will be easy but definitely a new way of doing things.

It is the best of Flash, Smart clients and the web all in one. I hope you’re going to get learning too! Nobody needs another html web site :)

ps: Dear Google, please make me a Silverlight Adsense control :)

Tags: ,
Filed under General, Software | No Comments »