Adding airport locations to VirtualEarth, Part 2 June 11, 2009
Posted by andrewwhitten in .NET, Bing Maps, Virtual earth, silverlight.add a comment
I went to Remix today and found out that the well regarded VirtualEarth brand is now known as ‘Bing Maps‘. I prefer Virtual Earth, but Microsoft were right to bring all their online services together as Bing, if only for the fact it makes it easier to explain.
Yesterday I added 6,000 pushpins to a layer on top of my map. This seemed to be way too much for Silverlight, and performance suffered.
I didn’t actually require every single airport code in the world, and I found this list of 1900 codes from this website. There was no location data, but I was able to filter my origional list of 6,000 against it with good success. The smaller list was clearer and performance much improved.
I also added some extra data as a tooltip with each pushpin, such as the Airport name, code and associated city.

Creating a tooltip is really easy. First I defined a really simple control to display these vales:
<UserControl
xmlns:controls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls"
x:Class="FlightTracks.Controls.AirportTooltip"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Width="125" Height="50">
<Grid x:Name="LayoutRoot" Background="White">
<StackPanel>
<TextBlock Text="{Binding Name}"></TextBlock>
<TextBlock Text="{Binding Code}"></TextBlock>
<TextBlock Text="{Binding City}"></TextBlock>
</StackPanel>
</Grid>
</UserControl>
I then bound it to each ‘Airport’ object I had, and then made it part of the Tooltips content. Finally I set the tooltip to the pushpin image:
private Image CreateImage(BitmapImage bmp, Airport airport)
{
// Picture of pushpin
Image image = new Image();
image.Source = bmp;
image.Opacity = 0.8;
image.Stretch = Stretch.None;
// Content of Tooltip
Controls.AirportTooltip at = new Controls.AirportTooltip();
at.DataContext = airport;
// Tooltip
ToolTip toolTip = new ToolTip();
toolTip.Content = at;
// Add tooltip to Image
ToolTipService.SetToolTip(image, toolTip);
return image;
}
It is a pity I only get an hour or so to play with this each night! When I finished I’ll release the code on Codeplex and write a large article about all the steps ^-^
Adding airport locations to VirtualEarth, Part 1 June 10, 2009
Posted by andrewwhitten in .NET, Virtual earth, silverlight.add a comment
I am playing with the Virtual Earth Silverlight control, and I wondered how hard it would be to make a quick application that could record my flights around the world?
It turns out the major task is getting a decent list of airport codes with locations! These guys from Holland have a really comprehensive list of airports in a CSV file that I converted to XML and included in my Silverlight project.
(I considered using a WCF service to provide my airports from a DB, but how many new airports are there exactly in these economic times? Instead I embedded the 6K file in the Silverlight app)
I used LinQ to create a pin in a seperate layer on top of the map and here is the result:
Having 6000+ pins in your map is not great for responsiveness, and anyway you can’t find your desired airport anyhow ^-^
What is the answer? I think some smarter rendering of layers.. that is the challenge for the next post
Sybase to SQL Server Migration Powerpoint Presentation Available April 24, 2009
Posted by andrewwhitten in Uncategorized.add a comment
Greg Low has published all the presentations from the SQL Down Under Code Camp in 2008, including a short one by myself
http://www.sqldownunder.com/Sessions2008/tabid/299/Default.aspx
The main part was the demo of a simple migration which unfortunately is too large to include.
Displaying HTML text in Silverlight April 24, 2009
Posted by andrewwhitten in .NET, silverlight.add a comment
I’m displaying text in my Silverlight 3 application that is using HTML markup, for example:
うんどうかい で <b> いち </b> い に なった よ
the <b> tag makes the letter bold, but there is no standard text control in the Silverlight toolbox to process this as rich text such as:
うんどうかい で いち い に なった よ
Luckially David Anson’s post provides a simple Silverlight control that I can include in my project and display the rich text as intended.
<MyLibrary:HtmlTextBlock Text="{Binding Sentences.Text}" />
Thanks David!
Formatting Code in WordPress April 14, 2009
Posted by andrewwhitten in Uncategorized.add a comment
I havn’t blogged for a while.. possibly for the fact that it was a bit painful to get my code to come up correctly.
Well, here is a test post
/// <summary>
/// Just a test
/// </summary>
public interface IBlobDriveObject
{
string ObjectName { get; }
string FullName { get; }
void CopyTo(string dstPath);
void CopyTo(string dstPath, bool overwrite);
}
Here is a description of how:
Yet another iPhone post February 19, 2009
Posted by andrewwhitten in Uncategorized.2 comments
Since the internet has so little discussion about the iPhone, I obviously have to write something
I have been a long time Windows Mobile developer.. all the way from PocketPC 2000 devices to Windows Mobile 6. (and I still think the origional Compaq iPaq is one of the most cool devices you can hold in your hand)
However, after 2 years of really good service, my HTC TyTN (Version 1) had been slowly dying with blank screens and broken keyboard. As a result I started looking at upgrade options.
Since my other favorite device was my iPod Nano, it made sence to give the iPhone 3G a look. Dan Obasanjo already has a post in which he compares his iPhone to his previous Windows Mobile.
Some additional thought of my own:
Good
Consolidation: iPod and mobile phone in one: I only have to check for one device in my pocket at any one time
Size: Always in my pocket without me noticing
International keyboards: I can type in Korean or Japanese very easily. This was something I could never really enable on my Windows Mobile device without third party software
Exchange Integration: I think Dan is more of an Exchange ‘power user’ than I am. I have only had positive experience with emails and agreeing meeting schedules, although I would only schedule my own meetings from Outlook.
Wifi hotspot detection: Windows Mobile makes life really hard to try and pick up a new Wifi signal (at least on my devices). I can pull out my iPhone anywhere and use an available network very quickly.
Bad:
Development: $199 for a developers kit? Microsoft really did a great job with the Compact Framework and SQL Server Compact.
Typing and link clicking: Maybe I have the wrong fingers, but I miss the precision I got with windows Mobile and a stylus. Small hyperlinks on a web page are also really annoying.
Speed: The iPhone is more than usable.. it just seems to lack a degree of responsiveness…
3rd Party Applications: Searching the iTunes store for useful and free apps is difficult. Also like music, apps are sold to each particular region so to download a useful public transport application to a different country you will need to set up anther iTunes account
Pay Apple to make song into Ringtone: Dan pointed this out, and it really justifies a lot of negative opinion people have about Apple. Luckially you can get around this for free by exporting your music file by AAC and renaming the file suffix. (You can easily google for this hack)
Personal Conclusion:
The iPhone 3G is a great purchase, and makes up for lack of flexibility by just employing a simple interface. I really hope Windows Mobile 7 can catch up with this, but it will be a stretch…
New development box December 22, 2008
Posted by andrewwhitten in Uncategorized.add a comment
Its been quiet, but I am back with a new custom development rig, Vital Stats:
CPU : Q9400
MB: Gigabyte 45-DS4
RAM: OCZ Platinum CC4 8GB
HD: 3 x Samsung 500GB Sata 2 (RAID 5 configuration)
GPU: NVidia 9800GTX+

Add my new 24” Widescreen Ultrasharp Dell monitor, and I have an acceptable development platform
I remember back at college I would dual boot Windows ME and Windows 2000… I have now returned to that with Windows Vista ( for productivity enhancing Fallout 3 sessions) and Windows Server 2008 (Hyper-V for all my VM requirements)
The only issue installing this was getting the Windows install process to use the RAID driver from my USB key.
SQL Server 2000 Performance Tuning October 15, 2008
Posted by andrewwhitten in SQL Server.add a comment
I recently looked at an underperformaing 32-bit SQL Server 2000 server recently, and had to come up with some suggestions as to how performance could be increased. Surprisingly the ‘best practice’ guides for this version of SQL Server were hard to come by, and quite often refered to facilities only available in SQL Server 2005 and above.
This is not a comprehensive list, but more of a starting point:
1) Implement new indexes
Run profiler against a realistic load of your database, and take note of the Reads, Writes and CPU count of each operation. Quite often a disproportionatly expensive query does not have a matching optimized index and is performing full table scans. If that query is very common, then you have an obvious candidate for performance improvement.
2) Remove duplicate existing indexes
Conversly you can have too many indexes, which are expensive to maintain. If you have two similar indexes, one on columns A & B and another on A & B & C, consider removing the second one. You may find overall perfroamnce gains
3) Consider using AWE
If your server has a lot of RAM and your SQL Server edition allows it, then consider turning on AWE to start accessing more than 1.7GB of RAM for your database. This will:
- Reduce use of TempDB
- Reduce general disk access
4) Consider upgrading to SQL Server 2005 64-bit
Although you can get 64 bit memory access in SQL Server 2000 Data Center edition, a more cost effective (and now supported) option would be to migrate up to SQL Server 2005
5) Maintainance Plan that Rebuilds Indexes Frequently
Fairly obvious, but a good maintainance plan will optimise your database on a nightly basis. (assuming you can afford the downtime overnight)
6) Remove use of Cursors
Despite what some people say, there are very few scenarios where you need to use cursors. Replace them with good queries inside Stored Procedures and see great increases in performance.
7) Rewrite queries that use ‘SELECT *’
Should be obvious, but a query that runs SELECT * is probably scanning the table far more than it really needs to. It also makes changes to that table risky.
Remove HINTS from queries
There might be some debate about the usefullness of HINTS, but the reality is that SQL Server 2000 can optimise queries far better than you can with a manual HINT prompt. If anything you are likely to make the query slower as a result by using it.
Links:
Should I migrate from Sybase to SQL Server? October 7, 2008
Posted by andrewwhitten in Uncategorized.add a comment
I’m giving a presentation this weekend at SQL CodeCamp about Sybase to SQL Server migrations. I’ve been looking into the background of Sybase in order to give reasons ‘why’ you should do it, and found that as with all technologies there are passionate supporters.
Sybase ASE is a good product from what I can tell. I never had to develop for it, but it does tick all the boxes from what I would expect from a relational database system.
Would I consider Sybase ASE for a new project today? Almost certainly not. I would choose a RDMS with a far larger market share such as Oracle, SQL Server or DB2. Sybase ASE does in fact now come in a 64-bit Windows version, but there are probably only a handful of instances around the globe whereas SQL Server now has countless.
Would I migrate from an existing Sybase instance? It really depends if there was a compelling reason.
- Data Center standardizing on SQL Server
- Need to run database in 64-bit under Windows ( with a proven market share )
- Difficult to find resources who are experienced with Sybase (developers and DBA’s)
If the reason was compelling enough then you should run the Microsoft SSMA tool against your database to determine the amount of work required for a migration.
| Sybase ASE Installation | Action? |
| Low connection usage | Put into a virtual machine |
| Simple CRUD Stored Procedures | Migrate to SQL Server with SSMA |
| Complex business logic in Stored Procedures | Feasibility study into database migration required. Potentially a lot of work needed. |
| Dynamic SQL queries from application | Feasibility into application remediation required.
Potentially a lot of work needed. |
I would say that in a majority of cases, you will require a great deal of work to port your database over to the SQL Server world. The SSMA tool is good but you will still be looking at a great deal of expense to make it happen.
Error in Managed .NET Sybase Provider September 26, 2008
Posted by andrewwhitten in Uncategorized.9 comments
Getting this error with your Sybase .NET driver? There is limited discussion that I found via Google, so I thought I would mention the solution here:
++++++++++++++++++++++++++++++++
at at Sybase.Data.AseClient.Unmanaged.ExecuteCommand(IntPtr pCommandHandle)
at Sybase.Data.AseClient.AseCommand.Execute()
at Sybase.Data.AseClient.AseCommand._ExecuteReader(CommandBehavior commandBehavior)
at Sybase.Data.AseClient.AseCommand.System.Data.IDbCommand.ExecuteReader()
++++++++++++++++++++++++++++++++
To fix this, contact Sybase and get the latest managed driver from August 2008:
Version: 1.15.325.0
Released 15th August 2008
