typemismatch

just a projection of my own imagination

  • You are here: 
  • Home
  • Software

Simple DB Profile Provider added to MultiCore

Posted on September 20th, 2009

The first take on a simple db profile provider has been added to the current release of multicore. That version is 1.0.2.0 and binaries/source are on github.

The profile provider works – has some limitations and will only work with string properties. When I get some more free time I’ll add support for other useful types :)

I also pushed source and released binaries to codeplex, for those more familiar with that you can find the code here.

As usual the wiki and source can be found on the main multicore site.

Tags: ,
Filed under .NET, Software | No Comments »

Is Amazon SimpleDB Injection Attack Safe?

Posted on September 18th, 2009

I hope as a developer you are well aware of SQL Injection attacks and if you aren’t, you’re living under a pretty big rock :)

It occurred to me recently that with more cloud based database technologies coming into existence that I have yet to see mention of this problem with those services. I think it is definitely something that warrants a good amount of research.

Initially I’m going to focus my efforts on Amazon’s simple db service since I’m actively using it. I’ll post my findings and any techniques to prevent discovered issues. Off the bat I’m guessing you can’t be too malicious since a delete request cannot be embedded into a select request however unwanted results are never good and a select looks like it could return more data than the developer was hoping for with a traditional attack.

If you have any thoughts on this or know of existing posts from other developers please comment! or post them on the multicore site.

Filed under Software | 1 Comment »

Don’t go Mono, go Ruby …

Posted on June 27th, 2009

I’ve always liked the Mono project and since its inception way back when I’ve dabbled with their technology. The thought of running .NET on linux was something I always wanted to do. Recently I had a real business need to have parts of an application run on UBuntu. Not only that but I hear plenty of clients make the wild claim that “hey, if we need to run on linux we’ll just use mono!”

Initially I looked at doing this in Ruby but the learning curve for my back end services was a little steep. No problem, I’ll keep development moving in C# but keep it simple 2.0 so that it can run on Mono. Over the last few days I setup some new UBuntu servers and tried to get some of these applications running. No luck. I even ran the analyser tool which tries to make sure everything is compatible… it was. All the calls I use are available in Mono but the results are different.

That alone is high risk. If I’m using the same basic calls then I really need the results to be the same on each platform. It then occurred to me that the entire principle of the Mono project is doomed to fail. It is and always will be a sub-par port of .NET.

The bottom line is, if you want or need your application to truly run cross platform then use a language with native support, from the beginning for those needs. There are many. You have choices like Java, Python or Ruby just to name some. C# for the time being is a Windows language.

I have chosen to slowly convert rather than port and will run back ground services as Ruby apps which once written in Ruby run anywhere Ruby is supported without problems. My websites however will remain asp.net mvc. I have had plenty of success with Rails but the new MVC for .NET is just too good :)

Just a side note: I’m sure plenty of applications can be built in Mono but they need to be built and tested in Mono from the beginning. The problem you’ll run into is many c# 3rd party components, if not most, are written and tested in .NET and you don’t really know if they’ll work on Mono. Again here I say – if you only use Mono fine but why not rather use a true cross platform technology rather than a continuous port.

Tags:
Filed under .NET, Software | No Comments »

Watch your time zones on Windows Azure!

Posted on June 8th, 2009

So I deployed some code to Windows Azure and was initially surprised that it was running differently than what I had observed locally.

Turns out and once you think of it its a no brainer … my code was running in a different time zone. All my other services were in EST but this was PST. The solution in my case is to keep everything as GMT and then do any necessary calculations :)

You might wonder if this is documented anywhere. To be honest, I have no idea since most of the documentation has been very poor. The website for Azure has circular links that will drive you nuts and the local SDK docs are just focused more on the API and are too incomplete as well.

Update: Since posting I’ve been told all servers will be and are currently in GMT time. Cool!

Tags:
Filed under Software | 3 Comments »

Deployment to Windows Azure

Posted on June 4th, 2009

Here goes my first real deployment. The first thing you’ll notice is that you no longer need an application id. It looks like that was there for live authentication and so it has been decoupled for those not needing it by default.

To deploy you just upload the application package and service configuration file. By the way, just right click your worker role project and pick Publish to generate your files. Once uploaded, you get this cool staging/production screen.

image

Once uploaded you can change the configuration xml via the browser which is great! I’m about the hit run and see what happens …

Staging worked perfectly. I can’t find a way to view logs so I’m going to promote it to production next. As a test the service emails me the logs, so I can see it all working.

The promotion seemed to work however I did get a system error from the website. I will say this – the site needs some work, it is pretty slow and bulky. Come on MS make it fly! :)

Tags:
Filed under Software | No Comments »

Using Windows Azure with Amazon Simple DB

Posted on June 4th, 2009

I have a great real world example of something that needs to be run in the cloud. Currently I have 2 types of applications running. One type is a sentinel and the other is a listener. There are many of these running today across three data centers. I want to know when one of these services has stopped functioning correctly.

My test is going to be to build a worker role that can run in Azure, connect to Amazon’s Simple DB service and look for status information sent from these other services. This will show connectivity between two different cloud technologies and allow me to test the availability and notification services of Azure. For example, is this new worker goes offline – how do I get notified?

I’ll be using my SDB .NET Provider which I haven’t yet released to the public. It allows me to hide the implementation of the Simple DB code so I can switch it out as required. It includes all Amazon libraries as well as SQS and a .NET Membership provider.

Here is the initial code block.

image

We’ll write an object to Amazon and then see if we can fetch it. This is making use of Amazon’s web services. I specifically didn’t put any exception handling around this start method because I want to see what the Azure system does when something goes wrong. The provider was configured using an app.config file.

When I tried to run – problem:

System.Security.SecurityException Message=Request for ConfigurationPermission failed while attempting to access configuration section at …. – lucky for me controlling the section permissions can be done in the config file. I set my section to requirePermission=false.

I don’t seem to be able to use a config file to setup the provider so I’m going to cheat for now and setup a stand alone instance without any config files and we’ll see how that does :) I did notice I’m probably supposed to put all the required config xml in the service configuration file so I’ll do that next time.

Here is a screenshot of the output, works like a charm. A test object was written and retrieved from Amazon Simple DB.

image

A couple notes. If you rename your worker role don’t forget to update your service definition file and configuration file. There does appear to be a problem with the developer fabric. I write information event entries to the log and they were not showing up but I knew the role was running. After restarting the fabric the messages started to appear again so I’ll see if I can report that as an issue. As an FYI I used a System Timer object to trigger my code, works great too.

In my next post, I’ll try deploy this to the real cloud :)

Tags: ,
Filed under Software | No Comments »

My TDD Analogy

Posted on June 3rd, 2009

In my post about Test Driven Design I expressed concerns around building your entire architecture to just support testing. My thoughts were definately tough to put into words, maybe I should have used more pictures :)

I do finally feel I have a decent analogy to the problem I’m concerned with. Building your application to be perfectly testable would be like building a car to always pass a crash test and to say – “let’s build a car that could never ever hurt someone”. Great, so it has no wheels or even an engine but dammit, it performs great in crash tests, it passes every test!

Applications have to work, testing like vehicle safety does unfortunately come second to functionality. Should you test? of course – but it is a balancing act so don’t get sucked into all the hype.

Also, in the words of Jeff Atwood, don’t just listen to me or don’t listen to me at all. I am no expert so do your homework :)

Tags:
Filed under Software | No Comments »

First Azure Worker Role

Posted on June 1st, 2009

Here are some of my findings around Microsoft’s upcoming Azure platform. I initially thought Amazon had it in the bag with EC2 but to be honest, I’m tired of running my own servers. Google’s app hosting is ok, if you like Java or Python technologies – which I do but I thought I’d try the full Visual Studio approach :)

I’m using Visual Studio 2010 Beta 1. First gotcha, I wanted to run my work role and was told I had to be running VS as administrator … boo really? Wasn’t that a freaking Vista problem. This is Windows 7 RC1 people!

image

If you’re not running SQL Express you’ll need to reconfigure the local data storage services, which have those lovely hidden options buried in a .config file. Thanks to the link for the location. (Changing Development Storage)

Get it right and you’ll get this nice little local storage window the first time you run something:

image

When your role gets running, you can load up the fabric UI to actually get control of your own Azure cloud. All this without having to actually deploy to the cloud yet. Pretty neat. Remember that a role is basically like a console application in the cloud. Here is my little default application running, the output is just like a console window:

image 

So what comes next? I’m going to try embed my Amazon Simple DB provider and S3 library into a real role and throw in some workflow for fun. Might as well push it right :) I’ll also be fetching some data from AQS. (Amazon Queue Service). I’ve read a fair bit about thread issues or at least limits on how many instances of a role can run.

Right now I believe you’re limited to 1 instance of a role which kinda sucks. You can have threads which is fine but still puts severe caps on application scale capacity.

Tags:
Filed under .NET, Software | 2 Comments »

A warning about test driven development

Posted on June 1st, 2009

Oh wow did someone really say something bad about TDD … I mean what could be bad about this latest fad ;-)

So testing your code is of course a good thing. Anything these days to help us write better code is a good thing but definitely in moderation. I’d say with all the work going into TDD and I’ll later explain my thoughts on DDD, people are once again on the search for the holy grail of software engineering. It doesn’t exist, get over it – software engineers are artisans by definition and that is because our skill is extremely creative and you can’t wrap it up in a process to make it perfect.

What bothers me with TDD is the amount of effort being placed on “passing the test”. It is one thing to make your code easier to test but a totally different thing to engineer your entire application, just so it can be tested. Is your client paying you $$ per hour to have something that can be tested or something that works?

What about dependency injection. A hot subject for allowing the injection of mock objects or testable objects into code. My question is, if you inject a mock object into a test – is the test really real? Now inversion of control has its place, like most patterns, but I warn you against thinking you’ll now have perfect code if every class is instantiated through an IoC container.

So when it comes to application architecture I urge you to use some common sense. Pick patterns that solve problems you really have. A lot of code can be tested just fine without DI. A facade is often simpler for centralized code. Here are the general rules I would suggest to keep you on track:

  1. Build an application that meets the requirements first!
  2. Make sure it performs and scales well.
  3. Make it easier to test! but not a requirement if it means major architectural changes.
  4. If you can’t automate your test, like many user interfaces – use a person, they’re called QAEs!

You don’t have to like it but too many developers forget what the point of the code is to start with. Not to pass tests but to do something cool :)

Tags:
Filed under Software | 1 Comment »

Visual Studio 2010 Beta 1

Posted on May 25th, 2009

Yeah I guess the title sums this up. Reminds me of how ridiculous it was when VS 2008 was launched and wouldn’t run on Vista …

I tried to get this up on Windows 7 RC1 and it installed fine but when it loads the screen doesn’t paint correctly. After a few clicks I just get the frame of the IDE and nothing else … freaking joy.

I _might_ be related to running in a virtual machine but either way it should work otherwise I’ll be stuck with VS 2008 for quite some time.

edit: I knew this would come back to bite me, no point hiding it. The readme has the solution about vmware 3d acceleration issues. Turn it off and you’re good – not a great solution but still a solution. I’m not sure who is to blame for the issue.

Tags:
Filed under Software | No Comments »