Coding frustrations

Apr 13 2011

(Source: chrismear)

3 notes

May 06 2010
(via coupde)

(via coupde)

6 notes

Apr 23 2010
chrismear:

“This is a brief public service announcement to inform you that the Nintendo 64 game console looks exactly like a koala bear.” (via BuzzFeed)

chrismear:

“This is a brief public service announcement to inform you that the Nintendo 64 game console looks exactly like a koala bear.” (via BuzzFeed)

1 note

Apr 20 2010

I argue that Apple now has not one but two monopolies:

I) A nearly-total monopoly on computer (and pocket computer) systems designed with good taste. II) A total monopoly on the Microsoft-free, hassle-free personal computer. [1]

Mr. Jobs is indeed starting to behave like that other convicted monopolist we know and love. Yet unlike the latter, Jobs did not engage in underhanded business practices to create his monopolies. They were handed to him on a silver platter by the rest of the market, which insists on peddling either outright crap [2] or cheap imitations [3] of Apple’s aesthetic. In order to resist the temptation this worldwide herd of mindless junk-peddlers and imitators have placed before him, it would not be enough for Jobs to merely “not be evil.” He would have to be a saint (and a traitor to his shareholders.)

Stanislav Datskovskiy puts it better than I ever could have, about Apple’s success.

Apr 17 2010

Mounting stuff with Linux

If you’re used to GUI based apps, the idea of having to manually mount apps is likely to seem overly arcane, and something we should have stopped having to do back in the twentieth century.

But if you find yourself needing to do so sometimes like, when dealing with virtual machines on the commandline, or pared back systems like OpenWRT boxes, it’s worth bearing in mind that on Linux, you are able to mount a drive pretty much anywhere on the filesystem that’s in a directory (as long as you have the correct permissions to do so).

For example, in OS X, where you’d normally expect to find disks you insert on the desktop, or at /Volumes/NameOfTheDriveif you’re looking at the path for it on the commandline.

On a Linux system, the default place for inserted drives would be either /mount/ or /mnt depending on what flavour of linux you’re using. However, you’re able to mount on any path, that might be more convenient, like /srv/www/ or /var/www.

2 notes

Apr 16 2010

More OpenWRT networking faffery.

When following these instructions to set up a local dev environment, after putting an version of openwrt into virtualbox, setting up dhcp bridging so I can see this box on the network, and updating name servers as described previously, I had more problems connecting to the outside world.

root@OpenWrt:~# ping 8.8.8.8
PING 8.8.8.8 (8.8.8.8): 56 data bytes
ping: sendto: Network is unreachable

I could reach other sites internally fine:

root@OpenWrt:~# ping 192.168.2.1
PING 192.168.2.1 (192.168.2.1): 56 data bytes
64 bytes from 192.168.2.1: seq=0 ttl=64 time=17.406 ms
64 bytes from 192.168.2.1: seq=1 ttl=64 time=4.640 ms

But no joy outside. In the end I found that the routing was the culprit - although I had defined the gateway value in /etc/config/network as 192.168.2.1, something had gone awry, and I don’t know what.

root@OpenWrt:~# route       
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
192.168.2.0     *               255.255.255.0   U     0      0        0 eth0

The solution was to manualy add a default gateway pointing to 192.168.2.1 on the main ethernet interface (eth1) instead with the route command:

root@OpenWrt:~# route add default gw 192.168.2.1 eth0 

And it started working again:

root@OpenWrt:~# ping 8.8.8.8
PING 8.8.8.8 (8.8.8.8): 56 data bytes
64 bytes from 8.8.8.8: seq=0 ttl=244 time=40.098 ms
64 bytes from 8.8.8.8: seq=1 ttl=244 time=63.447 ms

God, I don’t ever want to have to spend another Friday night puzzling over this stuff like this.

Life is too short.

2 notes

Mar 28 2010

A few tips when deploying with Drupal, OS X and CentOS

I’ve had to deploy a few Drupal sites lately to CentOS boxes, and while they’re fresh in my mind, I’m jotting down a few stumbling points here, and the steps you can take to avoid wasting too much time.

Check if the virtual hosts are set up properly

<VirtualHost *:80>
  ServerAdmin   admin@domain.com
  DocumentRoot /var/www/vhosts/domain.com
  ServerName domain.com
  ErrorLog /var/log/httpd/domain.com-error_log
  CustomLog /var/log/httpd/domain.com-access_log common
</VirtualHost>

<Directory /var/www/vhosts/domain.com>
    Options +FollowSymLinks
    AllowOverride All
    order allow,deny
    allow from all
</Directory>
Common mis-steps and fixes
Check for typos for where you’re logging to:

log when you mean logs

If Apache won’t restart, check the main apache error logs - if Apache can’t write logs to where you tell it to, then it won’t be able to start, and you’ll find log errors like so in /var/log/httpd/error_log:

(2)No such file or directory: httpd: could not open error log file /var/logs/httpd/domain.com-error_log.
Unable to open logs
Check if you’re got all the .htaccess files in the Drupal root

Drupal’s main directory has a hidden Apache file, .htaccess that is easy to miss when copying, and provides much of the voodoo that lets you use Drupal’s clean urls. If you don’t have this, you’ll often be able to load the front page of a site, but as soon as you click off the front pages, you’ll get ‘link not found’ errors. The tell tales signs in the site log files look like this:

File does not exist: /var/www/vhosts/domain.com/blog, referer: http://domain.com/
File does not exist: /var/www/vhosts/domain.com/admin

The quick fix here is to pull down the stock .htaccess file from the normal checkout of Drupal. Because the file begins with a dot, by default you won’t be able to see it without using a ls -a command, or something similar on the commandline. Alternatively, you can set your computer to display files that begin with a period, like this in OS X:

defaults write com.apple.finder AppleShowAllFiles -bool TRUE
killall Finder

defaults write com.apple.finder AppleShowAllFiles -bool FALSE
killall Finder

The alternative here is to do this as a toggle in Snow Leopard open and save dialogue boxes,

Check

Mar 17 2010

How you should be searching and replacing with Textmate

I came across this trick earlier this month, and after using gawdknowshowmany times already, I figured it’s worth highlighting for others:

  1. select foo (with double-click or ctrl-W)
  2. press cmd-E (that’s “Use Selection for Find”)
  3. select bar
  4. press shift-cmd-E (that’s “Use Selection for Replace”)
  5. press cmd-G to Find Next occurrence
  6. if you want to replace it, press alt-cmd-F which is the Replace & Find command and will, quite appropriately, replace the occurrence and find next one
  7. if you don’t want to replace it, press cmd-G again.

Almost vim-like.

Via require ‘brain’

Please note - be this isn’t the ONLY WAY EVER you should find and replace in Textmate, but for quick operation’s it’s pretty hard to beat.

1 note

Mar 11 2010

Use Dollar home, not tilde

I’ve been puzzling over why I can’t call scripts in a home directory for a while now, and I think I’ve finally cracked it.

Previously, I had my path listed like so:

    PATH="~/bin:/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:/usr/local/git/bin:$PATH"

1 note

+
Page 1 of 14