Archive for category Programming

Second place at Paris Android Dev Camp 2012

Our team, called the Épicuriens, had a great time at the Paris Android Dev Camp 2012. And we were even happier because we finished 2nd out of 11 teams, and ended up winning Android tablets for each team member!

The Paris event was part of the Global Android Dev Camp, which took place in in 88 different cities on the same weekend. Every continent was represented except Antartica!

Each team had less than 48 hours to create a complete Android App, and in Paris we had an extra requirement that the App be based on an Open Data Set.

Our Épicuriens team was made up of 3 Android hackers/developers

And one interaction designer

Since all the team members like wine (in France who doesn’t), we decided to use the Appelation Origine Controlée data set published by the French government. Believe it or not, out of 36 000 towns in France 22 000 belong to AOCs! We did restrict our App to only the wine AOCs, which did bring the number down a bit.

At the end of the weekend using our “AOC France” App, users could easily find wine producers in the different wine French wine producing areas. proto map navigation, location based notifications, an augmented reality view, and even a good old drill down list navigation.

Here are some screenshots from our App.

The whole event was very well organized thanks to the Paris Android User Group. They even shot a few videos of us during the weekend.

Compiling log4cpp 1.0 with gcc 4.3 or 4.4

In gcc 4.3 some bugs were fixed, unfortunately they can cause compile errors with code that would compile with older versions.

In particular this is the case with log4cpp 1.0 which fails with the following message: BasicLayout.cpp:37:5: error: ‘auto_ptr’ in namespace ‘std’ does not name a type

Luckily the fix is very simple; all that is required to get a clean compile is add an #include <memory> in src/BasicLayout.cpp.

Create a PDF file for each Excel Worksheet

Sometimes it’s nececessary to generate a separate PDF file for each worksheet within an Excel workbook. This can be a big waste of time; especially if there are many sheets and/or the you have to regenerate the PDFs every time the content changes!

If you are using Microsoft Office 2007 or later, the following VBA macro automates the process. The Fname variable can be used to customize the PDF file names that are generated.

Option Explicit

Sub createPDFfiles()
    Dim ws As Worksheet
    Dim Fname As String
    For Each ws In ActiveWorkbook.Worksheets
        On Error Resume Next 'Continue if an error results

        ' Name generated PDF files based on the worksheet Index (i.e. 1,2,3, etc.)
        Fname = "Annex 1.1." & ws.Index & "_result"

        ' Another option is to use the worksheet name. This may cause errors if the worksheet
        ' name contains characters that are not allowed in file names.
        'Fname = ws.Name

        ws.ExportAsFixedFormat _
            Type:=xlTypePDF, _
            Filename:=Fname, _
            Quality:=xlQualityStandard, _
            IncludeDocProperties:=True, _
            IgnorePrintAreas:=False
    Next ws
End Sub

Functional programming languages

In Can Your Programming Language Do This?, Joel Spolsky gives a nice simple explanation on how functional languages can make your code smaller, tighter, more reusable, and more scalable. Google has used this to their advantage in creating Map Reduce.