19 June 2007 in Microsoft, Mindscape | Comments (2)
We flipped the big switch earlier this week to launch backgroundmotion.com! We spoke a lot about this website at the technical events hosted by Microsoft earlier in the year and how we developed it within three weeks (excluding some subsequent additions as things such as SilverLight popped up on the radar
).
So what is BackgroundMotion?
It’s a site where you can go and share you favourite desktop images, and videos for use with Windows DreamScene. However it is a lot more than just that – it’s also a living breathing open source site where you can download the code and check out how we did certain things. You can learn about technologies and design principals used in the site such as:
- ASP.NET AJAX
- LINQ for SQL (in a .NET 2.0 project no less!)
- The MVP and Repository patterns
- How to integrate with Flickr, SilverLight, Virtual Earth, Windows Live Space
- How to write Vista Gadgets
- How to write secured Vista Gadgets using WCF
- How to use the Web Client Software Factory (Composite Web Block)
- How to work with RSS
- How to write a basic search engine using Lucene.NET
- Heaps more!
It really is quite an action packed sample application (and real world application). I’d strongly urge you to pull it down off codeplex and have a play.
I’d also like to urge you all to go and put at least a favourite desktop image or video onto BackgroundMotion.com. It’s a great resource and is getting a good amount of traffic right off that bat (all you need to do is link to the media you want to download. Nigel has an example if you want to host a video).
Web 2.0?
Part of what we wanted to show with BackgroundMotion is not just how to do some cool stuff but to show how you can leverage Microsoft technologies to create really compelling Web 2.0 style applications quickly and easily. We purposefully looked to simply leverage other services on the internet and provide our own services to aid in building BackgroundMotion faster.
Open Source?
This project was built using Microsoft technologies and we did work with folks from Microsoft (Mainly Darryl and Nigel with occasional appearances from Sean McBrean
) however this project is designed for developers to have a poke at and to play with. I’d be really excited to see some people pull it apart and add new features and submit them back to us so that we can look at integrating your changes into the codeplex project.
If you do have some patches then please email me.
Not big on downloading source? That doesn’t matter! We have integrated a way of viewing the key bits of code for each page so you can view it on the site. Of course I’d always suggest you dig a bit deeper and download the source – you will learn a lot
– JD
16 June 2007 in Business, Google, Tools | Comments (2)
As your business develops it’s always interesting to see what people have to say about you and your products. Sometimes this is easy because people post it directly to you or link to your blog and you get a track back however that only gives you a partial view of the world. I wanted to be able to see what people were saying about Mindscape, LightSpeed, BackgroundMotion and more anywhere on the internet.
Enter Google Alerts
I was reading through Simple and Loveable (great blog btw, I’ve been a long time lurker) a couple of months ago and noticed that Nat mentioned that she found a comment by somebody through an alert so I decided I’d have a look into it some more myself (and only just got around to “passing it forward” by writing this post…).
Overall I’m impressed, you can simply sign in, enter a term that you want to be notified about and have Google email you. You can select if you want updates “as they happen”, daily, weekly etc so you’re not overrun with email notifications and you can also configure what you want monitored – do you care if the name crops up in google news? blog search? web index? Of course you want to probably monitor all of the channels to get the best picture.
You can quickly see the benefits here. As an investor in a company (say, Xero) I can monitor the entire internet for the term “xero” and pick up what the online vibe is. This is probably quite an effective measure of the companies marketing being that they’re trying to be a Web 2.0 style organisation.
The upside to this is I can see if somebody blogs about our products or about our company and quickly go and follow up if they were having a technical issue or problem. It’s about taking that service to the next level – you should always make it as easy as possible for people to seek help but by going to the customer when they have an issue is priceless.
Of course it’s also useful in reducing the amount of time you spend ego-surfing by just having Google let you know when you or somebody else says something about you
Sign up for Google Alerts here
– JD
12 June 2007 in .Net, Code, Mindscape, Tools | Comments (2)
In my previous post about LightSpeed I discussed setting up a very basic LightSpeed instance but didn’t go into any detail about working with the data once we had configured it. In this post we’ll have a look at some basic ways of performing CRUD actions on our database through LightSpeed.
Creating Objects
To create an object we simply need to create an instance of our model class and assign the properties that we want set. This isn’t complicated and not LightSpeed specific so this isn’t a difficult mechanism to understand.
ConfigurationItem item = new ConfigurationItem(); item.ReferenceName = referenceName; item.ValueType = type; item.DisplayName = displayName; item.Description = description; item.Value = value; Repository.Add(item); Repository.CompleteUnitOfWork();
The important part here is at the end where we add the item to the repository and then tell the repository to complete the associated unit of work.
Retrieving Objects
There are many ways to retrieve objects in LightSpeed but I will detail two basic queries here. Retrieving my primary key and retrieving by a single field.
// Find the configuration item that has a primary key of 2 ConfigurationItem configItem = Repository.Find<ConfigurationItem>(2);
Here is a query by the DisplayName property which is just a normal property, not a primary key.
// Create a query to get an entity where the property "DisplayName" is equal to "Example" QueryExpression query = Entity.Attribute("DisplayName") == "Example"; // Get a collection of items that match that query from the database IList<ConfigurationItem> items = Repository.Find<ConfigurationItem>(query);
Queries certainly are a breeze when working with LightSpeed. In later posts we will look at more advanced queries that have multiple criteria.
Updating Objects
Updating an object with LightSpeed is an easy operation of just updating one or many properties on your entity and telling the repository to save those changes.
// Retrieve an object ConfigurationItem configItem= Repository.Find<ConfigurationItem>(2); // Update the display name configItem.DisplayName = "My Updated Display Name" // Save the changes to the database Repository.CompleteUnitOfWork();
Deleting Objects
Last but not least we occasionally need to delete data from our database.
// Get a configuration item of primary key 2 ConfigurationItem configItem = Repository.Find<ConfigurationItem>(2); // Mark the entity as deleted Repository.Remove(configItem); // Save the change, actually commiting the delete to the database Repository.CompleteUnitOfWork();
Now we have walked through CRUD interactions through LightSpeed.
Hope that helps,
– JD
11 June 2007 in .Net, Code, Mindscape, Tools | Comments (2)

In the weekend I was reworking a prototype of something I’m working on and I wanted to use LightSpeed to manage the data access and thought it would be appropriate as a code example of how to quickly and easily get started with LightSpeed. To clarify, I only needed LightSpeed for the persistence mechanism as opposed to the full domain modeling capability at this stage of my project.
The Problem
My application needed a mechanism for persisting configuration. The configuration this application stores is extensible and ideally will be extended by 3rd party plug-ins which means I needed to expose a service that can be used by these 3rd parties to store their custom configuration in a manner that will give access both to their plug-in as well as our application.
I’m also a staunch hater of >300KB XML configuration files and it’s early days in the prototype
Step 1: Create your model classes
I have a simple configuration entity that I wanted to be able to persist to a SQLite database (LightSpeed supports many different database engines by the way). At this stage of my prototype I’m effectively only storing a key/value pair, a human readable name and description and a type (e.g. string, color, int). In this code example you will need to reference LightSpeed in your project to gain access to the Entity<> class that we are inheriting off.
Note that LightSpeed takes care of the enum as well and will happily convert it to an int at the database level
Too easy.
using System; using Mindscape.LightSpeed; namespace Mindscape.Carbon.Core.Configuration { public class ConfigurationItem: Entity<guid> { public enum ConfigValueType { STRING, INT, COLOR } private string _referenceName; private string _value; private ConfigValueType _valueType; private string _displayName; private string _description; public string ReferenceName { get { return _referenceName; } set { Set(ref _referenceName, value, "ReferenceName"); } } public string Value { get { return _value; } set { Set(ref _value, value, "Value"); } } public ConfigValueType ValueType { get { return _valueType; } set { Set(ref _valueType, value, "ValueType"); } } public string DisplayName { get { return _displayName; } set { Set(ref _displayName, value, "DisplayName"); } } public string Description { get { return _description; } set { Set(ref _description, value, "Description"); } } } }
Step 2: Create your database
Currently you create your database manually however we are working on tools to do this for you. Note that I’m using a GUID as the primary key on this table and we didn’t need to add it to the model object in the previous step, LightSpeed does this for you. You only need to supply the primary key type in Entity
In my case I was using SQLite and just used a simple create table command:
CREATE TABLE ConfigurationItem( Id GUID NOT NULL PRIMARY KEY, ReferenceName NVARCHAR(50) NOT NULL UNIQUE, Value NVARCHAR(100) NOT NULL, ValueType INT NOT NULL, DisplayName NVARCHAR(100) NOT NULL, Description NVARCHAR(1024) NOT NULL);
Step 3: Add LightSpeed to your configuration
We need to tell our application about the database that LightSpeed should be working with and we can do this in code or in the .config file for our project. In this example I’ve elected to put it into the app.config of my project.
<configSections>
<section name="LightSpeed"
type="Mindscape.LightSpeed.Configuration.LightSpeedConfigurationSection, Mindscape.LightSpeed" />
</configSections>
<connectionStrings>
<add name="ConfigDB" connectionString="Data Source=MyDatabase.db3"/>
</connectionStrings>
<LightSpeed dataProvider="SQLite3"
connectionStringName="ConfigDB"
identityMethod="Guid"/> Step 4: Work with your data
That’s it! All the configuration work has been completed and there is no heavy XML mapping file or complex setup to tell LightSpeed about the database. The whole philosophy behind LightSpeed is to help developers get work done quickly and I hope this example and your own work with LightSpeed proves that. In following posts I will provide detail about working with your data however here is a taster of how easy it is to now put new objects into the database:
ConfigurationItem item = new ConfigurationItem(); item.ReferenceName = "MyRefName"; item.ValueType = ConfigurationItem.ConfigValueType.STRING; item.DisplayName = "Example Config"; item.Description = "This is an example configuration key"; item.Value = "example"; Repository.Add(item); Repository.CompleteUnitOfWork();
In this example I had an extremely simple model however you can appreciate that there is significantly less leg work required to get a LightSpeed solution up and running. I will post more advanced real world examples to help you gain more from working with LightSpeed in the near future. Also please leave any comments or questions you have on my blog regarding LightSpeed.
How can you use LightSpeed?
We currently are in late beta with an RTM of LightSpeed just around the corner. You can grab the download of LightSpeed from the Mindscape EAP site. You can also post in the forums to discuss any challenges that you have or to ask questions. We welcome any feedback.
Update: LightSpeed was released and is now available to play with here: http://www.mindscape.co.nz/products/LightSpeed/
Hope that helps,
– JD
7 June 2007 in .Net, Code | Comments (31)
Last night I had the opportunity to speak to the Christchurch .NET User Group about web standards and took the opportunity to add some discussion about testing using a tool called WatiN (pronounced “what-in”, horrible I know). From the feedback I’ve received so far the WatiN demo captured everyone’s imagination. I had a great time as well, very friendly folks in Christchurch
WatiN effectively allows you to script interactions with Internet Explorer and do things like fill out forms, click through and test the results that come back. This makes testing things such as a process flow really easy to do in a repeatable manner and included in your unit tests which ideally are being executed as part of your continuous integration processes.
Examples:
The example I demonstrated last night was just doing a simple test of the BackgroundMotion search engine. You can probably understand what is going on just from the code:
1 2 3 4 5 6 7 8 9 10 11 12 13 | [Test] public void TestSearchWithNoResult() { IE ie = new IE(); ie.GoTo("http://backgroundmotion/"); ie.TextField(Find.ById("ctl00_SearchBox")).Click(); ie.TextField(Find.ById("ctl00_SearchBox")).TypeText("beach"); ie.Button("ctl00_Search").Click(); Assert.IsTrue(ie.ContainsText("No results found")); ie.Close(); } |
Automated Validation is a hot topic for me as I really hate working on a project and then remembering to validate well after I wrote the HTML only to find I have a lot of work ahead of me. I wrote the following test code to allow automated posting of web content to the W3C validation service for checking:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | private static bool IsValidPage(string url) { string rawHtml = GetFile(url); IE ie = new IE("http://validator.w3.org/fragment-upload.html"); ie.GoTo("http://validator.w3.org/fragment-upload.html"); ie.TextField(Find.ByName("fragment")).Click(); ie.TextField(Find.ByName("fragment")).Value = rawHtml; ie.Button(Find.ByValue("Validate this document")).Click(); return ie.ContainsText("Is Valid"); } public static string GetFile(string url) { WebRequest myWebRequest = WebRequest.Create(url); WebResponse myWebResponse = myWebRequest.GetResponse(); Stream ReceiveStream = myWebResponse.GetResponseStream(); Encoding encode = Encoding.GetEncoding("utf-8"); StreamReader readStream = new StreamReader(ReceiveStream, encode); string response = readStream.ReadToEnd(); readStream.Close(); myWebResponse.Close(); return response; } |
With these two methods you can do write a test per page to validate the content:
1 2 3 4 5 | [Test] public void TestValidHTML() { Assert.IsTrue(IsValidPage("http://www.mysite.com/mypage.aspx")); } |
Note that this code doesn’t take into account subtle changes with the use of AJAX, it simply gets the raw content from the request. WatiN does however support handling AJAX changes quite nicely so upgrading to support a richer website would not present much of an issue. The interesting thing with the raw request is we could change the agent-type on the request to ensure that we’re getting valid HTML for various browsers despite being called from one central location. This can be great if you’re working with ASP.NET where the server controls will be rendered differently based on the agent type by default.
The code also doesn’t take account of potential network connectivity issues and was more for showing the sort of things that you might want to do with WatiN. WatiN is certainly a useful tool to have in your toolbox. If you want to learn more about WatiN just pull it down and also grab one of the few WatiN recorders as the one listed below and get a kick start in scripting your site interactions.
The Tools
WatiN: http://sourceforge.net/projects/watin/
WatiN Recorder: http://watintestrecord.sourceforge.net/
Hope that helps,
- JD
31 May 2007 in Apple, Code, Google, Microsoft | Comments (2)
Rather than echoing the “oooh -Google gears” and “oooh – Microsoft surface” stories I thought I’d put a bit more thought into these recent announcements and why I see them as important. Earlier this week Andrew and I were discussing the web and how we both agreed that the humble browser is not the ideal application platform. There are many advantages of web applications (instant updates, great metrics on use, much more) but we’re yet to see the richness and flexibility of what can be done in the offline world. Of course the positives of one platform are effectively the negatives of the other and vice versa. People still make a conscious decision about the type of application they’re building and this got me thinking.
Offline Applications
As I commented on Rod’s blog, I agree with DHH on his views about offline applications. Retrofitting existing applications doesn’t strike me as being a huge win, I’m virtually always connected with a pretty fat pipe. I don’t believe the advantages of offline applications are really obvious yet because we are all still thinking how it affects the current web model. We need to pull our view back another 20, 000 feet and start thinking outside the box. I’m not claiming I have the answers on this one but I’m sure we can do better than an RSS reader that has an offline mode!
Breaking out of the browser
With Microsoft Silverlight we have the opportunity to break applications outside of the browser (To see an example check out our Silverlight Video player on the Mindscape blog, just click the video when it is playing). I firmly believe this is a significant step forward again that didn’t really get noticed all that much. Suddenly the browser isn’t all that important other than to host these applications. I joked with Andrew that I look forward to the day when the web browser is a non-visual host and the applications are the only visual part (no jokes about visibility inheritance please
Microsoft Surface
First off, this is pretty damn cool. Personally I think it knocks the socks off the iPhone in terms of cool – Microsoft are helping to usher in a new paradigm here but that’s not why I’m bringing it up. Taking into account what we are discussing here you can quickly start to see the benefits of dropping the web browser. I really don’t want to see Internet Explorer or FireFox as a Window on a device like Microsoft Surface – it would just break the model of how the device is meant to be used. If web applications are no longer looking like web applications and are becoming super rich with cloud and offline storage we’re actually seeing a a convergence of the desktop and web worlds.
Challenges
Having said all this there is a HEAP of work still left to do. We don’t really want every application to look different, uniqueness isn’t actually a benefit in terms of usability, there needs to be standards. We need to consider accessibility for less able users or how this content can be moved between the various devices (PC, tablet, phone…coffee table). I really look forward to some of these problems getting solved though, the future looks bright.
I suspect that in the next 10 years we’re going to stop being able to define an application as being a web application or a desktop application. Rather than consciously trying to build Smart Clients, it will just be the way applications are built and we’ll all laugh at why we ever struggled to build them well in the past
What do you think? Agree? Disagree? Want to hire me for tarot card reading?
- JD
30 May 2007 in Business | Comments (1)
Another topic I hear about a fair bit is regarding bootstrapping – how do you get started when you don’t already have millions? I refer to this situation as bootstrapping and it’s not as hard as it sometimes can look from the outside. Bootstrapping is far more important when you’re launching a products company, as opposed to a services company, as there will be a sizable time frame between launching the company and launching your first product.
What we do at Mindscape
When we founded Mindscape we did so because we wanted to create an awesome software products company. The challenge was that we all need to eat and live so we decided that doing some consulting work would allow us to pay the bills while still enabling us to spend the majority of our time developing products. So far this strategy has worked very well however there is a need to be careful.
Beware the “easy” dollars
I fully believe that services companies simply don’t scale in a manner that provides the right level of return on your investment. Margins are thinner, managing people is very hard and you get that all as baggage in exchange for being able to make easier money at the start. Those dollars can look attractive but if you’re not careful you’ll find yourself a few years down the track owning a services company with no products. Be vigilant and ensure you’re only providing services that you require to deliver on your product vision.
Developing a product “on the side”
Personally, I wouldn’t waste my time trying to build more than a wobbly prototype on the side of your day job. Simply put, you tend to exchange your best hours of the day for money already so you’re already giving your product a weak start on life. I’m not saying it’s impossible to do this, it’s just much harder. You also need to be careful about intellectual property with your current employer if you want to juggle your product development on the side.
What about investors?
You could certainly go and find people to invest money in your company in exchange for equity at the very beginning and many people do launch in this fashion. It is always taught that if you want to become wealthy you need to learn to utilise OPM (Other Peoples Money) however this can often be a sign that you’re obsessed with your idea more than the business itself – if you really want to see your product make it to market you’ll have no concern doing a day a week consulting to help see that vision through. There are additional intangible benefits to gain from this:
- You build your network by engaging new clients
- You can bounce ideas about your product off people you’re working with
- You start building your company name and brand
- You get paid money so you can afford to live
I think all too often people have a view that somebody should pay for their idea and be lucky to get a small cut of the equity. Prove that you’re really committed and willing to make sacrifices before looking for investment. Ideas are a dime a dozen, it’s the execution, the team and the business that delivers success and ensuring you don’t go out of business in the early days for lack of cash is all about executing well.
- JD
29 May 2007 in Business | Comments (6)
This is a question that sometimes gets brought up while I’m within earshot – how old should you be to start a business?
I like to look at a question from another perspective and ask why it is being asked. For example, do they feel they don’t have the skills to start a business? Do they just want to feel comfortable with their choice in not starting by giving themselves what they see as valid excuses? Has somebody made them feel there is a specific age when success is more likely?
More often than not it’s a mix of all of these sorts of points. Simply put, it is never too early to start a business. A business doesn’t need to be a hulking great multinational (great work if you can get it…) so don’t feel you’re taking on too much too early – take your time and learn. There are many lessons you need to learn when going through the process of setting up and despite having setup a few businesses I still learn a considerable amount each time. I’d strongly suggest that if you’re a young person who wants to dig deep into business then start a business just for the opportunity to learn – I did and it was one of the best things I ever did.
The benefit for being young is there is a healthy level of risk – you don’t have a family to support, you probably don’t have house payments to make and you can simply afford to live on less. This gives you both flexibility while maintaining a hunger to make some money to be able to enjoy the finer things. If you’re looking to start a tech business then all the better – young people tend to just “get it”. I’m not saying it’s impossible if you’re older but often I’ve seen older people trying to develop tech businesses that don’t realise that they’re potentially half a decade behind on what they think is new and upcoming. Embrace the fact you’re young – use it to your advantage and learn like crazy while you’re still not putting everything on the line.
Now I’ve co-foundered a company with much more vigor and certainty than before. It just feels right and I’m more confident for having experimented with smaller businesses before.
- JD
P.S. I’ve not defined “young” as everyone has a different opinion. Young to some is 30, to others it’s 15 – it really doesn’t matter what you consider “young” to be, I still believe this all applies.
RSS Feed