See also: Heapify

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

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.

tvnamer v2 development

I've been working on a new version of tvnamer, the utility I discussed in "Automatically rename your torrent'd TV episodes"

It's a pretty much complete rewrite. Some of the new features include:

  • Configuration files. In tvnamer v1 you could only customise things like the output filename format by modifying the Python code directly. Now you can create a JSON file at ~/.tvnamer.json which changes any of the default options.
  • Support for multi-episode files, such as scrubs.s01e23e24.avi
  • Support for anime filenames, such as [Shinsen-Subs] Beet - 19 [24DAB497].mkv
  • Much better UTF-8 filename handling
  • Ability to move files to specific location after renaming (/media/tv/{series name}/season {seasonnumber}/ for example)

...

Read more

There are 2 comments on this post.

Twitter Integration

NEVERFEAR.org is now integrated into Twitter. We've had a Twitter account for sometime that is linked to our IRC channel. Now all article posts are tweeted on publish too!

You can follow us at @NeverfearOrg

...

Read more

There are no comments on this post.

How to convert infix to postfix (Python)

I wrote this originally some time ago. Mostly for my own amusement. It converts from infix to postfix notation.

I expect most of our readers know what these are but for the benefits of completeness infix is a functional notation we humans use for instance in mathematics where the operator sits in between the operands. Example:

(8 * 5) / 4

...

Read more

There are no comments on this post.

How to build a string representation of an integer in any base without bitwise operators

Last week I gave the geeks at #neverfear IRC a coding task, something I've been trying lately to both challenge them and myself. The challenge I gave them was actually a real-life problem I'd faced in industry as a developer. The challenge was as follows.

Produce an algorithm in the language of your choice that recursively converts a numerical value to a hexidecimal string without bitwise operators. Bonus points awarded for generalising your algorithm to the nth base.

We had a few good solutions mostly following a similiar approach in various languages that I'd like to share.

...

Read more

There are no comments on this post.

BandsInTownPy released

A Python module on the API at bandsintown.com released and is available for download at http://github.com/kay/BandsInTownPy

Sample usage:

from bandsintown import *
site = BandsInTownRequest()
 
print "Getting Flyleaf information by name"
artist = site.GetArtistByName("Flyleaf")
print artist.get_as_string().encode('utf-8')
print
 
print "Getting events for Flyleaf by Artist object"
events = artist.GetEvents()
 
print len(events), "events"
 
for event in events:
    print (event)
print
 
print "Getting todays events"
events = site.GetEventsToday()
 
print len(events), "events today"
 
for event in events:
    print event.get_as_string().encode('utf-8')
print
 
print "Getting events for Exilia by name"
events = site.GetEventsByArtistName("Exilia")
 
print len(events), "events"
 
for event in events:
    print event.get_as_string().encode('utf-8')
print

...

Read more

There are no comments on this post.

User Authentication With Django

Introduction

This article will teach you how to authenticate users with Django in a simple, quick, and secure manner. You'll also learn how to require authentication on certain pages of your website, and how to gracefully handle login and logout functionality.

The target audience is people who have had minimal experience with Django, and are aware of how Django works in a basic manner.

...

Read more

There are 13 comments on this post.

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

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