Wednesday, November 27, 2013

MS Access in LinqPad

Once in a while a legacy MS Access database passes my way. And for some reason these databases have made themselves indispensable and can not be ignored. Most of the time they provide in some core business data and I am being asked to extend reports or even extend the datamodel and application.

Being very used to c# and linq/lambda and a huge fan of Joseph Albahari's LinqPad I missed a connection between the legacy MS Access databases and the beautiful new query language Microsoft introduced back in 2007.

Luckily LinqPad provides a way to create custom drivers. So I made one for MS Access, so it is now possible to use Linq on the MS Access database (*.mdb, *.accdb). See the screenshots below:



I was inspired by the IQ Driver of Joseph, which used the IQ Toolkit. Based on the Access implementation of the IQ Toolkit I was able to write MS Access driver for LinqPad.

The driver can be downloaded here: MSAccessDataContextDriver.lpx

UPDATE (5 Nov 2014): The driver now supports password protected MS Access files.

Tuesday, July 02, 2013

c# mongoDB driver MongoCredentials replacement

As of version 1.8 of the official mongoDB c# driver the MongoCredentials-class is gone ...

Here's how to rewrite your code

var client = new MongoClient("mongodb://192.168.1.2");
var server = client.GetServer();
var db = server.GetDatabase("myDatabase", 
       new MongoCredentials("myUser", "myPassword"));
Becomes:
var cls = new MongoClientSettings()
{
    Credentials = new MongoCredential[] { MongoCredential.CreateMongoCRCredential("myDatabase", "myUser", "myPassword") },
    Server = new MongoServerAddress("192.168.1.2")
};

var client = new MongoClient(cls);
var server = client.GetServer();
db = server.GetDatabase("myDatabase");

Friday, May 03, 2013

iOS web app splash screen sizes

Always hard to find those splash-screen sizes for web apps on an iOS device;


  • iPhone 3G/3GS : 320x460
  • iPhone 4/4S : 640x920
  • iPhone 5 : 640x1069
  • iPad 1/2/mini portait : 768x1004
  • iPad 1/2/mini landscape : 1024x748
  • iPad retina portait : 1536x2008
  • iPad retina landscape : 2048x1496


They differ from the native app splash-screen sizes because of the top-bar.

For native apps splash-screen size, please refer the Apple documentation