How to free up space in rootfs on Arch Linux

Is your rootfs partition at 100% and causing you problems?

I’ve been hovering around 95%-100% for a few weeks now. Being at 95% is fine, but 100% can cause all kinds of problems. I was testing a form on my local web server and couldn’t do file uploads because “the disk was full.” I was writing code and my editor couldn’t save the file because “the disk was full.” Its frustrating because you have hundreds of free gigs where you’re saving the file, but because rootfs is full, you can’t!

I’ll start by showing you the output of df

$ df
Filesystem     1K-blocks     Used Available Use% Mounted on
rootfs          10209220  9625988     71164 100% /
/dev             4055116        0   4055116   0% /dev
run              4058036      252   4057784   1% /run
/dev/sda3       10209220  9625988     71164 100% /
shm              4058036      796   4057240   1% /dev/shm
tmpfs            4058036     3160   4054876   1% /tmp
/dev/sda1          99590    34166     60205  37% /boot
/dev/sda4      449789792 23726068 403549860   6% /home

Not good, but its my own fault. I only allocated about 10g to /dev/sda3 when I setup the OS. I should I have predicted that I would need more.

The real solutions is to boot to a livecd and resize /dev/sda3. This can take a long time, break your grub install, and cause other headache inducing effects.

Here are some tricks I’ve picked up to get your rootfs down from the dreaded 100% to something you can actually work with.

Continue reading “How to free up space in rootfs on Arch Linux” »

Code Review

Where I work, we have a lot of new developers and people still learning the languages. When learning a language, being able to get feedback on your code is an invaluable learning asset. It lets the more experienced programmers help teach the newer ones.

Most code review software is designed for pre-commit comments. A reviewer looks at the code before it gets added to the version control system and then approves or denies the changes. This is obviously vital for large projects involving multiple developers, but what about small shops where people work mostly independently and on different projects? What if you don’t have the resources or the need for an extensive review process and would rather casually browse your colleges code to add constructive criticisms or notify them of best practices which they might be unaware of?

To me the ideal tool will interface with subversion and allow reversion specific and line specific post-commit comments. I want to be able to browse our source code whenever I feel like it, write a comment about a specific line, and then have the author notified of the comment.

The PeerReviewPlugin for Trac looked like a winner, until I read this review

PeerReview Plugin for Trac

PeerReview Screenshot

In my company, we looked briefly at the “peerreview” plugin on TracHacks, and were very disappointed with it.

It seems obvious to us that a code-review plugin would naturally default to assuming that an entire Subversion commit should be code-reviewed. Unfortunately, the peerreview plugin forces you to manually identify the lines of code that you want to review. It doesn’t even give you hints in which lines might have changed with a particular commit, which means that if you don’t enter the line that changed carefully, you could end up re-reviewing the same lines of code over and over.

It still looks promising, and I don’t expect to find an out-of-the-box solution that is perfect for my specific situation. Right now ReviewBoard is looking up and I could always modify the PeerReview plugin to suit my needs (hooray, opensource). Please, leave a comment about how you and your company do code review. What code review systems have you worked with? What other solutions might I have passed over?

How do you measure productivity?

How do you measure your productivity while writing code? Judging a program’s success by lines of code (LOC) is like judging how successful an airplane is by its weight. Consider a more modern approach from Agile development called Weighted Micro Function Points.

Permalinks for Hierarchical Custom Post Types

June 2013 update:

This plugin is not actively developed. If you want to use this plugin with the latest version of WordPress, you should reference the source code on github and hopefully that will help you develop your own solution. I’m also open to pull requests.
End of update

I wrote a WordPress plugin that lets you have a hierarchy of custom post types where the post types are different. This is the plugin here. I see a few people marked the plugin is broken, it works, but its impossible to figure out how without instructions. I don’t know why the descriptions and stuff I added don’t show up on the WordPress site, so I’ll provide instructions and support on this blog.

Its worth pointing out that I made this other developers. If you’re looking for a plug and play solution, this isn’t quite it. But if you’re a developer with the same problem, I’ve done the heavy lifting for you.

Continue reading “Permalinks for Hierarchical Custom Post Types” »

Setting up a LAMP for local development on Arch Linux

Just installed Arch Linux (after leaving Ubuntu due to Unity/GNOME 3). Now I need to setup my development environment. This should work for most distros, not just Arch. I want Apache, MySQL, PHP, phpMyAdmin, and SSL. Because its easy and I’m lazy, we’re going to setting up XAMPP. As always, first reference the wiki (Xampp – ArchWiki).

The steps break down like this:

1) Download the latest version from here.

2) Extract and move to /opt/

# tar xvfz xampp-linux-*.tar.gz -C /opt

3) Set passwords for MySQL and stuff

# sudo /opt/lampp/lampp security

4) Only listen for local connections
– Open /opt/lampp/etc/httpd.conf
– Change “Listen 80” to “Listen 127.0.0.1:80”

You could stop here, but I’m going to make a virtual host (with SSL).

Continue reading “Setting up a LAMP for local development on Arch Linux” »

Quick CSS3 Fade Effect

Very simple fade effect for images that uses only CSS.

.box_transition {
  -webkit-transition: all 0.3s ease-out;  /* Saf3.2+, Chrome */
     -moz-transition: all 0.3s ease-out;  /* FF4+ */
      -ms-transition: all 0.3s ease-out;  /* IE10? */
       -o-transition: all 0.3s ease-out;  /* Opera 10.5+ */
          transition: all 0.3s ease-out;  
}

Demo

LESS: The dynamic stylesheet language

Wow, just wow. Imagine if you could use variables in CSS… now you can.

Here is the LESS website. The proposed method of using LESS is to write a style.less file and then include less.js which uses javascript to render your stylesheet dynamically. I really don’t like the idea of having to load an extra JS file and then generating the stylesheet on the fly. Talk about unnecessary overhead. But the LESS website loads quickly, even on my phone, so I guess the results speak for themselves. Visiting the page with javascript turned off was disappointing, but not unexpected. Thankfully they also made a command line tool that you can use to compile a .less file into a .css one. Use the compiler for production releases and the JS framework for prototyping. I’ll definitely being using LESS in my next project.

Continue reading “LESS: The dynamic stylesheet language” »

Unable to access phpMyAdmin

Quick entry today. I installed a LAMP on Ubuntu and when I accessed http://localhost/ on my browser it said “It Works” but when I tried to access http://localhost/phpMyAdmin/ I got a 404. The fix was simple, for some reason the phpMyAdmin config file wasn’t being loaded so I did a

sudo nano /etc/apache2/apache2.conf

then went to the end of the file (ctrl+w+v) and added the line

Include /etc/phpmyadmin/apache.conf

All good. Hopefully this helps someone.

How to install Eclipse 3.7 on Ubuntu 11.04

The Eclipse packages in Ubuntu are are very out of date. The latest version in the Ubuntu repos is 3.5.2 where as the latest version of Eclipse is 3.7. I’m posting this because Ubuntu 11.04 uses the new Unity desktop which uses overlay-scrollbars (scrolls bars that are hidden until you hover over them). For some reason Eclipse 5.3.2 doesn’t like to play nice with the overlay scrollbars, and I’d rather use the newest version anyways. With Eclipse, you can just download the tar.gz file from eclipse.org and run it no problem, but I like set things up in a cleaner fashion, so here’s how I did it.
Continue reading “How to install Eclipse 3.7 on Ubuntu 11.04” »

IE7… time to say goodbye

WordPress 3.2 was released July 4th 2011 and officially marked the end of WordPress support for IE6. Hooray! Now the crosshairs have landed on IE7 with WP 3.3 looking to cut support for Internet Explorer 7. To put things in perspective, IE6 was released when I was 11… and we’re finally starting to drop support for it. Luckily we’ve been upgrading the SU computer labs to Windows 7. Last summer they were still all running Windows XP, also released when I was 11…

I think its fair to assume that when the University stops supporting Windows XP we can stop worrying about it. See the thing is… wait for it… IE7 can’t run on Windows 7! Internet Explorer 7 makes up 7% of web browsers usage. Come August 1st 2011 Google will officially stop supporting IE7. The death of IE7 might come sooner then you think!