2010
01.27

A few months back I released the first version of my rather popular Asterisk call file library, pycall. pycall is a python library which makes creating and using Asterisk call files extremely, EXTREMELY easy. Since its inception, I’ve used pycall in several production environments, and for various other small projects that I’ve worked on.

The past couple weeks I’ve been working on my web design skills, and decided to make an information site for pycall which contains documentation, examples, and a tutorial to help users get acquainted with the neat features that pycall offers. So I present to you: http://pycall.org/. Check it out and let me know what you think :)

Also, if you’ve used pycall for a project, and want to get famous, see http://pycall.org/examples. I’m asking for any code contributions to host up there and share with the world.

Enjoy.

2010
01.07

In C, you can index arrays with either the array subscript inside of the typical square brackets:

arr[0]
or, with the less common (and somewhat mistifying):

0[arr]
Now, I’ve been using C for quite a while, but never realized that you could do this. It is definitely awesome, and could be really useful in some obfuscated programs. Now, just to make sure that this actually works, feel free to test it out. I wrote a really small sample program that runs a test (if it doesn’t work, please leave a comment with your compiler as I’d be interested to know if it doesn’t work on all platforms. Anyhow, feel free to use my source if you want.

The really interesting thing about this, is why it works. On the Stack Overflow discussion page for Strangest language feature, the user Michel explains why it works.

that’s because a[10] means *(a+10) … and 10[a] means *(10+a) :)

Pretty awesome. Anyhow, hope you learned something new, I sure did! Thanks Stack Overflow :)

2009
12.27

New Book

A couple of months ago I ordered a copy of Brian W. Kernighan and Rob Pike’s book: The Practice of Programming. This book caught my eye as it was written by two of my idols, (Brian W. Kernighan is a co-author of the C programming language, and Rob Pike is a UNIX programming god). The book covers programming style, efficiency, and testing (three very overlooked topics), and I figured that even though I tend to think I have excellent programming style, I could learn something about efficiency and testing.

To help myself learn material better, I’m actually trying something new with this book. I’ve created a github project, pop, and plan on solving all of the exercises in the book and keeping them version controlled within my pop project. I’m hoping that this forces me to really think about solutions and work them out as best I can. I figure that it will also give other people a reference / learning tool if they ever plan on delving into Kernighan and Pike’s book at some point in the future.

So if you are interested, check out the project and I’ll keep it updated as I go along!

2009
12.19

I’m announcing my Asterisk 1.6 C AGI library for developers (cAGI). cAGI is a fully compliant Asterisk 1.6 AGI library for C developers. It can be used in production (I’ve been using it on several production boxes for the past 5 months), and has been generally well tested.

cAGI was originally part of my WildPBX project, but I’ve decided to release it as an individual project to help speed up development, and loosely couple the entire WildPBX project.

Currently, I’m cleaning up the cAGI code base, and building a good Makefile for installing the library (so that the includes can be used from anywhere). It will be ready soon, I promise!

Stay tuned for more updates :)

2009
12.17

So if anyone wants a google wave invite, I now have them (25 to be precise). Wave is pretty cool so far, I’m definitely liking it :) Leave a comment if you’d like one!

2009
12.11

My IRC takeover bot, atkbot, is progressing nicely. Some of the features it now has are:

  • Simple configuration file.
  • Can connect to IRC networks that are password protected.
  • Can join multiple channels by default (specified in the configuration file), or none at all (just lurk on the server).
  • Will automatically re-connect if kicked from the network, or if the internet goes down.
  • Can be instructed to join one or many IRC channels via PMs from bot operators.
  • Will maintain operator status once it has taken over a channel. EG: If it gets ops and kicks everyone out of the room (and bans them!), it will also actively watch for new people joining the channel and remove them as well.
  • Will auto op any bot operators who enter the channel (or who are already in the channel when the takeover happens).
  • Can be instructed to join all channels on the current IRC server.
  • Has a customizable part message which it will use when instructed to leave a channel.
  • Supports variable command prefixes for bot operators to use. You can put in any string: (~, !, etc.)
  • If the bot’s nick is already taken, it will automatically choose another nick.
  • Alert’s all bot operators via channel invite and private message when a channel is taken over, easily alerting the owners so they can take action.

Overall, I think atkbot is going pretty damn good. I have been casually working on it for a few weeks now, and I’m liking it more and more. I still plan on adding a lot of features, like more advanced takeover options, support for multiple IRC networks, etc. — but I plan on building this into a working release soon.

One of the things I’m currently debating is packaging. How should I package atkbot? I’m open to suggestions.

The way I do my development uses GNUmake to build, and run the bot. I’m debating myself on whether I should port atkbot to a systems-level type program (that installs to a global path), or whether it should remain as a standalone program which must be downloaded and ran from within its local directory structure.

Anyhow, development and progress will continue! If you have any input, I’d be happy to have it.

2009
12.06

Time for another session of my favorite: Sunday night hacking. Need to finish some bugfixes in a voice broadcasting system I’ve been writing, as well as hopefully implement some features in my atkbot project.

My energy drink of the day is Full Throttle original.

Anyone else staying up hacking tonight? Best of luck!

2009
12.04

A little over a week ago I started working on a new project for fun in my freetime: atkbot.

atkbot is a cross platform IRC bot written in Java, designed to takeover IRC channels.”

Those of you who know me know that I’ve been using IRC forever. IRC (if you aren’t aware) stands for internet relay chat. It’s a pretty old protocol for chatting (in text) with friends. Tons of people still use IRC today, and it is a popular way to communicate with people.

IRC bots are programs which simulate a person, and provide certain functionality to IRC users. Most IRC bots are trivia games, or chat room monitoring tools, but there are also takeover bots which try to take over chat rooms and remove users from them. And this is the goal of atkbot.

atkbot doesn’t make use of any exploits, or anything like that, it simply joins IRC channels, and waits to be given operator status. Once it is given operator status, it bans and kicks all users from the room, sends channel invites to the bot operators (specified in the bot config files), and then private messages them as well to let them know that the channel has been taken over.

atkbot is cross-platform (will run on anything with Java), and is going to be highly configurable. I’m currently cleaning up the development code, and plan on pushing a first release at some point this weekend. The configs are simple and straight forward (see the config file for information), and should be completely independent of any other system packages.

I decided to write atkbot for fun as a little side project to make me laugh a bit. Please don’t use it for anything truly evil :)

I’ll post some updates once the first version is released. If you have any suggestions or features that you think should be added, please let me know!

2009
12.04

Neverfear

Just so you know, my articles will always be put up on my personal blog (this site), and http://neverfear.org/. Neverfear is a site that some of my good friends and I contribute to. So if you prefer to see them in a little better formatting, please visit Neverfear.

That is all.

2009
12.04

My Git

A few days back I ordered a copy of Scott Chacon’s book: Pro Git, which I am really enjoying reading. Scott is an excellent writer, and really does justice to Git. I was reflecting on his enthusiasm, and thinking about my own. Here are my thoughts on Git, and my experience with it over the years.

I started using Git around 2 years ago when I saw a screencast discussing it online. What initially drew me to Git was that it was created by Linus (who was very enthusiastic about it), and that my previous experiences with version control systems (VCS) were horrible. Naturally, I wanted to give it a try, and get back to the best-practices way of doing things (using a VCS).

When I first learned about VCSs, pretty much everyone used SVN or CVS. When I researched them both, there was no doubt in my mind that SVN was clearly the most popular, and so that’s what I decided to learn. I started using SVN for all of my code (most of it was hosted on Sourceforge at some point or another), and learned it well enough to push periodic updates to my projects and do basic collaboration with a few other people.

However, I never really liked SVN. It was always slow and time consuming to perform commits (something that you should do extremely frequently), so I just stopped doing them often. This got me into the bad habit of only performing a commit for a release, something that is definitely frowned upon, and completely nullifies any benefits that you get from using a VCS in the first place! To make the situation even worse: at the time, a good portion of the code I was writing was offline. This meant that I was unable to make commits when working on my code, as without an internet connection I couldn’t connect to the remote repository.

Using SVN also imposed limits on my work with others. A lot of the projects I worked on required collaboration with several other people. Using SVN slowed the process down. Performing merges, managing access rights, and doing SVN updates always took a lot of time. Also, if the SVN repository was down, it meant that nobody could access the source or project history, which made team effort difficult.

The other large issue I had (and still have) with SVN is that there are no good project hosting websites out there which meet my needs. Sourceforge, which is probably the largest and most popular SVN project hosting site is slow, filled with ads, and has an un-intuitive interface. It also requires approval for every project which can sometimes take hours. What I want in a project hosting site is something that:

  • Has a clean and pretty interface with no (or few) ads.
  • Allows developers to instantly create a new project and get to work.
  • Makes managing access rights and collaboration simple.
  • Allows private projects, which are necessary for proprietary code.
  • Has an issue tracker for each project, which allows advanced categorization of bugs and fixes. Something that makes it easy for both users to submit issues (and propose fixes), and developers to close bugs and keep it organized.
  • Allows you to store large projects and releases.
  • Has a pretty source viewer so that users can casually browse any version of your source code through a simple navigation window, and can permalink to any piece of code at their whim.
  • Allows users to embed snippets of code in their web pages for display on other sites.
  • Has pretty URLs, none of that ?p=155 stuff.
  • Has a wiki system that looks nice and is simple to navigate for users.
  • Has detailed graphs and statistics for each project.
  • Has some sort of ‘watch’ or ‘follow’ functionality which allows users to monitor the status of a project over time.

Enter Git. Git felt like it was designed for me.

As a developer who works on many projects small and large, I need a VCS which will be as flexible as I am.

Git is fully distributed, so no matter where I am or how many people are working on a project, I always have complete access to all revisions of the source. There are no file deltas (Git stores the entire file), and I can instantly see what the source looked like at any given time in the project’s history whether I’m online or offline. This gives me the flexibility to get work done wherever I am, whether it be on a plane, at the beach, or in the park. When you perform commits in Git, the files are checked into your local repository. Once you have internet access, you can push to your remote repository and add your full history straight into the project as if you were online the entire time.

Git also makes collaboration a simple process. I don’t have to manage a Git database and allow access to certain users: when someone makes a patch or adds code, they can simply link me to their Git repository, and I can merge it into the project at my leisure. This has the added benefit of being able to see all of the source contributer’s history in my project once I have merged the branches together. This makes working with other people extremely easy and reduces the hassle of managing a large monolithic SVN repository.

Git also handles merging and re-basing beautifully. When conflicts arise I am notified, and the current working revision is put on hold until these errors are fixed or stashed. Git adds the appropriate conflict information to my files so I can see exactly what is conflicting, and how it needs to be changed to progress.

Lastly, Git has an great community, and Github. Github is the ultimate project hosting site. You can create projects instantly and store large files. You can also store all of your SSH keys for the various systems you work on, thereby showing different commit users and / or messages. Github has a simple and intuitive web interface which looks great, and has clean functionality for users, developers, and people exploring the site.

The Github source viewer is nice as well. It lets you browse the entire history of the project, you can see a full snapshot of exactly what the source looked like at any given time. It also allows you to get a direct permalink to any particular source file from any revision in the project’s history. This is extremely useful for source review and any sort of online publishing / collaboration tools.

One of my favorite Github features is the ability to instantly ‘fork’ a project. Forking a project is extremely easy, simply click the ‘fork’ button on the project you’d like to fork. Github will instantly copy the projects source / history to your account, and automatically create your own Git repository for the project which you can change and modify all you like. This is very useful, as if you see a project you’d like to make a patch for, you can fork it, make the patch, and link the real project owner to your forked repository, where they can then merge in your changes! It’s also useful for people who just want to make their own modifications to a project. Github’s forking provides an elegant solution to a common problem.

Yet another nice feature of Github is it’s social networking type feel. Every account can ‘watch projects’, send private messages, add and remove friends, and get instant updates when your friends add / remove code to their projects. Github is also releasing a resume searching tool on their site at some point in the near future, and they have already implemented resume pages for each user who wishes to add to them. This means that in addition to providing project hosting, they’ll also be able to help companies find talented programmers based on their actual work!

Github also has many other neat features including a wiki system, statistics system for gathering project stats, and a language browsing feature which makes finding new projects in your favorite programming languages fun.

Since learning Git, and discovering all the nice features that it offers (in addition to the general awesomeness of Github), I think that I’ve definitely become a better programmer. Git has helped me remedy my bad habits by making the committing and merging systems thoughtless, and has given me the ability to really get the most out of my coding experiences. Git has also made running an contributing to open source projects fun again, and that what it is all about.