I finally added OAuth to TwiX, the Twitter-XMPP gateway.
Since August 2010 Twitter requires OAuth for API access. This is extremely stupid for background daemons like TwiX which do not have a user interface and especially no browser based UI.
TwiX is my C# playground. So, I needed an OAuth library for C#. TwiX runs on mono and .NET. I am running my instance of TwiX on a Linux server. Luckily almost all .NET libraries run without modification on mono.
A quick research returned several OAuth libraries, some are for ASP.NET, which I do not use, because TwiX is a faceless server daemon, not a Web application. I zeroed in on Shannon Whitley's implementation which comes with a handy sample project.
This example project has
- an OAuth core implementation
- a Twitter OAuth adapter
- a sample desktop app with embedded browser
= cool thing
I used the 2 OAuth classes in TwiX and converted the sample desktop app into a Twitter OAuth token generator tool (see screen shot). 1 hour of work, thanks Shannon.
This is a general Twitter token generator. It is not just for TwiX. The OAuthTwitterDesktopTool generates a twitter token and token secret for every Twitter app, if you know the app's consumer key and consumer secret. The OAuthTwitterDesktopTool is part of the TwiX distribution.
You can find TwiX with OAuth and the token generator on the TwiX homepage.
_happy_authorizing()
2. Januar 2011
OAuth for TwiX
1. Dezember 2010
Science Fiction Comes True
This looks like an image from a Science Fiction movie. But it is not. It is reality.
The image shows a real astronaut in a real space station and a real earth through real windows.
We see astronaut Tracy Caldwell Dyson inside the cupola of the ISS space station. The cupola has been installed during Space Shuttle mission STS-130 on 15 February 2010. It is the largest window ever deployed in space.

_happy_spacing()
19. Oktober 2010
About the Open Virtual World Client Scene Graph
Over the last 2 months I was programming a Scene Graph module for the the Open Virtual World client in C++ with Cairo.
More at the Open Virtual World blog.
_happy_graphing()
Labels: Avatar, C++, Code, Virtuelle Präsenz
26. September 2010
A Website Chat made easy with XMPP and BOSH
A description of the live chat feature on http://avatar.lupuslabs.de/contact.htmlToday we can use XMPP and BOSH and let the web page talk to my GTalk client, which runs all the time anyway.
- ejabberd XMPP server with BOSH
- Strophe JavaScript XMPP library
- jQuery JavaScript utilities
- Apache web server as BOSH proxy
- Google Talk or any other Jabber client
% {auth_method, internal}. % disabled
{auth_method, odbc}. % enabled
{odbc_server, {mysql, "localhost", "ejabberd", "mysql-user", "mysql-password"}}
{access, register, [{deny, all}]}.
% a2enmod proxy% a2enmod proxy_http
ProxyPass /xmpp-httpbind http://127.0.0.1:5280/http-bindProxyPassReverse /xmpp-httpbind http://127.0.0.1:5280/http-bind
ProxyRequests Off
<script type="text/javascript" src="jquery-1.4.2.min.js"></script><script type="text/javascript" src='strophe.min.js'></script>
var conn = new Strophe.Connection('/xmpp-httpbind');
conn.connect('test@wolfspelz.de', 'secret', OnConnectionStatus);
function OnConnectionStatus(nStatus){if (nStatus == Strophe.Status.CONNECTING) {} else if (nStatus == Strophe.Status.CONNFAIL) {} else if (nStatus == Strophe.Status.DISCONNECTING) {} else if (nStatus == Strophe.Status.DISCONNECTED) {} else if (nStatus == Strophe.Status.CONNECTED) {OnConnected();}}
function OnConnected(){conn.addHandler(OnPresenceStanza, null, "presence");conn.addHandler(OnMessageStanza, null, "message");conn.send($pres());}
function OnMessageStanza(stanza){var sFrom = $(stanza).attr('from');var sType = $(stanza).attr('type');var sBareJid = Strophe.getBareJidFromJid(sFrom);var sBody = $(stanza).find('body').text();// do something, e.g. show sBody with jQueryreturn true;}
function OnPresenceStanza(stanza){var sFrom = $(stanza).attr('from');var sBareJid = Strophe.getBareJidFromJid(sFrom);var sType = $(stanza).attr('type');var sShow = $(stanza).find('show').text();// do something, e.g. show status icon with jQueryreturn true;}
There is a patch, which allows for synchronous connection closing. The patch must be applied to the strophe.js file:
diff --git a/src/core.js b/src/core.js
index 5aeb06a..f79ae29 100644
--- a/src/core.js
+++ b/src/core.js
@@ -2161,7 +2161,8 @@ Strophe.Connection.prototype = {
req.date = new Date();
try {
- req.xhr.open("POST", this.service, true);
+ var async = !('sync' in this && this.sync === true);
+ req.xhr.open("POST", this.service, async);
} catch (e2) {
Strophe.error("XHR open failed.");
if (!this.connected) {
this.conn.flush();
this.conn.sync = true; // Set sync flag before calling disconnect()
this.conn.disconnect();
Of course, all these functions and callbacks should be prototype based and bind the instance to the closure. We should also use a model-view architecture and handle the protocol stuff in the model, while notifying the view of really important events.
- contact.html - the "driver" which loads everything and produces the GUI
- model.js - the model does it, classes: Model, Room, Participant
- view.js - the view shows it, the view registers listeners with the model
- utils.js - utility classes, logging, unit test, oberver pattern
- config.js - configurations for test and production
- setup.js - selects the appropriate configuration
- style.css
- lib/strophe.js - including the above patch
- lib/jquery-1.4.2.min.js
- lib/jquery-ui-1.8.5.custom.min.js
Labels: Code, Jabber, Javascript
11. September 2010
Service URLs should be Immutable
Service URLs are URLs where you (the client) expect a service. No surprise. Examples:
- the URL of a SOAP WSDL is a service URL,
- the REST URL of the Twitter timeline API: http://twitter.com/statuses/friends_timeline.xml,
- name or URL of AJAX scripts of a web site,
- a chat room URL provides a software bus service.
- combine host name and path to URLs
- append or decide on filename extensions
- append query parameters
- decide the protocol
- insert or remove port numbers
- decide the protocol (http vs. https) in AJAX clients for JS security reasons,
- replace query arguments by treating the service URL as a template,
- append URL parameters if (and only if) the service protocol consists of URL parameters (thanks Allan)
- (any other exceptions?)
Labels: Coding Rule
16. August 2010
Stellenausschreibung Softwareentwickler/in
- Selbständige Projektarbeit in einem Scrum- Team
- Objektorientierte Analyse und Entwurf
- Entwicklung von webbasierten Anwendungen und Webservices
- Aktive Teilnahme an modernen agilen Entwicklungsprozessen
- Erfahrungen im Bereich objektorientierter Entwicklungsmethoden
- Sehr gute Programmierkenntnisse in einer der Sprachen Java oder C++ oder C# oder PHP. Gute Programmierkenntnisse in einer der anderen Sprachen
- Sicherer Umgang mit CSS, JavaScript, XML, DOM/DHTML, Subversion, Webservices, MySQL und Entwicklungsumgebungen
- Kenntnisse agiler Entwicklungsmethoden wie Scrum und Unit-Testing
- Idealerweise Erfahrung mit moderner Programmiermethodik wie TDD, SOLID, DRY, KISS
- Abgeschlossenes Hochschulstudium der Informatik, Naturwissenschaften, Ingenieurwissenschaften oder vergleichbare Qualifikation mit mindestens einjähriger Berufserfahrung
- Sehr gute Deutsch- und gute Englischkenntnisse.
Labels: Jobs
15. August 2010
Entwickler Kennenlernen
Bei Startups ist das Team meistens klein. Da
hängt der Erfolg des Unternehmens von jedem Einzelnen ab. Deshalb versuchen wir
immer wieder ein starkes Team zusammen zu stellen, das alle
Entwicklungsherausforderungen meistern kann.
Java, C#
MySQL
HTTP
HTML/CSS
SOAP
XMPP
JSON
OAuth
TCP/IP
boost, STL
Eclipse
CVS, Subversion, Git
Win32, MFC, COM, XAML
3D-Engines, welche?
Selenium
PHP, Python, Ruby on Rails, Perl
MS SQL Server, Oracle
XML
JavaScript
REST
Ajax
COMET, BOSH
Objective-C , Scala, Groovy, Erlang
C, C++
gcc
Profiling
EC2, S3, SQS
wxWidgets, Qt, Gtk
Maven, Ant, Hudson/Jenkins
Spring, Hibernate
Javascript Libraries, jQuery, ExtJS, andere?
Netzwerk Programmierung, sockets, andere?
Concurrency, Mutex, pthread, andere Thread-APIs?
Assembler, welche?
DevStudio, welche Versionen?
Text Editoren, was verwenden Sie zum Programmieren/Scripting?
Web-Server, Application Server, Tomcat, Apache, andere?
Template Engines, welche?
Caches, Memcache, Redis, Terracotta, andere?
Browser Extensions, für welche Browser?
Unit Test Frameworks, JUnit, NUnit, andere?
Logging Frameworks, log4net, log4j, andere?
Agile Entwicklung
TDD
BDD
SOLID
DRY
MVC
Refactoring
Unit Tests
Automatisiertes UI Testing
Automatisierte Integrationstests
Code Coverage Analyse
Coding Conventions
Frequent Releases, wie "frequent"?
Pair Programming
Software Design Patterns
Scrum als Developer, Scrum Master, PO
Refactoring- und Coding-Werkzeuge in Entwicklungsumgebungen
Haben Sie Computer zuhause?
Welche(s) Betriebssystem(e)?
Einen Rechner oder ein Netzwerk?
Haben Sie eine Website? welche URL?
Bloggen, Twittern Sie oder benutzen Sie andere Social Networks?
Können Sie Linux installieren und verwalten? Welche Distribution?
Auf welchen Plattformen programmieren Sie? Windows, Mac, Linux, iOS?
Haben Sie Cross-Plattform Erfahrung?
Programmieren Sie gerne?
Programmieren Sie viel? wie viel? gut? sehr gut?
Haben Sie an Open-Source Projekten mitgearbeitet? welche?
Gibt es öffentlich zugängliche Projekte? URL?
Können Sie Code oder andere Arbeitsproben zeigen?
Labels: Agile Development, Code, Startup