Filter log4net to a single thread using Notepad++

Over the years I’ve Googled and Googled for a solution to this. Heck I even tried Bing! Finally time + an urgent need permitted figuring out a simple solution. To filter down to one thread using Notepad++:

  • Copy the angle brackets and thread number to clipboard. E.g. “[12]”
  • Menu -> TextFX Viz -> Hide Lines without (Clipboard) text
  • Press Ctrl-A (Select all text)
  • Menu -> TextFX Viz -> Delete Invisible Selection
  • Press Ctrl-A (Select all text)
  • Menu -> TextFX Edit -> Delete Blank Lines
  • That’s it! You are now viewing one logging from only one Thread

This works very quickly even with 70,000+ line 10MByte log files. IMO it avoids the need for xml log4net logging and Chainsaw (or similar).Simpler is always better.

Demo: Two threads counting to 100:

Copy the angle brackets and thread number to clipboard. E.g. “[12]”

Menu -> TextFX Viz -> Hide Lines without (Clipboard) text

Press Ctrl-A (Select all text)

Menu -> TextFX Viz -> Delete Invisible Selection

Press Ctrl-A (Select all text)

Menu -> TextFX Edit -> Delete Blank Lines

That’s it! You are now viewing one logging from only one Thread

Posted in Uncategorized | Comments Off on Filter log4net to a single thread using Notepad++

Reduce back and/or neck pain with a 50 cent cardboard box

Virtually all software developers eventually experience neck and/or back pain. Mine gradually increased from light neck pains in 1995/6 to being unable to work one day in 2001. Doctor’s advice: “stop doing what makes it hurt”. Useful…  Earlier today Martin Fowler posted “Back pain is a common issue, but everyone’s pain (and treatment) is different”. Indeed it is, but he also posted a photo that invoked a “Fingernails dragged down a blackboard” response from me. It’s a photo of programmers at work; many IMO asking for neck/back problems in later life.

Let me share the research that has kept me pain free for ten years. I am not qualified in this area, these are just the findings of a long term computer programmer (done little but code from 1981 to 2010, and hope to keep it up until The Singularity makes us obsolete) :

  • Move your screen(s) up to eye level
  • Every time you exercise do neck stretches
  • Read a book on back pain and/ or neck pain.These cover common issues that work for many people; Read the many glowing reviews on Amazon

Screen at Eye Level:

This should be common sense. I work looking forward not down. Peering down compresses neck vertebrae – probably not good for extended periods of time. Commons sense says “mix-it-up if you can”, don’t sit in the same position all day. Personally I alternate between a regular sitting workstation, standing workstation, laptop on a box (or whatever’s handy at the time) and casual surfing using an iPad like a book (not looking down at a laptop). Combined with regular exercise and stretching I still spend almost all waking hours in front of a computer. Of course from time to time I become lazy, and stop stretching after running/cycling; the pain starts creeping back. Returning to regular stretching always cured it (so far, touch wood!)

Sitting workstation:

I use an ergonomic Zody Chair using vesa arm mounts. Yes, I have hauled these to client sites. We just moved house and I don’t have a photo handy

Standing Workstation:

These can be cobbled together very cheaply. Skip those expensive stand/sit combo workstations and build another work area in your home office. The following photo shows a $100 Ikea kit. Notice the two mice? I used to have pain in my mouse button fingers. Learning to use a mouse left handed and swapping between them cured that too. Props to Paul Swan for the mouse tip – he’s a total Genius from my undergrad CompSci degree, now working on the Windows Server team.

Laptop on a box:

The title of this post.  Being in my late thirties peers are starting get aches and pains. Many on Facebook complain of sore necks from laptops. If you listen to only one piece of my advice, Put Your Laptop on a Raised Surface when using it. Oh, and wear sunscreen 🙂 Notice I use a real keyboard and wireless mouse than can be used in either hand – these cost peanuts compared to a Doctor’s visit. This is a great setup for short term client engagements – they always have something to stand a laptop on.

Can a $10 Book from Amazon really help?

The books I purchased in 2001 were an incredible help. I am not suggesting these as an alternative to a Doctor’s advice, just worth considering if your Doctor has been of no help.

Hopefully this post allows some to extend their coding careers. Please take this advice as just that, general common sense advice.

Posted in Uncategorized | Comments Off on Reduce back and/or neck pain with a 50 cent cardboard box

Bye-bye Mac OS X, hello Win7

Using DOS and Windows since the mid 80’s it was time for a change. Vista was never reliable on any of the three machines I tried, Microsoft fanboys were killing creditability in the user group scene – heck it got to the point where saying ‘Google’ was not permitted. It would immediately be corrected to ‘Bing’, sometimes by a chorus of fanboys! This anti-Google sentiment has to stop. Fanboys may go “Rah-Rah, Bing-Bing-Bing”, but how many of them command respect from peers? Many competent people stopped attending Microsoft events.

So how did OS X work out? Well it’s certainly a good operating system, does most things I need but obviously is not going to run Visual Studio anytime soon. Lack of open source software was a major gripe; 7Zip, KDiif3 and many other great open source projects just don’t exist for the Mac.

Snow Leopard was a total flop, costing me hours in lost time as it broke our HTPC which was running Hulu and XBMC. Initially Mac fanboys jumped all over  me for criticizing it the day after it was released, but over time the general consensus is that Apple needs public beta testing before releasing an OS upgrade. A few service releases later Snow Leopard works fine but lacks the snappiness of Win7.

Apple hardware is fantastic. Developing on a MacMini is heaven thanks to virtual silence. The tiny form factor helps declutter workstations, keep a clearer desk etc. Using a MacMini as a HTPC is a little expensive but totally worth it, low power means low heat and they’ll happily live in a cupboard. New Minis also support two digital monitors, IR remote, Bluetooth, latest WiFi, GigaBit internet and have a stack of USB ports. The 13″ MacBook Pro cost $1200, plus the cost of aftermarket 4GB RAM and an Intel SSD. With the SSD and Win7 it’s plenty fast even for a demanding developer. The quality keyboard and touches like back-lit keys, multi-touch track-pad etc make it easily worth the extra cash. Oh and using OS X battery life is nine hours for the latest model – I see over five hours with WiFi and Bluetooth on a 2009 model.

So why the move to Win7? “It just works” scream most Mac users when you ask them “Why a Mac”. True for basic users, but not people like us. Hours can be wasted with simple tasks like trying to format a non Apple external hard-disk. This where the experience breaks down. Problem with Windows are generally solved with a quick Google search. Certainly not the case for OS X, with the hard disk users were berated online for not buying a Apple branded hard disk. I have Bluetooth problems with a Microsoft mouse and have never been able to resolve it other than rebooting. Do you use two monitors? Fine, that works… oh you have one in portrait mode (like I do)? Is not going to happen in OS X yet, sorry. HTPC? What you did not buy an Apple TV unit? The Mac Mini work well as a HTPC but does not support font scaling like Win7. I found a hack which works in some cases not other. Of course almost those cool HTPC open source tools don’t exist for the Mac, ironically XBMC is one that does and it’s almost as stable as for Windows.

Conclusion:
Hopefully this posts helps you consider if  OS X is for you. It’s a good OS, but Win7 is so much better in so many ways. If you want something that “just works” for simple tasks I highly recommend an iPad. That device is so simple I bought another for my Parents. They grasped it quickly and are having few problems. Also the design of the iPad apps means it’ll be very hard for bad guys to devise a virus for them. Macs don’t get PC viruses they get Mac viruses; I would wager the iPad will be virtually virus free.

Posted in Uncategorized | Comments Off on Bye-bye Mac OS X, hello Win7

TeamCity Release Build sgen.exe gotcha

TeamCity is great, I had it up and running with Automated Tests in just minutes. But.. attempting to make a Release Build generated the following error. Googling shows many people have the same error and I only found ugly solutions that required manual registry editing, copying of files etc:

c:WINDOWSMicrosoft.NETFrameworkv3.5Microsoft.Common.targets(2015, 9): error MSB3091: Task failed because “sgen.exe” was not found, or the correct Microsoft Windows SDK is not installed. The task is looking for “sgen.exe” in the “bin” subdirectory beneath the location specified in the InstallationFolder value of the registry key HKEY_LOCAL_MACHINESOFTWAREMicrosoftMicrosoft SDKsWindowsv6.0A. You may be able to solve the problem by doing one of the following: 1) Install the Microsoft Windows SDK for Windows Server 2008 and .NET Framework 3.5. 2) Install Visual Studio 2008. 3) Manually set the above registry key to the correct location. 4) Pass the correct location into the “ToolPath” parameter of the task.

The first thing I did was use msbuild from the command line; sure enough Debug Builds were fine and Release Builds had the same error. This ruled out Team City. Obviously installing VS2008 on our build box would solve the issue, but I assumed the build tools must available elsewhere without need all of VS2008. They are:

The solution is: Download the Windows SDK and install .Net Development Tools (it says 2008 Server but I did this on XP SP3).

Posted in Uncategorized | Comments Off on TeamCity Release Build sgen.exe gotcha

Custom Building a Modern Mountain Bike

This was a dream bike build for me and lots of readers share the dream, so here goes:

Build or buy?

Building means you specify all the components. Even $5K bikes often come with pretty lame wheels, crank sets, cassette etc and you will not get to choose tires, seat, shifters, calipers, bars etc. It was a no-brainier to build, and I am happier with this ~$2,500 build up than most (all!) $4K stock bikes. Why the cost difference? I could hunt down discounted parts. E.g. the shocks, wheels, and frame are not 2009 models.

If you are returning to mountain biking look in the ~$700 range for an off-the-shelf bike with front shocks and disc brakes, any less and you’ll not enjoy the sport. Getting semi-serious means $2K+ on a full suspension bike. Regulars I see again and again at local mountain bikes trails are mostly riding $2,000-$3,500 machines with maybe 10-20% spending even more. The sticker shock takes a few weeks to get over. If you do buy off-the-shelf look at the specs to see if any parts are ‘custom’. Custom generally means it is a non standard size, and replacement/ re-use on another bike will be hard or impossible. Another good reason to build. At the end of the day this sport is more about the rider, but go too cheap and parts will soon break costing you more in the long run.

Tools needed?

Quite lot of tools are needed, probably at least $400 worth. In rough priority order:

. Allen key set (~$10)

. Allen key sockets (~$15)

. Torque wrench (~$50)

. Cable/ Housing cutters (~$20)

. Bottom bracket tools (~$30)

. Cassette whip/ remover (~$20)

. Decent work stand (~$200)

. Headset press ($50->120)

. Crown race setter (I use a $3 tube from a DIY store)

. Star nut setter (~$10)

. Pipe cutter (~$20)

. Chain link splitter (~$10)

. White lithium grease (~$3)

. Several misc DIY tools you should already have

Where to start

Stripping and rebuilding your old bike is a great learning experience; it should you take a day or two. You’ll be annoyed how expensive new cables/ housings are, but will have a slicker bike at the end of it.  I bought an $89 Sette 16″ frame and rebuilt an old bike into one the correct size for my wife, it came in at ~22.5lbs which is amazing for an $89 frame and $300 shocks.

Hunting down the Dream Bike

Boy, this took me many hours online – scouring reviews, price trade-offs, forum postings etc. The most useful resource is the mtbr reviews forum – for each part I looked at the bad reviews, and also got a good idea of what everyone was buying for that component. This way I found some parts that I am really happy with, e.g. Odi Ruffian removable grips and the Thompson Elite seat post.

Search lots of bike sites as prices often differ widely, for each high value part use comparison shopping sites like Froogle – this found me XT cranks at over $100 off when everywhere else wanted MSRP.

Below I will try to discuss the trickier choices made; in general I tried to distinguish between parts I may upgrade and parts I should never need to replace on this bike. E.g. ‘cheap’ mechanical BB7 disc brakes vs. the Thompson seat post. In some areas you probably want to check out lower-end parts before splashing out, I put a Manitou R7 fork on my wife’s bike and rode it for a while before justifying $800 Fox forks.

Parts Arrive

This bike comprised of eight or nine boxes of parts from five different suppliers. As I said there can be HUGE price differences between retailers, so the extra shipping costs are more than worth it.

BMC Trailfox 2.0 Frame under wraps

This is a unsold 2007 found for $499, MSRP for a 2009 model is $2,149.

If this does not excite you then you are dead.

Avid BB7: My first disc brakes and they rock. No longer am I locking up/ skidding after being airborne + doing endos etc is very controllable. Be sure to use Avid speed dial levers so you can adjust the lever pressure required.

Fox Talas 140 RLC: When downhilling it is immediately obvious that these work better than my Manitou R7 MRD and I loved the Manitou. The 100-120-140 adjustability is great, I run 120mm for XC and 140mm for DH/ light FR. 100mm feels plain weird on the BMC frame so stays unused. With hindsight the 150mm Talas model would have been a better choice, but these things were expensive as-is. If buying a Fox fork be aware that adjustable compression is only on the RLC models and adds a lot more to the base price. Add the QR15 option and you are close to $1000 for shocks alone!

Thomson Elite Seat post: Brilliant! It has machined groves which stop the post slipping and must be about as light as the carbon EC70 post that slipped so often on my old bike.

Mavic Crossmax ST:Good wheels are must, try finding these stock on anything less than $5K. These can run tubeless tires but as with hydraulic brakes they seemed an unnecessary complexity I did not want to deal with. Perhaps a future upgrade?

The Build Begins

Rule one: never clamp anything but the seat post, tubing on modern higher-end frames can be crushed otherwise. Install the seat post and mount in your stand.

Rule two: Weigh everything before it goes on the bike. You will want this info when shopping for upgrades.

Pressing in a headset: This BMC came with one pre-pressed but this is the tool you should use – a headset press. Almost all headsets these days are threadless and press in, instead of screwing in like they used to. This is a much better system as a headsets coming loose was common in the 80s and 90s.

Attach the cassette– needs a lot of torque and the special tool is called a cassette remover. This is a 9 speed cassette I had laying around; it will be a PG990 soon.

Attaching brake discs to wheels– use a torque wrench if possible. These are my first disc brakes so BB7 mechanicals were ideal; $46 each for 2009 models is a bargain. Rotor size was copied from a Sepcialized Enduro at 203mmF, 185mmR. With hindsight this is total overkill and they will soon be swapped for 160mm front and rear. Unless you weigh 250lbs and shuttle ski runs I cannot see 160mms overheating.

Pressing the crown race into place. That is a $3 piece of plastic piping which almost everyone uses – no other special tools are required.

The other headset parts. This can be confusing for a beginner so make you download the relevant pdf. These are sealed bearings; don’t bother saving a few pennies on the old bearings-in-a-cage variety. Note: I missed the compression ring form this photo.

Mounting the wheels getting ready to size the steerer; use something to prop it up. Put the headset parts, stem and spacers (max 30mm) in place.  Measure twice, cut once. Do not cut a steerer too short as the repair will be expensive.

Cutting the steerer– the pipe cutter is just a plumber’s tool. Debur using the tool’s deburrer and then smooth off with a metal file.

A star nut setter: Star fangled nuts are easy to bash it in with a hammer and I have done that before, but not on an $800 fork. The setter tool is only ~$10 so why not use one?

Depth of start nut varies on who you ask, from 4mm to 20mm. I set this one to 10mm. It should not matter since the star nut is only used to preload the headset bearings, the stem bolt holds things together.

Leave a gap from the top of the spacer to the stem since you are going to preload the bearings in a minute. The star nut bolt does not need to be very tight, just enough to stop play in the headset. I put the bike on the floor and tighten the steerer nut until steering becomes tight, then back off a little. At this point you should tighten the stem bolts.

Disc brakes and Hollowtech cranks are next. Both being new to me it is time for lunch.  There is no point rushing and I want a clear head especially for that expensive crankset.

Putting a caliper in place– very simple but you will need a mounting bracket that matches your frame and the rotor size. There are three different standards out there so do some homework on this or expect a trip to the local bike shop to find the correct mounting hardware. Avid brakes come with a cool auto-alignment system (CPS) that works much like the curved washers from v-brakes. This mitigates having to face brake mounts.

Hollowtech cranks: The scariest component. MSRP is $305 but all affordable cranksets seemed to have bad reviews. Hollowtech means outboard sealed bearings and very few parts + look bulletproof. The black spacers are for use with a 68mm shell like I had – another plus, this a one-size-fits-all deal.

Of course they needed a new tool. A torque wrench cannot be used with this tool so I used the torque wrench on my car’s wheel nuts to verify what 50Nm feels like. You do not want to strip BB threads!

This side requires very little torque and simply preloads the bearings. Tightening the crank on is done with two allen bolts at 90 degrees to the crank – they come with a stack of warnings so I doubt you’ll get it wrong.

Derailleur Alignment Tool: I am not sure how accurate the tool is, but all three bikes I used it on had misaligned hangers. Misaligned in different ways so I assume the tool is correct. Use the tool to check Up, Down, Left and Right – lightly bending the hanger until it is within 4mm on any measurement. I have to say that my shifts are pretty smooth and maybe this helped?

The spoils of XTR components. The front mech comes with a helpful guide to set the correct distance from the chainrings. If you are buying XTR you can probably eyeball this measurement.

New SRAM chain. Note the removable link which means the chain can easily be removed in the future. The other tool is a chain link splitter which is only needed to remove links from the chain if it is too large.

Put the chain around both large cogs and allow for two extra links. I have ran with zero links before and had no issues – actually I might do the same on this bike to reduce chainslap on rutted downhills. With a tight chain running the extremes of gear combinations is the only issue, but that is a no-no anyway.

It is looking like a real bike now.

Cables: … ugh, not hard but it takes a while. You must use a specific cable cutter or expect frayed cables. Housing and cables are different for both brakes and gears, also these days we run continuous housing from the levers to brakes – use tiny zip ties or special clips to attach the brake housing to the frame. Zip ties are my preference.

Initially I am using an old set of bars/ levers but wanted to dump the old grips. Push a WD40 tube as far as you can, spray in oil and twist. These came off totally intact with little bother.

I had never used these bars and they were incredibly wide. It was cool to see preset cut-down points. Again a few twists of a plumbers pipe cutter and deburring is all that is required.

Removable grips: What an awesome idea for people that love swapping out components. My hands grip really, really well with these – possibly the best part on the whole bike!

Six hours later it is complete (cables were tuned the next morning). It came in at 27lbs 8oz which for a ~$2,500 5″ travel all mountain bike is not bad at all. It should drop about a pound when replacing the old bars, shifters and oversized brake discs. Those tires are 2.6lbs too, yeah, yeah weight weenie.

The Results?

Time and money very well spent. The brakes in particular are changing my riding style, locking up is now almost a thing of the past, especially when scrubbing off speed after time in the air – especially when a corner is almost immediately after landing. Having full suspension makes rides so much less fatiguing and landing misjudged takeoffs much safer.

For a brand that is almost unknown in the US it attracts a lot of attention and questions – everyone so far seems to approve.

Posted in DIY, Other | Tagged , , , | Comments Off on Custom Building a Modern Mountain Bike

Atlanta User Groups I recommend

A friend just asked me what .Net groups are good these days. Atlanta is the Software Capital of the South which means we have many great groups in town and I watch them all for interesting topics, but these are the three I personally attend most often:

this is great for new ideas and decent technical depth. It is a fairly new group still finding its feet

Atlanta’s IASA chapter – always has super-smart people in attendance. Most meetings end up being a discussion (or argument!) with few punches pulled. The best part? BS artists are shot down very quickly and most never come back 🙂

this is the ‘main’ .Net User Group in town and excellent at delivering high level introductions to topics. Networking is very good here too as local MVPs etc are at most meetings

Other .Net focused groups are www.atlantamspros.com (now defunct) and

Hopefully that helps a few people looking to learn more and network 🙂

Posted in Atlanta, Tech Events, Technology | Comments Off on Atlanta User Groups I recommend