MIX 2009 in Las Vegas is only three days away. There will be a lot of interesting announcements including the new .NET MVC Framework and more information on Silverlight 3.0, ASP.NET 4.0, Dynamic Data etc. You could find more about MIX 2009 here
Here is a video where ScottGu talks about MIX 2009 and what’s it’s like to speak in large audiences at MIX, PDC etc..
Here are few Flickr pics of ScottGu’s from Las Vegas,
Scott smiles at the bear!
Scott in 70's suit
Masked man coding
Tatoo
What would ScottGu do?
ScottGu usually wears his red polo at the Mix, you could sign this petition started by Scott Hanselman here so he appears in red this year again
BlackBerry JDE or any other platform like NetBeans could be used for BlackBerry java application development. As a .NET developer I prefer using Visual Studio because of the features it provides over BlackBerry JDE and try to explain the same in this article
Background
I have been using BlackBerry JDE for a while now since I started BlackBerry development. After becoming familiarized with the 4.2.1 API that I am using, I decided to use Visual Studio because of its capabilities and find it very handy. I still use BlackBerry JDE for debugging & signing purposes when required.
Details
Here are the cons and pros before you decide if you want to use Visual Studio
Cons
Debugging
Signing
RIM BlackBerry API Intellisense
Error Navigation (Cannot navigate to the error line from output window but could navigate to the file)
Pros (over RIM JDE)
Better Syntax Highlighting, Code Outlining (CTRL + M, O – collapses everything)
Intellisense
Code Snippets (code snippet name – if, for & tab + tab)
Commenting & Uncommenting (CTRL + K, C)
Better Formatting (CTRL + K, D), Better Navigation(for functions & classes using the top dropdowns), Line Numbers – easier to read.
Source Gear Vault Integration
Better Search, Replace & Bookmarking capabilities(CTRL + K, K to bookmark, CTRL + K, N to move next etc.)
Get to use my customized Dark Theme( the best of it)
And all other features VS 2005 provides
I use VS 2005 as J# support is removed in VS 2008. Lets consider Hello World project, you could see this line in output window when you build the project in BlackBerry JDE.
C:\Program Files\Research In Motion\BlackBerry JDE 4.2.1\bin\rapc.exe -quiet import="..\..\Program Files\Research In Motion\BlackBerry JDE 4.2.1\lib\net_rim_api.jar" codename=com_rim_helloworld com_rim_helloworld.rapc warnkey=0×52424200;0×52435200;0×52525400 C:\BBProjects\helloworld\HelloWorld.java C:\BBProjects\helloworld\img\helloworld_jde.png C:\BBProjects\helloworld\resource\HelloWorldRes.rrc C:\BBProjects\helloworld\resource\HelloWorldRes.rrh C:\BBProjects\helloworld\resource\HelloWorldRes_de.rrc C:\BBProjects\helloworld\resource\HelloWorldRes_en.rrc C:\BBProjects\helloworld\resource\HelloWorldRes_es.rrc C:\BBProjects\helloworld\resource\HelloWorldRes_fr.rrc C:\BBProjects\helloworld\resource\HelloWorldRes_it.rrc
If your project contains too many files, then the above line would be something like this
C:\Program Files\Research In Motion\BlackBerry JDE 4.2.1\bin\rapc.exe -quiet import="..\..\Program Files\Research In Motion\BlackBerry JDE 4.2.1\lib\net_rim_api.jar" codename=com_rim_helloworld com_rim_helloworld.rapc warnkey=0×52424200;0×52435200;0×52525400 @com_rim_helloworld_build.files
@com_rim_helloworld_build.files contains all the files included in your project. RIM JDE will automatically create this for you when required
This is important to build in Visual Studio to check if there are any errors in code. Now lets open Visual Studio and create a new J# class library project(C# or J# project does not matter, as the file extension is what that matters)
Create the J# project in a different directory, delete the default class1 file, close VS and move the J# project contents to your existing blackberry project so that everything is in one place. Now open the project in VS and include the necessary files. This will look something like this at this point
Now that you have included the files, you can code in visual studio and would require to build project to check for the errors. Lets create a batch file to build java project from within the Visual Studio. Here is the code for building and showing if succeeded or not.
"C:\Program Files\Research In Motion\BlackBerry JDE 4.2.1\bin\rapc.exe" -quiet import="..\..\Program Files\Research In Motion\BlackBerry JDE 4.2.1\lib\net_rim_api.jar" codename=com_rim_helloworld com_rim_helloworld.rapc warnkey=0×52424200;0×52435200;0×52525400 C:\BBProjects\helloworld\HelloWorld.java C:\BBProjects\helloworld\img\helloworld_jde.png C:\BBProjects\helloworld\resource\HelloWorldRes.rrc C:\BBProjects\helloworld\resource\HelloWorldRes.rrh C:\BBProjects\helloworld\resource\HelloWorldRes_de.rrc C:\BBProjects\helloworld\resource\HelloWorldRes_en.rrc C:\BBProjects\helloworld\resource\HelloWorldRes_es.rrc C:\BBProjects\helloworld\resource\HelloWorldRes_fr.rrc C:\BBProjects\helloworld\resource\HelloWorldRes_it.rrc
Create a batch file using the above code in the project directory and add this into external tools to run within VS. You could do the same using MenuBar: Tools–>External Tools. Add one and setup the batch file, initial directory etc as shown below
You could set a keyboard shorcut like SHIFT + CTRL + F7 and execute it, you will see the results in output window.
Just change something in the code and build again(using shortcut or external tool), you will see the error details. You could then navigate to appropriate file from clicking in the output window
That’s it you are all set up for BlackBerry java application development in visual studio. I use both Visual Studio(for development) and BlackBerry JDE(for debugging & signing) to get the best of both worlds.
Also the BlackBerry build and signing process could be automated using BB Ant Tools if required.
SQL Server user group beings 26th Feb in Manchester with Tony Rogerson talking on Bits and Bobs to help the developer and DBA with TSQL and Martin Bell on Table Valued Parameters in SQL Server 2008.
It’s nice to see SQL Server User Group forming in Manchester and organising the event. It’s been a while since the last Manchester .NET meeting, I have planned to attend. Here are the meeting details
Agenda
18:00 – 18:30 – Introduction, Networking and Food
18:30 – 19:00 – Round Table problems and answers, SQL nuggets – bring a tip or 1 – 5 minute demo and share with your peers.
19:00 – 19:45 – Bits and Bobs to help the Developer – TSQL, Tony Rogerson, SQL Server MVP
In this session I will look at a number of techniques and features in the product that help Developers and DBA’s allike create robust and scalable queries. We will look at how the optimiser can use the schema to help it, parameter sniffing, table valued functions, cte’s, table valued variables and a few more [once I've thought about them - please email me tonyrogerson@torver.net if there is anything specific].
19:45 – 20:00 – Break
20:00 – 21:00 – Table Valued Parameters – Saints or Sinners?, Martin Bell, SQL Server MVP
With the release of SQL Server 2008 and the new Table Valued Parameter feature, should we all be using them or are they the spawn of the devil? Martin will look at what options are available in the different versions of SQL Server and compares the performance and practicalities of using each one.
I recently came across this, find it very useful and productive at work. If you are using dual monitors, could use the same when doing a Remote Desktop. To use Remote Desktop for dual monitors, type
mstsc /span
and run in the command prompt. There are few limitations in using this though, you can find them here in MSDN blog.
This works in Remote Desktop client V6.0 or higher which means having Vista is ok, Windows XP users might have to update their client. The RDP client could be updated from here
I use a lot of saved RDP connections, in fact have a RDP folder in the Taskbar. If that’s the case, open the *.RDP file in notepad and add this line at the end
Span Monitors:i:1
And finally if you are using SplitView, it supports Remote Desktop with Dual Monitors which means it will take care of resizing windows within monitor and other features for you, otherwise you will have to resize windows manually.
I have been developing applications for Blackberry recently using Blackberry JDE in Java. I have always used Vault for source control in Visual Studio and it integrates well with Visual Studio. Here is how to do it in BlackBerry JDE.
BlackBerry JDE supports source control integration as you can see in this screenshot
The tricky bit is to setup the vault command in there. SourceGear Vault has a command line tool “Vault” which could be used. Here is the usage of it,
Here is checkout command usage,
Now enable source control integration and setup appropriate appropriate commands for checkout, revert and add file for source control in preferences dialog of BlackBerry JDE as shown below
After you setup these, make sure to setup vault command in path variable for your PC so the JDE picks it up. As for Vista, goto Computer –> Properties –> Advanced System Settings –> Environment Variables as show below,
Vault Command Path:
C:\Program Files\SourceGear\Vault Client
That’s it, you are all set to go. The JDE with Vault will work fine now. The only problem I found is the inability to checkin files and to specify dynamic repository path in add script from within the JDE, will update the post once I find some info on that.
Microsoft has released charts for ASP.NET few weeks back at the PDC. ScottGu has blogged about it here. I have been using charts in the past from a third party vendor and have converted them all to ASP.NET charts because of the variety & extensibility they provide and it will be part of .NET Framework 4.0 moving forward even though it’s a separate installation now . It was acquired from Dundas Charts by Microsoft.
One thing I could not find in the documentation is a way change the location where chart is stored. By default it’s stored in hard disk and the location is specified in the web.config file as below
I celebrated my birthday last week and would like to thank Phil, Tim & everyone else (colleagues, friends & family) for making it such a wonderful memorable day and for all their wishes & gifts. I did not expect something like that (see pics below) especially from my manager Phil and Tim, was totally surprised. We even went out for lunch, it was very nice of them to spend their time.
Last year was good, met lot of people, worked on lot of things in different roles, have learnt lot of things in general related to work, technology, people, culture… the list goes on…… and am thankful to all of them.
A new whole year, time to set/review goals and work towards it which would help me personally (in life) and also professionally (at work).
ScottGu shares information like how Silverlight was used by NBC for 2008 Olympic Games and statistics of the same. He also answers many questions like Silverlight’s support in Mobile, iPhone and Chrome etc..
Silverlight 2 includes the following features,
• .NET Framework support with a rich base class library. This is a compatible subset of the full .NET Framework.
• Powerful built-in controls. These include DataGrid, ListBox, Slider, ScrollViewer, Calendar controls and more.
• Advanced skinning and templating support. This makes it easy to customize the look and feel of an application.
• Deep zoom. This enables unparalleled interactivity and navigation of ultrahigh resolution imagery.
• Comprehensive networking support. Out-of-the-box support allows calling REST, WS*/SOAP, POX, RSS and standard HTTP services, enabling users to create applications that easily integrate with existing back-end systems.
• Expanded .NET Framework language support. Unlike other runtimes, Silverlight 2 supports a variety of programming languages, including Visual Basic, C#, JavaScript, IronPython and IronRuby, making it easier for developers already familiar with one of these languages to repurpose their existing skill sets.
• Advanced content protection. This now includes Silverlight DRM, powered by PlayReady, offering robust content protection for connected Silverlight experiences.
• Improved server scalability and expanded advertiser support. This includes new streaming and progressive download capabilities, superior search engine optimization techniques, and next-generation in-stream advertising support.
• Vibrant partner ecosystem. Visual Studio Industry Partners such as ComponentOne LLC, Infragistics Inc. and Telerik Inc. are providing products that further enhance developer capabilities when creating Silverlight applications using Visual Studio.
• Cross-platform and cross-browser support. This includes support for Mac, Windows and Linux in Firefox, Safari and Windows Internet Explorer.
I will be blogging more about Silverlight in the coming days.
Scott has created a nice cheat sheet that has all the functions related to jQuery in one page. You could download it from here and print it for quick reference. It’s very handy rather than going to JQuery help.
This blog post explains how to use jQuery’s plugin Tablesorter to implement client side sorting in ASP.Net Gridview. This comes in handy especially when object data source is used with grid view as gridview does not provide sorting out of the box
Implementation
To implement TableSorter, the rendered table should have THEAD in the markup. Gridview does not provide this by default but we could achieve it either by setting appropriate properties or by using a CSS friendly control adapter. We will do it by using the former method.
Initialize the table for sorting when document is ready using the below code,
$(document).ready(function()
{
$(“#gvEmployees”).tablesorter();
});
If you are using update panel, you need to consider using pageLoad function(javascript)
function pageLoad(sender, args)
{
$(“#gvEmployees”).tablesorter();
}
At this point the sorting should work on client side, Now you would want to set ascending and descending icons for grid headers. You could easily do this by defining these styles in your style sheet.
Tablesorter provides lots of config options, here are few important ones,
sortList: [0, 1] — This instructs to sort by index 0 column in descending order.
dateFormat: “uk” — if your format is dd/MM/yyyy, it does not seem to work by default for this format.
debug: true — this option provides you information like how much time it took and how(what type) it considered the columns.
$(“#gvEmployees”).tablesorter(
{
debug:true,//provides debugging information
sortList:[[0,1]],//sorts 0th column by descending order
dateFormat:“uk”,//sets the date format to dd/MM/yyyy
});
Now some interesting things, if you have columns that are formatted differently like having a thousand separator. We could use a customParser in this scenario, otherwise the data would be considered string and the sorting would not work as expected.
We should define a customParser with an id and then assign it to a column while initializing tablesorter.
//define a parser
$.tablesorter.addParser(
{
// set a unique id
id:‘formattedNumbers’,
is:function(s)
{
// return false so this parser is not auto detected
returnfalse;
},
format:function(s)
{
// format your data for normalization
return s.replace(/,/g,”); //removes comma separator from formatted numbers
},
// set type, either numeric or text
type:‘numeric’
});
//initialize table for sorting
$(“#gvEmployees”).tablesorter(
{
headers:
{
6:{ sorter:‘formattedNumbers’}
}
})
There might be templated columns and checkbox bound fields in the gridview and if we need to do sorting for those columns, we could do so by using textExtraction. textExtraction is similar to customParser but this applies to the whole table and gets node instead of a string for processing. Here is some code that will process templated text columns and checkbox bound columns.
//define a function for extracting text from node
function extractValue(node)
{
var children = node.childNodes[0].childNodes.length
if(children == 0)//boundTextField or a templateColumn
This covers most of things that one would do in gridview. The download contains all the above mentioned code.
Points of Interest
The Tablesorter is very good for the kind of functionality it provides with so much less code & effort. I am sure more and more people would be interested in this and would be using this as Microsoft recently announced it’s support to jQuery
It’s very simple to create an extended gridview control built with these functionalities.
You could download the sourcecode for sample from here Download