Quantcast
Channel: Soy Clone
Viewing all 50 articles
Browse latest View live

chess widget

$
0
0
A new feature at chesspark is a game viewer widget. So that you can embed chess games in a blog post or web page. This game is one I recently lost (which I do a lot). Of course you can also download the PGN, but the game viewer is cooler. :) There are gonna be many more features for sharing games and chess info. One is embedding live games and chat in a widget similar to this.



If you can not see this try http://thetofu.com/chess.html for the same example.

Frank the bot post

$
0
0
It has been awhile since I have logged into the livejournal jabber server. I should go look at the state of djabberd too. :)

Punjabi MC

$
0
0
I am testing and getting the newest punjab in subversion ready for release. I will mention the improvements when I make the announcement. I like blogging via my xmpp client. I am thinking about moving my blog, where should I move it to?

Attention, the release level is at orange.

XMPP and Chess

$
0
0
Last night http://chesspark.com released a new web interface to our XMPP based chess server. We also have a new way to get a game with a redesigned, notification based, game finder. You can still get a game with the old ways too. :) In the near future their will be documentation on the technology and protocols we use. Lots of the XEPs like MUC, BOSH, and Pubsub. Also, I hope to blog more about that when I get a chance. For now, go play a game and have fun!

Twisted Words XMPP Component Example

Posted using LJ Talk...

KISS or The Simplification of Punjab

$
0
0
It has been seven weeks since I have updated this. :( That is not good. Anyway, to remedy this problem I am gonna document some problems I am currently in the process of solving. The first one, is the complexity of Punjab. Punjab is a HTTP XMPP connection manager. It provides a way to use Jabber or XMPP via HTTP.

Currently, punjab provides a SOAP, XMLRPC, HTTP Polling, and BOSH frontend to XMPP servers. The only one that works well is BOSH. The others have been a chore to maintain.

Because of this, I am gonna cut down on what Punjab 1.0 will be. Here are the steps for the KISSification of Punjab. :)

1. Make the requirements to run punjab the current version of twisted and twisted words. (Backwards compatibility is out the door till later.)

2. Focus on just BOSH. Clean up the code and the session interface to just do BOSH.

3. Write tests to make sure Punjab is 100% BOSH compatible.

4. Make a 1.0 release.

Please make comments below if you have any thoughts on this. After those 4 steps are made, each 'new' thing in Punjab will try to be as simple as it can. Current thought is a JSON version of BOSH.

NOTE: as of now #1 is done. The rest will be other posts.

Tweet Roll for Charleston

$
0
0
Hey, someone put a tweet roll for Charleston micro bloggers. I call it a tweet roll because it is like a blog roll but for twitter. :)

So, all you lowcountry folk check it out! http://twitter.com/chasbloggers

Tooting a horn

playing chess with a livejournal account

$
0
0
Someone asked about using Chesspark with other XMPP or Jabber accounts and I thought I would make a quick post on how to do it with livejournal. Any XMPP account will work the same as livejournal, so you do not have to limit yourself.

First, if you have a livejournal account, you will need to create a Chesspark account using your livejournal username.

See the following urls :
http://www.chesspark.com/faq/#general-5
http://www.chesspark.com/join/

I used this one, so the username I put in the form field was thetofu@livejournal.com
Note the '@livejournal.com' , you will need to add this when creating and logging into the account.

Now here is the only part where it may get confusing. You have to enter a Chesspark password. This can and should be different from your livejournal password. It is used to access the Chesspark website and not the live game server. This will be changed soon and support for openid is in the works. So fill in your Chesspark password, but remember to use your livejournal password on the next part.

Next we want to play some games. To get to the live game server you can use the web or download a client.
Web: http://www.chesspark.com/play/
Download: http://www.chesspark.com/download/

Going to the play url or starting up the Chesspark application you will be presented with a login screen.
Here you will enter your full livejournal username and password. ( NOTE: not your Chesspark password from above).

So, I enter thetofu@livejournal.com and my livejournal password and I am off! Playing Chesspark with my livejournal account!

So, how does this work? Well, Chesspark is XMPP based and can communicate with other XMPP chat servers. Livejournal has XMPP chat and when you log in with a Chesspark client you are actually logging into livejournal.com. After that you can communicate via livejournal to Chesspark and do anything you like as if you were on the Chesspark server.

I hope this helps and have fun!

BOSH Cloud

$
0
0
We all know that ejabberd is cool and erlang is extremely scalable. Facebook even decided to use erlang for their new chat system! Even with all of that, I want to write about an alternative. :) I am not gonna compare numbers and benchmarks. This post will lack data and statistics for all of that. I am just gonna describe a system thats implemented, in production, and works well. It is the story of the BOSH Cloud.

First, XMPP is a standard protocol for presence based applications, namely IM chat. It is growing in use, even as I type this blog entry. Web based chat can be done using XMPP with some help. The help comes from an extension to the XMPP standard called BOSH. BOSH solves the problem of implementing something that requires state, over a stateless protocol like HTTP. (Ejabberd has a BOSH implementation) Anyway, the question is, 'what is a BOSH Cloud?'

The answer is that it is a set of Amazon Ec2 instances used to provide a scalable BOSH connection manager. You have a HTTP load balancer up front and you can create as many BOSH instances based on your scaling needs on the back end.

To create one of these you will need the following:

Ability to create Amazon Elastic Compute Cloud (ec2) images and instances.
Punjab
Nginx


What we have here is a recipe to implement a BOSH connection manager and do simple round robin scaling. Ngnix provides the load balancing and Punjab provides the BOSH implementation. To scale, you run them on Amazon's elastic compute cloud.

To start, you will need an amazon web developers account and know a bit about ec2.

http://developer.amazonwebservices.com/connect/kbcategory.jspa?categoryID=84

This implementation starts with a basic debian image. Installed on this image is Python, Twisted, Nginx, and Punjab. There is plenty of good documentation on how to build an ec2 image on amazon's web site. Once we have the applications and their dependencies built we will need to configure them before we build a new image.

Lets start with what is up front, Nginx. This will be our simple round robin load balancer. The configuration will look something like the following : (values will vary based on your needs)
user www-data;
worker_processes  4;

error_log  /var/log/nginx-error.log;
pid        /var/run/nginx.pid;

events {
    worker_connections  4096;
}

http {
    include       /usr/local/nginx/conf/mime.types;
    default_type  application/octet-stream;

    access_log  /var/log/access.log;

    sendfile        on;
    
    proxy_read_timeout 300;
    
    keepalive_timeout  65;
    tcp_nodelay        on;

    gzip  on;
    # ... some other stuff

    upstream punjab {
        ip_hash; # needed to make sure ips stay on the punjab server used by the connection
        server punjab0.yourdomain.com:5280;
        server punjab1.yourdomain.com:5280;
        server punjab2.yourdomain.com:5280;
        server punjab3.yourdomain.com:5280;
        # .... and so on
    }


    server {
        listen       80;
        server_name  localhost;

        # ... other config options 

        location /bosh {
               proxy_set_header Host $http_host;
               proxy_set_header X-Real-IP $remote_addr;
               proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
               proxy_pass http://punjab;
        }
    }


Nginx could also serve static files or your chat client. Nginx has a very small foot print and is fast. The main thing about this configuration example is the nginx load balancing. NOTE: you will NEED the ip_hash directive in order to have the same ip use one punjab. Otherwise it will be disconnected.

Next we configure punjab with the basic .tac file that comes with punjab.

# punjab tac file
from twisted.web import server, resource, static
from twisted.application import service, internet

from punjab.httpb  import Httpb, HttpbService

root = static.File("./html")


#b = resource.IResource(HttpbService(1, use_raw=True))
b = resource.IResource(HttpbService(1))
root.putChild('/bosh', b)


site  = server.Site(root)

application = service.Application("punjab")
internet.TCPServer(5280, site).setServiceParent(application)


You may also want to use dynamic DNS and set your punjab domains when instances start up. The following script will do that.


#!/bin/bash
USER_DATA=`/usr/bin/curl -s http://169.254.169.254/latest/user-data`
# hostname is the first available value
HOSTNAME=`echo $USER_DATA | cut -f 1 -d , | cut -f 2 -d =`
hostname $HOSTNAME

MYNAME=`/usr/bin/curl -s http://169.254.169.254/latest/meta-data/public-hostname`
cat<<EOF | /usr/bin/nsupdate -y ddnskey:yourddnskey
server ns.yourdomain.com
zone yourdomain.com
update delete $HOSTNAME.yourdomain.com CNAME
update add $HOSTNAME.yourdomain.com 60 CNAME $MYNAME
send
EOF




Now that those are configured, you can build your image. Once you have the images, the magic can happen. :)

So first we start an instance and run nginx.

ec2-run-instances -d "hostname=www"

This will start up one instance and if the script above is executed it will take the user data given and create.

www.yourdomain.com

Which will load balance to the punjab instances.

You can have nginx start up on boot with the above configuration and you are almost there.

Start up the Punjab instances.
for i in 0 1 2 3; do
   ec2-run-instances  -d "hostname=punjab$i" 
done



This will start up 4 Punjab Amazon instances and if your server start up scripts run punjab on boot, you will be up and running. You can scale as you like by starting up new instances or taking down old. You can have a script to reconfigure nginx and then HUP it to add the new instances to the load balancing pool.

I will note that there are things left out, namely the Javascript BOSH client. You are welcome to leave questions in the comments or leave them as exercises for your enjoyment. :) That is it for a basic BOSH setup using Amazon ec2 and python or a "BOSH Cloud" . You can also do this with ejabberd and erlang.

WuChess

Beards

Palmetto Open Source Software Conference

$
0
0
As some of you know I live in Charleston, SC. Likewise, you may know that South Carolina is not necessarily known as a technical state. The amount of software/engineering jobs are not the same as other states. Similar with technical students and people. That said, I went to the Palmetto Open Source Software Conference on Weds July 30th 2008. It was a one day conference at the University of South Carolina and I was pleasantly surprised.

The conference was well done, and apparently the concept and idea came about 3 months ago. So, with 3 months planning and a first year conference, it was very well done! The turn out was better than I imagined too. Being a developer/contributor of open source projects, I was in the minority, but there were plenty of people excited about open source and using it. All of the speakers were great and presented well. You can get a list at the website. http://posscon.org/ This post is not about the specifics of the conference but the themes that seemed to be throughout each of the presentations and informal discussions.

One theme in the conference seemed to be pragmatic approaches to solving problems, be it business problems or just software problems. People wanted to use and used open source because it solved their problem and solved it well.

Another theme was "openness", being open in the way you do business, working with businesses and the open source community, and "open", in giving your employees the ability to improve your business, and the way they do work, by encouraging them to be curious and contribute or use open source.

And last, how does South Carolina find these kinds of employees. Ones that can solve problems, have a curiosity and can do most anything you ask of them (jack of all trades). The last theme or topic that was discussed brought questions on how to help students and others in South Carolina to be curious and excited about technology, solving technical problems, and using open source, to enrich and encourage that.

These are all old topics and nothing new, but pragmatic and open technical solutions are definitely the way to go, and seeing companies and programmers start to think this way is very very encouraging for South Carolina! I just wish more of them knew what XMPP was. :)

Thanks to everyone involved and for starting this important topic of conversation in South Carolina!

I definitely recommend everyone in South Carolina and the surrounding areas to go back next year!

WuChess Video Contest

Twisted XMPP

Baseball and Chess

$
0
0
In sports, or any competition, we always want to know who is the best. Also, we want to know who has the best chance to win the game. Some of us always want our favourite player or team to win. But knowing their chances may help with the expectations that may bring heartache or joy or a wager we may have with a friend.
There are many ways, statisticians and mathematicians have come up with, to determine outcomes and strengths of players or teams. One way, in Chess, is finding a players rating by a rating system. At Chesspark, we use a variation of the Glicko rating system. I have always wondered if this rating system would work well with team sports. So, being that I love baseball, I did some research (google search) on baseball and chess ratings. What follows, is a my first experiments in using glicko atings to determine game outcomes and finding the strength of a team.

First, I could not find any information on baseball and Glicko. I did find some on ELO and baseball. There is a site that does ELO ratings on soccer (football) teams as well. ELO and Glicko are rating systems used in Chess or other games involving two players. Team sports do not necessarily use these methods to determine the outcome of the next game. Baseball has a well known method called the Pythagorean expectation. It uses what the teams have done in previous games to determine the outcome. It uses runs scored and runs allowed. You can use this equation in other sports too. I would like to compare ratings versus the Pythagorean expectation and also investigate combining the two.I gathered data from http://www.retrosheet.org. Wrote a python script to parse the data, and compute the ratings. I will release code in upcoming blog posts. Using the script and data we can calculate the final ratings of teams at the end of the season. The results are interesting.

Glicko Rating results for the Major League Baseball 2007 Season:

====================== teams by rating ==========================
team                           rating  rd         total wins - losses 

New York Yankees               1580.0  28.465171  162   94   - 68 
Boston Red Sox                 1571.0  29.260524  162   96   - 66 
Cleveland Indians              1564.0  28.649712  162   96   - 66 
Los Angeles Angels of Anaheim  1562.0  28.888047  162   94   - 68 
Arizona Diamondbacks           1537.0  28.440955  162   90   - 72 
Colorado Rockies               1534.0  28.165939  163   90   - 73 
Detroit Tigers                 1533.0  28.574597  162   88   - 74 
Seattle Mariners               1532.0  28.210795  162   88   - 74 
Toronto Blue Jays              1529.0  28.210438  162   83   - 79 
Philadelphia Phillies          1529.0  28.447520  162   89   - 73 
San Diego Padres               1523.0  28.317698  163   89   - 74 
New York Mets                  1510.0  28.604631  162   88   - 74 
Los Angeles Dodgers            1505.0  28.615645  162   82   - 80 
Minnesota Twins                1495.0  28.312780  162   79   - 83 
Atlanta Braves                 1494.0  28.618743  162   84   - 78 
Chicago Cubs                   1494.0  28.402241  162   85   - 77 
Oakland Athletics              1488.0  28.395109  162   76   - 86 
Texas Rangers                  1487.0  28.586974  162   75   - 87 
Milwaukee Brewers              1474.0  28.445591  162   83   - 79 
St. Louis Cardinals            1464.0  28.453097  162   78   - 84 
Washington Nationals           1462.0  28.858994  162   73   - 89 
San Francisco Giants           1462.0  28.315478  162   71   - 91 
Chicago White Sox              1461.0  28.461948  162   72   - 90 
Kansas City Royals             1461.0  28.856424  162   69   - 93 
Baltimore Orioles              1460.0  28.501870  162   69   - 93 
Tampa Bay Rays                 1450.0  28.742325  162   66   - 96 
Houston Astros                 1448.0  28.453125  162   73   - 89 
Cincinnati Reds                1442.0  28.818955  162   72   - 90 
Florida Marlins                1438.0  28.412856  162   71   - 91 
Pittsburgh Pirates             1424.0  28.681253  162   68   - 94 


NOTE: This is a great example on how close in skill professional baseball teams are.


Now, lets take a game from the 2007 season and determine the outcome via glicko and the same percentage via the Pythagorean expectation. I will use Atlanta Braves games since they are my favourite team. Lets take the 42nd game Atlanta played. This game was versus the Boston Red Sox who was a high rated team all year.

NOTE: This determination is very simplistic and missing some steps, a more in-depth example may follow in other blog posts.

Boston had a record of 29 - 12 (Winning percentage 70.7%)
Atlanta had a record of 25 - 17 (WP 59.52%)

2007-05-19 ATL 1529.0 vs. BOS 1675.0

2007-05-19 ATL 52.562% vs. BOS 72.554%

By rating, Boston should win, they are the strongest. The chance for Atlanta to win is about 47.7%. The outcome of the game was Boston 13 and Atlanta 3. Boston crushed them. Before this, Atlanta split a series with Washington, a very weak team.

By winning percentage, we see that Boston's real percentage is lower than what their percentage should be and we see that Atlanta's real percentage is higher than the determined one. Using that we see that Boston is favoured to win unless luck comes into play.

Both methods show Boston being the favourite, but 10 runs seems too much. :)

Determining the actual chance that Boston will win is a bit more complicated than the above example, with both methods. It is easy to see that using each way shows that Boston is stronger and should win the game, and they did. You can also use other statistical methods to determine how many runs both teams could score and use that to help with determining the outcome. I want to find if I could use ratings to help or replace some of these.I believe ratings is a great indicator of how strong the team is right now (or at the moment) and is a simpler way when looking at strength of schedule and other factors in finding out who will win a series or finish first in the standings.

In posts to follow, I hope to start predicting the outcome of current games, and developing a system to make this easier for me and others. I plan on using XMPP, Pubsub and BOSH. I also want to investigate finding a pitcher or batter's rating using glicko. After that, who knows.


The baseball information used here was obtained free of charge from and is copyrighted by Retrosheet. Interested parties may contact Retrosheet at "www.retrosheet.org".

Punjab, the BOSH of Choice.

$
0
0
It has been a long while since the last Punjab release. But I am happy to announce that Punjab is now at version 0.13. This release has many changes.

First, there was a massive code clean up and removal. XMLRPC, SOAP, and HTTP Polling are no longer supported and have been removed. Also, versions of Twisted older than 2.5 are no longer supported. Similar, versions of Twisted Words older than 0.5 are not supported.

Second, speed increases have been made to the handling of xml and requests. There have been code improvements and protocol support fixes. There are protocol and unit tests too.

Also, Version 1.0 is close and should be out very soon.

Finally, in order to answer 'Which BOSH server do you need?'. Look for examples and demos of strophe and other software and technology using Punjab! These examples will be on here and the Punjab home page.

Speeqe about it.

$
0
0
One thing I do everyday is group chat via XMPP. There are lots of ways to do this, via many xmpp clients. If I am on my laptop or computer then having a client works out well. I can chat to my hearts content.

Often, a problem that comes about, is if I am away, and I need to communicate via a chat room, what do I do? I could use a remote computer and a command line XMPP client or I can use Speeqe.

Speeqe is a web based chat creator, you can create and theme your own chat rooms! There are many ways to use Speeqe for various different things, but the solution to my problem, I find very useful, is that you can connect to other chat rooms on the federated XMPP network.

To do this you can use the url trick, for example:

Jabber Development Room

http://speeqe.com/room/jdev@conference.jabber.org/

Charleston Linux Users Group

http://speeqe.com/room/csclug@conference.butterfat.net/

You can just start chatting anonymously or login via a XMPP account.

This trick, and the other things you can do with Speeqe, are cool, but best of all it does not end there. Speeqe is open source!

You can use and add features to Speeqe and the possibilities become endless. :)

The neat thing is it already uses open source software. It uses Strophe, Punjab, Palaver, Apache, and Django.

It can be set up to use any XMPP server and any Multi-User chat implementation. It is very flexible.

More examples of setting up and using Speeqe are sure to come!

Look forward to the official release of Speeqe!
Viewing all 50 articles
Browse latest View live




Latest Images