This shows the output from all the properties of the URI class for the current request. The Uri has been hardcoded as:
Below is a small snippet showing how to format (or re-format) XML so it’s indented. XML isn’t stored in this humanly readable way in databases (or in System.XML’s various writers), so this method makes the XML easier on the eyes.
This is a very simple snippet showing how to use the Microsoft.Office.Interop.Excel assembly (version 12 for this example).
This is a small example showing the discover and reading of all embedded resources in your assembly.
The Microsoft.SqlServer.Management.Smo namespace and assembly is used by Management Studio for its interogation of the database. If you have Management Studio installed you can use this in your own applications, a simple example of which is shown below.
This small registry snippet can be used if you’ve lost the Windows context menu’s (right click menu inside explorer and your desktop) New->Text Document option.
The flexibility and arguably the over complexity of TFS versus other online bug tracking software is its ability to create custom work item types that cover anything you like. For the Scrum template this includes a Sprint workitem, a product backlog item as well as the standard bug and task items.
A few days ago I bulk inserted 1000 work items for one iteration and area. The performance of the main bug list after this wasn’t too bad considering there’s no cache in place in Spruce right now. I’m not planning on putting one in until version 1, unless there is a real need for it. I’m guessing most people will be using it on a local network so the latency shouldn’t be too bad, the TFS api also does a good job caching items itself.
The installation of (the current version of Spruce when this post was written) is very straightforward:
Here’s a quick reference for scripting table creation in SQL server by hand, where the text is readable and pretty rather than an autogenerated mess.
The following list is the features I’m aiming to implement between version 0.1 and 0.9. Search is a fairly critical one so this will be top of the list, once I’ve finished polishing the UI.
Update: There is now this Microsoft tool to do this for you.
As you’ve probably noticed if you’re one of the 10 people who don’t browse the site for less than 40 seconds (that’s 99% of the traffic), the URL has changed and the design too. I’ve moved all my content over from the dedicated Win 2008 server running N2 to Squarespace.com, saving me about £25 a month.
Have you just created an ASP.NET MVC 3 site on your local/developer box to use Windows authentication, mapped it correctly and then continually got an authentication box appearing even though you’re typing the username/password correctly? And the permissions on disk are fine, you even have everyone mapped to the root folder.
I’ve just released a new minor version of Spruce - my open source ASP.NET MVC project for Team Foundation Server. The minor increment fixes a few issues, but also (barring bug fixes) ends the development cycle of the project. I’m not planning on adding any new features or support for new work items to Spruce in the future. It’s now got support for MS Agile’s Bugs, Tasks, Issue work items and doesn’t support the other three work items.
I’m not really fuming about the SOPA issue as I live in the UK, however given the amount of DNS control the US has, it is worth giving a little-bit-of-a-crap about.
This is a modification of this page that I adjusted for 2012 UK statistics.
I’m in the middle of doing the final two modules of the 3rd year of my part-time Computer Science degree, which means going back to the books. I’ve gone through virtually every note taking technique possible for the reading over the years - textbook + pencil on the tube, Pulse pen, converting PDFs by hand for the Kindle and netbook. This year I’ve decided to try something different, and use the annotations functionality built into the PDF 9+ format. Fortunately the Open University provides most of the course reading in PDF format (except this book, the main course text of one module). There’s no lectures and occasional seminars so the majority of your time is spent reading the course texts and doing the activities for each assignment.
One of the biggest points earners for me on Stackoverflow has been this question about Error logging in C#/.NET. Having been fairly experienced with the setup of Log4net, I’ve seen firsthand how much over kill it generally is for logging (unless you like to use your live servers for debugging), and also how it just isn’t needed as .NET has its own in built and comprehensive logging framework built in.
Now it’s 2015 and WebApi is almost in version 3 (vNext edition), I’ve removed the Microrest source from Bitbucket.
I’ve written this same snippet so many times I’ve decided to shove it here to save my fingers a few calories in future. It’s nothing special, just a way of serializing an object to XML.
Open visual studio command line prompt, and type:
If you try to run your own powershell scripts via the console, they won’t be allowed by Powershell by default due to its paranoid security policy. To get around this, open a powershell console as an administrator and type:
If you need to inject a generic section of code to your view you’d typically write an extension method for the HtmlHelper class and return an MVCHtmlString. You can also create an extension method that will add a @section Name to the view, using something like the snippet below:
The site is now powered by WordPress, having tried it out a few years ago and rejected it, I’ve come to like it and its plugin architecture - it’s fairly slick now and supports everything I needed. It has a wealth of themes which Squarespace doesn’t have, far more flexible and about the same price.
This is an age old debate which I’ll chirp in with my opinion. According to Gojko Adzic there’s two types of TDD people in the world: classic stubbers and the new(ish)-school Moqers (or Mockito in the Java world). MOQ is an amazing tool, but consider the following test code:
As part of the refactor I’m doing for Roadkill, I’m loading custom types from the config file as default instances, via StructureMap. The types are defined as strings in the config file, and in future more plugins will be loaded this way.
This class is a TraceListener implementation that uses the log4j XML format and sends the XML to a UDP socket. This means you can configure a trace listener to send all your logs to something like http://log2console.codeplex.com.. There is also Harvester which has a TraceListener implementation for streaming over a network.
In the next version of Roadkill (1.6) I’ve moved away from NHibernate, the ORM that has been powering it for two years since version 1 and to a commercially supported ORM called Lightspeed.
I’ve spent the last week working on sorting out the caching in Roadkill as prior to 1.6 it relied on NHibernate’s second level in memory cache and some incorrect 304s.
I managed to get the wiki engine I spend a lot of more spare time writing, Roadkill working on Ubuntu with Mono this weekend. Unfortunately for me, a lot of the documentation is patchy which meant it took a few hours to get it up and running by scouring Stackoverflow, blogs and news groups. It is infact very simple to get MVC3 working with Apache on Linux, provided you have the right Apache config settings and are willing to add a few hacks into your code to cater for the gaps (NotImplementedExceptions) in the Mono framework.
Assuming you have used the Github Windows gui (or the console) to clone a Github repository, you can push it up to Codeplex in the console by using something like this:
One of the subjects I recently studied in my part time university course was how to measure a software system’s complexity, including quality measures for your code. These are statistical ways of measuring code or system complexity date back to before the SOLID principles became popular and with a little bit of insight give a fairly good marker of how complicated or clean your code is.
One of the more important parts in Roadkill Wiki is removing malicious HTML from the markup that’s entered, even when the markup (Creole and Markdown) is controlled.
When you write Typescript, you’re forced by the compiler to use the “this” keyword when you want to access member variables or methods. If they’re static, you’re forced to use the name of the class (as you usually would in C#, although it’s syntactical).
Warning: this post contains large amounts of pro-automated-testing propaganda.
In the UK we’re fortunate enough to get 5 free holidays a year, under the guise of “Bank Holidays”. These are mostly on Mondays and come in January, March/April, May, August and December.
A while ago Roadkill’s CI solution was hosted on Appharbor, which was a great solution (and free for a single project), but the configuration hacking and I problems with the hosted environment with the unit tests meant it wasn’t a viable solution for Roadkill’s requirements.
This is a short presentation I created for the company I work for, and gives my thoughts on the state of .NET logging libraries in 2014. My knowledge comes from day-to-day use of MSEntLib and log4net and moving from TraceListener to NLog in Roadkill. The presentation comes from a web and windows service perspective.
This is just a boring Powershell 4 snippet for starting and stopping IIS websites:
One of the main issues I have with WCF, compared to say a WebApi or a NancyFX based API, are the ridiculously large configuration options you have available. The ABC approach it uses (addresses, bindings, contracts) can adds a lot of confusion when you’re creating a service and also connecting with a client.
Or to word it another way, What is a Principal Developer?
I listen to a lot of podcasts from a small clique of online “life hackers” (a cringey term), most of which I’ve discovered via Joe Rogan.
I’ve been using Powershell on a daily basis for about 2 years now, mostly with Chocolatey and provisioning servers (the devops movement). Whilst it’s a huge improvement over batch files (anything is) and VBS, it is has foibles.
There’s a great guide on Digital Ocean for setting up new sites in Apache on Linux. Once you’ve done it a few times though it can be shortened to a few bullet points:
Through the magic of Vagrant (it works well with Linux, not so well with Windows thanks mainly to Windows), you can create a virtual Ubuntu machine on your Windows box in 7 commands:
My podcast recommendation for this week comes from Sam Harris’s discussion with David Chalmers about consciousness.
My podcast recommendation for this week comes from Sam Harris’s discussion with David Chalmers about consciousness.
One of the biggest omissions in the TDD literature is the concept of code first vs test first. The discussion doesn’t seem to surface very often, possibly because it’s a more advanced topic.
Not really a podcast, more of a vodcast, the discussion talks about fasting (Ray Cronise had just been on a 30 day water fast), hot/cold therapy and the Vim Hoff method and the concept of being satiated.
With all the changes to .NET that have happened this year, and the constantly evolving .NET core/standard (and the bombshell that project.json is going), it’s quite hard to decipher what Microsoft are doing to the frameworks besides the main marketing features of it running on Linux/MacOS with NPM style packages and ASP.NET getting Kestrel.
I’ve probably missed a couple, but this is a list I’ve compiled of all the CI services I know about, geared towards cheapo devs on a budget. My area of expertise is Teamcity, Octopus, Bamboo, Gitlab and a bit of Jenkins and Travis, and limited to dot net core.
I had this problem today where a
dotnet restore was failing on a Linux CI server, but working on my Windows 10 dev machine. The error was:
My career as a web-centric software dev started with Unix (Linux and some Solaris/BSD) and thanks to .NET Core I’m now back in that world for some of my web development. I much prefer Unix for the server, particularly as it’s far cheaper than Windows to tinker with as a developer but also its simplicity. It is made for automation - something Windows is slowly catching up with but still performs in a clunky way.
Probably the most basic use of a Docker image is to run it, and let it exist - like
docker run hello-world. If you want to do this on a regular schedule, you have several options but the cron one is narrowed down to running cron on the Docker host or in the container.
A weekly favourite podcast doesn’t really work on this site, as I only end up adding them every month or two. So I’m switching to a monthly format to share my discoveries in the Podcast world.
Today I became a Python developer (writing a single script counts as a being a Python developer doesn’t it?!).
The first 30 minutes of this podcast are worth a listen alone, Chris Kresser discusses how your stomach biome is linked to depression, your brain and cravings. After that they discuss the role of meat in providing nutrition to humans, and how we don’t consider ourselves animals anymore.
Not to be confused with Docker for Windows (Docker inside a Linux Hyper-V VM on Windows 10), these are my initial opinions on Microsoft’s implementation of Docker, running on Windows 2016 Server, which was released a few weeks ago. You can also enable it, minus any settings, via the beta version of Docker for Windows on Windows 10.
Over the past few months I’ve put Roadkill on hold in my free time, to get some .NET core projects working inside Docker. They’re mostly sandbox websites for exploring the tech stack, and are hosted privately in Gitlab. Gitlab gives you a decent CI server for free, which works really well with CI and deployment of .NET core apps (both websites and console apps).
The script below changes your Powershell prompt to look a bit more like a Bash one. Update your
~Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1 file to add the code below. If you aren’t using poshgit then remove the