Archive for the ‘Tips & Tricks’ Category

Spam: Fighting Back!

Posted: August 3, 2011 in Tips & Tricks
Tags: , , , , , , ,

Before you read on, this how-to post is specific to the Mac OS X mail client (Mail), but should be just as easy to set up in other mail clients that support custom mail filtering.

You probably hate spam mails just as much as I do, so share with you what you can do to fight back and hopefully make the spammer blacklist your e-mail from their “service”. Keep in mind, while reading this, the process of retrieving information about the owner is not necessary if you already know the individual or company’s e-mail address — which is ultimately what we’re looking for. Spam services often mask their identity, or make it hard to find any contact details about them (and you can’t reply to spam-mail), which is why we need to go find them ourselves. For the sake of demonstration I’ll be trying to find my e-mail knowing only a domain.

Firstly, identify the owner of the domain from which the spam is coming from. This can be done via whois services, for example For example, if you were to look up my domain at you’d be presented with these informations about the owner  (in this case me);

# Hello Your session has been logged.
# Copyright (c) 2002 - 2011 by DK Hostmaster A/S
# The data in the DK Whois database is provided by DK Hostmaster A/S
# for information purposes only, and to assist persons in obtaining
# information about or related to a domain name registration record.
# We do not guarantee its accuracy. We will reserve the right to remove
# access for entities abusing the data, without notice.
# Any use of this material to target advertising or similar activities
# are explicitly forbidden and will be prosecuted. DK Hostmaster A/S
# requests to be notified of any such activities or suspicions thereof.

Registered:           2009-05-01
Expires:              2012-05-31
Registration period:  1 year
VID:                  no
Status:               Active


# Use option --show-handles to get handle information.
# Whois HELP for more help.

From this information, you can see that my site is hosted by a company called ‘DK Hostmaster’, so now we’ll go to the hosting company’s site and see if we can get some contact information on their client (me) — now this site is in Danish by default, but there is an English version available if you want to follow along with me in the process of retrieving the necessary information.

On the main page, we can search for available .dk domains in the box with the title ‘Find .dk domænenavn’ (or in English ‘Find .dk domain name’) — so we’ll search for ‘’, and voila!

The return result has several informations about the owner (me) and how to contact me. From here on out, you can decide how you want to combat the problem; you could try calling them by phone and talk them into blacklisting your e-mail from their service, you could do the same by visiting the address, or as I do, find an e-mail associated with that individual/company responsible and let them taste their own medicine.

So, armed with a name/company, telephone number and address, finding an e-mail address should be easy, especially since most spam-services would be associated with a company. There are several ways of doing this; try searching for the company name, and an e-mail address should be easy to find on their website, or searching for a company associated with the telephone number or address should be just as easy.

Well then, now that we have an e-mail address, let’s perform our counter-attack!

  1. Open up Mail and under the ‘Junk Mail’ pane in the preferences window and make sure that ‘Filter junk mail before applying my rules’ is unchecked.
  2. Afterward, go to the ‘Rules’ pane in the preferences window.
  3. Click the ‘Add Rule’ button and set up the rule as shown below, where ‘’ corresponds to the domain from which you are receiving spam, and the ‘’ corresponds to the contact e-mail address you found at the company’s site.
  4. Click the ‘Message…’ button to add a message to the spammer if you want, maybe something along the lines of ‘I believe this belongs to you.’
  5. Click ‘OK’ and you’re good to go!
From now on, mail sent to you from the spam domain will bounce (get forwarded) to the company’s contact e-mail address — which will probably annoy them quite a bit. Oh, and any mails received from that domain will never appear in your inbox ever again, as it is automatically trashed.
I hope you enjoyed this article and make good use of it — let’s show these bastards that we’re not that easily fucked with, have fun!

So, there’s this service we have in Denmark called NemID (English translated: EasyID), and for some reason, probably of lack of knowledge about how the Mac platform’s log files are organized, they’ve decided to put a log file in our user directory – URH! wrong place.

This has been bothering me quite a bit, and for quite a while now. Since I don’t think they’re going to fix the issue anytime soon, I thought why not apply a temporary fix and share how to do this with all of you who might have, if not the same, maybe similar problem.

Be gone, danid.log!
Getting rid of unwanted log-files is actually quite easy on the Mac, all we need to do is to set up a folder action from within Automator that will move a file to the trash should it be the nagging log file we want to get rid of.

1. Fire up Automator and choose the Folder Action from the template listings.

2. Choose the folder in which the unwanted file appears.

3. Search for the ‘Filter Finder Items’ action and add it – fill out the options as necessary to zero in on the unwanted file, in my case the file is called ‘danid.log’.

4. Search for the ‘Move Finder Items to Trash’ action and it below the previous action.

5. You’re done, save the folder action.


Be sure to make a test file, a dummy-replica of the unwanted file, and try to put it into the folder.

A full trash can and the file going missing once you drop the test file into the folder indicates a correctly programmed folder action.

By sheer accident, I discovered the Mac App Store supports searching based on the file format you are looking to work with — Mac OS X will even ask you if you want to search the store for an application capable of reading a file, should it not have one installed already.

Search terms
I’m not quite sure whether or not there are more ways of search the content on the Mac App Store, if there is I will update the following list accordingly – please do comment below if you are aware of more ways to search.

  • extension:argument — searches for any application that is able to read/write files of type specified in the argument (ie. ‘extension:nib’)

Well, it’s about time I did a post on music production, I have been wanting to do this for quite a while. In this quick tip, I will show you how to wire up a crisp stereo effect, which works great as both send and insert. I recommend having this effect hooked up to the 4th auxiliary channel (for pre-fader) of your main mixer, as you will probably find, it is a necessity once you hear the effect it has on your sounds — if you aren’t familiar with the terms send and insert, here is a great article about just that.

Any sound can benefit from this effect, be it a synth, a sample or another effect even, so make your pick and load it into Reason. I’m going to go with a SubTractor synth, just to show how this DSP technique can be used to a convert mono signal into stereo.

First off, cut all cables to your sound of choice. To prevent auto-routing, hold down the SHIFT key as you add a Spider Audio Merger & Splitter and a DDL-1 Digital Delay Line. Now, instead of meticulously going through each cable connection, I thought it best to just show it and explain how it works.

Example 1
From our output of our chosen device, we split the audio signal with the Spider Audio Merger & Splitter. We then take the first left split channel, and simply put it back into the left merging input of the Spider Audio Merger & Splitter. The next left split channel we put into the left input of the DDL-1 Digital Delay Line and route the right output of that back into the right merging input of the Spider Audio Merger & Splitter. That takes care of the routing.

Skip ahead to Setting Up The DDL-1 Digital Delay Line.

Setting Up The DDL-1 Digital Delay Line
With the routing done, all we need to do now, is to tweak a few knobs on the DDL-1 Digital Delay Line and we’re home free. Take a look at the example below, the settings shown apply to both insert and send.

Example 2
For this technique, most of these settings remain the same every time you use it. However, the delay controls how much spread the effect will have — I find the range 8 − 48 to be great, the shorter the sound though, the shorter you’ll want the delay to be, but this of course depends on the what effect you are trying to accomplish.

Notice that the delay is in milliseconds, not steps.

Hopefully you found this useful, thanks for stopping by.

Count in Binary

Posted: September 10, 2010 in Tips & Tricks
Tags: ,

I felt like doing a quick post on something this evening, and so tonight I’ll be teaching you how to count in binary. Regardless of whether or not you are a programmer, being able to count in binary is quite fun.

What is Binary?
Binary refers to a system consisting of two components, and in the realm of computing we recognize these two as ones and zeroes.

1 .. 2 .. 4 ?
Counting in binary is quite simple. Consider a block of zeroes, say 8 (eg. 00000000), each of these numbers are called bits, and 8 bits make up one byte.

0	00000000
1	00000001
2	00000010
4	00000100

Notice the pattern here, that each time you move the 1 one over toward the left, you increase the value by a factor of 2 (multiplication by 2). So, 8 would be 00001000.

Where did 3, 5, 6 and 7 go ?

0	00000000
1	00000001
2	00000010
3	00000011
4	00000100
5	00000101
6	00000110
7	00000111
8	00001000

Notice that on each pass of multiplication by 2 (1, 2, 4, 8, 16), we fill the gap of zeroes behind it in a pattern similar to how we did the multiplication. The only difference is that we are counting on top of it. If you look away from the bit that make up the number 8 (fifth bit from the left), you are just counting 1, 2, 3, etc. all over again — this is illustrated below.

8	00001000
9	00001001
10	00001010
11	00001011
12	00001100
13	00001101
14	00001110
15	00001111
16	00010000

There is also a visual pattern going on here, if you look at each column of the numbers 0 through 8, look at the rightmost column, and you will see the alternating pattern of even and odd numbers (0 is even, while 1 is an odd number). The same pattern emerges when you look at the next column, which alternates in a pattern of 2/2 (2 zeroes, 2 ones, etc.). As you may have guessed, these patterns are found all throughout the columns, as the next column will then be 4/4 — this makes a nice rule of thumb to remember binary counting by, you can also immediately tell whether or not it is an odd or even number, just by looking at the rightmost column.

If this still doesn’t make a whole lot of sense, try adding two binary numbers together, as shown below (overly simplified, for illustrating the correlation).

8 + 2 = 10	00001000 + 00000010 = 00001010
16 + 5 = 21	00010000 + 00000101 = 00010101

Hopefully this was understandable. It is quite easy to count in binary, once you know the pattern. With 8 bits (one byte), you can count from 0 to 255, of course you can always extend the range to 16, 32 or even more bits if you wish. Knock yourselves out, have fun.

I bet you have been wanting to put your own custom ringtones on your iPhone, free of charge, for quite a while — I have a solution for you.

Ever since I got my first iPhone, I have found the lack of easy custom ringtones to be quite a pain. Apple will tell you to use iTunes if you wish to rip a piece of a song and use that as your ringtone, however they will charge a small fee for that and only a select few of the iTunes store songs are eligible for ringtone creation — in other words, their solution is not very handy, at all.

The Solution
It is actually quite simple and I don’t really know why I only just found out about this, but it seems GarageBand does the trick for us and you are not constricted to use song rips with this approach.

Open up GarageBand and create a new project, set the loop bar to 40 seconds or lower (this is the time limit of ringtones on the iPhone). Over the span of your loop, start creating your very own ringtone, and when you are happy with your marvelous creation go to the menu ‘Share’ and click on ‘Send Ringtone to iTunes’. Sync your iPhone and voila!

I’ve never really used the Interface Builder all that much when developing, and frankly I don’t like the “magic” it does for me. I prefer being able to visualize what my application does in the code by avoiding the NIB altogether — and I’m going to show you how I go about doing this.

Why ?
Well, there are projects where it just doesn’t make sense to use Interface Builder, rendering the NIB obsolete to the project itself. This is true for projects that have little or no GUI based on the AppKit, like fullscreen games. Games in particular usually incorporate their own GUI, which is managed by the engine.

How ?
As far as I know, there is no Apple-sanctioned method of approach of doing nibless development under cocoa, and the method I will show you is probably not the only way — or the best, for that matter.

The standard main.m looks something like this:

#import <Cocoa/Cocoa.h>

int main(int argc, char *argv[]) {

    return NSApplicationMain(argc,  (const char **) argv);

The return NSApplicationMain(argc, (const char **) argv) instantiates your application by creating the singleton object NSApplication, loading the MainMenu.xib (the nib) and calling the run method on your NSApp. In order to avoid the nib, we need to circumvent this by initiating the application ourselves.

The first thing we do, is to get rid of the NSApplicationMain function call. In it’s place we simply return zero, as cocoa will call exit() before reaching the return instruction of the main function, so this never gets executed anyway. Now that our main function looks like a generic C program, we can begin recreating what the NSApplicationMain did for us.

We will need to wrap everything in an autorelease pool, and make sure we have an instantiated application — we do this as such:

#import <Cocoa/Cocoa.h>

int main(int argc, char *argv[])
    // create an autorelease pool
    NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
    // make sure the application singleton has been instantiated
    NSApplication * application = [NSApplication sharedApplication];
    // drain the autorelease pool
    [pool drain];
    // execution never gets here ..
    return 0;

Now that we have made sure we have an application to run, we can go on and create an application delegate — if not already present in your project.

Create a new Objective-C NSObject subclass, name it AppDelegate. In the @interface section found in the header of your new NSObject subclass, add the NSApplicationDelegate protocol to it as such: @interface AppDelegate : NSObject <NSApplicationDelegate>

Import the AppDelegate’s header to your main.m as such: #import "AppDelegate.h"

Now that your AppDelegate implements the NSApplicationDelegate protocol and your main.m knows about it, we can create an instantiation of the application delegate and assign it to the NSApplication, and then all we really need to do is to call the run method:

#import <Cocoa/Cocoa.h>

#import "AppDelegate.h"

int main(int argc, char *argv[])
    // create an autorelease pool
    NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
    // make sure the application singleton has been instantiated
    NSApplication * application = [NSApplication sharedApplication];
    // instantiate our application delegate
    AppDelegate * applicationDelegate = [[[AppDelegate alloc] init] autorelease];
    // assign our delegate to the NSApplication
    [application setDelegate:applicationDelegate];
    // call the run method of our application
    [application run];
    // drain the autorelease pool
    [pool drain];
    // execution never gets here ..
    return 0;

This takes care of the main function. Now all we need to do, is implement how our application delegate handles our application. You can handle this however you want, I’m just going to show you how to create a window with a content view. Keep in mind, that for the sake for keeping the demonstration short and to the point, I do not use custom classes for these, in real projects I would definitely write a class for the content view.

Inside of the class declaration of the AppDelegate, we put an NSWindow and a NSView as such:

@interface AppDelegate : NSObject  {

    NSWindow * window;
    NSView * view;

Because the AppDelegate implements the NSApplicationDelegate protocol, there are quite a few methods that it will now respond to and that will get called during run-time. So in the definition of our application delegate, we add the following methods and implementations as such:

@implemention AppDelegate

- (id)init {
    if ( self = [super init] ) {
        // create a reference rect
        NSRect contentSize = NSMakeRect(0.0f, 0.0f, 480.0f, 320.0f);
        // allocate window
        window = [[NSWindow alloc] initWithContentRect:contentSize styleMask:NSTitledWindowMask backing:NSBackingStoreBuffered defer:YES];
        // allocate view
        view = [[NSView alloc] initWithFrame:contentSize];
    return self;

- (void)applicationWillFinishLaunching:(NSNotification *)notification {
    // attach the view to the window
    [window setContentView:view];

- (void)applicationDidFinishLaunching:(NSNotification *)notification {
    // make the window visible.
    [window makeKeyAndOrderFront:self];

- (void)dealloc {
    // don’t forget to release allocated objects!
    [view release];
    [window release];
    [super dealloc];


.. and that concludes my approach of doing nibless development. Notice that I did not implement the main menu, so when you run this the main menu will not work. But there is a solution for that as well, I might write an article about that some time — please do let me know if this is something you would like to see.

Phew, that got a little lengthier than I originally expected it to.

Hopefully you found this useful. If you have any questions or thoughts on this, please leave a comment — Thank you.

Download Xcode Project
I’ve made an xcode project available for download at, just click the link above to get it. It has been build, tested and it works.

UPDATE Fixed a typo; in AppDelegate.m it said ‘@implemention’, while it should have been ‘@implementation’. Thank you albert7546, for pointing out the source wouldn’t compile.