marthijn. Rotating Header Image

Panoramas of Madeira

I took the following panoramas during my holiday on Madeira with my Canon 50D and Tamron 17-50 f/2.8 lens. All the images are made out of two or more pictures and I used AutoPano to stitch the pictures.

Câmara de Lobos

Continue reading →

CodeIgniter simple CRUD improved

Currently I’m developing a web application in PHP using the CodeIgniter framework. Since I needed some admin functionality such as create, read, update and delete records (CRUD) I searched for CodeIgniter libraries. I came across this post by Henri. His solution is very simple and easy to understand and implement. In this post I’ll describe how to improve his solution so it’s possible to sort columns. I start with the files Henri provided in his post.

In order to enable sorting I first modify the get_paged_list function of the PersonModel class:

function get_paged_list($limit = 10, $offset = 0, $order_column = '', $order_type = 'asc'){
	if (empty($order_column) || empty($order_type))
		$this->db->order_by('id','asc');
	else
		$this->db->order_by($order_column, $order_type);
	return $this->db->get($this->tbl_person, $limit, $offset);
}

Continue reading →

Using NUnit in Visual Studio 2010

Like in older versions of Visual Studio it is possible to use NUnit as an external tool in the new 2010 version. By creating a toolbar as well it is very easy to run your test suite. The usual way to add an external command is by clicking the menu Tools -> External Tools. However, by default this menu item is not visible. To enable this menu item go to Tools -> Settings -> Expert Settings.

Visual Studio 2010

Continue reading →

Lens abbreviations

Each lens manufacturer uses different abbreviations to describe the features or aspects of a lens. This post lists all abbreviations of Canon, Nikon, Sigma, Tamron and Tokina. Some general terms such as AF (auto-focus) and MF (manual-focus) are not listed.

Canon

AbbreviationMeaningDescription
AFDArc-Form DriveAn older type of auto focus motor, generally slower and noisier than USM
DODiffractive OpticsA technology used to make lenses with long focal lengths without the normal increase in physical size
EDExtra-low DispersionPrevents chromatic aberration because it concentrates and directs the wavelength of the light more effectively onto the camera's sensor
EFElectro FocusStandard lens mount, compatible with all EOS bodies
EF-SElectro Focus - Short back focusLens mount for APS-C sensor DSLRs
IFInner FocusTo ensure stability in focusing, this lens moves the inner lens group or groups without changing the lens' physical length
ISImage StabiliserA family of techniques used to reduce blurring associated with the motion of a camera. Specifically, it compensates for pan and tilt of a camera
LLuxuryProfessional lenses; good optical performance and a solid construction
MP-EMacro Photo ElectronicThese lenses are designed for macro photography and do not have autofocus, the "electronic" refers to the electronic aperture control
TS-ETilt-Shift lensControl of perspective and depth of field
USMUltra Sonic MotorAuto focus motor that offers fast and silent focusing powered by the ultrasonic vibration of a component, the stator, placed against another component

Continue reading →

Android service menu

The mobile operating system Android has a hidden service menu where some information about the phone can be viewed (Phone information, Battery information, Battery History and Usage statistics). To access this menu open the dialer and dial:

*#*#INFO#*#*

In numbers:

*#*#4636#*#*

I have tested this on my HTC Desire (Android 2.1) and in an emulator (Android 2.1). The following screen is shown:

Service menu

Service menu

Continue reading →

Unit testing in Watir

Watir is an open-source Ruby library for automating web browsers. Combined with unit testing for Ruby it is a really powerful tool to test websites and webapplications. In this post I explain how to write a test for a simple website.

Watir

Watir

Continue reading →

Type conversion in C#

Type conversion (or typecasting) is the technique to change an entity from one data type into another. In general there are two types of type conversion; implicit and explicit conversion. This post tells about type conversion in C#.NET and the performance issues.

Implicit conversion

Implicit conversion (or coercion) is automatic type conversion by the compiler. In C# it does not require a special syntax because the type conversion is safe and no data will be lost. In the following example the value of an integer is stored in a long. This is safe because an integer is 4 bytes (on a 32 bit computer), and a long is 8 bytes. So every value that fits in an integer fits in a long. For a complete conversion table see this page.

int i = 12345678;
long l = i;

It is also possible to cast a derived class to a base class without using a special syntax.
Continue reading →

Using Rhino Mocks to mock a void function

In some of my web applications I use Rhino Mocks to create mock objects. Usually the code has a record section where the expected calls are recorded, and a playback section where the testing is done. In the following code snippet the DoSomething() function calls a void function which is defined in the interface of _myMock. The problem is this void function is not expected and the NUnit test run will fail:

Rhino.Mocks.Exceptions.ExpectationViolationException : IMyInterface.MyVoidFunction; Expected #0, Actual #1.
using (_mock.Record())
{
  Expect.Call(_myMock.GetValue("a")).Return("b");
  /* insert expectation for void function here */
}
 
using (_mock.Playback())
{
  // DoSomething calls the mocked object's GetValue function, which returns 'b' when the parameter is 'a'
  // DoSomething also calls a void function which is located in the interface of the mocked object, so this
  // void function must be mocked too, else the test run will fail
  Assert.AreEqual("b", _myObject.DoSomething("a"));
}

Continue reading →

How to create a chroot ssh user in Ubuntu

On my server I want to create accounts that can do SSH in a chroot environment. On the internet I searched for tools and I found Jailkit. In this post I will tell how I installed Jailkit on Ubuntu server 9.10, created a jail and how users are added to the jail. Note that most commands in this tutorial should be executed as su or sudo.

Jailkit installation

First I installed Jailkit by using the following commands:

# cd /tmp
# wget http://olivier.sessink.nl/jailkit/jailkit-2.11.tar.gz
# tar -zxvf jailkit-2.11.tar.gz
# cd jailkit-2.11
# ./configure
# make
# make install

Continue reading →

Building a home server part 2

In part 1 I described the requirements and hardware for my home server. In this post I will tell about unpacking and assemblage of the home server.

Home server componentsHome server components unpacked

Continue reading →