Feel like a geek and get yourself Ema Personal Wiki for Android and Windows

19 November 2010

Code injection in Early Modern England

Mary Stuart
Code injection methods like SQL injection, Javascript injection or buffer overflow exploits are well known devices to break the security of a system. Much less known is that code injection is a phenomenon that was invented centuries ago and was already used in early modern history.

In 1586 the catholic conspirator Anthony Babington plotted against the protestant Queen Elisabeth I to advance Mary Stuart to the English throne. Mary Stuart was being held captive. All her correspondence was spied upon and read by Walsingham, the chief minister of Queen Elisabeth. So Babington and Mary encrypted their letters about the conspiracy to prevent non-authorized eyes to read the contents. They used a mix of a cipher and a code, which was a quite common way of encrypting diplomatic correspondence in those days.

What they did not know, was that Walsingham employed a gifted mathematician and linguist, Thomas Phelippes, who managed to break the conspirators' code. Walsingham and Elisabeth could now read everything about the plot. As could be expected, it would be quite unfavorable for the Queen's health if the plan would be brought into practice.

They could just have arrested the two conspirators, but Walsingham decided otherwise and waited. He wanted to arrest everyone involved in the plot. Because the other conspirators were unknown, Walsingham and his cryptographer decided to insert a request into one of the letters from Mary to Babington. In the code that Phelippes cracked, they encoded a request to Babington to mention all his fellow conspirators to Mary and added this request to a genuine letter.

For the story's sake it would be nice if Babington had indeed replied with the names, but he was arrested earlier and the other conspirators were discovered anyway. Code injection nevertheless had been born. 

The end of the story should be an exhortation to be very serious about the security of your code. The letters decoded by Thomas Phelippes served as evidence in a trial against Mary and her followers. Mary was convicted of treason and executed in the end. 

24 September 2010

Ema Personal Wiki for Android (and Windows)

Ema Personal Wiki Ema Personal Wiki is a notebook with linkable pages for tracking your ideas, information, todo lists, tasks, bookmarks, projects, notes, brainstorms - in short, your life - in the most flexible way. It has two versions: an Android and a Windows version, which are synchronized with your Dropbox account.

Create pages with information, and link these pages by simply using a WikiWord on another page or surrounding a word with curly brackets. This keeps you completely in charge of how you want to organize your personal notebook.

Get yourself a wiki and feel like a geek.

Download and install

The installer for the Windows version: download link. It is free and open source.
The source can be found on github.

The Android version can be downloaded from the Android Market. Search for "Ema" to find it, or click this link (Android only), or use the QR code on the right.


See the Android app manual for screenshots and features for the Android version.
See the Windows application manual for screenshots and features for the Windows version.

09 July 2010

Speed up compilation time in Visual Studio

Speed up your compilation time with Visual Studio drastically with this tip, especially with large projects.

Working from memory is always faster than working from disk. It would be a huge improvement to use Solid State harddrives as much as possible, but those are still quite expensive.

I always thought that the bottleneck for my PC was the CPU. Until I started to use the Moo0 system monitor (see picture on the right), which has clearly shown me that in 100% of the cases where there is a bottleneck, it is the harddrive.

Since memoryusage was only 30% most of the time, I figured that I might use some of my memory as a RAM-disk and work from a virtual disk that exists in memory only. There is a free RAM-disk utility that can be downloaded from mydigitallife.info. It credits Microsoft, Gavotte and lyh728 for the software.

The disadvantage of a RAM-disk is that all your carefully crafted contents are deleted once you restart your PC.

I solved this by synchronizing the RAM-disk with the c# project directory on disk where the code resides. There is an excellent synchronization utility called SyncBack which has a free edition. I told it to synchronize every 15 minutes, so I will lose fifteen minutes work at most. In most cases it only takes seconds to synchronize the changes, so I could synchronize more frequently.

All of the code and a few of the required dll's are now served from memory. This really sped up my compilation time. Are there more usages of this mechanism? The browser cache on RAM-disk? Outlook PST files? SQL server data files? How much more memory can my PC have...? How much does it cost...?

20 May 2010

Joel on software - a summary: 2010

This is a summary for the blog by Joel Spolsky, Joel on Software, volume 2007. The summary for the years 2000-2010 can be found on the Joel on Software summary index page.

It's a waste of time to involve everyone in everything. Reduce communication lines as much as possible. -- A Little Less Conversation.

A great tester gives programmers immediate feedback on what they did wrong, but also on what they did right. It's demoralizing to have only the negative feedback. -- Why testers?

To get a popular blog, it has to be about your readers and things that interest your readers, not about yourself. -- Let's Take This Offline.

~ ~ ~

17 May 2010

Joel on software - a summary: 2009

This is a summary for the blog by Joel Spolsky, Joel on Software, volume 2007. The summary for the years 2000-2010 can be found on the Joel on Software summary index page.

To software developers applying to a small company: everything about your resume has to scream getting your own hands dirty. -- Blog post 2009/01/02.

If you can't think of anything to say, maybe you should just shut up. -- Blog post 2009/01/12.

Don't be fanatic about coding principles like TDD and SOLID, which can be bureaucratic and limiting. What really matters is, how quickly you can respond to real business needs with your code. -- From podcast 38.

Success is the product of a combination of factors that came together in precisely the right way at precisely the right time. Failure is often caused by a collapse of motivation to try and turn the dials to find success. -- Start-up static

Programmers should not report to the person who writes the specs (the program manager). To be effective, the program manager should have earned respect from the programmers. -- How to be a program manager.

Treating your customers well really does pay off. -- Why Circuit City Failed, and Why B&H Thrives

You won't get rich by selling gap-filler applications, because the platform with the gap will fill the gap itself if it's urgent. -- Blog post 2009/06/10.

Duct tape programmers prefer a shippable product over politically correct code. They tend to avoid cool technologies that are all totally reasonable, but are just a little bit too hard for the human brain. -- The Duct Tape Programmer.

It appears to be a permanent part of the human condition that long term deadlines without short term milestones are rarely met. -- Capstone projects and time management

If you want passionate users, your mission should be expressable as "We help $TYPE_OF_PERSON be awesome at $THING”. -- Figuring out what your company is all about

Slow growth may result in slow death if there happens to be a competitor that grows fast. -- Does Slow Growth Equal Slow Death?

Micromanagement is needed when somehow uncaring people are involved in a project. -- When and How to Micromanage

The minimum bar for a reliable service is not that you have done a backup, but that you have done a restore. -- Let's stop talking about "backups".

11 May 2010

Joel on software - a summary: 2008

This is a summary for the blog by Joel Spolsky, Joel on Software, volume 2007. The summary for the years 2000-2010 can be found on the Joel on Software summary index page.

To attract the kids who are really interesting in programming, a programming-intensive BFA in Software Development should be created. -- Undergraduate programming.

Instead of imposing a statistically meaningless measurement of downtime, set up a program of continuous improvement. Ask "why" until you know what caused a problem and correct the root cause. -- Five whys

The Office binary formats are complex because the applications are ridiculously complex. Don't use it, let Office do the work for you (via COM automation) or use a simpler file format (like CSV or RTF). -- Why are the Microsoft Office file formats so complicated? (And some workarounds)

"Seeming impossible" is practically a requirement for a truly great innovation. Real innovation happens when someone tries anyway, overlooking an obvious flaw, and finds a way to make an idea work. -- Inspired Misfires

Employees didn't start the company and won't behave like people who did. -- Lessons I learned in the army

Consumers (= your wife) don’t give a flicking flick about your stupid religious enthusiasm for making web browsers which conform to some mythical, platonic "standard" that is not actually implemented anywhere. -- Martian headsets

A lot of good developers are working on hopeless and useless architecture astronomy because companies like Microsoft an Google are driven to grow at all cost, even though they can't think of a single useful thing to build for us. -- Architecture astronauts take over.

Don't disable options. Instead, show a message to the user why the action can't be completed. -- Blog post 2008/07/01.

Procedures need to be flexible, otherwise they can evolve into something that looks more like antagonism toward customers. -- Good System, Bad System.

The purpose of middle management is to create useful channels of communication. -- How I Learned to Love Middle Managers

If you're stuck, the "Hair on fire" strategy may help: do nothing except finish the project. -- Hair on fire.

Measuring performance and stimulating performance by commissions is tricky. Employees will figure out how to get the number you want at the expense of what you are not measuring. -- Sins of Commissions

A lot of the principles advocated by Joel Spolsky don't really matter for a project to be successful, as long as the people working on the project are smart and get things done. -- The Unproven Path.

If you are a student, to get the job you want: 1. schedule your interviews as close as possible. 2. Don't accept a forced deadline that prevents you from taking other interviews. 3. Or accept it only verbally and just cancel it if you get a better offer later. -- Exploding offer season.

Management should be an administrative function. Authority and respect are earned and not bestowed. -- My Style of Servant Leadership

Stop listening to Joel Spolsky. -- Amnesia.

05 May 2010

Joel on software - a summary: 2007

This is a summary for the blog by Joel Spolsky, Joel on Software, volume 2007. The summary for the years 2000-2010 can be found on the Joel on Software summary index page.

You can't skip the design step. And you can't design in a meeting. -- The Big Picture

To get remarkable customer service: 1. Fix the problem. It's crucial that tech support have access to the development team. 2. Don't give customers the idea they are stupid. Instead of telling them to check if the connector is plugged, tell them to unplug the connector and plug it back in. 3. Be flexible. When customers have a problem and you fix it, they’re actually going to be even more satisfied than if they never had a problem in the first place. 4. Take the blame. 5. Be polite. 6. Don't take it personal. 7. Always return the money if customers are not happy. 8. Get the good guys for customer service. Give customer service people a career path. -- Seven steps to remarkable customer service.

It takes a mindset of constant criticism to find the thousands of tiny improvements to your software that makes it a great product. -- A Game Of Inches.

When you ask people to choose a style or design that they prefer, they will generally choose the one that looks most familiar. -- Blog post 2007/06/12.

Comments on a blog are a bad idea because they often detract from the original ideas of the blogger. If other people disagree, they're welcome to do so on their own blogs, where they have to take ownership of their words. -- Learning from Dave Winer.

The developers who ignore performance and blast ahead adding cool features to their applications will, in the long run, have better applications. Sandboxes didn’t work then and they’re not working now. In the future, there will be an AJAX SDK which will rule them all and in the darkness bind them. -- Strategy Letter VI.

To ensure software failure: 1. use mediocre developers. 2. don't make a detailed blueprint. 3. negotiate a better sounding deadline. 4. re-assign work frequently. 5. work overtime. -- Five Easy Ways to Fail.

If you're demoing software, 1. People will remember the location so pick the nicest location possible. 2. Make the room seem packed. 3. Get a room that is made for presentations. 4. Dress up the location with music, goodies and make people socialize. 5. Make the demo screens as big as possible so people will be able to read what you are demoing. 6. Don't make yourself look like a gopher: lock the door until the room is ready and bring people to do stuff. 7. The only interesting way to design a demo is to make it a story. 8. Be sure to accidentally bump into all the nice little “fit and finish” features of your product. 9. Say all the important points two ways. 10. Practice and re-watch it on a video. 11. Have a follow-up plan. -- How to demo software.

Talk at Yale

Quality of software can't be measured in an automated way because automated tests won't measure some of the most important aspects of software: the look and feel, and usability. --Part 1

It sucks to be an in house programmer, because you will only get the chance to make half baked, ugly programs, and nobody will really care. Part 2

Being able to write clearly on technical topics is the difference between being a grunt individual contributor programmer and being a leader. Part 3

The market pays for solutions to gnarly problems, not solutions to easy problems. The only way to keep growing - as a person and as a company - is to keep expanding the boundaries of what you're good at. And you will be able to solve more gnarly problems. -- Where there's muck, there's brass

28 April 2010

Joel on Software - a summary: 2006

This is a summary for the blog by Joel Spolsky, Joel on Software, volume 2006. The summary for the years 2000-2010 can be found on the Joel on Software summary index page.

If you start a software company, 1. be clear about what problem you are solving, 2. find a partner, 3. don't expect much at first, be patient. -- Micro-ISV: From Vision to Reality.

If code is to be successful, it needs an organization that takes the code and turns it into products. Your first priority as manager of a software team is building a "development abstraction layer". This layer makes that the only thing programmers have to care about is coding. -- The Development Abstraction Layer.

Using AJAX is a huge advantage over traditional full page request / response methods, because it makes the user feel being in control. -- FogBugz 4½ and Subjective Well-Being

Non-programmers will never be good at running software companies because they can't tell the bunglers from the real programmers. -- My First BillG Review.

Programming languages with first-class functions let you find more opportunities for abstraction, which means your code is smaller, tighter, more reusable, and more scalable. -- Can Your Programming Language Do This?.

Three management models
The Command and Control Management Method is best summarized as "do it or I'll shoot you". Programmers don't like this. And in a software company you can't just tell everybody exactly what to do because it would simply be too much and the manager is often the person with the least information.

Econ 101 management assumes that everyone is motivated by money. One big problem is that it replaces intrinsic motivation (the natural desire to do things well) with extrinsic motivation (getting paid if you things well), which reduces the desire to do a good job. Another problem is that people will be trying to game the system instead of doing things well. Econ 101 is abdication of management: management simply doesn’t know how to teach people to do better work, so they force everybody in the system to come up with their own way of doing, which they can't because that is a management job.

The Identity Management Method is making people identify with the goals you’re trying to achieve, which creates intrinsic motivation. Be open about your own goals and don't have a hidden agenda.

How do you decide between C#, Java, PHP, and Python? The only real difference is which one you know better. -- Language Wars.

Guerrilla Guide to Hiring

To get great programmers: 1. go to conferences and events and talk to the people there, don't post on a general purpose job board. 2.get great kids a year or two before they graduate (internships) 3. build a community to recruit from. 4. Employee referrals is one of the weakest sources of new hires. -- Finding Great Developers.

Programmers are more likely to take the job that offers them a nice private office with an Aeron chair and good hardware. Treat developers as the experts, regardless of politics. Programmers will be happy if they work on a cool project with cool technologies. Managing your corporate brand is just as important for recruiting as it is for marketing. -- A Field Guide to Developers.

Criteria for sorting resumes (!= hiring). 1. Applicant is passionate about computers and loves programming 2. It has a cover letter customized for this particular application. 3. The applicant can communicate. 4. Is smart. 5. Has experience with difficult technologies. 6. Adds diversity to the team. 7. Don't look for experience with particular technologies if you're not looking for a guru in a particular technology. -- Sorting Resumes.

Type declarations are one of those accidental difficulties that good programming languages can eliminate. -- Book Review: Beyond Java.

A phone interview can save a lot of time when hiring. Smart people can generally tell if they're talking to other smart people by having a conversation with them on a difficult or highly technical subject. -- The Phone Screen.

Agile is not supposed to be about swapping out one set of bureaucratic, rigid procedures for another equally rigid set of procedures that still doesn't take customer's needs into account. -- From the "you call this agile?" department.

We need to rethink the misconceived notion that lots of choices make people happy. Each additional choice makes complete sense until you find yourself explaining to your uncle that he has to choose between 15 different ways to turn off a laptop. -- Choices = headaches.

Lego programming does not exist and never will. -- Blog post 2006/12/05.

"Simple Sells" is a myth. -- Blog post 2006/12/09

Poeple most often don’t really care about software itself. The more they notice it, the more annoyed they’re going to be. Elegant software gets out of the way and only presents choices to support the task they are trying to accomplish. -- Elegance.

Whatever. -- Explaining Steve Gillmor 23 Dec.

Gifts from vendors to bloggers are ethically indistinguishable from bribery and reduce the credibility of all blogs. -- Bribing Bloggers.

23 April 2010

Joel on Software - a summary: 2005

This is a summary for the blog by Joel Spolsky, Joel on Software, volume 2005. The summary for the years 2000-2010 can be found on the Joel on Software summary index page.

If you love to program computers, count your blessings: you are in a very fortunate minority of people who can make a great living doing work they love.
1. Learn to write. The programmers with the most power and influence are the ones who can write and speak in English clearly, convincingly, and comfortably. 2. Learn the underlying concepts of modern languages. 3. Learn micro-economics. A programmer who understands the fundamentals of business is going to be a more valuable programmer to a business. 4. Do the boring classes too. 5. Computer science != programming. Take the programming-intensive classes. 6. Don't worry about India: really good programmers do have jobs. 7. Don't waste your talent on regular summer jobs, get a good summer internship. -- Advice for Computer Science College Students.

Great products are great because they’re deeply debugged and as a result reliable, keeping the customers in. Restaurants, software, it’s all the same. -- Foreword to Painless Project Management.

On FogBugz
The articles in this block can be summerized as follows: "FogBugz has a lot of great features. Buy it". That said, I can extract off-topic bits from the articles which look nice to me (which I'm doing anyway).

Listen to your customers, not your competitors. -- The Road to FogBugz 4.0: Part I

Terse and to-the-point mail may seem rude. Being more verbose leaves a polite impression. -- The Road to FogBugz 4.0: Part II

Hungarian notation may not be that bad after all. -- The Road to FogBugz 4.0: Part III

Success of a software product depends only 2% on good coding. The other 98% is customer service, debugging, marketing, demoing and testing. -- The Road to FogBugz 4.0: Part IV

Good coding conventions can make bad code obvious. Hungarian notation was very useful until the dark side took over. Exceptions are the new Goto. They make code less maintainable by breaking the possibility to have the information all in the same place. -- Making Wrong Code Look Wrong.

The software development world desperately needs better writing, i.e. more entertaining and less boring. -- Introduction to Best Software Writing I.

If you try to skimp on programmers, you'll make crappy software, and the software won't sell. Mediocre programmers never produce something as good as what the great programmers can produce. -- Hitting the High Notes.

With a day of usability testing and handful of subjects, you can find where the program's behavior diverges from the user's expected behavior. -- Usability Testing with Morae

If you want to get things done and make fast progress, you have to understand what is the most important thing to get done right now. -- Set Your Priorities.

Microsoft consistently underestimates the value of pervasive, free form, instantaneous search. -- Blog post 2005/10/14.

The term Web 2.0 is not a real concept. It has no meaning. It's a big, vague, nebulous cloud of pure architectural nothingness. -- Blog post 2005/10/21.

Many people who are excellent developers are lousy managers. And: someone who created and ran a profitable lemonade stand is most likely a better manager than someone who has taken two years of finance courses at Harvard. -- Fog Creek Software Management Training Program

Good programmers live in a shoebox in the middle of the road know pointers and recursion. The ability to understand them is directly correlated with the ability to be a great programmer. -- The Perils of JavaSchools

18 April 2010

Joel on Software - a summary: 2004

This is a summary for the blog by Joel Spolsky, Joel on Software, volume 2004. The summary for the years 2000-2010 can be found on the Joel on Software summary index page.

The number one best way to get someone to look at your resume closely: come across as a human being, not a list of jobs and programming languages. -- Getting Your Résumé Read.

.NET should have had a linker that could enable software vendors to ship executables without dependencies. -- Please Sir May I Have a Linker?

Be careful with you beta testers. Don't pick too few, don't overload them, and reward feedback. -- Top Twelve Tips for Running a Beta Test

RDBMS access is intrinsic to modern application implementation and should be supported in programming languages in a first-class way syntactically. -- Blog post 25/03/2004

Perfectionism is a very dangerous quality in business and in life, because by being perfectionist about one thing you are, by definition, neglecting another. -- Blog post 22/04/2004

Nobody thinks they know how to remove a burst appendix, or rebuild a car engine, unless they actually know how to do it, but for some reason there are all these people floating around who think they know everything there is to know about software development. -- Mike Gunderloy's Coder to Developer.

Microsoft has decided to break the compatibility of many API's when shipping a new version. There's no return on investment for application developers to convert their applications to a new API. Microsoft alienates developers from the Windows platform and forces them into web development. -- How Microsoft Lost the API War.

When you're writing software that mediates between people, you have to get the social interface right. -- It's Not Just Usability

It is hard to come up with a price that maximizes profit for a piece of software. Product price segmentation can have significant negative implications for the long term image of your product. And people don't even know themselves what they are willing to pay. -- Camels and Rubber Duckies

13 April 2010

Joel on Software - a summary: 2003

This is a summary for the blog by Joel Spolsky, Joel on Software, volume 2003. The summary for the years 2000-2010 can be found on the Joel on Software summary index page.

Local optimizations can harm your business as a whole. -- Blog post on 2003/01/15

The Apple strategy is not to talk about future versions of their products. Advantages: 1) you will be guaranteed at least half a year without competition. 2) Avoid disappointed expectations. 3) flexibility that you need later when Murphy strikes. 4) It is a simple policy. -- Mouth Wide Shut.

An attractive community site is easy to understand and work with, and discourages fuss. Small software implementation details result in big differences in the way the community develops, behaves, and feels. -- Building Communities with Software

VCs do not have goals that are aligned with the goals of the company founders. Company founders would prefer reasonable success with high probability, while VCs are looking for fantastic hit-it-out-of-the-ballpark success with low probability. -- Fixing Venture Capital.

The way to stand out when applying for a job is to write a letter that reflects your unique personality and highlights the reasons why you want to work at the place to which you are applying. -- Blog post 2003/06/15.

No software company can succeed unless there is a programmer at the helm. -- Rick Chapman is In Search of Stupidity.

Unicode maps characters to codes. The encoding defines the way the sequence of codes that represent characters are stored. You have to know what encoding a string is to display it correctly. -- The Absolute Minimum Every Software Developer Absolutely, Positively Must Know About Unicode and Character Sets (No Excuses!)

The most important factor in software work is not the tools and techniques used by the programmers, but rather the quality of the programmers themselves. -- random qoute from Blog post 2003/11/14

When software is built by a true craftsman, more effort went into getting rare cases exactly right than getting the main code working, even if it took an extra 500% effort to handle 1% of the cases. This delights users and provides longstanding competitive advantage. -- Craftsmanship.

Unix culture values code which is useful to other programmers, while Windows culture values code which is useful to non-programmers. -- Biculturalism

09 April 2010

i18n-proof c# regex recognizing uppercase and lowercase letters

Finding WikiWords with patterns like [A-Z][a-z][...] won't do: the recognition of uppercase and lowercase letters is not i18n-proof.
The following Regex finds WikiWords in an i18n-proof way:
private static Regex _wikiWords = new Regex(@"
    \b       #start on a word bounday
    \p{Lu}   #start with uppercase letter
    \p{Ll}*  #zero or more lowercase letters 
    \p{Lu}   #one uppercase letter 
    \w*      #and zero or more arbitrary characters 
    |                 #or
    \p{L}+\d\w*       #a mix of letters and digits
    |                 #or
    \d+\p{L}\w*       #a mix of digits and letters
", RegexOptions.IgnorePatternWhitespace);
Speaking of i18n. The term i18n is flawed. I am from the Netherlands. If i want to support my own language, and no other language, no international boundary is crossed. But I still need a i18n-proof WikiWord engine.

07 April 2010

Joel on Software - a summary: 2002.

This is a summary for the blog by Joel Spolsky, Joel on Software, volume 2002. The summary for the years 2000-2010 can be found on the Joel on Software summary index page.

Maybe this is the key to productivity: just getting started. Move forward every day. You may accomplish only small changes, but sooner or later you will win. -- Fire And Motion

When you're showing off, the only thing that matters is the screen shot. Build your (demo) UI in such a way that unfinished parts look unfinished. -- The Iceberg Secret, Revealed

Three minutes of design work can save hours of coding because Nothing is as Simple as it Seems

If you have a small number of customers, prefer frequent small releases to minimize time between user request and releasing the code. If you have (or want) a large number of paying customers, prefer less frequent releases to avoid a bad impression. For Systems With Millions of Customers and Millions of Integration Points, Prefer Rare Releases, mainly because of compatibility issues. -- Picking a Ship Date

Pick a programming language pragmatically, suitable for the job. Don't base your choice on syntax. -- Blog post 2002/05/05

There are different "worlds" of software. When somebody tells you about methodology, think about how it applies to the work you're doing. -- Five Worlds

Smart companies try to commoditize their products' complements to increase the price of their products. -- Strategy Letter V

The success of a platform is directly proportional to its ability to attract developers. -- Platforms.

Entering a bugreport in your bugtracking software should be as easy as possible, otherwise people will avoid using it. -- Blog post 2002/09/12

A good installer will roll back all changes when it fails. -- Blog post 2002/10/08.

Never listen to your customers. They were dumb enough to buy your products, so they have no credibility. -- oops, that was a Dogbert quote.

Leaky abstractions are abstractions where the underlying concept sometimes leaks through. The only way to deal with the resulting problems is to learn about the underlying concept. So the abstractions save us time working, but they don't save us time learning. -- The Law of Leaky Abstractions.

There are a lot of programming worlds, each of which requires a tremendous amount of knowledge for real proficiency. If you have a choice of platforms, use the one your team has the most skills with, even if it's not the trendiest or nominally the most productive. -- Lord Palmerston on Programming.

30 March 2010

Joel on Software - a summary: 2001.

This is a summary for the blog by Joel Spolsky, Joel on Software, volume 2001. The summary for the years 2000-2010 can be found on the Joel on Software summary index page.

Don't grow faster than you can find talented people. Some things need talent to do really well, but talent is hard to scale. Having the talent create rules for the untalented ("The Methodology") results in very low quality. -- Big Macs vs. The Naked Chef

Everything you ship to customers should be produced by the daily build process. -- Daily Builds Are Your Friend.

Never let people work on more than one thing at once. Programming is the kind of task where you have to keep a lot of things in your head at once. Therefore task switches take a really, really, really long time. -- Human Task Switches Considered Harmful

A company with a personal voice is attractive, because we are humans. -- Spring in Cambridge.

It makes no sense to optimize software by reducing the size of it, since storage is cheap, but programmer's aren't. -- Strategy Letter IV: Bloatware and the 80/20 Myth.

Architecture Astronauts add so many levels of abstraction that the resulting ideas are completely useless and incomprehensible. They throw bombastic whitepapers at problems that don't need to be solved. -- Don't Let Architecture Astronauts Scare You
If you want something to be The Next Great Thing it has to be more than architecture, it has to enable things that people really need. -- Are the Groove Designers Architecture Astronauts?

If your business plan includes projections from IT research firms, you better start planting tomatoes. -- Blogpost on 2001/04/18

Eating your own dog food can be disgusting, but that is precisely why you have to do it. -- What is the Work of Dogs in this Country?

If Microsoft were to concede the slightest point in an anti-trust case, hundreds of independent software companies would see this as their opportunity to enter Microsoft's markets. -- Michael E. Porter's Competitive Strategy
(Actually the point this article is trying to make is "you should analyze your competition and try to guess how they will react to your move", but I found the former sentence somewhat more appealing.)

Good software, like wine, takes time: probably ten years to become really good. Take this into account in your business model. -- Good Software Takes Ten Years. Get Used To it.

Fixing bugs is only important when the value of having the bug fixed exceeds the cost of the fixing it. The advantages of fixing a bug are: better reputation, less time wasted with tech support, you might charge more for the product. -- Hard-assed Bug Fixin'

If it's a core business function - do it yourself, no matter what. -- In Defense of Not-Invented-Here Syndrome.

VB is not cool because your code doesn't have {'s and }'s. I can live with the shame if it means I'm more productive. -- Working on CityDesk, Part Three

Nowadays a good programmer spends a lot of time doing defensive coding, working around other people's bugs. -- Working on CityDesk, Part Four

Joel points the reader to "Guidelines on Writing a Philosophy paper" by Jim Pryor. This article has some important points on writing, such as:
Don't write using prose you wouldn't use in conversation. Make the structure of your article obvious. Pretend that your reader is lazy, stupid, and mean.

Be pragmatic in your choices and don't necessarily follow the lastest hype. -- Working on CityDesk, Part Five

The stricter the API is about its input, the more likely the code is going to work in funny situations. -- A Hard Drill Makes an Easy Battle

Modern programming languages might give the impression that you don't need to understand the underlying concepts anymore. But this is not true. Some of the biggest mistakes people make even at the highest architectural levels come from having a weak or broken understanding of a few simple things at the very lowest levels. -- Back to Basics.

If you're not in a position to force changes to the development process, you still can initiate improvements. 1. Just do it yourself. 2. Find the people who are willing to improve and capable of it, and get them on your side. 3. Let bad programmers solve their own problems, this will occupy them for months and prevent further damage. 4. Get Away From Interruptions. 5. Keep doing your normal work to avoid bad reputation. -- Getting Things Done When You're Only a Grunt.

NHibernate: SQL query error

A unittest failed with this exception from the MSSQL CE provider:
System.Data.SqlServerCe.SqlCeException: There was an error parsing the query. 
[ Token line number = 1,Token line offset = 34,Token in error = ) ].
The SQL statements are generated by NHibernate, so this was a litte bit confusing. 

Fortunately, there is logging. And an excellent viewer.

The generated SQL statement does not contain any values to INSERT. This is logically correct, because the entity class does not contain persistent properties itself: it only contains two mapped collections:
public class HL7v3InfoMap : ClassMap<HL7v3Info>
    public HL7v3InfoMap()
        Id(x => x.Id);

        HasManyToMany(x => x.FunctioneleEenheden)

        HasManyToMany(x => x.DataTypen)
In this case the mapping was not finished yet, so the problem solved itself when I added more properties. But I also have cases where the class does not have any persistent properties of itself, for example a class that is an abstract base class.

I don't know a better solution than adding a dummy property to the entity.

21 March 2010

Joel on Software - a summary: 2000

This is a summary for the blog by Joel Spolsky, Joel on Software, volume 2000. The summary for the years 2000-2010 can be found on the Joel on Software summary index page.

The goal of your software company is not to solve some specific problem, but to be able to convert money to code through programmers. -- Converting Capital Into Software That Works.

Interviewing. It is much, much better to reject a good candidate than to accept a bad candidate. You’re looking for people who are smart, and get things done. -- Guerilla guide to interviewing.

Every decision should made by the person with the most information, which is probably the team working on the software, not the manager. -- Command and Conquer and the Herd of Coconuts.

Companies need to keep their employees loyal by treating them well, not by enforcing blind loyalty though a contract. -- NDAs and Contracts That You Should Never Sign.

Realistic schedules are possible and are the key to creating good software. -- Evidence Based Scheduling.

Performance reviews and incentives simply can't work in the workplace. It's insulting and demeaning and lowers morale. -- Incentive Pay Considered Harmful

Don't rewrite an application from scratch. There is absolutely no reason to believe that you are going to do a better job than you did the first time. -- Things You Should Never Do, Part I.

UI design for programmers
A user interface is well-designed when the program behaves exactly how the user thought it would. Pick the simplest possible model. -- Controlling Your Environment Makes You Happy and Figuring Out What They Expected.

Design is the art of making choices. Don't give the user options that are not relevant to the task he wants to perform.-- Choices.

Well-designed objects make it clear how they work just by looking at them. -- Affordances and Metaphors.

Consistency is a fundamental principle of good UI design. Emulate popular programs as closely as possible. It may not show off much creativity, but in the long run it makes users happier. -- Consistency and Other Hobgoblins

Design your software so that it does not need a manual. Minimize text in the UI. -- Designing for People Who Have Better Things To Do With Their Lives.

Design your program so that it does not require a tremendous amount of mouse-agility to use it right. Prevent the need for pixeltinkering -- Designing for People Who Have Better Things To Do With Their Lives, Part Two

You shouldn't ask people to remember things that the computer could remember. And: show respect towards your users. -- Designing for People Who Have Better Things To Do With Their Lives, Part Three

Find out which features support the most important user activities. The Process of Designing a Product.

Give knowledge workers space, quiet, and privacy to maximize productivity. -- Where do These People Get Their (Unoriginal) Ideas? See also: Bionic Office.

You need 1 tester for every 2 programmers. -- Top Five (Wrong) Reasons You Don't Have Testers

If you start a company, pick one of: 1) Amazon model (invest a lot and get big fast) or 2) Ben and Jerry's model (grow slow but steady and durable). -- Strategy Letter I: Ben and Jerry's vs. Amazon

Any business plan that calls for making a computer that doesn't run Excel is just not going anywhere. -- Strategy Letter II: Chicken and Egg Problems
Google obviously did not read this article before introducing Google Wave.
Joel provides other example of the chicken and egg problem in Wasting Money on Cats

Eliminating barriers to switching (both ways) is the most important thing you have to do if you want to take over an existing market. -- Strategy Letter III: Let Me Go Back!

To get programmers to work for you: make the workplace attractive, eliminate obstacles, and provide benefits which are more valuable than the money they cost. --Whaddaya Mean, You Can't Find Programmers?

"The Joel test" is introduced as a rogue alternative for testing your company's coding quality with twelve simple yes/no questions. In practice the Joel test seems to do quite well. -- The Joel Test: 12 Steps to Better Code

Writing specs
When you design your product in a programming language instead of human language, it takes weeks to do iterative designs instead of minutes. A spec saves time communicating. With a spec, it is possible to make a schedule. Writing a spec is a great way to nail down all those irritating design decisions, large and small, that get covered up if you don't have a spec. -- Painless Functional Specifications - Part 1: Why Bother?

Specs have a disclaimer, one author, scenarios, nongoals, an overview and a lot of details. It's ok to have open issues. Text for particular audiences go into side notes. Specs need to stay alive. -- Painless Functional Specifications - Part 2: What's a Spec?

You need a dedicated "program manager" to write the specs. The Program Manager is both technically and socially gifted: he has to get along with all people involved, like customers, sales and the developers. -- Painless Functional Specifications - Part 3: But... How?

If you want readers for the specs you wrote, follow these rules. 1. Be funny. 2. Write understandable. 3. Write as simple as possible (be "unprofessional"). 4. Review. 5. Don't use a template. -- Painless Functional Specifications - Part 4: Tips

The only time a company would want to change its name, from something people recognize to something completely new, would be if it had such low brand equity that the old name was a liability. -- Blog post on 2000/11/12

Use a bug tracking system. Every good bug report needs exactly three things. 1. Steps to reproduce, 2. What you expected to see, and 3. What you saw instead. -- Painless Bug Tracking

A good architect only uses tools that can either be trusted, or that can be fixed. -- Up the tata without a tutu.

09 March 2010

The easiest way for custom View folders in ASP.NET MVC

To change the directory where ASP.NET MVC looks for the views, create a custom ViewEngine and add this ViewEngine to the ViewEngines collection, replacing the old one.

This CustomLocationViewEngine will replace the default "Views" search location with a custom one:
public class CustomLocationViewEngine : WebFormViewEngine
    private string location;
    public CustomLocationViewEngine(string location)
        this.location = location;

        base.MasterLocationFormats = locationFormatsFrom(base.MasterLocationFormats);
        base.ViewLocationFormats = locationFormatsFrom(base.ViewLocationFormats);
        base.PartialViewLocationFormats = locationFormatsFrom(base.PartialViewLocationFormats);

    private string[] locationFormatsFrom(string[] orgLocationFormats)
        return (from l in orgLocationFormats select l.Replace("Views", location)).ToArray();

Assign a new instance of this class to the collection in global.asax.cs, in Application_Start:
ViewEngines.Engines.Add(new CustomLocationViewEngine("Mvc"));

The reason for me to change the default view directory, is that I don't like the default setup where the Controller, the View and the Model all reside in seperate directories. In large applications it is very inconvenient switching between the three parts of the MVC pattern. I have good experiences with this approach:
Create a directory for each controller and put the Controller, Views and Models there. If the directory gets too large, the Controller is too large.

06 March 2010

A C# CQRS framework AgrCQRS

To get some grip on the topics DDD, CQRS and Event Sourcing, I have started on a framework for CQRS applications and a sample (questionnaire) application which uses the framework. It is heavily inspired by the resources mentioned below. You can find the project on its CodePlex site: http://agrcqrs.codeplex.com/

Lately a very interesting pattern has emerged, the Command Query Responsibility Segregation (CQRS) pattern. It is actually an existing software pattern that is being applied on a higher level, that is a framework level. It comes down to seperating the domain model and domain logic from the read model. The pattern gives the advantages of high scalability and removes quite some concerns which are introduced by using the domain model for querying, for which it simply isn't well suited.

CQRS and Event Sourcing seem to go hand in hand. Event sourcing is a way of storing state by storing the stack of events that led to the state instead of storing the state itself.

Watching/reading list:
Remember CQRS is an evolving pattern, and there is few frameworks or guidelines which you can grab and start to use (yet). The framework I created on CodePlex can be used, but needs polishing.

The AgrCQRS framework is written for the .NET framework 3.5 in C#.

26 February 2010

Amber Alert 404

Scott Hanselman geeft op zijn blog het idee door om bij een 404 foutmelding ("pagina niet gevonden") foto's van vermiste kinderen op te nemen.
It's a simple and brilliant idea. Millions of 404s are delivered every day. We are reporting on missing pages, but not on missing children.

Ik heb het idee overgenomen en een html pagina gemaakt die de RSS feed van Amber Alert laat zien. In deze pagina wordt alles voor 100% aan de clientkant geregeld, zodat er geen aparte servercode nodig is. Uiteraard met uitzondering van de instructies die de webserver nodig heeft om deze pagina bij een 404 fout te laten zien.

Voor ASP.NET websites pas je in de web.config in de system.web sectie de customErrors instructie als volgt aan:

<customErrors mode="On">
    <error statusCode="404" redirect="/amber-alert-404.html" />

Je kunt de webpagina voor eigen gebruik downloaden vanaf deze locatie: http://www.janwillemboer.nl/2010/amber-alert-404.html.

22 January 2010

Memory leaks with WPF windows

WPF is like an Escher drawing. You should always close the window. Even if you ... did not open it!

If you create a new WPF (XAML) Window object, and do not show it for some reason, you still have to close it or it will stick in you memory until the end of days.
  • In VS2008, create a New WPF application
  • In Window1, create new Button
  • in the Click handler of the Button, put the following statement:
    var w = new Window1();
  • F5, click on the button
  • Close the application: now it won't close because the Window1 instance that was created in the click handler is still somewhere in memory
  • Now change the click handler and Close the window you did not open:
    var w = new Window1();
  • F5 and click and close: now the application will function normally

This seems very odd to me. Moreover, if there is some cleanup required, the Window class should implement the IDisposable interface.