Sunday, 29 March 2009

Using keyword

When using anything that implements IDisposable (SqlDateReader, SqlConnection etc) you can use the using keyword to ensure that the object is disposed, e.g.

using (SqlDataReader reader = Dal.ExecuteReader(GetConnection(), "SelectProductAll"))
{
dsScrum.ProductTask.Clear();
if (reader.HasRows)
dsScrum.Product.Load(reader);
}



Is the same as:

SqlDataReader reader = Dal.ExecuteReader(GetConnection(),"SelectProductAll");
try
{
dsScrum.ProductTask.Clear();
if (reader.HasRows)
dsScrum.Product.Load(reader);
}
finally
{
if (reader != null)
reader.Dispose();
}

Wednesday, 25 March 2009

jQuery

I've been looking at using Javascript libraries recently, in order to revamp Lesley's site there are a lot out there (Prototype, Mootools, scriptaculous, Dojo, YUI). I've decided to use JQuery as it appears to have the largest following, which means more support, tutorials and extra plugins. It's also easily extensible meaning you can customise and extend.

What is it? "jQuery is a fast and concise JavaScript Library that simplifies HTML document traversing, event handling, animating, and Ajax interactions for rapid web development. jQuery is designed to change the way that you write JavaScript." In short, you can get Flash-type effects and general all-round sexiness using only javascript, could be used for cool menus, client side table sorting, tabs, AJAX data/image loading, page manipulation, custom dialog boxes, charts etc.

To use you need some understanding of CSS as it uses CSS-style selectors ("li", "#Id", ".class", "a>img" etc) to access elements using jQuery and it appears a lot of the functionality uses CSS to move/position elements.

Here are some good links that I've found:

Tuesday, 24 March 2009

SubSonic

SubSonic..... fed up writing boring DAL code? Me neither.. but if you are this may be for you.

SubSonic has several things we would be interested in but the main selling point is that it auto generates a DAL for you. It also has CMS starter site that seems really cool... more on that later.

I'm not going to re-write their web site help here; so I recommend you visit their site and enjoy the videos. Code is available from codeplex... their site was a little flaky when downloading so I used that instead.

The forums are really good and its been around for a few year now so I think this is something we should all be considering when taking on a new project.

Almost forgot the good news (yes folks it gets better!) its.... wait for it...... OPEN SOURCE!

Enjoy

Tuesday, 17 March 2009

Setup Blackberry demo on standalone PC

I recently had to setup a Blackberry demo onto a standalone laptop, the laptop was a clean install before starting.

I setup everything on the local computer, including Web Service, as it would not be connected to the internet or network.

To setup do the following:

  • Install appropriate .NET Framework.

  • Install IIS and run aspnet_regiis -i.

  • Install jdk-1_5_0_17-windows-i586-p.exe for use by simulator.

  • Install BlackBerry_Email_MDS_4.1.4.exe for MDS simulator to hit network.

  • Install BlackBerry_Simulators_4.5.0.55_8700-Vodafone.exe, or whichever simulator is to be used.

  • Install SQLServer onto laptop. Use either desktop engine and connect via IP Address and enterprise manager from own computer to create database, or install full developer edition with Enterprise Manager.

  • Create new copy of Web Service pointing at (local).

  • Create new copy of Blackberry app, only need to change the connection string in the main _Stub class. Use the laptops computer name as you can't use IP Address as it'll be offline and handset can't hit localhost or 127.0.0.1.

  • Move new .COD into the installation folder of the handset simulator.

  • Go to network connections on laptop and disable all connections (Right Click->Disable). Not sure why but when these are enabled and not connected to network the web service calls are very slow.

  • Run the MDS Simulator first and then open up handset simulator. Done!

I created a batch file to run the MDS and handset simulator:

@echo off
echo Running MDS Simulator...
cd C:\Program Files\Research In Motion\Blackberry Email and MDS Services Simulators 4.1.4\MDS
call run.bat
echo Running 8700 Simulator...
cd C:\Program Files\Research In Motion\Blackberry Smartphone Simulators 4.5.0\4.5.0.55 (8700-Vodafone)
call 8700-Vodafone.bat
pause

Free Hit Counter