09 Dec
Many people often want What You See Is What You Get (WYSIWYG) editors when creating content from within their web applications. This can be either in the Django admin control panel or for the end user. One of the most flexible and useful of the WYSIWYG editors currently available is TinyMCE due to its extensive plugin library and robust feature set. Integration with Django is relatively simple given that you extend the functionality of built in classes.
The first thing we will need to do is create a custom widget from forms.Textarea found in the django.forms module. We accomplish this by inheriting the Textarea class and overriding the constructor and render methods. Defining the relative path (on your web server) to the TInyMCE javascript source is also required here. So be aware that you will need to change that path to suite your environment. You may also want to change the content_css variable to include your sites’ main CSS file. The following is the source code for widgets.py which should be place in your projects root directory.
Read more »
26 Nov
Within the PC gaming community, it is quite useful to be able to control or monitor your servers programmatically. The almost universal standard being Rcon or “Remote Connection.” The protocol is overall very simple, it only requires a standard UDP socket and that you send a packet header with the login credentials per each request you make.
We will start by importing the python socket module and creating a UDP connection to the server.
import socket
if __name__ == "__main__":
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
# Connect to CoD4 server at 8.9.17.24:28960
# Will also work for most other games in a similar fasion
sock.connect(("8.9.17.24", 28960))
Read more »
16 Dec
A couple of months ago I stumbled upon a slew of information related to using the PS3 controller as a joystick on Linux. I immediately took my PS3 controller and started experimenting with the documentation out there for doing this sort of thing. Unfortunately however, not everything mentioned in this documentation worked correctly. For instance, I was not able to use a joystick on the controller to control the mouse without a separate piece of middleware. This was because the application I used (the only decent one I was able to find) to signal key presses for every button press on the controller, is unmaintained and had a blocker bug with mouse emulation.
You will need two components in order to make this work: the first being QJoyPad to bind controller buttons to keys, and JoyMouse to use one of the joysticks on the controller to control the mouse. Also remember that I am only using the USB cable to use the controller rather than using it via Bluetooth. I will post directions for using Bluetooth and the accelerometers in the controller at a later date, if I am able to get a hold of a Bluetooth adapter. Nevertheless, the tools are the same.
Read more »
28 Sep
As I am a big proponent of the SETI@Home project as well as a Linux user, discovering that optimized SETI applications existed and how to use them was important. It took quite some time to figure this all out by myself since there are hardly any (from what I could find) resources on SETI@Home optimized clients on Linux. Eventually I ran into this site which offers SSE3 and SSSE3 optimized clients for Linux in addition to SSE, SSE2, and SSE3 clients for FreeBSD.
For those of you who don’t know what SETI@Home optimizers are, they are essentially specialized versions of the standard version of the SETI@Home client which take advantage of extended floating-point instruction sets available to certain x86 (Intel, AMD, or the like) processors. Using these instruction sets allows optimized clients to complete work many times faster than it could before with the standard client. For example, prior to using an SSSE3 optimized client on my Intel Core 2 Quad Q6600 my recent average credit (RAC) on SETI was in the 500 range including one other active machine and now my RAC has spiked over 2,500 not including the other active machine.
Read more »
13 Aug
I actually wrote this little application quite a few weeks ago, I was just contemplating whether it was worth posting or not. I had just finished building my new PC and was starting to do a lot of overclocking and tweaking. Frustrated by the fact that there weren’t any Linux or open source alternatives to overclocking calculators, I quickly wrote one up using Qt 4. It simply calculates the resulting clock speed of your CPU given the FSB and the multiplier. Who knows, maybe somebody will find it useful. I was thinking about adding some tray icon functionality to monitor system temps. as well. Although, I am going to sit on that idea for a little while.

Download QOverclock 0.1
Download QOverclock 0.1 (Win32 Binary)
23 Jun
This took a bit longer to get out than I had originally expected but here it is. As a precursor to my previous post, I wanted to make a new “plugin” for pidgin that would update my music status from Banshee because as of the development versions of 1.0, they had an entirely new API in place and other similar plugins hadn’t (and still aren’t as far as I know) been updated to work with the new API. So that’s exactly what I did and its a very simple ~30 line python script that I am putting out to the world in case anyone else wants similar functionality.
Basically you just stick the file in your home directory (or at your option in /usr/bin or /usr/local/bin) and add it to your auto-started applications in GNOME or KDE or put it in your xinitrc or whatever you want. For GNOME users I happen to know that you can do this from System > Preferences > Sessions > Startup Programs > Add. For windows users this script will never run because Banshee is *nix only as well as DBus (as far as I know). Enjoy!
Download pidgin_banshee_status.py
10 Jun
Ever since the DBUS API change (more like overhaul) during the development of Banshee 1.0 and developers haven’t yet started supporting it in their plugins so I decided that I would play around with it. From what I have seen, it seems that the perception is that DBus is hard and complicated but its actually really easy and makes things very simple. Essentially you use a DBus debugger (because in most cases, documentation for an applications’ DBus API is not available) like D-Feet to look up which interfaces, methods, properties, and signals are available to you. Then use them to do what you want.
Read more »
09 May
Back when I wrote ProxyBot, I was frustrated by the fact that there was a lack of maintained and documented third party libraries for the IRC client protocol. So I essentially wrote my own implementation of the IRC client protocol for use with the bots that I write. Well I wrote the library to take advantage of OOP (Object Oriented Programming for those who don’t know) which in turn made it really quick and easy for me to throw together a bot.
So this is a simple little tutorial on how to write a basic “Hello World” bot using PyBotlib. The library itself is only a single file so I have not bothered to repackage it or write setup scripts as you will only need import that single file within your application. You may get the latest source code for the library at any time here (google code/SVN) or here (blog). So here we go…
Read more »
14 Apr
Ever since I have been getting back into the swing of Web Development, working on one of my projects, I really took notice to something. Whenever you see a PHP application out there that is free to download and you start looking through how they did things. You start to see that generally many web application developers (particularly PHP developers) will tend to rewrite many back end libraries for things such as the templating engine or database abstraction layer (DBAL) when there are so many libraries which do exactly the same thing and in many cases, much more. So my question is, why are we as developers wasting so much of our time rewriting things which are already there for us instead of using them to reach our intended goal? I recently asked myself this question while working on one of my projects.
I realized that I had wasted several months of my time developing what I called a “framework” for PHP when it was really not very full featured and actually made things extremely hard for myself in the large scheme of things. After doing some homework, I had found really rich libraries that allowed me to do things beyond my wildest dreams before. Projects such as Smarty, jQuery, and TinyMCE just to name a few. What really gets me though is that many free (as in beer or potentially as in free speech) projects constantly fall behind because they take forever to their own things such as rich text editors and ajax frameworks while their users are wondering why they don’t have the features they are looking for.
So this is a call to all web developers out there. You really need to start reassessing the libraries you write and think of how you could possibly use others’ great Open Source projects to assist you in the development of your application. Stop reinventing the wheel and start innovating, that’s what we are all about, right?
12 Mar
So there were some things that were in need of tweaking in the last version, so I have now released version 0.7. Due to popular demand I have implemented support for MySQL in addition to Postgres. I tried getting SQLite to work but it isn’t thread safe and would require a new instance in every thread which makes things messy and does not work with the current database abstraction layer. So until I can pass SQLite instances across threads, that feature will not work. I put some more details in the readme which is included with the source distribution. I am always open to feedback so feel free.
Download ProxyBot