Hot and spicy ...

Sending SMS using Skype

Category: Technology
Tags: , , ,

Because this post has been so successful I’m reposting it here.

Don’t ask me why but for a fixed period (one month, each day at 14:30 GMT+1) I needed to send SMS to a fixed number. The text had to be choosen by random from a set of texts. I have no SMS gateway provider account so I searched for a simple solution. The simplest one is to create a Python script that reads the text from a file and then calls an Applescript that triggers Skype.

The Python script (dumb, no magic):
[python]import codecs
import os
import sys
import random

FILENAME = ‘texts.txt’
CHECKER = ‘checker.txt’

PROGRAM = ‘/usr/bin/osascript’
ARG = “‘sendsms.scpt’”

if __name__ == ‘__main__’:

# compute already sent sms
# it is one line with all line numbers already sent
checkfile = open(CHECKER, ‘r’)
fline = checkfile.readline()
checkfile.close()

already = []
if fline:
already = [int(al.strip()) for al in fline.split(',')]

textfile = codecs.open(FILENAME, ‘r’, ‘utf-8′)

count = 0; lines = []; lastline = ”
for textline in textfile.readlines():
if not (count in already):
lines.append((count, textline))

count += 1
lastline = textline

# no more data found so we take the last text and start from the beginning
if lines == []:
lines.append((count-1, lastline))
already = []

ourcount, ourline = random.choice(lines)
already.append(ourcount)

checkfile = open(CHECKER, ‘w’)
checkfile.write(‘,’.join([str(inp) for inp in already]))
checkfile.close()

line = ourline.encode(‘macroman’).replace(‘\n’, ”).strip()
os.system(‘%s %s “%s”‘ % (PROGRAM, ARG, line))
[/python]

You absolutely need to encode your texts into MacRoman because Applescript only understands that encoding.
Here the AppleScript:

on run argv
    set smstext to item 1 of argv as Unicode text

    tell application "Skype"
        set message to send command "CREATE SMS OUTGOING +49..." script name "SMS"
        set smsid to item 2 of every word of message
        send command "SET SMS " & smsid & " BODY " & smstext script name "SMS"
        set result to send command "ALTER SMS " & smsid & " SEND" script name "SMS"
        display dialog "SMS send! Text: " & smstext
    end tell
end run

Now you can include the Python script into your crontab. Enjoy.

SCRUM – Agile software development

Category: Management
Tags: , ,

In the area of software development more and more companies switch(ed) to a new way of going thru the process of developing applications. They recognize that old models like the Waterfall-Model are no longer satisfying their needs.

Nowadays a software development process is more and more driven by dynamically changing requirements. This leads to the need of checking early and often if the software still matches the customers’ needs.

When using good ol’ models you are “forced” to have all the requirements defined before you have a project plan. In a world that doesn’t forgive even small delays in the delivery of an application and where the dynamics of global markets lead to frequently changing requirements new ways of developing software has to be found.

In 2001 a new paradigm for such a new way called “The Agile Manifest” has been presented. It emphasized the following

  • Focus on individuals and interactions over tools and defined processes
  • Working software is more important than documentation
  • Close collaboration with the customer versus complex agreements
  • Fast reaction to changing requirements better than blindly complying to the project plan

SCRUM is one of the methods that arised around this manifest (although it existed before). The name is derived from the word “scrumming” and means that a game has to be restarted because of an accidental infringement or if the ball has gone out. This is also applicable in the software where you have a series of controlled development restarts (called sprint). At each restart you check where you stand and if the requirements has changed.

SCRUM understands itself as a framework (and not as a set of rules you have to follow) and consists of the following components

  • Roles (Master, Chicken vs. Pig)
  • Artefacts (Logs, Burndown-Chart)
  • Events (Sprint, Daily SCRUM)

Be aware that SCRUM does not fit for every project or company structure and isn’t the silver bullet for software development management. I’ve been involved in some projects using this method and it boosted productivity a lot. If it fits then you’ll have great benefits if not your project is likely to fail. If you want to switch to SCRUM or something similar make sure to have someone with experience in this area at your side.

You can find a detailed explanation in a document I wrote about SCRUM (German).

Additional Links

  • http://www.scrumalliance.org/pages/what_is_scrum
  • http://agile.dzone.com/articles/modular-agile-loosely-coupled
  • http://www.agilistapm.com/differences-between-waterfall-iterative-waterfall-scrum-and-lean-software-development-in-pictures/
  • http://www.scandio.de/2010/09/scrum-fuer-it-dienstleistungsunternehmen/
  • http://blog.lmrtechnologies.com/2010/07/03/the-moscow-priorization-technique/

repoze.BFG: Example Application

Category: Web-Applications
Tags: ,

Here is a very simple BFG example application that showcases a simple timetracker and various BFG features. This example depends on repoze.bfg 1.2.x and has pinned dependencies. This example is no reference for code and programming style but only gives an idea on how a BFG app looks like.

Features

  • Full fledged python package
  • Declarative configuration (configure.zcml)
  • ZODB as database
  • jQuery enabled interface
  • Demonstrates the use of AJAX
  • repoze.bfg.skins integration
  • repoze.who integration
  • Unit tests

Installation

To install this demo just follow the following simple steps. Make sure to have Python 2.6, easy_install and virtualenv installed!

$ virtualenv --no-site-packages timetracker
$ cd timetracker && mkdir src
$ bin/easy_install PasteScript
$ mv $HOME/timetracker.tar.gz src/ && cd src
$ tar xvzf timetracker.tar.gz && cd timetracker
$ ../../bin/python setup.py develop
$ ../../bin/paster serve --reload timetracker.ini

Open your browser and go to http://localhost:6606/ and log in using admin:admin

Download

Download Timetracker Example Application

Web-Applications with repoze.BFG

Category: Web-Applications
Tags:

At the annual Zope conference in Dresden I gave a talk about a framework called repoze.BFG that eases development of web applications. This talk was backed up by a one day tutorial I gave before the conference.



Copyright © 2010, Simon Pamiés