Posts Tagged ‘Lisp’

DX-Twitter – CL Twitter Interface

July 23, 2013

I have been doing a lot of refactoring of some of my existing projects and dx-twitter was the results of one of those refactoring sessions.

Like the repository says its a “A nearly usefull collection of lisp functions to use twitter api with”.

Well its a little more usefull now because I added a parser that translates tweets to cl objects for you so you don’t have to do the tedious bits of processing twitter stream feeds.

What is missing is some helper functions to handle continous streams from twitter.

As an asside I ended up with dx-oauth “a loose collection of functions to help with oauth”. A lot of the nasty bits where borrowed (with permission) from cl-oauth. dx-oauth focuses on what you need to use oauth with third party api’s like twitter and Facebook.

Yes dx-facebook is next, but I have not had the chance to push it to github yet but it will be there some time this month.

dx-twitter is simple, nothing fancy, but if you have ever tried to use social media api’s like the one for Twitter (or god forbid Facebook) you will know that there are a thousand little gotcha’s when calling api’s with oauth that can make life a missery. Hope fully dx-twitter can safe you some of that pain for the Twitter api.

If it looks a little rough around the edges it is because it is rough around the edges. However it will get smoothed out during the next month as I start using it in a commercial application.

Advertisements

WFX (CL web widgets) – Update

July 23, 2013

So I have not blogged for ages (more than a year, eish it feels like yesterday!), yeah I know it is bad form, but I have been busy. Well its a good excuse, if it means that some existing open source libs where updated and some new ones got birthed.

WFX a widget framework based on hunchentoot and cl-who has been receiving some much needed TLC. It now boasts an ajax grid and a lot of other basic widgets like linked drop downs etc.

Yes we have an ajax enabled acceptor with some functions to make using ajax simpler.

WFX also got some base widgets to help with integrating to html templates bought of the web, so now its easier to integrate that kewl admin template you got for a steel.

The changes have not been merged with the master branch because I am upgrading all my commercial sites with the changes first to make sure that what gets merged into the master is solid.

Yeah I should have kept my trap shut until all the changes where in master but I got excited because WFX will be easier to use now because a lot of the foot work has been done for you.

To make our lives even simpler there is dx-starter-site to help you kick start a site with security etc. but that needs some more work. The big question is do I add db support straight into it because we use xdb2 as our db for everything and I don’t know if that is what people would want. The idea with dx-strater site is that it should contain all the basics you need to start straight in with a web application instead having to do boring logins and other stuff to use out of the box.

If you are curious about the changes to WFX you can have a look at the expand-func branch.

SBCL glibc Error on Ubuntu

June 15, 2012

I use Ubuntu and SBCL for all my lisp development but lately the latest versions of the two have not been playing nicely with each other.

This will effect some of the instructions to install SBCL in my other blogs.

To get around the problem install sbcl in the following manner:

sudo apt-get install build-essential
sudo apt-get install sbcl
sudo apt-get install time
wget http://sourceforge.net/projects/sbcl/files/sbcl/1.0.57/sbcl-1.0.57-source.tar.bz2
bzip2 -cd sbcl-1.0.57-source.tar.bz2 | tar xvf -
cd sbcl-1.0.57-source
sudo sh make.sh
sudo apt-get remove sbcl
sudo sh install.sh

To test SBCL:
/usr/local/bin/sbcl

WFX, XDB2 – Open sourced

June 15, 2012

Most of what I do is web based systems in Common Lisp using Hunchentoot. Over time me and some of my collueges have created one or two packages to help us with this type of development. Some of these we always wanted to open source but never got round to it because we have not had the time to do decent documentation (something of a pet pieve of mine).

However we came to a point where we felt that despite the lack of documentation these packages would be of use to other lispers, so we took the plunge and opened up WFX and XDB2 to the public. Both have a BSD 2 clause license so what and how you do anything with them is your problem.

WFX is a widget framework written for use with Hunchentoot.

XDB2 is a collection of interfaces that you can use as a in memory persistable transaction log with snapshots.

(As time permits I will blog more about these packages, but don’t hold your breath, time has been in short supply this year so far.)

Garage48 :Johannesburg

December 3, 2011

I am taking part the “Johannesburg” Garage48 event which started today. I am using Common Lisp at this event and even though the project I chose to work on is not really ground breaking stuff I am hoping to garner some interest for lisp.

It is going to be tough going because I only learnt about the event this morning and did not have as much time as I would have wanted to prepare, but I think we will do ok.

If you want to follow the event go to www.garage48.org/johannesburg and if you want to follow the progress on our little project go to www.socialvillage.co.za.

May the source be with us!

Hunchentoot 1.2.1 Gotcha

November 15, 2011

So you have been running hunchentoot for ages and got your grubby paws on 1.2.1 (most likely from quicklisp.org) but now your sites are throwing stuff like the following at you:

[2011-11-15 22:17:15 [INFO]] No session for session identifier ‘2:9CA87E6B20EE1E45F2637A82CD267198’ (User-Agent: ‘Mozilla/5.0 (X11; Linux x86_64; rv:7.0.1) Gecko/20100101 Firefox/7.0.1’, IP: ‘127.0.0.1’)
127.0.0.1 – [2011-11-15 22:17:15] “GET /index HTTP/1.1” 404 184 “-” “Mozilla/5.0 (X11; Linux x86_64; rv:7.0.1) Gecko/20100101 Firefox/7.0.1”

Well don’t dispair, you need to change the instances of hunchentoot:acceptor you create to start hunchentoot to hunchentoot:easy-acceptor. This is because all those funky create-*-dispatcher[-*] functions (used by define-easy-handler and maybe you directly) now belong to the “easy-handler framework”.

(Thanx H4ns for pointing that out.)

Hunchentoot Webserver and Application Security

December 22, 2010

I had the opportunity to have the security of the Hunchentoot lisp web server set-up, from the previous post, and a web application using Hunchentoot reviewed by a reputable firm. In short this is what they had to say:

“it would appear that the server administrators should be commended for their network-level hardening of the target system”

Its not a hundred percent clean bill of health because only automated testing was used with some manual interventions to validate the auto testing.

(more…)

Hunchentoot Virtual Hosts with nginx

August 5, 2009

(This posting is dated have a look at https://zaries.wordpress.com/2010/11/09/lisp-web-server-from-scratch-using-hunchentoot-and-nginx/ for a newer approach)

I looked at a couple of options to do virtual hosts with hunchentoot, but eventually I settled on nginx. It might not be the best solution but it does what i need with minimal effort. (I did not have to read and understand the source code to be able to use it or compile it or patch it or any of those nasty things that causes you to pull your hair out trying to remember or repeat it some other time.)

My setup is as follows. I have a vps server that is starting up sbcl in a screen session that loads one instance of hunchentoot. For me to be able to run multiple sites (same file names (NOT SAME FILES)) from the one instance of hunchentoot I used a prefix of the site name to differentiate individual sites. No its not greek.

Example:
http://localhost:8090/my-site/home.html
http://localhost:8090/my-other-site/home.html

(No I am not running huncnetoot on port 80 because that would cause me to pull out more hair.)

These then have to translate to domains like http://www.mysite.com (http://localhost:8090/my-site/) and http://www.myothersite.com (http://localhost:8090/my-other-site/).

I am not going to go into how to setup hunctentoot, there are plenty of tutorials on that subject, thou I would advise going the clbuild route.

Here is how I installed nginx on Ubuntu 9.04.

1. sudo apt-get nginx
(Yes I know it might not be the latest version but it will only serve as a reverse proxy and that part works fine.)

2. sudo gedit /etc/nginx/sites-available/default

I deleted all the stuff that was in there and replaced it with the following

server {
        #The port nginx must listen on
        listen   80;

        #The name of the domain to route
        server_name  www.mydomainname.co.za;

        #To default to the home page from  www.mydomainname.co.za;
        rewrite ^(.*)/$ $1/home.html;

        location / {
            #Where to route the listed domains too...in our case hunchnetoot
            proxy_pass http://localhost:8090/my-site/;

            #Some more config stuff if you want it. This can be moved to /etc/nginx/proxy.conf and 
            #the following line can replace everything up to proxy_buffers:
            # include /etc/nginx/proxy.conf;
            proxy_redirect          off;
            proxy_set_header        Host            $host;
            proxy_set_header        X-Real-IP       $remote_addr;
            proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
            client_max_body_size    10m;
            client_body_buffer_size 128k;
            proxy_connect_timeout   90;
            proxy_send_timeout      90;
            proxy_read_timeout      90;
            proxy_buffers           32 4k;
        }
       
        #This is needed to handle the links to all the images,stylesheets and javascript files 
        #This was also the bit that was missing from all the other examples I found. 
        location /mu-site/ {
                proxy_pass http://localhost:8090/my-site/;
        }
}

server {     
        listen   80;
        server_name  www.myotherdomain.co.za;

        rewrite ^(.*)/$ $1/home.html;
        location / {
            proxy_pass http://localhost:8090/my-other-site/;
        }
       
        location /my-other-site/ {
                proxy_pass http://localhost:8090/my-other-site/;
        }
}

Save and start nginx with sudo /etc/init.d/nginx start.

Now go to your favourate browser and browse for http://www.mysite.com or what ever you used as you domain.

PS: If anybody can give me an example of how to use hunchentoot-vhost to do the same I would really appreciate it.

Lisp Examples Frustration

June 25, 2009

Before I say anything else I have to say that I love LISP and I find the community really help full. I appreciate all the hard work that people put into open source lisp applications that they put out there. I know, I tried it and just never could pull of spending that amount of time on a give back to the community.

So what is my frustration you might ask. Well its the lack of simple yet comprehensive front to back examples by the authors of software. There is no one better to give a simple example than the creator of a piece of software. That person knows what their software can do and what it should not do instinctively. A well though out example can be like a picture, worth a thousand words. A few word with the example would not go amiss either 😉

Such an example is an invaluable tool for the user of the software. Users are just that users. Users don’t want to wade through source code or copious but terse documentation to figure out what is what. Users don’t always have the time or the skill to figure it out on their own but they are still potential users, even potentially loyal users.

Yes the community will eventually come round and do the simple front to back example article, even a couple of them, but I will put money on it that they will pass on some misconceptions via there coding style or their depth of understanding of the subject matter. Those misconceptions or bad practices can cost the new user valuable time and hair.

Please guys don’t skimp on those examples, if nothing else it will cut down on all those “how do I do x?” questions in mailing lists etc.