<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-1767553563820981240</id><updated>2011-11-09T08:33:49.664-08:00</updated><category term='VS2010'/><category term='XNA 4.0'/><category term='WP7S'/><category term='Performance'/><category term='Book'/><category term='BlackBerry'/><category term='SQL Compact'/><category term='MIX10'/><title type='text'>The Mobile Sandbox</title><subtitle type='html'>A native mobile developer's adventures in managed mobile development</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://mobilesandbox.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1767553563820981240/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://mobilesandbox.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>João Paulo Figueira</name><uri>http://www.blogger.com/profile/01808451986712386444</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://bp0.blogger.com/_AksH5-lumMs/SCQYuaNZMAI/AAAAAAAAAQs/eA23ckrE4Fw/S220/MVP_profile.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>12</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-1767553563820981240.post-8837595862365920425</id><published>2010-04-28T06:01:00.001-07:00</published><updated>2010-04-28T07:07:07.976-07:00</updated><title type='text'>New blog</title><content type='html'>I am moving all my blogging activity to a new roof, where I will discuss more than just managed code on mobile devices. Please follow me on the &lt;a href="http://smilingsmith.blogspot.com/"&gt;Smiling Smith&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1767553563820981240-8837595862365920425?l=mobilesandbox.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mobilesandbox.blogspot.com/feeds/8837595862365920425/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1767553563820981240&amp;postID=8837595862365920425' title='5 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1767553563820981240/posts/default/8837595862365920425'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1767553563820981240/posts/default/8837595862365920425'/><link rel='alternate' type='text/html' href='http://mobilesandbox.blogspot.com/2010/04/new-blog.html' title='New blog'/><author><name>João Paulo Figueira</name><uri>http://www.blogger.com/profile/01808451986712386444</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://bp0.blogger.com/_AksH5-lumMs/SCQYuaNZMAI/AAAAAAAAAQs/eA23ckrE4Fw/S220/MVP_profile.jpg'/></author><thr:total>5</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1767553563820981240.post-5178205090934680379</id><published>2010-03-25T02:19:00.000-07:00</published><updated>2010-03-25T02:39:28.632-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='XNA 4.0'/><category scheme='http://www.blogger.com/atom/ns#' term='WP7S'/><title type='text'>XNA 4.0, the WP7 emulator and the GPU</title><content type='html'>After giving a first go at writing a brainless Silverlight application for the Windows Phone 7 emulator, I turned towards XNA 4.0. My curiosity about this platform was itching me so I decided to have a go and scratch. XNA is a platform that enables (hopefully) quicker and easier development of managed code games for XBOX, PC, the Zune and now the Windows Phone 7.&lt;br /&gt;&lt;br /&gt;Although this is a managed environment with lots of abstracted features such as the device GPU and bitmap rendering (you really don't care how the bits are painted, nor how the frame buffer is laid out), it still has all sorts of interesting "low-level" stuff that managed to draw my attention. One of issues that drew my attention is the requirement of taming the GC in order to get a smooth experience.&lt;br /&gt;&lt;br /&gt;A few years back I had the very interesting experience of running a .NET CF 1.1 game on a Pocket PC 2003 device. This game (1945) is still available with full source code from &lt;a href="http://www.codeproject.com/KB/mobile/CfPocket1945.aspx"&gt;CodeProject&lt;/a&gt; and struck me for being fast (I have this speed bias against managed code, so it was enlightening). Naturally I decided that my first experiment with XNA 4.0 would be to write a port of this game.&lt;br /&gt;&lt;br /&gt;Unfortunately my three-year-old laptop worked against me. The NVidia Ge Force Go 7700 with 1 GB of dedicated RAM still seems quite appropriate for Windows 7 (after all, I get a 4.7 performance index for games and 4.8 for Aero) but fails miserably when it comes to driving the WP7 emulator. If you read the CTP release notes, you get the impression that the major requirement is DirectX 10 support. It's not. I have DirectX11 installed and still it does not work. Apparently your graphics driver must support the Windows Device Driver Model (WDDM) 1.1 and DDI (whatever that is) version 10. Unfortunately my driver supports only DDI 9Ex and WDDM 1.0. Apparently there is no updated NVidia driver that supports the required features (and that does not BSOD).&lt;br /&gt;&lt;br /&gt;Dead in the water? No, I turned to my Zune 120 and XNA Studio 3.0 and started to write the Zune version of 1945. After all, this is also a sandboxed mobile device, so it's fair game.&lt;br /&gt;&lt;br /&gt;I will post the code and my experiences writing in the forthcoming posts.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1767553563820981240-5178205090934680379?l=mobilesandbox.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mobilesandbox.blogspot.com/feeds/5178205090934680379/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1767553563820981240&amp;postID=5178205090934680379' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1767553563820981240/posts/default/5178205090934680379'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1767553563820981240/posts/default/5178205090934680379'/><link rel='alternate' type='text/html' href='http://mobilesandbox.blogspot.com/2010/03/xna-40-wp7-emulator-and-gpu.html' title='XNA 4.0, the WP7 emulator and the GPU'/><author><name>João Paulo Figueira</name><uri>http://www.blogger.com/profile/01808451986712386444</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://bp0.blogger.com/_AksH5-lumMs/SCQYuaNZMAI/AAAAAAAAAQs/eA23ckrE4Fw/S220/MVP_profile.jpg'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1767553563820981240.post-2925893350052699478</id><published>2010-03-22T02:16:00.000-07:00</published><updated>2010-03-22T02:31:14.128-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='MIX10'/><title type='text'>MIX10 Hi-res videos are back online</title><content type='html'>Apparently the MIX10 videos are being such a huge success that the servers had problems delivering them to all who were interested in them. The problem was such that the site was closed altogether and only the low-res videos were made available a few hours later. Today I found out that the high resolution videos are back online (thankfully). Now, let's go back and finish &lt;a href="http://live.visitmix.com/Videos"&gt;downloading them all&lt;/a&gt;...&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1767553563820981240-2925893350052699478?l=mobilesandbox.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mobilesandbox.blogspot.com/feeds/2925893350052699478/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1767553563820981240&amp;postID=2925893350052699478' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1767553563820981240/posts/default/2925893350052699478'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1767553563820981240/posts/default/2925893350052699478'/><link rel='alternate' type='text/html' href='http://mobilesandbox.blogspot.com/2010/03/mix10-hi-res-videos-are-back-online.html' title='MIX10 Hi-res videos are back online'/><author><name>João Paulo Figueira</name><uri>http://www.blogger.com/profile/01808451986712386444</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://bp0.blogger.com/_AksH5-lumMs/SCQYuaNZMAI/AAAAAAAAAQs/eA23ckrE4Fw/S220/MVP_profile.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1767553563820981240.post-8750227549383996531</id><published>2010-03-17T12:57:00.001-07:00</published><updated>2010-03-17T13:06:35.051-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='WP7S'/><title type='text'>WP7 Calculator</title><content type='html'>&lt;a href="http://1.bp.blogspot.com/_AksH5-lumMs/S6E1tItJhYI/AAAAAAAAAd8/A7lzlS7sWB8/s1600-h/Wp7Calc1.PNG"&gt;&lt;img style="MARGIN: 0px 10px 10px 0px; WIDTH: 164px; FLOAT: left; HEIGHT: 320px; CURSOR: hand" id="BLOGGER_PHOTO_ID_5449696073642247554" border="0" alt="" src="http://1.bp.blogspot.com/_AksH5-lumMs/S6E1tItJhYI/AAAAAAAAAd8/A7lzlS7sWB8/s320/Wp7Calc1.PNG" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;div&gt;This is my first foray into Windows Phone 7 development and Silverlight. I have to say that although this is an extremely simple project, it was also very easy to write. In all, I must have invested a couple of hours figuring out how to use the Grid to place the buttons and then it was a simple matter of ripping some of my old native code.&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;Using VS2010 Express was a bit of a mixed experience because although it does look nice (very nice indeed), the whole experience feels a bit sluggish. The code editor is not as responsive as VS2008 (which is a tad slower than VS2005's).&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;I'm sharing this code here because this is the start of a (hopefully short) learning experience. Although I'm not new to mobile development, this Silverlight stuff is very new to me (has some similarities to the ASP.NET development experience). I expect to publish here often to share my experiences with this new platform in the hope that it will help some of you that are in the same path.&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;Let the journey begin!&lt;/div&gt;&lt;div&gt; &lt;/div&gt;&lt;div&gt;Source code: &lt;a href="http://www.primeworks-mobile.com/Downloads/Blog/Wp7Calc1.zip"&gt;Wp7Calc1.zip&lt;/a&gt; (101 Kb)&lt;/div&gt;&lt;div&gt; &lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1767553563820981240-8750227549383996531?l=mobilesandbox.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mobilesandbox.blogspot.com/feeds/8750227549383996531/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1767553563820981240&amp;postID=8750227549383996531' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1767553563820981240/posts/default/8750227549383996531'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1767553563820981240/posts/default/8750227549383996531'/><link rel='alternate' type='text/html' href='http://mobilesandbox.blogspot.com/2010/03/wp7-calculator.html' title='WP7 Calculator'/><author><name>João Paulo Figueira</name><uri>http://www.blogger.com/profile/01808451986712386444</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://bp0.blogger.com/_AksH5-lumMs/SCQYuaNZMAI/AAAAAAAAAQs/eA23ckrE4Fw/S220/MVP_profile.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_AksH5-lumMs/S6E1tItJhYI/AAAAAAAAAd8/A7lzlS7sWB8/s72-c/Wp7Calc1.PNG' height='72' width='72'/><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1767553563820981240.post-1716588853920106335</id><published>2010-03-16T04:28:00.000-07:00</published><updated>2010-03-16T04:29:17.070-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='VS2010'/><title type='text'>VS2010 pre-order offer</title><content type='html'>Want to save some money on the upcoming VS2010? Here's an offer from Microsoft:&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;"&lt;span class="Apple-style-span" style="font-family: 'Segoe UI', sans-serif; "&gt;Microsoft Visual Studio 2010 Professional will launch on April 12 but you can beat the rush and secure your copy today by pre-ordering at the affordable estimated retail price of £484.99.&lt;/span&gt;&lt;/div&gt;  &lt;p class="MsoNormal"&gt;&lt;span lang="EN-US" style="font-family:&amp;quot;Segoe UI&amp;quot;,&amp;quot;sans-serif&amp;quot;"&gt;If you use a previous version of Visual Studio or any other development tool then you are eligible for this upgrade. Along with all the great new features in Visual Studio 2010 (see &lt;/span&gt;&lt;span lang="EN-US"&gt;&lt;a href="http://www.microsoft.com/visualstudio"&gt;&lt;span style="font-family:&amp;quot;Segoe UI&amp;quot;,&amp;quot;sans-serif&amp;quot;"&gt;www.microsoft.com/visualstudio&lt;/span&gt;&lt;/a&gt;&lt;/span&gt;&lt;span lang="EN-US" style="font-family:&amp;quot;Segoe UI&amp;quot;,&amp;quot;sans-serif&amp;quot;"&gt;) Visual Studio 2010 Professional includes a 12-month MSDN Essentials subscription which gives you access to core Microsoft platforms: Windows 7 Ultimate, Windows Server 2008 R2 Enterprise, and Microsoft SQL Server 2008 R2 Datacenter.&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span lang="EN-US" style="font-family:&amp;quot;Segoe UI&amp;quot;,&amp;quot;sans-serif&amp;quot;"&gt;So visit &lt;/span&gt;&lt;span lang="EN-US"&gt;&lt;a href="http://www.microsoft.com/visualstudio/en-gb/pre-order-visual-studio-2010"&gt;&lt;span style="font-family:&amp;quot;Segoe UI&amp;quot;,&amp;quot;sans-serif&amp;quot;"&gt;http://www.microsoft.com/visualstudio/en-gb/pre-order-visual-studio-2010&lt;/span&gt;&lt;/a&gt;&lt;/span&gt;&lt;span lang="EN-US" style="font-family:&amp;quot;Segoe UI&amp;quot;,&amp;quot;sans-serif&amp;quot;"&gt; to check out all the new features and sign up for this great offer."&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1767553563820981240-1716588853920106335?l=mobilesandbox.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mobilesandbox.blogspot.com/feeds/1716588853920106335/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1767553563820981240&amp;postID=1716588853920106335' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1767553563820981240/posts/default/1716588853920106335'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1767553563820981240/posts/default/1716588853920106335'/><link rel='alternate' type='text/html' href='http://mobilesandbox.blogspot.com/2010/03/vs2010-pre-order-offer.html' title='VS2010 pre-order offer'/><author><name>João Paulo Figueira</name><uri>http://www.blogger.com/profile/01808451986712386444</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://bp0.blogger.com/_AksH5-lumMs/SCQYuaNZMAI/AAAAAAAAAQs/eA23ckrE4Fw/S220/MVP_profile.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1767553563820981240.post-5468869211799025527</id><published>2010-03-16T02:54:00.001-07:00</published><updated>2010-03-16T02:56:18.440-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='WP7S'/><title type='text'>Petzold on WP7S</title><content type='html'>I leaned how to write my first Windows application using straight C and the API from a venerable book written by Chales Petzold. The teacher is back with a preview of the upcoming book on Windows Phone 7 Series programming. Go get your &lt;a href="http://charlespetzold.com/phone/index.html"&gt;preview copy&lt;/a&gt; now!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1767553563820981240-5468869211799025527?l=mobilesandbox.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mobilesandbox.blogspot.com/feeds/5468869211799025527/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1767553563820981240&amp;postID=5468869211799025527' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1767553563820981240/posts/default/5468869211799025527'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1767553563820981240/posts/default/5468869211799025527'/><link rel='alternate' type='text/html' href='http://mobilesandbox.blogspot.com/2010/03/petzold-on-wp7s.html' title='Petzold on WP7S'/><author><name>João Paulo Figueira</name><uri>http://www.blogger.com/profile/01808451986712386444</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://bp0.blogger.com/_AksH5-lumMs/SCQYuaNZMAI/AAAAAAAAAQs/eA23ckrE4Fw/S220/MVP_profile.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1767553563820981240.post-3625972504347403973</id><published>2010-03-15T10:57:00.001-07:00</published><updated>2010-03-15T10:57:44.259-07:00</updated><title type='text'>Visual Studio Express 2010 for Windows Phone</title><content type='html'>Get it &lt;a href="http://www.microsoft.com/express/phone/"&gt;here&lt;/a&gt;!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1767553563820981240-3625972504347403973?l=mobilesandbox.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mobilesandbox.blogspot.com/feeds/3625972504347403973/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1767553563820981240&amp;postID=3625972504347403973' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1767553563820981240/posts/default/3625972504347403973'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1767553563820981240/posts/default/3625972504347403973'/><link rel='alternate' type='text/html' href='http://mobilesandbox.blogspot.com/2010/03/visual-studio-express-2010-for-windows.html' title='Visual Studio Express 2010 for Windows Phone'/><author><name>João Paulo Figueira</name><uri>http://www.blogger.com/profile/01808451986712386444</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://bp0.blogger.com/_AksH5-lumMs/SCQYuaNZMAI/AAAAAAAAAQs/eA23ckrE4Fw/S220/MVP_profile.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1767553563820981240.post-9112811687362683615</id><published>2009-06-16T00:43:00.000-07:00</published><updated>2009-06-16T00:48:32.079-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='BlackBerry'/><title type='text'>BlackBerry MDS Simulator</title><content type='html'>Just cracked how to use the latest RIM MDS Simulator on my Vista box. Install the simulator as usual, and go to the install directory (in my case it's C:\Program Files\Research In Motion\BlackBerry Email and MDS Services Simulators 4.1.2\MDS). Make sure your user has write access to this directory, otherwise MDS will fail to run. On Vista installs, this directory is read-only for your user (should be OK with XP, though). Now, for the final bit: open the run.bat file and replace the following:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;!BMDS_CLASSPATH!;!BMDS_CLASSPATH2!&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;with:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;%BMDS_CLASSPATH%;%BMDS_CLASSPATH2%&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Now the MDS Simulator works and I can browse the internet from the BlackBerry simulator. When you are done, just press Ctrl-C on the MDS console and then exit it (so eighties, isn't it?).&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1767553563820981240-9112811687362683615?l=mobilesandbox.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mobilesandbox.blogspot.com/feeds/9112811687362683615/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1767553563820981240&amp;postID=9112811687362683615' title='12 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1767553563820981240/posts/default/9112811687362683615'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1767553563820981240/posts/default/9112811687362683615'/><link rel='alternate' type='text/html' href='http://mobilesandbox.blogspot.com/2009/06/blackberry-mds-simulator.html' title='BlackBerry MDS Simulator'/><author><name>João Paulo Figueira</name><uri>http://www.blogger.com/profile/01808451986712386444</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://bp0.blogger.com/_AksH5-lumMs/SCQYuaNZMAI/AAAAAAAAAQs/eA23ckrE4Fw/S220/MVP_profile.jpg'/></author><thr:total>12</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1767553563820981240.post-1216889167638162671</id><published>2009-02-27T01:08:00.000-08:00</published><updated>2009-02-27T01:52:36.086-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SQL Compact'/><category scheme='http://www.blogger.com/atom/ns#' term='Performance'/><title type='text'>SQL Compact Insert Performance</title><content type='html'>One of the performance bottlenecks of SQL Compact databases is data insertion, especially when large amounts of data must be inserted. Lots of people have struggled with this, especially when coming from SQL Server development, where everything is easier and so much faster. Using the same coding approaches as in the desktop SQL Server, SQL Compact will run very slowly when inserting large volumes of data. There are two main reasons for this:&lt;br /&gt;&lt;ol&gt;&lt;li&gt;On heavily indexed tables, all data changes will be slower (this means inserting, updating and deleting data). In such cases you may get better performance by dropping all indexes and constraints before adding the data and recreating them at the end. Please note that SQL Compact uses indexes internally for PRIMARY KEY, UNIQUE, and FOREIGN KEY constraints.&lt;/li&gt;&lt;li&gt;The query processor is the worst mechanism for inserting large volumes of data. Executing a SQL INSERT comand (even if it is prepared and has command parameters created by explicitly stating data type and size) is always slower than the best alternative: using a base table cursor. When your application uses the SQL Compact Query Processor to execute a command it always pays a performance price because the QP must parse, compile and optimize the command execution path. If you can, do this work by yourself.&lt;br /&gt;&lt;/li&gt;&lt;/ol&gt;I have recently talked about this on two presentations (TechEd EMEA 2008 and &lt;a href="http://www.devdays09.com"&gt;DevDays09&lt;/a&gt;) and used a simple demo to illustrate this. The sample solution (InsertDemo, see download link below) uses four different approaches for bulk data insertion:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="font-weight: bold;"&gt;Brute force&lt;/span&gt; - Each row is inserted by executing a SQL command created on the fly, using a string concatenation. If you look at the code you will see that I'm reusing both the &lt;span style="font-family: courier new;"&gt;SqlCeCommand&lt;/span&gt; and the &lt;span style="font-family: courier new;"&gt;StringBuilder&lt;/span&gt; objects so that I take the GC out of the performance measurement. This approach has the worst performance of the four and you can explain it through the heavy use of the query processor.&lt;/li&gt;&lt;li&gt;&lt;span style="font-weight: bold;"&gt;Prepared&lt;/span&gt; - Instead of executing a new command every time, you can create a command with parameters and prepare it (note that the .NET CF &lt;span style="font-family: courier new;"&gt;SqlCeCommand.Prepare&lt;/span&gt; does not prepare the command like the OLE DB version does, it merely marks the command for preparation upon first execution - this is a pitty because the OLE DB version allows you to parse the command and check for syntax errors before executing it). Note that here we have a tighter insertion loop because we only need to set the parameter's values and execute the command.&lt;/li&gt;&lt;li&gt;&lt;span style="font-weight: bold;"&gt;SqlCeResultSet&lt;/span&gt; - This is the best managed approach for inserting data in a table. By using the &lt;span style="font-family: courier new;"&gt;SqlCeResultSet&lt;/span&gt; class your code circumvents the query processor completely and inserts the data in the table by using a lower-level object: a base table cursor. Note that contrary to the OLE DB interfaces, there is no notion of a current row for insertionpurposes so you must create a &lt;span style="font-family: courier new;"&gt;SqlCeUpdatableRecord&lt;/span&gt; object to store the data for insertion. You can create just one instance of this object and reuse it to insert all the required rows in the table (see how I did it in the sample code).&lt;/li&gt;&lt;li&gt;&lt;span style="font-weight: bold;"&gt;OLE DB&lt;/span&gt; - This is the fastest approach, but it's not managed. Interestingly the relative performance difference to the &lt;span style="font-family: courier new;"&gt;SqlCeResultSet&lt;/span&gt; seems to be constant with the inserted sample size, which seems to point to the .NET CF runtime. Although the difference seems small for small data sets, it may become significant for larger data sets.&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;Have a go with the sample project (you need both in the same solution in order for the whole demo to work). There are a few things that you might be interested in testing with this demo:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Sample size - Inserting more rows will take longer, but does the total time grow linearly?&lt;/li&gt;&lt;li&gt;PRIMARY KEY - What's the impact of adding a PRIMARY KEY to the sample table? How does performance behave when the sample size increases?&lt;/li&gt;&lt;li&gt;Random keys - When using a PRIMARY KEY, what's the impact of inseting a sorted data set vs. a random data set?&lt;/li&gt;&lt;li&gt;Delete - What happens when you delete large amounts of data under the previous circumstances?&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;I hope you have some fun gathering data with this demo. It uses a very simple table (one integer column) so it's not real. But you can change it to model your real table and see how it behaves under the pressure of thousands of inserts.&lt;br /&gt;&lt;br /&gt;Enjoy!&lt;br /&gt;Sample code: &lt;a href="http://www.primeworks-mobile.com/Downloads/CodeProject/InsertDemo.zip"&gt;InsertDemo.zip&lt;/a&gt;, &lt;a href="http://www.primeworks-mobile.com/Downloads/CodeProject/OleDbInsert.zip"&gt;OleDbInsert.zip&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1767553563820981240-1216889167638162671?l=mobilesandbox.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mobilesandbox.blogspot.com/feeds/1216889167638162671/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1767553563820981240&amp;postID=1216889167638162671' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1767553563820981240/posts/default/1216889167638162671'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1767553563820981240/posts/default/1216889167638162671'/><link rel='alternate' type='text/html' href='http://mobilesandbox.blogspot.com/2009/02/sql-compact-insert-performance.html' title='SQL Compact Insert Performance'/><author><name>João Paulo Figueira</name><uri>http://www.blogger.com/profile/01808451986712386444</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://bp0.blogger.com/_AksH5-lumMs/SCQYuaNZMAI/AAAAAAAAAQs/eA23ckrE4Fw/S220/MVP_profile.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1767553563820981240.post-6871143393089399973</id><published>2009-02-07T08:44:00.000-08:00</published><updated>2009-02-08T08:58:22.993-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SQL Compact'/><title type='text'>How fast is fast?</title><content type='html'>I don't like to use the "optimization" word when talking about software. Coming from a mathematics and engineering background, the word "optimization" usually means the best possible result. Can we use this word to describe the performance of our code? Hardly. I have learned that there is always some way to make your code run a bit faster.&lt;br /&gt;&lt;br /&gt;Sometimes the new approach requires a little change to your code, while other times it will require major rewrites making it an important investment. Is it worthwhile? Well, we have to measure the performance improvement to asses how much of an improvement (if at all) we are talking about.&lt;br /&gt;&lt;br /&gt;There are three major tools to help you in the performance assessment and tuning of your application:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Code instrumentation - a set of programming tools that help you measure the timings of specific portions of your code.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;The .NET CF Profiling tools - these help you take a bird's eye view on your whole application's performance drivers.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;The Query Execution plan - this is a SQL Compact-specific tool that shows you how the Query Analyzer compiles your SQL command and how it plans to execute it. Some of the execution bottlenecks may become apparent and, with some skills you will be able to make your command run faster.&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;Code instrumentation is simplest to use and involves timing your code. The .NET CF helps you with &lt;span style="font-family: courier new;"&gt;System.Environment.TickCount&lt;/span&gt; and &lt;span style="font-family: courier new;"&gt;System.DateTime.Now&lt;/span&gt; to determine the timing when a specific piece of code runs. The first method is more precise and (anywhere from one tenth of a second to half a second) ad reports elapsed time in milliseconds. The second method is less precise and is accurate to the second. Both methods work by retrieving the time measurement of the process start and end and by subtracting both to get an approximate exucution time.&lt;br /&gt;&lt;br /&gt;With the .NET CF 3.5, Microsoft introduced a much more precise time measurement intrument, the &lt;span style="font-family: courier new;"&gt;System.Diagnostics.StopWatch&lt;/span&gt;. Although more precise, I generally don't use this timing method because I don't need all the precision. Timing code involves running a fairly large number of trials and averaging out the timing at the end, so individual timing precision is less of an issue. Also, most of the time you are really concerned about shaving 5, 10 or more seconds from a particular piece of code, you won't care about improving it by 10 milliseconds.&lt;br /&gt;&lt;br /&gt;I will be looking at these topics in the next few posts about SQL Compact performance.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1767553563820981240-6871143393089399973?l=mobilesandbox.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mobilesandbox.blogspot.com/feeds/6871143393089399973/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1767553563820981240&amp;postID=6871143393089399973' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1767553563820981240/posts/default/6871143393089399973'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1767553563820981240/posts/default/6871143393089399973'/><link rel='alternate' type='text/html' href='http://mobilesandbox.blogspot.com/2009/02/how-fast-is-fast.html' title='How fast is fast?'/><author><name>João Paulo Figueira</name><uri>http://www.blogger.com/profile/01808451986712386444</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://bp0.blogger.com/_AksH5-lumMs/SCQYuaNZMAI/AAAAAAAAAQs/eA23ckrE4Fw/S220/MVP_profile.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1767553563820981240.post-4395191809954478412</id><published>2009-02-04T10:00:00.000-08:00</published><updated>2009-02-04T10:12:21.280-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Book'/><title type='text'>Writing Mobile Code</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://www.amazon.co.uk/Writing-Mobile-Code-Engineering-Applications/dp/0321269314/ref=sr_1_1?ie=UTF8&amp;amp;s=books&amp;amp;qid=1233770485&amp;amp;sr=8-1"&gt;&lt;img style="margin: 0pt 0pt 10px 10px; float: right; cursor: pointer; width: 240px; height: 240px;" src="http://ecx.images-amazon.com/images/I/518B89080GL._SL500_AA240_.jpg" alt="" border="0" /&gt;&lt;/a&gt;I keep coming back to this book because it's an invaluable reference for .NET CF developers and mobile application designers alike. With a constant and consistent focus on performance, the author explores the various aspects of mobile software development with an emphasis on Microsoft platforms and the .NET Compact Framework. Although the book's examples are all written to target the .NET CF 1.1, the material seems to keep its original freshness due to the author's approach: writing mobile code is different than writing desktop code. A mobile software developer worth his salt knows that in an underpowered device with limited memory and storage, and with small screen sizes one has to think differently. And this book teaches you how.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1767553563820981240-4395191809954478412?l=mobilesandbox.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mobilesandbox.blogspot.com/feeds/4395191809954478412/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1767553563820981240&amp;postID=4395191809954478412' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1767553563820981240/posts/default/4395191809954478412'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1767553563820981240/posts/default/4395191809954478412'/><link rel='alternate' type='text/html' href='http://mobilesandbox.blogspot.com/2009/02/writing-mobile-code.html' title='Writing Mobile Code'/><author><name>João Paulo Figueira</name><uri>http://www.blogger.com/profile/01808451986712386444</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://bp0.blogger.com/_AksH5-lumMs/SCQYuaNZMAI/AAAAAAAAAQs/eA23ckrE4Fw/S220/MVP_profile.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1767553563820981240.post-9010704765162311499</id><published>2009-02-04T00:36:00.000-08:00</published><updated>2009-02-04T10:19:38.521-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SQL Compact'/><title type='text'>SQL Compact Performance</title><content type='html'>Last November I delivered a presentation at TechED EMEA 2008 about SQL Compact performance tuning. I had some requests for the presentation source code but could not find the time to post the sources online and, because this was a managed code presentation it did not feel right to post the code on my &lt;a href="http://nativemobile.blogspot.com/"&gt;native code blog&lt;/a&gt;. After receiving one more request for the presentation materials I thought that this a good time to start writing about my presentation's topic and share the presentation code.&lt;br /&gt;&lt;br /&gt;Like every aspect of software development for Windows Mobile or Windows CE, performance is one of the top priorities for developers. Devices are inherently limited in memory, storage and processing power. This also limits the amount of horsepower you can house in such a device and SQL Compact is a great example of that: it's a small-sized relational database engine with a simple but effective security model that also runs on desktop computers and serves multiple clients. Due to its small size, SQL Compact does not include all the bells and whistles that his desktop cousin has to offer, so you should expect to do some of the optimization work that SQL Server does behind the scenes. You just cannot expect to bring your desktop development experience to a mobile device and expect it to perform in the same way. You have to adopt a device development mindset: prepare to work more.&lt;br /&gt;&lt;br /&gt;Here are two quick examples of how things work so differently on SQL Compact:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;There is no connection pooling mechanism so it is considered a bad practice (performance-wise) to quickly create, open and close a database connection. In the worst-case scenario you will be loading and unloading the database engine everytime you do this!&lt;/li&gt;&lt;li&gt;Don't use the INSERT command to insert data on a table. Even if you use command parameters on an INSERT command, you will still get less than optimal performance. To get the very best performance when inserting data, you need to use a base table cursor which is exposed throught the &lt;span style="font-family:courier new;"&gt;SqlCeResultSet&lt;/span&gt; class.&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;Interested? Stay tuned for more in the next post.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1767553563820981240-9010704765162311499?l=mobilesandbox.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mobilesandbox.blogspot.com/feeds/9010704765162311499/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1767553563820981240&amp;postID=9010704765162311499' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1767553563820981240/posts/default/9010704765162311499'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1767553563820981240/posts/default/9010704765162311499'/><link rel='alternate' type='text/html' href='http://mobilesandbox.blogspot.com/2009/02/sql-compact-performance.html' title='SQL Compact Performance'/><author><name>João Paulo Figueira</name><uri>http://www.blogger.com/profile/01808451986712386444</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://bp0.blogger.com/_AksH5-lumMs/SCQYuaNZMAI/AAAAAAAAAQs/eA23ckrE4Fw/S220/MVP_profile.jpg'/></author><thr:total>0</thr:total></entry></feed>
