225 Articles


8 years Ago

Apple Developer Videos

Published by marco on

It’s well-known that Apple runs a walled garden. Apple makes its developers pay a yearly fee to get access to that garden. In fairness, though, they do provide some seriously nice-looking APIs for their iOS and OS X platforms. They’ve been doing this for years, as listed in the post iOS 7 only is the only sane thing to do by Tal Bereznitskey. It argues that the new stuff in iOS 7 is compelling enough to make developers consider dropping support for all older operating systems. And this for pragmatic reasons, such... [More]

Brilliant articles by the funniest guy at Microsoft

Published by marco on

I recently stumbled upon some Essays from the funniest man in Microsoft Research by Raymond (Old New Thing). He is such a funny writer that this article, against convention, will consist mostly of citations rather than an even mix of citations and paraphrasing that I naturally consider to be much more lucid and pithy. I quote at length to do the material justice, for documentation and to ensure that you all download the PDFs to see if there is more where that came from (there is). All emphases have been added.

Mobile... [More] by James Mickens (Microsoft Research)

How to fool people into giving up their email address

Published by marco on

On Codecademy, you can learn to program in various languages. It starts off very slowly and is targeted at non-technical users. That’s their claim anyway—the material in the courses I looked at ramps up pretty quickly.

Anyway, the interesting thing I saw was in their introductory test. It struck me as a subtle way to get you to enter your email address. I’d just recently discussed this on a project I’m working on: how can we make it fun for the user to enter personal information? The goal is... [More]

The HTML5 AppCache and HTTP Authentication

Published by marco on

The following article was originally published on the Encodo blogs and is cross-published here.

The following article outlines a solution to what may end up being a temporary problem. The conditions are very specific: no server-side logic; HTTP authentication; AppCache as it is implemented by the target platforms—Safari Mobile and Google Chrome—in late 2012/early 2013. The solution is not perfect but it’s workable. We’re sharing it here in the hope that it can help someone else or serve... [More]

Entity Framework Generated SQL

Published by marco on

Microsoft just recently released Visual Studio 2013, which includes Entity Framework 6 and introduces a lot of new features. It reminded me of the following query that EF generated for me, way, way back when it was still version 3.5. Here’s hoping that they’ve taken care of this problem since then.

So, the other day EF (v3.5) seemed to be taking quite a while to execute a query on SQL Server. This was a pretty central query and involved a few joins and restrictions, but wasn’t anything too... [More]

Ignoring files with Git

Published by marco on

The helpful page, Ignoring files (GitHub), taught me something I didn’t know: there’s a file you can use to ignore files in your local Git repository without changing anyone else’s repository.

Just to recap, here are the ways to ignore a file:

  • Global .gitignore: you can designate basic exclusion directives that apply to all repositories on your system. This file is not committed to any repository or shared with others. Execute git config –global core.excludesfile ~/.gitignore_global to set the file... [More]

Some new CSS length units (and some lesser-known ones)

Published by marco on

I’ve been using CSS since its inception and use many parts of the CSS3 specification for both personal work and work I do for Encodo. Recently, I read about some length units I’d never heard of in the article CSS viewport units: vw, vh, vmin and vmax by Chris Mills (Dev.Opera).

  • 1vw: 1% of viewport width
  • 1vh: 1% of viewport height
  • 1vmin: 1vw or 1vh, whatever is smallest
  • 1vmax: 1vw or 1vh, whatever is largest

These should be eminently useful for responsive designs. While there is wide support for these new units, that... [More]

.NET 4.5.1 and Visual Studio 2013 previews are available

Published by marco on

The following article was originally published on the Encodo blogs and is cross-published here.

The article Announcing the .NET Framework 4.5.1 Preview provides an incredible amount of detail about a relatively exciting list of improvements for .NET developers.

x64 Edit & Continue

First and foremost, the Edit-and-Continue feature is now available for x64 builds as well as x86 builds. Whereas an appropriate cynical reaction is that “it’s about damn time they got that done”, another... [More]

Deleting multiple objects in Entity Framework

Published by marco on

The following article was originally published on the Encodo blogs and is cross-published here.

Many improvements have been made to Microsoft’s Entity Framework (EF) since I last used it in production code. In fact, we’d last used it waaaaaay back in 2008 and 2009 when EF had just been released. Instead of EF, I’ve been using the Quino ORM whenever I can.

However, I’ve recently started working on a project where EF5 is used (EF6 is in the late stages of release, but is no longer generally... [More]

9 years Ago

Merge conflicts in source control

Published by marco on

I was recently asked a question about merge conflicts in source-control systems.

“[…] there keep being issues of files being over written, changes backed out etc. from people coding in the same file from different teams.”

My response was as follows:

tl;dr: The way to prevent this is to keep people who have no idea what they’re doing from merging files.

Extended version

Let’s talk about bad merges happening accidentally. Any source-control worth its salt will support at least some form of... [More]

A provably safe parallel language extension for C#

Published by marco on

The paper Uniqueness and Reference Immutability for Safe Parallelism by Colin S. Gordon, Matthew J. Parkinson, Jared Parsons, Aleks Bromfield, Joe Duffy (Microsoft Research) is quite long (26 pages), detailed and involved. To be frank, most of the notation was foreign to me—to say nothing of making heads or tails of most of the proofs and lemmas—but I found the higher-level discussions and conclusions quite interesting.

The abstract is concise and describes the project very well:

“A key challenge for concurrent programming is that side-effects (memory operations) in one thread can affect the... [More]”

Programming in the moderncurrent age

Published by marco on

In order to program in 2013, it is important not to waste any time honing your skills with outdated tools and work-flows. What are the essential pieces of software for developing software in 2013?

A runtime is a given for all but the most esoteric of programming exercises. Without something to execute your code, there is almost no point in writing it.
Programming without an integrated debugger can be very time-consuming, error-prone and will quite frankly suck the fun right... [More]

Are all errors exceptions?

Published by marco on

The following ruminations were written seven years ago but have held up remarkably well. They have been published with minor updates.

This article deals with the situation illustrated below, specifically the question raised in the comment.

if (! $folder_id)
  $this->db->logged_query (“SELECT folder_id FROM” .
                           $this->app->table_names->objects .
                           “WHERE id = $obj->object_id”);
  if ($this->db->next_record ())
    $folder_id = $this->db->f... [More]

A scalable pattern for building metadata

Published by marco on

The following article was originally published on the Encodo blogs and is cross-published here.

In the latest version of Quino—version 1.8.5—we took a long, hard look at the patterns we were using to create metadata. The metadata for an application includes all of the usual Quino stuff: classes, properties, paths, relations. With each version, though we’re able to use the metadata in more places. That means that the metadata definition code grows and grows. We needed some way to keep a... [More]

Updating to a touch-friendly UI

Published by marco on

I was recently redesigning a web page and wanted to make it easier to use from touch-screen browsers. Links made only of text are relatively easy to click with a mouse, but tend to make poor touch targets. If the layout has enough space around the link, this can be remedied by applying CSS.

The basic box

Suppose we have a box with three links in it, as shown to the right.

Setting the height

The first step is to make this box taller, so the logical thing to do is to set the... [More]

10 years Ago

Solving problems

Published by marco on

This graphic Geeks versus Non-Geeks when Doing Repetitive Tasks (How-to Geek) illustrates quite nicely how programmers approach the world of problem-solving.

The chart does not show just much time must be spent before the programmer wins, that being dependent on the complexity of the task. The probability that the task will recur is also highly relevant, as automation of a smallish, one-time task is useless. Neither of those things will stop a determined programmer, though, who will automate no matter... [More]

Encodo Git Handbook 1.2 is available

Published by marco on

tl;dr: Encodo Systems AG has moved from Perforce to Git and has written a manual for getting started for other users or companies looking to make the leap. It’s available for free at Encodo Git Handbook.

In the beginning, there was Microsoft Visual SourceSafe. And it was not good.

In 1994, I started working for a small software company. Source control was a structured network share until I started moving projects into Microsoft Visual SourceSafe, which was slow and balky and feature-poor,... [More]

11 years Ago

How to Write Good Code

Published by marco on

The oft though-provoking XKCD published a flow chart recently, called Good Code (XKCD), which outlines the two branches: doing it fast or doing it right. The chart is linked below.

Despite the panacea of Agile Development, you still can’t have both fast and right. While it is possible to write good code, the odds are good that that code will accomplish a task that no longer requires completion (indicated by the “requirements have changed” block).

Even if it’s decent code, it’s further quite likely... [More]

TuneSync 2.0

Published by marco on

A few years ago, I developed a utility for syncing ratings, play counts and last-played times between the same set of songs on two different iTunes installations. I haven’t worked on it in years, but it’s quite well-written and full-featured and has rich documentation with a tutorial. You can download the Windows-only software for free.

I originally wrote this software because I was listening to a lot of music at work and rating it. When I got home, I didn’t have these ratings anymore because... [More]

Encodo C# Handbook 7.30 – Loose vs. Tight Coupling

Published by marco on

I’m currently revising the Encodo C# Handbook to update it for the last year’s worth of programming experience at Encodo, which includes a lot more experience with C# 4.0 features like optional parameters, dynamic types and more. The following is an expanded section on working with Linq. A final draft should be available by the middle of April or so.

7.30 – Loose vs. Tight Coupling

Whether to use loose or tight coupling for components depends on several factors. If a component on a... [More]

Encodo C# Handbook 7.17 – Using System.Linq

Published by marco on

I’m currently revising the Encodo C# Handbook to update it for the last year’s worth of programming experience at Encodo, which includes a lot more experience with C# 4.0 features like optional parameters, dynamic types and more. The following is an expanded section on working with Linq. A final draft should be available by the middle of April or so.

7.17 – Using System.Linq

When using Linq expressions, be careful not to sacrifice legibility or performance simply in order to use Linq instead... [More]

PHPDocumentor Fork (earthli-v2)

Published by marco on

PHPDoc is a popular tool for generating documentation for PHP projects. I made a whole lot of improvements to it for PHP5 and updated all the skins to look less boxy, have nicer and more informative icons and be easier to use, and then created an earthli fork. This article includes a full feature list and screenshots.

The earthli WebCore (the software that runs this web site) is open-source. It is also relatively well-documented. The documentation is generated using PHPDoc, but a better... [More]

Overriding Equality Operators: A Cautionary Tale

Published by marco on

tl;dr: This is a long-winded way of advising you to always be sure what you’re comparing when you build low-level algorithms that will be used with arbitrary generic arguments. The culprit in this case was the default comparator in a HashSet, but it could be anything. It ends with cogitation about software processes in the real world.

Imagine that you have a framework with support for walking arbitrary object graphs in the form of a GraphWalker. Implementations of this interface complement... [More]

12 years Ago

Sealed classes and methods

Published by marco on

According to the official documentation, the sealed keyword in C# serves the following dual purpose:

“When applied to a class, the sealed modifier prevents other classes from inheriting from it. […] You can also use the sealed modifier on a method or property that overrides a virtual method or property in a base class. This enables you to allow classes to derive from your class and prevent them from overriding specific virtual methods or properties.”

Each inheritable class and overridable... [More]

How to configure a local firewall for OpenVPN (Part II)

Published by marco on

The following tip was developed using Ubuntu 9.1x (Hardy Heron) with OpenVPn 2.1rc19. It builds on the the setup from Part I.

Part I of this guide to configuring a local firewall for OpenVPN introduced you to using iptables on Linux. It also included a script for OpenVPN that opened and closed the firewall for specific IP addresses. If you haven’t read it already, you should probably go do that first.

Unfortunately, it turns out that the firewall configuration from part I is not watertight... [More]

How to configure a local firewall for OpenVPN

Published by marco on

The following tip was developed using Ubuntu 9.1x (Hardy Heron) with OpenVPn 2.1rc19. It was originally published on the Encodo blogs and cross-published here.

There are dozens of guides around that describe how to optimally configure the iptables firewall on Linux for OpenVPN. There’s even a script installed by default that is extremely well-commented and shows to how close down the firewall, then open up only very selected ports and protocols for optimal browsing. However, all of those... [More]

Quino Released

Published by marco on

Encodo Systems AG[1] has released Quino to licensed customers; test licenses are available on request. Feel free to contact them at “info [at] encodo [dot] ch”. Read the Quino Fact Sheet for an in-depth overview.

Big, new features include:

  • Multi-language support
  • Remote method execution
  • Remote query execution
  • Full support for Microsoft SQL Server (including schema migration)
  • Improved support for object graphs in the ORM
  • Typed constants in the metadata
  • Beta support for ASP.NET MVC

More... [More]

Encodo C# Handbook 1.5.2 Released

Published by marco on

Version 1.5.2 of the Encodo C# Handbook is now available for download. It includes the following updates:

  • Expanded “8.1 – Documentation” with examples (this section is now four pages long)
  • Added more tips to the “2.3 – Interfaces vs. Abstract Classes” section
  • Added “7.20 – Restricting Access with Interfaces”
  • Added “5.3.7 – Extension Methods” and “7.17 – Using Extension Methods”

It’s also available for download at the MSDN Code Gallery.

Building pseudo-DSLs with C# 3.5

Published by marco on

DSL is a buzzword that’s been around for a while and it stands for [D]omain-[Specific] [L]anguage. That is, some tasks or “domains” are better described with their own language rather than using the same language for everything. This gives a name to what is actually already a standard practice: every time a program assumes a particular format for an input string (e.g. CSV or configuration files), it is using a DSL. On the surface, it’s extremely logical to use a syntax and semantics most... [More]

Designing a small API: Bit manipulation in C#

Published by marco on

A usable API doesn’t usually spring forth in its entirety on the first try. A good, usable API generally arises iteratively, improving over time. Naturally, when using words like good and usable, I’m obliged to define what exactly I mean by that. Here are the guidelines I use when designing an API, in decreasing order of importance:

Static typing & Compile-time Errors
Wherever possible, make the compiler stop the user from doing something incorrectly instead of letting the runtime handle it.... [More]