Catch-almost-all in Exim: only address with specific pattern

Catch all

Catch all

On one of the domains I have, I installed the option to have a catch-all email address. One of the big advantages of using the catch-all address is that I can have a separate email address for each store that asks me for my email address without explicitly having to create these addresses.

However, there is also a downside to having a catch-all address, namely that spammers can send an email to any address at the server, and the server will accept it. Of course I can use some procmail filters to remove all of these , but I would actually like to stop the receiving of these messages already at the server.

A couple of days ago, I moved the email handling of this domain to my own server which runs Exim as the MTA. I modified the configuration of Exim such that it will accept any email address that has a specific pattern. This way I created an catch-almost-all server: I don’t have to create specific email address for each store as long as I use a standardized pattern and anything else is stopped by Exim before receiving it already.

Continue reading

Converting tabs to spaces in ViM with retab

Because I wanted to do some things with the Twitter API, lately I started using Python a bit more again. One cause for major headaches when working with Python is the issue of source files mixing tabs and spaces.

Personally, I always like to set up a tabstop and shiftwidth of 4 in my ViM session and expand all tabs to spaces. I achieve this by using these settings in my .vimrc:

set tabstop=4
set shiftwidth=4
set expandtab

Before, when I opened a file that had mixed tabs and spaces, I always used a find-and-replace approach to change all tabs into spaces. However, yesterday I found out that a much easier approach exists in ViM (as usually… ;) ), namely by using the :retab command. After opening a file that has mixed tabs and spaces, using the :retab command will actually reformat the current buffer based on the setting of expandtab.

Always happy when I find these little gems that make my life easier :)

Linux-like window movement under Windows

On my own computers at home, I have been running Linux since about 1999. One of the things that I really liked directly from the beginning of using Linux was that under X, I could move any window by holding the ALT button on the keyboard and then click anywhere in the window and drag it to the position I wanted.

This unlike Windows, where I have to always drag a window by clicking somewhere in the title bar. When I started working at Paragon Decision Technology (makers of AIMMS), I had to start working with a Windows laptop as our software is windows only for a big part (at least developing projects requires a windows version of AIMMS).

I did some searching and did find a couple of programs/plugins that were able to achieve the move-window-by-dragging-anywhere in-the-window, but none of them were exactly what I needed. After some time, I ran into the program AutoHotkey.

AutoHotkeyThis is an extremely powerful piece of software that allows you to do all kinds of cool things.

Currently I use it basically for two things:

  • Startup/Activate programs. E.g. if I press the keyboard shortcut Win-o, the Outlook window will be activated if Outlook was running, or Outlook is started otherwise. This can be achieved with the following piece of AutoHotkey script:
    SetTitleMatchMode 2
    IfWinExist - Microsoft Outlook
    	Run outlook
    SetTitleMatchMode 1
  • The earlier mentioned move-window-by-dragging-anywhere in-the-window feature. This can be achieved with the following AutoHotkey script:
    ; Note: From now on whenever you run AutoHotkey directly, this script
    ; will be loaded.  So feel free to customize it to suit your needs.
    ; Please read the QUICK-START TUTORIAL near the top of the help file.
    ; It explains how to perform common automation tasks such as sending
    ; keystrokes and mouse clicks.  It also explains more about hotkeys.
    CoordMode, Mouse  ; Switch to screen/absolute coordinates.
    MouseGetPos, EWD_MouseStartX, EWD_MouseStartY, EWD_MouseWin
    WinGetPos, EWD_OriginalPosX, EWD_OriginalPosY,,, ahk_id %EWD_MouseWin%
    WinGet, EWD_WinState, MinMax, ahk_id %EWD_MouseWin% 
    if EWD_WinState = 0  ; Only if the window isn't maximized 
        SetTimer, EWD_WatchMouse, 10 ; Track the mouse as the user drags it.
    GetKeyState, EWD_LButtonState, LButton, P
    if EWD_LButtonState = U  ; Button has been released, so drag is complete.
        SetTimer, EWD_WatchMouse, off
    GetKeyState, EWD_EscapeState, Escape, P
    if EWD_EscapeState = D  ; Escape has been pressed, so drag is cancelled.
        SetTimer, EWD_WatchMouse, off
        WinMove, ahk_id %EWD_MouseWin%,, %EWD_OriginalPosX%, %EWD_OriginalPosY%
    ; Otherwise, reposition the window to match the change in mouse coordinates
    ; caused by the user having dragged the mouse:
    CoordMode, Mouse
    MouseGetPos, EWD_MouseX, EWD_MouseY
    WinGetPos, EWD_WinX, EWD_WinY,,, ahk_id %EWD_MouseWin%
    SetWinDelay, -1   ; Makes the below move faster/smoother.
    WinMove, ahk_id %EWD_MouseWin%,, EWD_WinX + EWD_MouseX - EWD_MouseStartX, EWD_WinY + EWD_MouseY - EWD_MouseStartY
    EWD_MouseStartX := EWD_MouseX  ; Update for the next timer-call to this subroutine.
    EWD_MouseStartY := EWD_MouseY

The best part about the window movement part is that it even works on windows that are partially behind modal dialogs. Normally, when an application is showing a modal dialog, you cannot move the underlying window because you must first close the modal dialog. With the above script, this restriction does not apply anymore.

These two examples are just scratching the possibilities of AutoHotkey, but they have made my life a lot easier!

If you have any great AutoHotkey scripts that made your life easier, please share them via a comment!

Useful .screenrc settings for GNU Screen

When installing linux on any computer (server or workstation) the first program I always install is GNU Screen! The one thing I always had a problem with when using screen was that I did not know which exact window I had open within a screen session. What I was looking for was a way to have some sort of a task-manager in screen.

Luckily, I found some settings for the .screenrc file to achieve just this! If you add the following lines to your ~/.screenrc file:

#kill startup message
startup_message off

#It displays a status line at the bottom of the terminal which shows what window you're in and a list of the other windows.
termcapinfo xterm "ks=E[?1lE:kuE[A:kd=E[B:kl=E[D:kr=E[C:kh=E[5~:kH=E [F"
hardstatus alwayslastline "%{-b gk}%-w%{+b kg}%50>%n %t%{-b gk}%+w%<"

The first line is easy because I am not interested in seeing the startup messages of screen every time I open it :) The last part will create the actual task manager in the bottom line of your terminal, as shown below:

Task manager in screen

Task manager in screen

The name of the screen in the bottom line can be changed by just renaming the window with the gnu-screen command Ctrl-a Shift-A.

This task manager line helps me to easily work with multiple windows each logged in with a different user, viewing a different file, or in a different directory.

Getting rid of skip_nax_wizard=true for your facebook page

As mentioned in my previous post, for the company I work for I have created a facebook page. Initially, I would always get to see the “Getting Started” page of facebook whenever I was using my personal account to view the AIMMS facebook page. After I got enough of likes, this getting started tab page was automatically removed.

However, if I used my personal account to view the facebook page, I still would not be able to see any of the custom tab pages I created: almost every tab page I would click on resulted in a redirect to the getting started page of facebook, which redirected automatically again to, which defaulted to showing the wall of the AIMMS facebook page. This was especially annoying for the insights, as I was not able to view the insights. The only workaround for this was to click on the link “Use facebook as AIMMS”, after which I was able to see the insights. I just did not like the additional steps required for it :)

After I created the page, I made one of my colleages an administrator also. The other day I checked with him and when he was using his account, he was able to get to the insights tab page and all the other tab pages, while being logged in with his personal account.

On the internet, the only thing I could find about the skip_nax_wizard=true, is that it would automatically disappear. After I saw that for my colleague there was no problem, I figured there must have gone something wrong with my account.

I filed a bug-report with facebook and right away got the message that they will read all the bugs, but might not respond to them. However, after a couple of days, I went back to the company facebook page with my personal account and all of a sudden I got two additional questions again, one of which was to provide a picture for the facebook page (which I already had set up). It appeared somehow a small reset was done somewhere.

The best news was that from this moment on, I am now able to view the insights of the company page without having to first use facebook as AIMMS again!

If you do have a similar problem, you might want to try to just send an error report to facebook.

Working on new things like facebook applications

The majority of the blog has always been about the SynCE-KPM project I was working on. While I had a windows mobile phone, this project was very useful for me. For the last 1.5 years, I have been very happy with my android device, which means that I am not working on the SynCE-KPM project anymore…

Over the last couple of months, I have been very active for my work to see how I can get the AIMMS users more involved and active. One of the things I did start quite some time ago already was the AIMMS google group. Over the years, this group has become a bit more active.

Besides the google group, I also started a new AIMMS blog in November last year. As you can see there, I have been quite a bit more active on that blog compared to my own person blog here :) I think the AIMMS blog is a nice opportunity of disclosing information to as many people as possible with as little effort as possible.

After I had started the AIMMS blog, one of the other things I started to take a look at was the social media sites, like facebook and Twitter. After just setting up the AIMMS facebook page, I decided that I wanted to create a custom landing page. Initially, I created this with just a simple FBML page. However, after some time I started to create my first AIMMS tab page application as a welcome tab.

The current project I am working on is to create a new facebook application that will allow any user in Facebook to request a free AIMMS trial directly from within facebook.

So instead of blogging about SynCE-KPM, I might start blogging a bit more about my experiences with creating new facebook applications :)

Results from 4th Circuitrun at the Zandvoort race track

When I was a student, I was relatively active with sports: I played field hockey and tried to play squash once or twice a week. However, the last couple of years I was not very active anymore and started to notice that I got in bad shape. So I decided to go and run, which I started somewhere in the mid of January. The main goal I set was to run 10KM under 60 minutes.

Last sunday, there was the 4th international circuit run on the race tracks of Zandvoort. Because I did not have enough of time to enroll for the 12KM just yet, I did the 5KM run. Given the fact that I want to do the 10KM under 60 minutes, I must do the 5KM at least within 30 minutes :) However, my goal for the 5KM was set a bit higher: I wanted to end between 25 and 27 minutes.

The end result was even better than my goal, because my final time was 24 minutes and 42 seconds :) Only thing left to do now is to start improving this time on the 5KM and start running longer distances to get to the 10KM (and next year run the 12KM version of the Circuit run :) )

Action foto at the finish:

Action foto finish circuit run 2011

Action foto finish circuit run 2011

One of the nice things of the new smartphones these days is that they contain a GPS receiver also :) However, I did find that it was quite a hassle to take my phone with all of the time, so recently I decided to get a new gadget, namely the Garmin Forerunner 305. This is a lot easier to carry with :)

The advantage of these GPS loggers is that they can provide a nice overview of the race :)

Finally: official google reader app for android

I really liked the regular google reader to keep up with all websites. However, I never found a good application for my phone (both in my windows mobile time, and now with my android phone). I was really happy to read that there now is a google reader application in the android market.

Below the QR code for direct link to the android market. Just scan it with your device.

QR Code for android reader

QR Code for android reader

Mark all messages as read in HTC Mail app

As you might have read in my previous post, after years of suffering with Windows Mobile, I finally have made the switch to Android by buying a Desire HD.

I was extremely happy with the fact that with the new version of sense that is on the Desire HD, you can add multiple exchange email accounts. However, one of the things that I could not find is to mark all messages in an email box as read. The only possible workaround I could find was to manually select each of the messages, after which I would press “Mark read”. If you have a lot of messages in the mailbox, this is a lot of work :)

I thought that it should be possible to mark all messages at once, but I could not find anything about it on google. After some playing around with it, I finally got it :)

To mark all messages as read, you have to follow these steps:

  • Open the HTC Mail app
  • Select any of the messages

    Marking all messages as read in HTC Mail app - Step 01

    Marking all messages as read in HTC Mail app - Step 01

  • Press “Menu” button. Notice that this time it is different than pressing the button when nothing is selected

    Marking all messages as read in HTC Mail app - Step 02

    Marking all messages as read in HTC Mail app - Step 02

  • Press “Select All”
  • Press “Mark as unread”
  • Repeat the steps to select all messages
  • Now press “Mark as read”

and there you have it, all messages in your mailbox are now marked as read :)

Please note that you only need to do the steps for marking all messages as unread in case some of the messages in your mailbox are read and some are unread. In this situation, you only have the option to mark everything first as unread, after which you can select everything again and mark the messages as read.

Went from Windows Mobile to Android

A couple of weeks ago, I had the possibility of extending my current phone contract again.

The last couple of years I have had a variety of Windows Mobile devices. They were always working for me, but not exactly 100% as I would have liked. With regards to the communication with Linux, I have tried with the SynCE group to work on this.

One thing I never did was writing programs for the device itself, only for communicating with the device under Linux. I did not think that writing programs for windows mobile under linux was very easy, so I never went further with this.

Also, lately I have been getting fed up with the fact that for new websites/services there are excellent clients for iPhone / Blackberry / Android, but almost never for windows mobile. A good example of this is Facebook, which has a very crappy Windows Mobile client.

After seeing which devices were available, I decided to extend my contract and get the new Desire HD. It took me a bit of time to get used to the new kind of interface, but I have to say that I really like Android (with Sense). I am really happy that my current phone does not have Windows mobile anymore :) The major advantage for me is that finally I have the possibility to add two exchange server accounts to the device at the same time, both with Push syncing: I can have my phone connected to the exchange server at work and at the same time to my Zarafa server at home :)

Also, having android allows me to easily develop applications for the device under Linux. The only thing left for me now is to find a good idea for which no app has been written yet :)

Having this new phone will mean I will probably not actively develop new functionality for SynCE-KPM anymore. However, if bugs are found, I will try to see if I can solve them