Pages: 1 2 3 4 5 6 7 8 9 10 11

The Asterisk Spooling Daemon

While working on the new v2 release of pycall, I was doing some research on the internal limitations of Asterisk call files, and thought I'd share some interesting (technical) bits of information here.

All information below has been gathered from the latest Asterisk release (v1.6.2.7). If you don't do any programming, you may want to skip this article, as it is a bit geeky.

...

Read more

There are no comments on this post.

Basic XML Parsing with Python and LXML

Recently I've been developing an API using python and Django for work, which uses XML responses to speak to clients. One of my goals for the client was to be able to easily parse the XML responses that the server sends, so that I could appropriately handle errors.

Fortunately, python has many tools for building and parsing XML. During my research, I tested several options, but found that the well supported library LXML was a perfect match for what I needed. Unfortunately, I had a hard time figuring this out, as examples to just parse XML content was lacking in the official tutorial, and there were no good resources online with code samples.

So let's take a quick peek at a sample XML document, then we'll analyze some simple LXML code to see how it works. Of course, before you can run any of these code samples, you'll need to download and install LXML (there are packages available on most linux systems already).

...

Read more

There are no comments on this post.

Setting the desktop wallpaper programmatically (C# Snippet)

Here's a little C# program I made that gets the filename of the currently set desktop wallpaper and also can be used to set the desktop wallpaper.

Example usage: SetDesktopWallpaper.exe C:\MyNewWallpaper.jpg

Just something I made for my sister who has Windows 7 Starter edition and lacks the presentation controls. Add it to your 'Send To' folder and just select the file you want to set the wallpaper as and go.

...

Read more

There are 3 comments on this post.

Ignoring certain content-types with urllib (Python Snippet)

This is a little piece of code I wrote to intercept and disregard a http or https request from urllib.urlopen if the Content-Type header on the response is not within a list of accepted content types.

I'm sure somebody might find a use for this.

This snippet creates a customer URLopener and then overrides the open_http and open_https methods, checks for MIME type and halts the request if the response is of a MIME type you do not accept.

...

Read more

There are no comments on this post.

Shut Up Woman, Get On My Horse

I recently found a rather odd but amusing flash animation by Weebl at http://shutupwomangetonmyhorse.com/.

Enjoy

...

Read more

There are no comments on this post.

Bash Script: Start irssi (or any process) if not already running via a cronjob

I know there are a thousand of these available online. This is one I just wrote and wanted to make it a thousand and one. This script will start irssi if there is no irssi process available.

Save the following script somewhere (example /home/kay/bin/irssi_init.sh) and add the following to your crontab:

*/1 * * * * /home/kay/bin/irssi_init.sh >> ~/irssi_init.log

...

Read more

There are no comments on this post.

Designing a user-orientated permission system

System permissions are important. Defining what people can and can't do with your application is a significant part of security.

There are two perspectives I tend to care about with permissioning. The first is user-orientated and the second is data-orientated. In this article I will talk about designing a user-orientated permission system.

For the purposes of this post a permission will be considered a boolean value that represents whether a person can or can't perform an operation. In other systems you might go as far as to consider the extent to which they have permission which ends up working like a priority based permissiong system. This is only really useful in my opinion if you've an operation two people can perform at once and you wish to provide a fine grained hints to the system as to who should have the operation performed first. It's something to consider but usually unnecessary and out of the scope of this article.

...

Read more

There is 1 comment on this post.

Auto Generate Forms With Django's ModelForm

In this short article, we'll analyze a better way (in some cases) to create forms for your Django models.

If you've ever worked with Django forms, then you know that there is a lot of repetitive code involved in the process of writing a form to create your model. Take, for instance, the following model, which represents a physical server (somewhere):

from django.db import models
 
class Server(models.Model):
    """
    This class represents a physical server.
    """
    hostname = models.CharField('Server Name',
        help_text = 'Hostname of the server.',
        max_length = 50
    )
    ip = models.IPAddressField('Server IP Address',
        help_text = 'Public IP of the server.',
        unique = True
    )
    disk_space = models.IntegerField('Disk Space on Server',
        help_text = 'Total disk space in MB.'
    )
    ram = models.IntegerField('RAM on Server',
        help_text = 'Total RAM in MB.'
    )
    cpu = models.IntegerField('Processing Power',
        help_text = 'Total Processing Power in MHz.'
    )
 
    def __unicode__(self):
        """
        Make the model human readable.
        """
        return self.hostname

...

Read more

There are 4 comments on this post.

Transparent Telephony - Part 3 - Making and Receiving Calls Using VoIP

Welcome back to the Transparent Telephony series. If you're a new reader, you may want to start at the beginning: Part 1 - An Introduction.

In the previous installment, we walked through installing Asterisk. In this article, we'll be picking up where we left off and configuring Asterisk to make and receive phone calls using VoIP!

Specifically, we'll:

...

Read more

There is 1 comment on this post.

Transparent Telephony - Part 2 - Installing Asterisk

Welcome back to the Transparent Telephony series. If you're new, you may want to check out part 1 here: Transparent Telephony - Part 1 - An Introduction.

This series is designed for technical people, programmers, and just general enthusiasts who want to learn: how telephony works, how to setup your own phone server (PBX), how to write telephony applications, and how to reduce your phone expenses. There are tons of neat things you can do with telephony knowledge, so keep reading!

This article will walk you through installing Asterisk on your CentOS or Ubuntu server. If you are going to install on a virtual machine to follow along, I recommend using VirtualBox, as everything should work out of the box. Certain virtual machine programs like Xen have kernel issues which makes installing Asterisk difficult. Also, never ever use Asterisk in production on a virtual machine! You'll have timing issues (this will be explained later in the series).

...

Read more

There are no comments on this post.

Pages: 1 2 3 4 5 6 7 8 9 10 11

Powered by Debian, Guinness, and excessive quantities of caffeine and sugar.