A blend of programming and seo

Posts from — May 2009

Programming languages you never knew existed

I have compiled a list of interesting programming languages from around the Internet. If anyone has any more to add to this list, let me know.

ALPACA – a meta-language for programming arbitrary cellular automata
Aura – a brainfuck descendant
Arbol [1] – a small functional programming language
Argh! – A fungeoid with complex data storage
B5 – a functional macro processor
BFM – a brainfuck variant with macros
BIT – where the basic types are the bit and the address-of-a-bit
Braincopter – an image based brainfuck clone
brainfuck – designed to have the smallest compiler ever
Bub – a brainfuck variant
C- – a fictional joke language
C-P-L – a language in which a non-comment is a syntax error (but on the plus side, all styles of comments are supported, and comments may be arbitrarily nested).
Dis – a variant of Malbolge
DOGO – a fictional joke language
Doublefuck – an extended version of brainfuck
FIFTH – a fictional joke language
FiPL – Fish Programming language (half-joke, a parody on programming language paradigms)
HELP – HELP stands for Hellish & Esoteric Language for Palm
Hunter – a language related to noit o’ mnain worb and RUBE
Homespring – an excessively high-level language, where the instructions are English
sentences based around the metaphor of a mountainside river.
Illgol## – a variant of ILLGOL
Java2K – a probabilistic language
l33t – inspired by brainfuck and Beatnik, source code is entered as ‘l33t 5p34k’
Mycelium – a 2-dimensional image based language where the code is read from a png image
Nietzsche – a hexadecimal language
Obfuna – single character instructions for unary operations
Orthagonal – a two-dimensional stack-based language
Piet – an art-based programming language
Q-BAL – a queue-based language
RUBE – not quite a cellular automaton
SMITH# – described as “the future of GOTO”
snobol – StriNg Oriented symBOlic Language
Spoon – a brainfuck derivative
TWiRQ [12] – a two-dimensional language
UNITY – a programming language without program flow.
Unlambda – Your Functional Programming Language Nightmares Come True
URISC – a machine with only one instruction
Whenever – a language with no sense of urgency
Whitespace – only spaces, tabs and newlines are considered syntax
Wiki – whose programs consist of machine code encoded as Wikipedia articles.
Winter – mediaWiki scripting language

May 28, 2009   3 Comments

How to survive the digg effect

If you have a wordpress blog and have gotten to the front page of digg, you may have seen the following error message:

wordpress error

This is usually caused by a large amount of traffic that is overloading your database (because each page that is loaded requires a query or multiple queries).

A great way to not only improve the speed of your entire blog, but help prevent the above error from occuring is to install a plugin called WP-Cache.

Installing

Installing is pretty easy and straight forward:

  1. Upload to your plugins folder, usually
    wp-content/plugins/

    and unzip the file, it will create a

    wp-content/plugins/wp-cache/

    directory.

  2. If you have Gzip Compression enabled turn it off (in Options->Reading).
  3. Activate the plugin on the plugin screen.
  4. Go to “Options” administration menu, select “WP-Cache” from the submenu, the plugin will try to autoconfigure everything. The plugin will try to autoconfigure everything and guide you through the process. In case of failure –normally due to the lack of files’ privilegies– it tell you and give the instructions to solve the problems.
  5. A way to make things even faster is to enable gzip compression for wp-cache. It can done by doing the following: (within wp-cache-phase1.php) add the following line: if ( extension_loaded(’zlib’) ) ob_start(’ob_gzhandler’); before this line: foreach ($meta->headers as $header) {

The wp-cache wordpress plugin can be downloaded here

May 27, 2009   1 Comment

a web server in php

Have you ever wanted a web server written entirely in PHP? Now you can with nanoweb. A project like this really shows the power of the PHP language.

Features

  • HTTP/1.1 implementation
  • Keep-alive connections and cache helpers
  • Modular architecture
  • CGI and Server side includes support via included modules
  • Name based virtual hosts
  • Authentication support
  • Error documents
  • MIME support
  • gzip content encoding
  • PHP support
  • Many other modules

Performance

A report here states the following: “nanoweb reached 101 days of uptime and did not show a single glitch after serving more than 4.1 milion hits and more than 52 GB.”.

Here are some more details:

Static test

This was measured on this server, a duron 700 with 1gb of ram.

The tests were run using ab and consisted of 500 requests (20 simultaneous) on static and dynamic content.

Static content : Server Software: aEGiS_nanoweb/2.0.1-dev
Server Hostname: si.kz Server Port: 80
Document Path: /six.gif
Document Length: 28352 bytes
Concurrency Level: 20
Time taken for tests: 3.123 seconds
Complete requests: 500
Failed requests: 0
Broken pipe errors: 0
Keep-Alive requests: 497
Total transferred: 14496686 bytes
HTML transferred: 14337322 bytes
Requests per second: 160.10 [#/sec] (mean)
Time per request: 124.92 [ms] (mean)
Time per request: 6.25 [ms] (mean, across all concurrent requests)
Transfer rate: 4641.91 [Kbytes/sec]
received Connnection Times (ms) min
mean[+/-sd] median max Connect: 0 0 1.9 0 13
Processing: 18 100 276.4 40 2739
Waiting: 1 97 276.9 39 2739
Total: 18 100 277.8 40 2750

Installing

Unix:

install-sh -f or Run ./install-sh (if you have X-windows installed)

Windows:

Run INSTALL.BAT Note: Performance will not be as good as in unix because PHP does not support process forking in windows.

Download

Nanoweb 2.2.9 can be downloaded here

May 20, 2009   2 Comments

How to create an animated favicon

What is a favicon?

A favicon (short for “favorites icon”), also known as a page icon, is an icon associated with a particular website or webpage. A web designer can create such an icon, and many graphical web browsers —such as recent versions of Internet Explorer, Firefox, Mozilla, Opera, Safari, iCab, AOL Explorer, Epiphany, Konqueror, and Flock—can then make use of them. Browsers that support favicons may display them in the browser’s URL bar, next to the site’s name in lists of bookmarks, and next to the page’s title in a tabbed document interface.

Guidelines

The following are guidelines for displaying a favicon on your website:

  • The link elements must be inside the head element (between the opening and closing head tag) in the HTML.
  • The image can usually be in any image format supported by the web browser, the major exception being IE, which only supports ico.
  • The .ico file format will be read correctly by all browsers that can display favicons.
  • Use the appropriate color depths (ICO: 16X16;4, 8, 24 bpp—i.e. 16, 256 and 16 million colors GIF: use 16×16 in 256 colors PNG: use 16×16 in either 256 colors or 24-bit).
  • I have found that you do not have to place html on your website. You can just place a favicon.ico in the root directory of your website, but it may take longer to show up in some browers.
  • Creating an animated favicon

    Animated favcons are easy to create. After following the guidelines from above, you just need to create an animated gif and rename it: favicon.ico. It is currently not supported in Internet Explorer.

    Examples of sites that have animated favicons:

More information on favicon can be found Here

May 19, 2009   1 Comment

An ftp server written in PHP

nanoFTPd is an ftp daemon written in php. as of version 4.2.0, php supports the command-line interface (stable since 4.3.0), which nanoFTPd relies on. nanoFTPd is modular, so it’s easy to add custom modules and other stuff, like different database interfaces (currently supports mysql and postgresql).

Features

  • user authentication via a database/textfile
  • mysql + posgresql support
  • passive mode
  • dynamic ip support
  • basic ftp commands
  • logging

Requirements

  • PHP 4.2.0 or above
  • A database server (mysql or postgres)
  • PHP extension: cli
  • PHP extension: sockets
  • PHP extension: posix

Note: for best performance, compile php with –disable-cgi

Configuring

before running nanoFTPD, you need to do the following:

1) change variables in config.php
2) change the first line of nanoftpd.php to the path of your php binary

Installing

installing is fairly straight forward. you only have to copy the whole directory (with subdirectories) into a directory of your choice… e.g. /usr/share/nanoftpd
(working on a better structure — e.g. config.php into /etc, nanoftpd.php into
/usr/sbin).

Download

You can download nanoftpd here

May 18, 2009   7 Comments