Todays .htaccess tip – How to get rid of the www. subdomain

#www. is overrated
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www\.(.*)
RewriteRule ^(.*)  http://%1/$1 [QSA,L,R=301]

Now let’s explain how this works:

The first line is a comment, that explains what the rewrite is supposed to do.

This line just turns on the rewrite engine

RewriteEngine On

This line says if the domain is “www.anything” and note that it saves the domain without the www. part as %1

RewriteCond %{HTTP_HOST} ^www\.(.*)

now this line does the actual rewriting. from anything to the domain with the query string attached (QSA) so we won’t break links. also note that it is a permanent redirect (the R=301 part) and it’s the last rule (L) that will be executed for this request.

RewriteRule ^(.*)  http://%1/$1 [QSA,L,R=301]

Mac OSx on the go

If you have read my previous post about OSx, then you might wonder a bit when i tell you that i am still using OSx. I could have installed Linux or even Windows on the Macbook.

But there are some reasons for me to keep using OSx. First reason being that i paid for OSx.  The other reason being that i like the mobility of the Macbook. I just close the lid and it goes to sleep once opened it’s back.  Yes Windows and Linux can do the same but not nearly as good.

I am really happy with the Hardware ever since i upgraded the Ram to 8GB and installed a SSD as my main disc. I can not really complain about lag since i don’t really see any lag anymore.

What still annoys me, is that since i updated to Lion i have to reboot a lot more than before. It’s due to many things. sometimes it’s just a program that hangs itself up or sometimes it’s even the login screen that get’s stuck (haven’t that for a while though)

I am actually thinking of trying Linux on my Macbook, maybe a dualboot work. It would be interesting to see if i can get Archlinux to work just well with the suspend and hibernation as OSx does.

But a reinstall will probably not happen until i have enough of Diablo 3 (y u no out yet)

Enghave Station Pizza & Grillbar [Ordered Out]

We ordered through Pizzaplus.dk. That means that we paid online and had human interaction while ordering.

We ordered our food at 11:15 and the order got confirmed to be at our office 12:30, but as we later should discover, is that they first open at 15:00 on weekends. That was not mentioned on pizzaplus. No idea who’s fault that is but it’s a big minus for Enghave Station Pizza & Grillbar.

After having to wait 4 hours and several phone calls to Enghave Station Pizza & Grillbar, we got the food. The personal at Enghave Station Pizza & Grillbar was friendly but was not very good at danish and they talked very silently, that made it very hard to unterstand what they said.

I had the:

46. Fettuccini spinat
Med spinat, flødesauceog gorgonzola.

It’s pasta with spinach, creamsource and gorgonzola cheese.

It did not taste bad, but i could not taste the gorgonzola, but the spinach was very dominant. Because of that i would give it a Rating: ★★☆☆☆.

In Service i would give it 0 out 0f 5.

The pricing is okay i Paid 49DDK for it, but it was not as much food as i hoped so that draws down and makes the pricing expensive. i give it Rating: ★★☆☆☆

Read on to find out how the Veggie pizza was, that Sandra had.

22. Vegetariana
Tomat, ost, paprika, asparges, løg, champignon og artiskok.

Deep pan. Slightly to much of most of the ingredients which took the overhand on the less than desired amount of champignon but this was still the best pizza I ever had in Copenhagen. I give it Rating: ★★★★☆

However if I wouldnt have had something to do during the extremely long waiting time I would have been so irritated it would have ruined the entire meal. I felt tricked and unsure that we would even get food at all, an excellent way to ruin a customers mood and apetite.

The pizza was very good, but not worth that wait.

Overall rating Overall Rating: ★★½☆☆

Mac OSx – What fanboys ignore [update]

If you trust those Apple Fanboys, then OSx must be THE ultimate OS.

It is true that Mac OSx has the best Window Manager and some smart details that makes it easy to use.

But you loose your freedom of choice, OSx comes with a Window Manager that you have to use, you can’t change the layout like you would on any X11 WM. So you can’t make your desktop personal besides changing the Wallpaper.

The default layout is fine for me so that does not bother me. Something i was very surprised to hear is the FS support. You will ofc have HFS/HFS+ support and also Fat and Fat32 but thats it. Yes you can read NTFS, but you can’t write to it. EXT, ZFS or  RaiserFS are not supported at all. Unless you would like to run your FS Driver in userspace(fuse).

Now what i like with OS x is that you get a unix shell, the default one sucks (bash) but i installed the z shell that runs smoothly <3.

On Linux I loved the package managers, just run one command and you have the software. Mac is Freebsd based so they have “copied” the port system. Let me explain how the port system works.

The Freebsd port system works with makefiles, so say “make config” and then you can choose the compile options like support for bluetooth, in that way you get nice and small binaries. In most Linux distributions you would have a package manager that just installs binary packages. That is fast and fits most people. So why would you compile from source? To be able to choose, and customize the software to your needs.

Now with Mac ports you compile the source, but you can’t config pre compilation. (if you can somehow please leave a comment) So why would i ever want to compile if i just get the default config?

The management ability from mac ports is limited to the Software installed with MacPorts. So if i want to update all my Software i would need to open the Software and let the Software search for updates. I miss my package manager.

One more thing, I like to lock my Desktop, so people can’t go on my Facebook and write shit or change my Wallpaper to some sort of nasty porn picture. On Windows it’s easy (Windows key +L) on Linux (ctrl + alt + L) on Mac you need to go to the keychain preferences and tell to show a tray icon, then you need to go there and click on “Lock screen”. WTF!? give me a hotkey for that.

Oh Yeah, you can make one of your own (someone give me the path to the screensaver). Right now i have one for fast User switch but that is not fast as i would like it to be.

Now before you Fanboys get angry and start a flamewar. I like OSx, else i would not have spend money on it, but those things do really bother me i would wish them to be fixed.

[Update]

As I was informed, OSx has a build in shortcut for that ctrl+shift+eject.

Follow these instructions if you would like a hotkey for locking your Desktop:

http://artofgeek.com/2009/09/08/lock-your-macs-screen-like-in-windows-snow-leopard-edition/

but instead of the path shown use:

/System/Library/Frameworks/ScreenSaver.framework/Resources/
ScreenSaverEngine.app/Contents/MacOS/ScreenSaverEngine

Don’t forget to go to

System Preferences –> Security –> Generell

and tell em to ask for the password immediately.

Eine Kleinigkeit für Lisa

#!/usr/bin/env python
#für dat Lisa

def stuff(quest):
    from random import randint
    num = randint(0,len(quest))
    return quest[num]

def main():
    quest=["huuunger!",
           "Will spielen",
           "du bist doof"
           ]
    print("Ich bin das baby du musst mich lieb haben!")
    while 1:
        input = raw_input(stuff(quest))
        if input == "stirb":
            print("du mörder!")
            raw_input()
            break
if __name__ == '__main__':
    main()

A little something for my GF


#!/usr/bin/env python
'''
This is made for my wonderfull girlfriend.
'''
try:
    import psyco
    psyco.full()
    import random
except:
    import random

def getBooks(file):
    import os
    f = open(os.path.join(os.path.curdir,file),'r')
    books = []
    for line in f.readlines():
        books.append(line)
    return books

def shuffel(books):
    num = random.randint(0,len(books)-1)
    result = books[num] + ", Number of books in list %s" %len(books)
    return result

def main():
    print(shuffel(getBooks('books.txt')))
    raw_input()

if __name__ == '__main__':
    main()

Hello World

if user == nice:
    print "hello World"
else:
    print ":=("