Hello, I’m a web craftsman with a passion for the modern web. I build web applications and play with social services and communities.
After booting a fresh EC2 instance with Ubuntu 12.10 this showed up right after login:
WARNING! Your environment specifies an invalid locale. This can affect your user experience significantly, including the ability to manage packages.
And when running some apt-get commands I got this:
perl: warning: Setting locale failed. perl: warning: Please check that your locale settings: LANGUAGE = (unset), LC_ALL = (unset), LC_CTYPE = "de_DE.UTF-8", LANG = "en_US.UTF-8" are supported and installed on your system. perl: warning: Falling back to the standard locale ("C"). locale: Cannot set LC_CTYPE to default locale: No such file or directory locale: Cannot set LC_ALL to default locale: No such file or directory
There are plenty of supposed solutions out there but none worked for me but this one:
# add this line to /etc/environment; then reboot LC_ALL="en_US.UTF-8"
Since Xcode 4.2 Apple doesn’t ship a normal GCC anymore, but instead packages LLVM. While it was possible to compile Ruby with LLVM before, the result was error prone. Not anymore! Since 1.9.3-p125 Ruby is fully compatible with LLVM and here is how you can install it without the need of any additional GCC installation.
- Install Xcode 4.3 or the new stand-alone command line tools
- Install rbenv and ruby-build
# install rbenv $ git clone git://github.com/sstephenson/rbenv.git ~/.rbenv $ echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> .bash_profile $ echo 'eval "$(rbenv init -)"' >> .bash_profile # You may be using Zsh or any other shell. # I presume you know how to adopt the previous two lines then. # install ruby-build $ mkdir -p ~/.rbenv/plugins $ git clone git://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build # reload bash (alternatively close and re-open Terminal) $ source ~/.bash_profile
- Compile Ruby 1.9.3-p125 and make default ruby
$ env CC=/usr/bin/gcc rbenv install 1.9.3-p125 $ rbenv global 1.9.3-p125 $ rbenv rehash
- Done. Check everything is ok now
$ ruby -v # => ruby 1.9.3p125 (2012-02-16 revision 34643) [x86_64-darwin11.3.0]
Sweet. Leave a note in the comments if this helped you. Happy coding!
Gestern hat die Sächsischen Zeitung einen Artikel mit der Überschrift “Der Facebook-Erfinder von Görlitz” veröffentlicht. Der Beitrag beschreibt meinen Werdegang vom Erfinder des Görlitzer Netwerkes the-reality.net vor 8 Jahren bis hin zu einem Ausblick in die Zukunft. Sehr lesenswert! Vielen Dank an Frank Seibel für das nette Interview und Wolfgang Wittchen für die hervorragenden Fotos!
Link zum vollen Artikel: Schöne neue Neiße-Welt
There is still plenty of interest in my old article “Develop memcached web apps with XAMPP under Mac OS X” so I decided to write a little follow up.
XAMPP for OS X hasn’t seen any updates in quite a while so I decided to go with MAMP after upgrading to Mac OS X Lion (10.7.2 as of now). Quite ironic since I originally changed from MAMP to XAMPP because of the lack of updates from MAMP. However, both are quite similar when it comes to installing extensions from pecl or pear so you may have some luck applying the following steps to either dev environment.
Also while I am installing the mongo driver for php here, the very same steps should work for other pecl packages such as memcache, uploadprogress or xdebug. So let’s get started!
- Install XCode (I’m on 4.2 at the moment)
- Install MAMP (2.0.5)
$ brew install mongodb
- Start the MongoDB server
Now it’s time to install the mongo php extension:
- Download the matching version of the php source code from php.net (MAMP 2.0.5 comes with PHP 5.3.6)
- Create an include-folder in your MAMP php installation
$ mkdir /Applications/MAMP/bin/php/php5.3.6/include
- Extract the php source code into that new folder. The extracted folder is called php-5.3.6.
- Rename that folder to just php, then the php source code should be located here:
- Change into that directory and configure php:
$ cd /Applications/MAMP/bin/php/php5.3.6/include/php
- MAMP comes with a weird pear config file that causes issues, let’s remove it:
$ rm /Applications/MAMP/bin/php/php5.3.6/conf/pear.conf
- Now install the mongo driver with pecl:
$ cd /Applications/MAMP/bin/php/php5.3.6/bin
$ ./pecl install mongo
- Activate the extension in your php.ini:
And that’s all. From now on you only need the last two steps to install other extensions.
In the past months I have been confronted with a few web projects requiring scalable file storage solutions. One of them is my very own service comemories, which stores user-uploaded photos. Those photos are stored in original size as well as a few generated thumbnails.
To deal with file uploads, most developers seem to use Amazon S3 these days, so did I. Surely it’s a great service that pretty much just works, but with increasing traffic on comemories I started to feel a little uncomfortable about the way Amazon charges me. Basically they let a month pass and then sum up how much storage I use, how much traffic I used and how many API calls my app did.
So far so good, but what if my app sees some tremendous success suddenly and many more people upload photos than I anticipated? S3 would scale just fine and handle all the traffic with no issues at all… And by the end of the month I would get the big surprise in form of a credit card bill.
Of course it depends a lot on what you are trying to do, but if you are anything like me and you are running a web service more or less for fun and because you are learning about technology, you should really reconsider if S3 is the right choice.
Let’s have a look at their pricing for a little example application:
Image we run a web service with 10.000 users who uploaded 100 photo each at 5MB per photo. This would sum up at about 5TB of storage needed.
- Amazon charges $0.14 per GB for the first TB leading to $140
- then the other 4TB cost $0.125 per GB summing up at +$500
- every image has to be transferred in once: +$500
- and for simplicity let’s say every images is transferred out once: +$750
A total of $1890 for the month the images are uploaded. Now let’s imagine no more photos are uploaded from this point on but every photo is accessed once per month again. This means we would keep paying $1390 month to month.
Wow! 5TB is not even that much. You could buy three 2TB HDDs for 210€ altogether to get 6TB of storage and this would only be a one time cost instead of monthly charges. But ok, just buying plain HDDs is not really comparable to the service Amazon offers. But what about rented dedicated servers?
Hetzner Online offers the EQ9 for 99€ per month and the server has 4500GB storage installed. Coming to 0.022€ per GB. So I could just get two of them and have 9TB storage for less than 200€ per month. Now Amazon offers some redundancy. So let’s just get 4 of those servers and have everything stored twice. Voilà, redundant storage for under 400€ per month.
Let’s not forget that we actually have 4 powerful machines here with Core i7 and 12GB of RAM each! Those make some pretty good app servers too. If we ran this on Amazon EC2 instead, it would cost us another fortune.
Don’t get me wrong here. I know getting a bunch of dedicated servers is no cool and fancy cloud with unlimited automatic scaling capabilities and also requires quite a bit of operations know how and work, but for web applications of small to medium size with just 1-2 people working on them this may just be the better solution. Big enterprises on the other hand could see some benefits from outsourcing all storage worries to a over-priced 3rd party. But really, who can count themselves to those?