veni vidi Scripsi

How I Recovered from a Corrupt Git Repository

How my Git repository got corrupt in the first place

Ok, so how my Git repository got corrupt was (sort of) entirely my own fault. And why it was a problem was definitely entirely my own fault.

I had two stashes in my repository and decided for no apparent reason to pop the second stash straight after popping the first stash. Git told me there were conflicts in the second pop. I decided that I shouldn't really have popped them straight after each other (lesson #1 here) and decided to restore a Time Machine backup to get to the state where both stashes were still stashed. And that's continue.

Upgrading the Mac from Snow Leopard / Lion to Mavericks

In October 2013 I upgraded both my work Mac running Lion and my home Mac running Snow Leopard to Mavericks. Here's a report of the problems I ran into.

Installing & Running Plone 4.3 on Mac OS X Mavericks

So, I'm finally getting to know Plone. We will be using it for the company website and I should be getting a short training in working and developing with Plone so I can take on the main­te­nance of the website after delivery.

I had some extra time to delve into Plone before the training and I have to say: Plone definitely has a steep learning curve. It toke me forever just to get it up and running (not being familiar with zc.buildout doesn't help). Just now I had to help my colleague getting everything up and running and he ran into continue.

Recipe: Spinach, Tomato, Goat's Cheese, Potato & Egg Wraps

The other day we had some spinach left after using half of the 300g bag in a risotto and I wondered what to make with it. I wanted to finish it since we were going to be away for a couple of days and I didn't want to just bin it. Normally I use it in a curry, but we'd be going out for diner to an Indian restaurant, so that wasn't an option.

I remembered the wraps we made a while ago and thought we could make some wraps with the spinach. I cooked up my own recipe with the continue.

Mac OS X Apache Mass VHosts (with support for htaccess and symlinks)

A while ago I wrote two posts, one on using Twig and another on using htaccess with Mac's Apache. I was reasonably happy with the described setups until I discovered that when I used something like <link rel="stylesheet" href="/style.css" media="all"> in my HTML it wouldn't work because my site was running at the default http://localhost/~heleen/website/index.html and so it would map the 'root' slash to http://localhost/ rather than http://localhost/~heleen/website/. I found a solution to this using vhosts, which works really well. But then I had to add another website, and another, and realised that surely there should be an easier way continue.

Getting htaccess to work on a Mac (Lion) with Apache and using symlinks

Edit (sudo) /etc/apache2/users/[your-username].conf:

  1. Add Doc­u­men­t­Root "/Users/[your-username]/Sites/" at the top of the file;
  2. Add Fol­lowSym­Links to the Options;
  3. Change Al­lowOver­ride None to Al­lowOver­ride All;
  4. Change Deny from All to Allow from All.

Original:

<Directory "/Users/[your-username]/Sites/">
    Options Indexes MultiViews
    AllowOverride None
    Order allow,deny
    Deny from All
</Directory>

New:

DocumentRoot "/Users/[your-username]/Sites/"
<Directory "/Users/[your-username]/Sites/">
   Options Indexes MultiViews FollowSymLinks
   AllowOverride All
   Order allow,deny
   Allow from All
</Directory>

Restart Apache: sudo apachectl graceful

Resources

PIL, JPEG and Freetype support on Mac OS X Lion when using Virtualenv

Assuming you're using virtualenv and pip and working in your virutalenv ((your-env)username@computer:~$).

  1. Download PIL, but do not install it:

    $ pip install --no-install PIL
    
  2. For Freetype support: edit setup.py in {your-virtualenv-folder}/build/PIL. On line 40 change FREETYPE­_­ROOT = None to FREETYPE­_­ROOT = libinclude('/usr/X11'):

    # Library pointers.
    #
    # Use None to look for the libraries in well-known library locations.
    Theme: Basic Nature
    
    # Use a string to specify a single directory, for both the library and
    # the include files.  Use a tuple to specify separate directories:
    # (libpath, includepath).  Examples:
    #
    # JPEG_ROOT = "/home/libraries/jpeg-6b"
    # TIFF_ROOT = "/opt/tiff/lib", "/opt/tiff/include"
    #
    # If you have "lib" and "include" directories under a common parent,
    # 
    continue.

Installing Gettext on Mac OS X Lion

Just now I tried to use django-admin.py makemes­sages to create a language file and got the following error: /bin/sh: xgettext: command not found. After a search on my system it turns out I don't have gettext installed.

I did some searching and found mac-ports solutions, but I'm not a big fan of them. I tried compiling myself and got the following errors:

stpncpy.c:34: error: expected declaration specifiers or ‘…’ before numeric constant
stpncpy.c:34: error:    expected ‘)’ before ‘!=’ token

stpncpy.c:34: error: expected ‘)’ before ‘?’ token

make[3]: *** [stpncpy.lo] Error 1

make[2]: *** [install] Error 2

make[1]: *** [install-recursive] Error 1

make: *** [install-recursive] Error 1

I continue.

Oh no! I've Forgotten my Django Admin Password!

And here's how to reset it if you can still reach the in­stal­la­tion via SSH or similar.

Start a Django shell:

python manage.py shell

Use the following code to change the password:

from django.contrib.auth.models import User
u = User.objects.get(username__exact='[username]')
u.set_password('[fill in new password here]')
u.save()
exit()

That's all!

Sources

Quick Templating System for HTML Page Mock-ups (Mac OS X specific)

For the project I am currently working on at my job I needed to make some HTML page mock-ups. The HTML and CSS were already available within the current version of the website, I just needed to re­struc­ture the content a bit and make a few mock-ups of it to see what sort of issues we'd run into.

Initially I just copied the HTML and replaced the old content with the new content. Then I made another copy and replaced it with different content. I then realised what I needed was a tempting system. If I was going to make 10 continue.

Previous »