The writings of Peter Stuifzand

Archive for August 2009

HTTP requests are send by clients to servers. Most of the time the client is a webbrowser. The only thing that WebHooks says is this: servers are clients, too.

WebHooks have nothing to do with realtime updates or with sending HTTP requests to browsers. It's about servers sending HTTP requests to other servers when something happens.

At the moment I work from another place than home and sometimes I need to get on the internal network. Normally you would VPN for that kind of thing. But if your not scared to use SSH then it's not that hard.

First you need to open a connection to your internal network.

ssh -D 9000 hostname

The -D 9000 option will open a port and create SOCKS proxy on your local machine. This allows you to send traffic to the internal network through the SSH connection. Replace hostname with the name of the host you want to connect to.

Then you have to configure Firefox (or another browser) to send all its traffic through this proxy. You can do this in the Preferences screen. In the Preferences screen you go to Advanced, Network, Connection. Click the Settings button. This will open a screen that allows you to set all kinds of proxies. To use the SOCKS proxy you need to click the label that says 'Manual proxy configuration'. Then fill in the text field called 'SOCKS Host' and set the port to 9000. Click OK and check that you still have an internet connection.

Proxy Settings

If everything still works, you should try to open the internal webpage. If it doesn't work, then you should reset it to the original settings.

If your internal network uses a domainname with a virtual host then you should add the domains to your local /etc/hosts file. The ip address that you use should be set from the POV of the host you connect to: 127.0.0.1 is not your local machine, but the machine you connected to.

My GreaseMonkey script for TinyThread is not very useful anymore. The design has been changed to look a bit nicer. It's good to see the changes were mostly functional.

This also means you can remove the GreaseMonkey script from your browser.

TinyThread is a simple website that will make it easier to have a conversation. You can login using OAuth with your Twitter account. When you start or join a conversation it will send a tweet to your followers so they can see where you're talking about.

But TinyThread is a simple website with simple styles. That's why I created a small GreaseMonkey script that adds a little bit of style to the thread page.

I based these styles on the work done by @irwin. I however did tried to keep it a bit more like the original style, by using blue and purple links.

I'm not sure what to say. FriendFeed is an amazing service for sharing and commenting on stuff. And now they are acquired by Facebook. I'm not sure what will become of this. But it doesn't feel good.

At last I have found the function that will replace many spaces with one space. I first wrote a blog post about this in januari of 2007. Then I wrote a blog post about how to enhance this function to move the cursor one position after the inserted space. With an update a day after that, which said that it didn't work in some instances.

Today I'm proud to announce the final and working function that works as it should.

I created this function with help from Al on StackOverflow.

Temporary data is a simple pattern that I use while I'm trying to get some code working. The inverse of Temporary data is that you get the data, for example, from a database.

The code you have to write to get the data from the database is often many times as long as the code you need to specify the data structure.

my $languages = [
    { code => 'nl', name => 'Nederlands' },
    { code => 'en', name => 'English' },
];

If you would like to get this same data structure from your database you have to do a lot of work before this works. You need to design and create a table, fill the table with example data and write code to retrieve the values from that table.

By using this small data structure you can easily start prototyping the interface and the design of page you're working on.

After you're done prototyping, designing and coding you can refactor these four lines and replace them with:

my $languages = $db->get_languages();

Related to the simplest thing that could possibly work.

Today I will post some links to other pages that talk about Vim outliner.

The potatoes are ready now.

Potatoes

I was trying to find some ways to increase the speed of my webshops, because speed matters.

I did this by using the YSlow Firebug add-on. It told me that I didn't gzip some of my static files. That seemed strange to me because I already enabled gzipping in my nginx.conf.

I used curl and Firefox to find out if my files where gzipped. It seemed they weren't. So I changed my gzip settings in nginx.conf to the following on my development server. (Source).

# output compression saves bandwidth
gzip  on;
gzip_http_version 1.1;
gzip_vary on;
gzip_comp_level 6;
gzip_proxied any;
gzip_types text/plain text/html text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;

# make sure gzip does not lose large gzipped js or css files
# see http://blog.leetsoft.com/2007/7/25/nginx-gzip-ssl
gzip_buffers 16 8k;

# Disable gzip for certain browsers.
gzip_disable "MSIE [1-6].(?!.*SV1)";

This in itself apparently didn't enable gzip compression. So I had to look further. It seemed that gzip compression won't be shown for files which are already cached. By disabling the cache for a bit I saw that my files were gzipped, but that it just wasn't shown. Again a problem solved.

View archived entries