JQuery and the DropDownList – ComboBox

After playing around with Combo boxes for a while within jQuery I thought it would be good to write down, mainly so I can remember how to find and play with properties from within jQuery.  So here we go, here is the HTML that we’ll be using:

 <select id=”ComboBox” >
   <option value=”1″>Value 1</option>
   <option value=”2″>Value 2</option>
   <option value=”3″>Value 3</option>
   <option value=”4″>Value 4</option>
   <optgroup label=”Group1″>
      <option value=”5″>Value 5</option>
      <option value=”6″>Value 6</option>
      <option value=”7″>Value 7</option>
      <option value=”8″>Value 8</option>
   </optgroup>
</select>

Get the value of the selected item

This is the easiest.  Use the val method.

$(“#ComboBox”).val()

Get the text of the selected item

If you just try using the text() method on the combobox, this will give you the text values of all of the options in a single string.  Not what you want.  The trick is to use the :selected query modifier on the option.

$(“#ComboBox option:selected”).text()

Find out when the select value changed

This is also rather easy with JQuery.

$(“#ComboBox”).change(function() { /* do something here */ });

Programmatically set the selected item.

$(“#ComboBox”).val(2);

Modify the list.

Modifying a select element is not fundamentally different than modifying any other element in the dom, but there are a few basics here to keep in mind. Mainly: try to avoid using the dom directly.  Create html strings instead.

Clear the list:   $(“#ComboBox”).html(“”);

Add to the list: $(“<option value=’9’>Value 9</option>”).appendTo(“#ComboBox”);

For more information check out the jQuery API

The start of a partnership

It’s time for me to upgrade my development computer, in order to do this I have a few requests of my new partnership, mainly due to the fact that Windows 7 has been out for a while, well from MSDN, and it has made a huge step forwards being able to harness the power of the processor.

First it’s got to be a processor worth having and I’m currently looking at the Intel Nehalem i7 920 S1366 2.66GHz (£213 from Dabs, or Amazon) or  AMD Phenom II X3 720, which kicks arse on most processors that are out at the moment. This chip can be bought from Amazon at around £97.

Next is the motherboard, which must support the ability for a lot of memory and support the AMD processor above, the Gigabyte MA790xt-ud4p, appears to do the job, and at £95 from Ebuyer.com.  Or going for the Intel processor there is the Gigabyte S1366 Intel X58 DDR3 ATX Audio 2GbE Lan 3 Channel (£194 from Dabs)

As a developer you need to have a number of monitors, you need to see as much as you can to work efficiently, a graphics card that is capable of driving three if not more monitors is a must.  The ATI-based graphics ATI Radeon™ HD 5870 graphics Graphics Card, is a mega graphics card and should support up to 3 monitors.  This can be bought from Dabs costing around £299, what about this link too, it’s just starts to get confusing!

Next and very importantly the machine must be 64bit and support Virtualization Technology, in order to use Microsoft Virtual PC in Windows 7 this has become a slight issue as not all processors support Virtualization. I came across a post by Marcus Yam, Which Intel CPUs Support XP Mode Virtualization?, which provides a good list of chips, also Intel provide a list of features for their chip sets, which is most helpful.  Ed Bott has a good post too on How many Intel CPUs will fail the XP Mode test in Windows 7?.  Apparently AMD has virtualization built into all 65nm and 45nm processors, so that makes it a little easier.

What about the motherboards will they support Virtalization Technology?  I’ve not managed to find this out yet.

The main hard drive is going to have the be a solid state hard drive, as I do like the idea of loading applications up in seconds, something like Crucial 64GB 2.5″ M225 SATAII Solid State Drive?, which comes in at £165, from Dabs, not bad for such blistering performance, the question is whether I RAID the drive or not?  Not sure what the benefits would be to me, performance is not an issue with a solid state hard drive, and for reliability I am using Windows Home Server which backs up every night.  Or am I missing something with RAID?

The file system to storing all my data is not really an issue as Terabyte hard drives are two a penny these days.

Next is the memory I need to have about 8 Gbytes in order to perform fast Virtualization with the ability to expand further if I need to, I know the memory needs to be fast and what I’m not sure about yet is what type and speed do I need the memory to be?  I’ve heard about Triple Channel and Dominator, but what is this all about?  I’ve come across the Corsair (TR3X6G1866C9DF) 6GB DDR3 3X2GB DDR3-1866 CL 9-9-9-24 Triple Channel Memory Kit as £227 from Amazon a little high priced how ever very fast or another option is Corsair Memory DDR3 1333MHz 12GB Core I7 Supt, which appear to be good value at only £225 from Dabs.

With all the hardware I’m going to have to get a Power Supply Unit to drive it all, Corsair Memory 1000W ATX PSU (£160), and to house the kit it’s going to have to be a large desktop case (£85)

Other accessories I will need also to make my machine, some Arctic Silver 5 3.5g Thermal PasteArctic Silver ArctiClean Thermal Material Remover & Surface Purifier 60ml Kit, and Nylon 6.6 Plain Washers, Colour : Natural, Thread Size : M5

Next question is will all of the above work together?

My research has taken me many places and it all started at DotNetDevNet, with Jose and Guy helping me out.

So my search goes on.

Team Foundation Server 2008 installing on a single server

I was given the task of installing Team Foundation Server on a single server, and there are a few things to check and need to have installed before you can install

 

First read and the supplied TFSInstall.chm install guide file. This is key – if you are new to the TFS install and do not follow the supplied “checklists” for your chosen set up, you will endure pain and agony. 

I pretty much tried to follow the install guide by the book, but below points out some specifics of our set up and the issues I came across.

 

  1. I install Windows Server 2003 on a Virtual Machine
  2. Install IIS
  3. Install SQL Server 2005 Standard Edition
  4. Install SQL Server 2005 Service Pack 2
  5. Apply all the updates to Windows
  6. Downloaded en_visual_studio_team_system_2008_team_foundation_server_workgroup_x86_x64wow_dvd_X14-29253.iso from MSDN subscription and extracted the files.

 

 

How do I create the aspnetdb database?

I’ve been using the Microsoft Aspnetdb database for some time now, and I still get asked about how to create the database, so here you go enjoy:

Microsoft has a new and powerful default database schema in ASP.Net 2.0 as ASPNETDB.mdf database. This database file serves as a role provider, and membership provider. Visual Web Developer 2005 supports the ASP.Net configuration to manage this personal aspnetdb database file within the web application inside the App_Data folder. Aspnetdb database helps in managing users along with their roles e.g. admin, employee, editors etc. It also enables the in-built functionality of Login controls and web parts to be integrated on ASP.Net 2.0 web pages that helps in managing user profiles, login, and personalized user pages very easily even without writing the bulky code to implement the sql queries or stored procedures along with data access code for inserting, updating or deleting the user personalized data.

How to create Aspnetdb database?

Using aspnet_regsql command:

You can use aspnet_regsql command to create aspnetdb database. This command executes the default scripts to create the default database for asp.net 2.0 web applications.

Steps to create aspnetdb database using aspnet_regsql command:

  1. Open the Visual Studio 2005 command prompt from Start –> All Programs –> Microsoft Visual Studio 2005 –> Visual Studio Tools –> Visual Studio 2005 Command Prompt
  2. Type aspnet_regsql and press enter key 
  3. This will open the ASP.Net SQL Server Setup wizard. Click next to continue… 
  4. In the next screen select the option to Configure SQL Server for application services. This option executes a script to configure the database for managing user profiles, roles, membership and personalization. Click next to continue…
  5. In this step enter the sql server name and choose the right authentication method. Leave the database field to default and click next… 
  6. Confirm your settings and click next to finish. 

It’s also worth checking out:

How to Collaborate with Remote Employees

I’ve been working at home on and off for a number of year, and one thing that always comes up is how to collaborate with remote employees over the internet.

I have been using Microsoft Shared View, it’s easy to use and just does the job.  If you are using a Mac then you could also try out Microsoft Shared View for the Mac, although I have not tested this out yet.

It’s also worth check out How to Collaborate with Remote Employees with Office Communicator 2007 R2 by Scott Hanselman, for other ways for collaborate.

ASP.Net MVC Custom Error Pages

Now that I’m using MVC fully it’s time to implement a Customer Error Page.

As ASP.NET MVC is a layer on top of ASP.NET we can still use the same Customer Errors that we are used to in the Web.Config, so just to make it SEO friendly, here is what it can look like:

<customErrors mode=On defaultRedirect=~/Error/Unknown />

 

 

http://www.genericerror.com/blog/2009/01/27/ASPNetMVCCustomErrorPages/

 

Other references worth check out are:

ASP.NET Custom Errors: Preventing 302 Redirects To Custom Error Pages

Better Custom Errors in ASP.NET

404 vs 302 ASP.Net Custom Errors

Fastest way to Screen Cast

If you need to screen cast then check out Screen Toaster, it’s fast easy to use

 

  • Register & use it anywhere, anytime
  • No download. Compatible with Windows, Mac OS X, Linux.
  • Capture videos of onscreen action in one click
  • Record screencasts, tutorials, demos, training, lectures and more.
  • Share and stream videos online in Flash
  • Embed them on blogs and webpages or send them by email.

 

Scripting SQL Objects with SQL 2008

If you need to script out the objects within a database, from generating tables through to extracting out the data so you can use it in another database or schema then you are going to need to script the SQL.

MS SQL Server 2008 has new Generate Scripts option which enables you to script data in SQL Server database tables. you can script data from sql tables into a script file, to the clipboard or script data on a new sql query window. Script data can be used to export and/or import table data from one database to another database.

The Script Data option creates INSERT statements foreach row in the table using the column data that the related table record has. Later than the scripted table data can be used by executing the generated t-sql scripts, to create a copy of the original table on an other server or an other database with identical data or identical rows on the destination database or table, what’s more you can script the the database to go to a SQL 2000 database from a SQL 2008, how cool is that?

SQL Server generate script with data is a powerful SQL Server tool in order to create sql script to move data from one database to another database.

I want to demonstrate with a sample how a sql developer can use the Generate Scripts task in order to script table data of a SQL Server 2008 database table.

Open the Generate Scripts SubMenu Item from Task Menu

First of all, open the Microsoft SQL Server Management Studio which is installed from the Client Tools of a MS SQL Server 2008 installation package.

Connect to a MS SQL Server database instance using the Server Explorer or using the Connect screen.

Then open the Object Explorer window and expand the Databases node.

Here I connected to the local SQL Server instance and clicked over the Databases node and a list of existing sql server databases are visible in the object explorer window now. Later, I clicked the sql database MyWorks which owns the tables that I want to script data, rows/records of the database.

Continue by right clicking on the database name and open the context menu, chooes Tasks menu and open submenu. Select Generate Script submenu item from the displated list.

Generate SQL Server Script Wizards

When you select the Generate Scripts sub menu item the Generate SQL Server Scripts Wizard starts. SQL administrators and sql programmers can use the Script Wizard to generate t-sql scripts as a t-sql scripter to create scripts for any object (tables, views, schemas, etc). You can work in detail on the Script Wizard and find useful hint that you can benefit in your sql developments.

Watch the following screen cast to see it in action.