Posts

Showing posts from 2012

Getting all profile happy with JustTrace

Image
Recently I have been developing a fair size application and so far everything seemed to be "just working" fine. However during testing I noticed a few times the app seemed to stall up. This left me quite unhappy and I knew it was time to relook at some of my "decisions". Initial glances through the code didn't really highlight anything so I thought it about time to profile the application and see what it can find.

In the past I have used Redgate's Ants Profiler and an early version of Telerik's JustTrace. I decided to give Telerik's JustTrace a go again as I have heard alot about it and wanted to see how it's changed / grown.

Alas, my initial attempt to use JustTrace ended quite abruptly, I've been developing on Windows 8 and VS2012 exclusively for about 5 months now and sadly JustTrace didn't support IIS8 or IIS Express 8. I was gutted to find this out but a quick chat to the Telerik Dev Team and Chris Eargle gave me hope as they advise…

Deploying Non Project Files with Web Deploy

Deploying Websites and Web Applications has changed massively over the years, I have seen the likes of FTP, Copy & Paste over RDP (why!!) etc but there has always been a degree of, did I copy the correct files, did I miss any, did I upload the correct client config etc.

Since VS2010 I have been a big fan of always publishing my applications to either a local folder and then upload or directly to the server, depending on the setup.

One thing I have always struggled with is publishing files that aren't part of my project, and ensuring the correct client config settings are uploaded. Now I'm running VS2012 full time I decided it was time to put to bed these issues and ensure I could use one click, or as near to one as possible, to deploy stage configurations of my applications as well as live.

VS2012 has tweaked publishing again, it now includes a much fuller publish model, with WebDeploy amongst the usual FTP, FileSystem etc. The Package / Publish process is just an extensi…

Shims Shim Shims

Tonight I started a small project and I thought I'd take the opportunity to explore the new Microsoft.QualityTools.Testing.Fakes library. In case you don't know this library basically allows you to "easily" mock out those pesky sealed classes within the .Net Framework, I've only used it to do System.IO tonight but it does do more. I have a feeling though System.IO will be used heavily with it.

What the library allows you to do is to generate a shim version of each sealed class within a dll. So what is a shim? MSDN at the moment says the following:
Shim types allow detouring of hard-coded dependencies on static or non-overridable methods. What this means to you and I is you get to create a wrapper type, ShimDirectoryInfo for example, you then set delegates for each method and property that you are going to use on the type and let these return your expected values. When your real code then goes to use the original type, DirectoryInfo in our example, it will automa…

Portable Class Library Projects and your Build Server

Yesterday my build server started failing on a particular project and after a quick look at the log I found that it simply wasn't building the solution. Peculiar as I knew it built fine on several development machines, however I dug into the logs and found the following:
 error MSB4019: The imported project "C:\Program Files (x86)\MSBuild\Microsoft\Portable\v4.0\Microsoft.Portable.CSharp.targets" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk. Oh dear, now I know Portable Class Libraries is an add on so I went to MSDN Visual Studio Gallery and got the installer so that I could chuck it on to the build server.

However when attempting to install I got a great message saying I needed VS2010 and SP1 installed, obviously for a build server this wasn't going to happen. After a bit of digging on MSDN I found that the installer actually has a switch that when used just installs the targets for MSBuild.
To ins…

Using the SQL Server Export generating an excel spreadsheet from an access database

Image
What a wordy title, go read it again, it's crazy but true.

This post covers generating an Excel spreadsheet from an Access Database but using a SQL Server tool. It's crazy but great and easy!

I am assuming you have SQL Server installed and the import export wizard, if you don't have this go get it first before carrying on.

First up open the Import and Export Data application, note this has to be the x86 edition so if you are running an x64 machine, which I think most dev's are nowadays, ensure you choose the correct edition.
This will give you the welcome screen.

Click next to get the ball rolling, this first screen is where we want to get the data from, in this case access, so use the drop down box to select Microsoft Access. Then provide the path to the database file, you can see my file path was actually on the network and it worked fine.







Next up the destination, well again Excel is what we want so highlight in the list and provide a path to save too. You can also c…

Revisting Linq To Lucene

Last July I wrote a blog post about prototyping getting Entity Framework CodeFirst working with Linq To Lucene. I hadn't realised it was quite that long ago but alas time flies especially with a baby.

Anyhow, I never finished the work nor made it "feature" ready or submitted it back to the project, this was partly due to the apparent inactivity. However this week the Linq To Lucene project has become quite active, and as I now need to use the implementation I spent a few hours to finish it. This included working out how to get all the tables off of a DbContext, which involved a bit of reflection magic and then writing some tests to ensure it worked at least how the LinqToSql version had done.

I have now submitted this as a patch, http://linqtolucene.codeplex.com/SourceControl/list/patches - item id 11857, and hope its available in the main trunk soon, enjoy!

Troubleshooting NuGet failing to load

Today I had the unfortunate circumstance for VS2010 to crash whilst I was working, nothing to big I thought, I've had this happen before.

I reopened VS went to open my solution and got the following message:

---------------------------
Microsoft Visual Studio
---------------------------
The 'NuGet.Tools.NuGetPackage, NuGet.Tools, Version=1.6.21215.9133, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' package did not load correctly.

EEK!

Nuget is smegged :( I immediately thought to uninstall the extension and then reinstall it, same thing happened :(

I then, (looking back this was foolish as NuGet is shared), thought I know I just load it in VS11 that will work, it also errored.

Not cool, the error message however directs you to start VS with logging enabled by using the /log command argument and then to look at the activity log.  The activity log is located in your appdata roaming folder, simply stick %appdata%\Microsoft\VisualStudio\10.0\ActivityLog.xml into run or %app…

Developing with MonoTouch - Day 1 - Setup

Image
Introduction

So recently I have started a company and been working on a rather large project, initial plans were to use Window 7 or Windows 8 tablets for the "mobile" solution however for various reasons the plan has somewhat changed to now use iPads.

As primarily a .Net developer this was a tough decision but a necessary one. However I often talked about using MonoTouch for doing iOS develop after successfully doing some work with MonoDroid when it was in beta. So this is my solution, use MonoTouch to code as much as possible in C# and then Xcode where necessary.

I thought it would be a good idea to blog my experiences and any insights I gleam during my first few weeks. I have to admit I have never owned a Mac or an iPad so its all very new, although I have used other peoples.

Stage 1 - Order the kit!
First things first the kit, as most of my work won't actually be on the iPad application but on Azure services etc I decided that the Mac Mini was the way to go. I opted fo…

DotNetOpenAuth 4 beta with Windows Azure

Recently I blogged about using DotNetOpenAuth, I got it working within my local MVC3 Web Application after fixing the dependency issue however when I came to put it into Windows Azure I was getting a random error when the compute emulator started up.

--------------------------- Microsoft Visual Studio --------------------------- Windows Azure Tools for Microsoft Visual Studio
There was an error attaching the debugger to the IIS worker process for URL 'http://127.255.0.0:82/' for role instance 'deployment16(174).xxxxxxxxxxx_IN_0'. Unable to start debugging on the web server. See help for common configuration errors. Running the web page outside of the debugger may provide further information.
Make sure the server is operating correctly. Verify there are no syntax errors in web.config by doing a Debug.Start Without Debugging. You may also want to refer to the ASP.NET and ATL Server debugging topic in the online documentation.
Nice! How confusing, the compute process didn…

Using DotNetOpenAuth and getting "DotNetOpenAuth.Messaging.OutgoingWebResponseActionResult"

Today I started integrating OpenID into my latest web application. I chose to use the DotNetOpenAuth library as a helper, it's top and makes Open ID really easy, supports Web Forms, MVC and even classic ASP. Anyhow there are many how too guides, including one from my good friend Danny Tuppeny, so when it comes to setting it up I refer you to those.

However today I found when I was using the AsActionResult extension method my web page would come back blank with just  DotNetOpenAuth.Messaging.OutgoingWebResponseActionResult written on screen. For some reason the ToString was being called and returned.

Commonly it seems that the issue is caused by not having a binding redirect for older versions of the MVC assembly however my one was set, but what I did notice was the following:

<dependentAssembly>         <assemblyIdentity name="DataAnnotationsExtensions" publicKeyToken="358a5681c50fd84c" culture="neutral" />         <bindingRedirect oldV…

Windows Azure and type initializer for 'System.ServiceModel.Diagnostics.TraceUtility' threw an Exception

Image
I've been working on a new product that I'm with Windows Azure and today whilst I came to debug a WCF service within it stumbled apon an error that at first glance doesn't make a whole lot of sence, but with a bit of working backwards turns out is quite simple to fix.

The scenario: I have a WCF service setup to run in a WorkerRole as part of an Azure solution, pretty simple.

To enable me to see what was going on clearer with my service i decided to configure my system.diagnostic listeners and added the default AzureLocalStorage listener, which is created automatically for you, to my service model and message logging.
<system.diagnostics>    
    <sharedListeners>
      <add name="AzureLocalStorage" type="ServiceAuthenticationGatewayWorkerRole.AzureLocalStorageTraceListener, ServiceAuthenticationGatewayWorkerRole"/>
    </sharedListeners>
    <sources>
      <source name="System.ServiceModel" switchValue="Verbo…

Tidying up user data for display

Today I was tidying up a quick WPF application i had built for a client. It simply renders "today's schedule" in a way that is meaningful for them and allows them to view it on multiple screens and print as necessary.

Development was quick as it only consumed several Google Calendar feeds and based upon my test data worked well.

However today seeing used in real life made me rethink how i rendered the data, in my test data I entered items how I would enter them, this is important, I entered them using sentence casing for paragraphs, title casing for titles etc. However due to the way some of the users worked everything was being entered in CAPS :(

Functionally the app works fine, however for me, and I'm no designer, it looked odd. So I opened the solution again and started to look at ways of improving this. My initial thoughts were to apply some sort of styling, think text-transform:capitalize; if you were using CSS, but alas XAML doesn't have this. I then though…

Tricky times using the MVC3 Date Validator and JQuery UI DatePicker

Today I came across a strange problem whilst seemingly writing a simple MVC3 prototype. My prototype had a textbox for a date value which I then used jQuery UI to append a date picker too. I was also using unobtrusive validation and data annotations on my models to seemingly "speed up" developing my prototype.

Although I thought I had wrote everything correctly whenever I tried to submit my form in Chrome I was getting a random error: Please enter a valid date. Originally I had suspected I had messed up the date time formatting, as I was using en-GB format, not the default en-US. Much time wasted and many things I tried had no effect.

I then by chance loaded the page in Internet Explorer only to find the issue had "vanished", so I went back to Chrome and nope it was back. Upon double checking my code I pondered if using the classname of "date" on my element could cause problems and a bit of Googling confirmed this. In short don't apply a date picker …