GPG error for virtualmin/webmin

So I’m getting

W: GPG error: http://software.virtualmin.com virtualmin-squeeze Release: The following signatures couldn’t be verified because the public key is not available: NO_PUBKEY

when I do an aptitude update. I did the following to fix it:

wget –quiet http://software.virtualmin.com/lib/RPM-GPG-KEY-virtualmin -O – | apt-key add -

wget –quiet http://software.virtualmin.com/lib/RPM-GPG-KEY-webmin -O – | apt-key add -

Then I got a new error:

W: Conflicting distribution: http://software.virtualmin.com virtualmin-squeeze Release

The fix was to upgrade from Debian Squeeze to Debian Wheezy. Also, removing the virtualmin-squeeze deb repo and keeping the virtualmin-universal also fixed this.

Cleverkite 2 Year Review

Honestly, I don’t even know why I’m writing this. Oh yeah, to make some easy content for my sparsely updated blog. It’s been 2 years since I started using Cleverkite, and if you’ve read my past 2 reviews on them you might know what’s coming. Basically nothing has changed, but that’s a good thing. Still fantastic service for a solid 2 years. I hope they never get rid of their legacy platform, but I’m pretty sure at some point they will (most companies I’ve seen have done this eventually). Either way, even if they did, I’d just sign up for their newer (although a lot more expensive) plans because I do believe I’d get my money’s worth and possibly more.

Ovearll great service, great people (I’ve only interacted with 1 person from Cleverkite but I am going to generalize really badly and assume everyone there is great), and I don’t know if I should write a 3 year review since it’ll be the same as all the others. Maybe I’ll just copy and paste this same review and replace the 2s with 3s.

preparing for technical interviews

I know there’s a bunch of posts, articles, blogs, etc about this type of topic so I thought I’d jump on the bandwagon and write my own. Not too long ago I had to go job hunting since I just graduated and couldn’t sit on my ass all day doing nothing. I had never been to any interviews before so the entire interviewing process scared me to death. Luckily, there are a bunch of resources online but they can only go so far. I knew that I would need to get into actual interviews and probably bomb them in order to learn anything. Basically, I had to fail and accept rejection in order to learn how to become better at interviews.

I went on craigslist and tried to find any company that was hiring web developers/software engineers and just sent my resume to them all. Even if I wasn’t interested in the company or working there, I sent my resume just to get an interview so I would get more interview experience. Lucky for me I actually didn’t have to go through too many interviews before I found a company I liked and got hired, but from the interviews I did get there were a few things I could generalize from them. Below is a list of topics I would highly recommend anyone to study if they are looking for a job in web development/software engineering:

design patterns (singletons, abstract factory, etc)
data structures (linked list, binary tree, etc)
database normalization (what it is, 1NF-BCNF)
algorithms
web security
optimization techniques (both front end and back end)
**IMPORTANT: a lot of the places actually put quite a bit of emphasis on how well I knew the language they used. For example, some employers used PHP and asked me really specific questions about PHP such as random functions I’d use (given a string, what function would you use to do blah). All of them asked about output buffers (ob_start stuff).
**TIP: I found doing a lot of puzzles helped me answer questions in interviews. I recommend project euler, or playing Professor Layton for the DS. One of the questions I got at one of my interviews was right out of the Professor Layton game.
**IMPORTANT TIP (UPDATED): After each interview, when the interviewer asks if you have any questions, you should start talking about the company and their technologies. I found out that the reason I got offers was because I took advantage of this. Even though this was a QA session, I treated it as a discussion session and talked with the interviewer about various technologies and my experiences and opinions on them. Even though I didn’t do too well on some interview questions, this allowed me to show the interviewer that I knew a lot of stuff that they weren’t testing me on. In fact, my current employer said the entire reason they hired me was because of my talk with them during the QA session.

It’s important to note that I’ve been doing web development since I was 11 so I was already quite knowledgeable in a wide variety of topics, so if you’re still a newbie you should study up on what’s hot and play around with it a bit. Gain experience through personal projects; don’t go in and try to talk about something you don’t have experience on, or it will backfire.

Those are just a few things to get you started. Practice makes perfect, and I can definitely say that as I interviewed more and more, I gained a bit of confidence in my interviews and also found some very good topics to study up on. I highly recommend you to just go out and get as many interviews as you can, even if you’re going to completely bomb them.

swfupload http 302 error

I needed to provide users with a way to do easy multi-file uploading, so after searching around I found SWFUpload. It’s a pretty neat little widget that does exactly what I want. I’m also using jQUery, so I’m using the SWFUpload jQuery plugin by Adam Royle. It allows very nice integration of SWFUpload with the jQuery syntax we know and love.

Everything was going smooth until I tried a sample file upload. It was kind of working, except the file wasn’t getting uploaded. Enabling debugging within the SWFUpload (by passing debug: true into the settings object) allowed me to see that it was failing because of an HTTP 302 error. This meant it was redirecting, and I knew why.

If you have any sort of authentication, it’s probably failing since Flash doesn’t use the same cookies as the browser. You have to pass the PHP Session ID in order for it to work correctly. This depends on your application, but the point is, somehow you’ll have to pass and set the Session ID in your application. After I did this, everything worked perfectly.

magento 500 error after fresh install

I’ve just started to learn magento and I had a problem with my install always giving a 500 error, even after following the install instructions. Correct permission, all apache and php requirements met, I kept getting 500 errors on every page. I finally found out why. Magento doesn’t allow you to use localhost as your domain. I think it was something about cookies not working correctly under the localhost domain. The solution was simple: add another alias for localhost. I use a Mac so I went into /etc/hosts and added this line:

127.0.0.1 local.dev.com

The domain could be anything, I just chose local.dev.com since it’s pretty generic and I can use it again for any other projects that have a similar problem.

libgosu draw methods example

For any of you who need some sort of 2D graphics solution for Ruby, I’ve found that libgosu does the job pretty well so far. Following their tutorial makes it easy to get started, but when I wanted to draw simple shapes I didn’t find too much on the web about the paramters to their draw functions, especially the colors.

Usually their draw methods are in this form:

draw(x coordinate, y coordinate, color, …)

At first I tried strings of colors, hex values, etc but nothing worked. I finally found out that a color in this format works:

0xffffff00

Now I’ve actually never seen a color specified with 8 bits, usually it’s in 6 bit hex but whatever works!

Cleverkite 1 Year Review

Not much has changed since my initial 1 month review, the service they provide is still great. The only drawback is that they have a new line of cloud VPS and have put their old line in legacy status (which means me), so they aren’t going to be improving much on the system I’m on. While it makes me sad that I won’t be experiencing the new OpenVZ RAM management for a while, the VPS itself has been one of the most stable I’ve ever had.

I haven’t needed to contact support much in the past year, but when I have I always get a reasonably quick and friendly response. I can’t remember the last time the VPS was down, but I think there were a few restarts that I wasn’t aware of since my uptime reset. I’ll be renewing my VPS for another year (I pay annually, that’s how much I trust these guys) and hopefully the same great service will follow me into the next year, when I’ll write a 2 year review that’ll probably be exactly the same as this review.

mysql 5.5 skip innodb

In MySQL 5.5, it seems the skip-innodb option was removed so trying to boot MySQL with that option just makes it fail. Skipping InnoDB can save quite a lot of RAM and on lower end systems, this can be very useful. Here’s the new equivalent to skip-innodb in MySQL 5.5:

ignore_builtin_innodb
default_storage_engine=MyISAM

rvm + capistrano + gitosis install guide

Even though the mentioned 3 tools are the de facto that everyone is using, it’s actually a huge pain in the ass to set up for the first time. One could easily spend a few days just trying to troubleshoot any problems that come up, and there are so many potential problems that even Google doesn’t have all the answers in plain sight.

First, install git and gitosis. I run debian so you’ll have to find the equivalent commands on your version of linux, but for debian/ubuntu you can install those using:

aptitude install git-core gitosis curl

For CentOS you can install git with yum using

yum install git-core

But for gitosis, you’ll have to install it via the python install or adding the REPOs referenced in this post.

Curl will be used to install RVM.

Now for RVM, run this command:
bash << (curl -s https://rvm.beginrescueend.com/install/rvm)
If you run that command as root, it will do a system install. Otherwise, it will do a user install (RVM will only work for that user). It's up to you which one you want to do, but I usually do a system install. After the install, you'll need to add this to /etc/profile or the .bash_profile of every user you want to use RVM:

[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*

The above code is for a user install. If you're doing a system install, replace $HOME/.rvm/scripts/rvm with /usr/local/bin/rvm.

Now run:

source /etc/profile

or

source .bash_profile

depending on where you added that code. Once it's installed, install your preferred version of ruby. I use REE, so I do

rvm install ree

Once you have your version of ruby running, you may want to create separate gemsets. If so, use this command:

rvm gemset create yourgemset

If you don't use a gemset, it will just use the default gemset which is no gemset. On your local machine, install capistrano with this command:

gem install capistrano

Go to the root of your rails application, and type:

capify .

This will generate a Capfile and, more importantly, a deploy.rb inside your config folder. This deploy.rb is the heart of how you will deploy applications now. I won't go into a sample cap file since there are quite a bit on the web, but I think it's good to mention that capistrano is just a tool that runs commands for you, instead of you having to go into the machine and do them yourself. You can create capistrano tasks which are just basically commands you'd type when you're SSHed into a machine, only here you can run them easily by doing cap namespace:task. That's all there is to it.

To get RVM and capistrano working, check out my earlier post about it.

Now, gitosis is kind of a bitch to work with if you haven’t used it before. I find this tutorial to be a very valuable resource when working with gitosis, especially the initial setup. However, one thing to add to that tutorial that YOU MUST DO is SSH into your REMOTE machine as the user that will be used to deploy the application. You must generate an SSH key for that user, and add it to the gitosis-admin keydir and basically add that user as a gitosis user in addition to yourself. This is needed since capistrano will use that user to deploy and get the code from gitosis.

After all this is working, you should have a basic setup with rvm + capistrano + gitosis working. It’s real tough to install the first time, but after a while you get used to it. If anyone finds anything to add to this tutorial, I’d be more than happy to update this post!

installing iis 6 on windows 2003 server

I don’t know about anyone else, but this task was one of the most difficult server tasks I’ve ever had to do. Installing IIS on Windows 2008 is a lot easier, but in 2003 it’s akin to banging your head against a wall for a day or so. The thing is, you need so much stuff just to install IIS it’s hard to know where to get everything. I’m using Windows 2003 Server R2 SP2, but the installation requires files from the REGULAR, NOT R2 version! So here’s how I did it:

Install SP2 EVEN IF YOU ALREADY HAVE IT INSTALLED! I just downloaded it from Microsoft again and installed it. Next, I downloaded the admin pack (Located under system32 as adminpak.msi, or download from here: http://www.microsoft.com/download/en/details.aspx?displaylang=en&id=16770). Then I loaded the OLDER REGULAR version of Windows 2003 Server with Alcohol 52%, pointed to the i386 directory, and it installed.