Sunday, April 30, 2006

The Future of Mysql

By Justin Silverton

In a recent article from zdnet:

"Oracle played a big card when it bought InnoDB, the most popular way to inject data into the open source mySQL database.

Monday mySQL responds by getting Solid™ Information Technology, a proprietary database vendor, to take its solidDB Storage Engine for MySQL open source, under the GPL, starting in June.

Solid has its base in telecommunications and transaction processing, which had been considered a completely different market from the small fry mySQL supplies. It has 3 million copies out at places like Alcatel, Cisco, EMC, HP, NEC, Nokia, and Nortel.

The addition of Solid technology to mySQL, the company said, puts mySQL into the enterprise league and makes it a direct threat to Oracle." (full article available here)

Where is mysql going from here? The purchase of the solidDB storage engine is a direct result of the Oracle buy out of the innoDB storage engine currently being used. Oracle attempted to buy out the mysql database back in February for an undisclosed amount, but were unsuccessful. They are now trying to rid themselves of their competiton by purchasing the developers and the technology behind it. It was only a matter of time before something like this was going to happen. As a company based on an open source product, its biggest asset is its developers. Large companies may not be able to take the company over, but they can purchase the developers behind its main technology. The Mysql corporation now has control over technology that sets them apart from their competition.

Is this better than Innodb? It does support transactions, but it does not support foreign keys (it will, however support them in the future). The following is a list of solidDB features:

* ACID transactions.
* Automatic roll forward recovery after failure.
* Uses optimistic (or pessimistic) multiversion concurrency control.
* Database and log files are binary compatible among different platforms.
* Fully multi-threaded using kernel threads. It uses multiple CPUs/cores if they are available.
* Supports all MySQL SQL data types
* Supports full MySQL syntax
* The MySQL-specific SHOW command can be used to retrieve information
about databases, database engines, tables, and indexes.
* Function names occupy a different name space than table or column names.
* No practical limit on number of tables or columns, or database size.
* The EXPLAIN command can be used to determine how the optimizer resolves
a query. (not yet supported in the prototype)
* Foreign keys and on-line backup will be supported in future product release. They are already supported by solidDB, but the interface between MySQL and solidDB is not yet available for these features.

Thursday, April 27, 2006

10 ajax applications you can't live without

By Justin Silverton

1) WadgetOS - http://www.theartofennui.com/wadgetos/wadgetos.php

An Ajax- based WebOS. It includes a web-browser, chat client, caclulator, and games (slot machine). I can't find a lot of info on this, because most of it has since been taken down, but it is still interesting.

Here is an update I received from the co-creator:

i'm the co-creator of wadgetos, thanks for mentioning it. the whole thing was basically a proof of concept, the biggest feature being the ability for anyone to create programs using the powerfull php language. and the info hasn't been taken down, it's just not too easy to find ;)

2) Kiko - http://www.kiko.com/

a) dead simple calendar you can use right in your web browser
b) Universal access: Kiko integrates with your mobile phone and AIM and lets you access your calendar from any computer.
c) Share your calendar: Invite anyone to events (not just other Kiko users!) Let others view your calendar with just a click. Check out the example calendar
As easy as paper - or maybe easier: Write "Pay gas bill every month" onto your calendar and watch Kiko do the Right Thing!

3) time-tracker - http://www.formassembly.com/time-tracker/

Time Tracker is a simple tool to keep track of the time you spend on any task.

4) Del.icio.us Director - http://johnvey.com/features/deliciousdirector/

del.icio.us direc.tor is a prototype for an alternative web-based rich UI for del.icio.us. It leverages the XML and XSL services of modern browsers to deliver a responsive interface for managing user accounts with a large number of records.
The main features are:

A) In-browser handling of del.icio.us bookmarks (tested up to 12,000 records)
B) Find-as-you-type searching of all your bookmarks, with basic search operators
C) Sort by description, tags, or timestamp
D) Ad-hoc tag browser

5) Ajax IM - http://www.unwieldy.net/ajaxim/

ajax im is a browser-based instant messaging client. It uses the XMLHTTPRequest object in JavaScript to send and receive commands to and from the server. No refreshing of the page is ever needed for this "web application" to work, as everything is updated in real-time via JavaScript.

6) Ajax Write - http://www.ajaxwrite.com/

AjaxWrite is a streamlined word processor, comparable to Microsoft Word. To keep the program lean, we left out some obscure advanced features; you'll find the functions you use most often, right where you'd expect them to be. (We're still working on the spell checker.) You can import and export documents in all popular formats, including documents with graphics. The save function lets you save your work to a drive on your computer. Also, since you run ajaxWrite from your web browser, it is platform independent and can therefore be used with any operating system.

7) Ajax Sketch - http://www.ajaxsketch.com/

AjaxSketch is basically a pared down version of Illustrator or Inkscape — perfect for creating quick charts and diagrams from scratch. It includes autoshapes, pencil mode, and text for creating the basics. You can also edit by resizing, rotating, changing background or pen color, and altering opacity.

8) Eye Spot - http://eyespot.com/

Use the eyespot Mixer to edit and combine your videos, music and photos online! Share your video and mixes with the world for Free.

9) webezz - http://www.webezz.net/

Build your website using an easy-to-use Ajax Editor.

1o) meebo - http://www21.meebo.com/

Sign into your AIM, MSN, ICQ, Google Talk, Jabber, or Y! Messenger account with this ajax based web site.

Free Icons - redux

By Justin Silverton

Back due to popular demand, here is a list of sites that provide free icons that can be used in any application. Anyone may use the list in it's entirety.

If anyone has any other sites that offer free icons, please let me know and I will add it.

Updated 4/27/06

My goal is to have the largest list of free icon sites on the Internet


Here is a random site in Japanese I found while searching for free icons. Although it contains no icons, it does contain i-candy. Enjoy:


Wednesday, April 26, 2006

Commodore 64 emulator in PHP

By Justin Silverton

For those of you that still remember the early days of computing, there is a commodore 64 emulator written in PHP.

A live demo is available here: http://phpc64.extra.hu/c64/index.html
the sourcecode is available here: http://phpc64.extra.hu/php_c64_source.tar.gz (released under the GPL License)

Homepage is here: http://phpc64.extra.hu/

Some Commands

The following are supported: NEW, RUN, LIST, LIST N-M, SAVE "NAME", LOAD "NAME",

Programming examples

IF 2<6>"A" THEN XXX (Note: XXX being a line number.)

10 FOR I%=1 TO 1020
30 NEXT I% (Note: variable after NEXT is optional, but recommended)

Known Bugs

-----* doesn't check BASIC programs for syntax errors (because of size limitations)*
Internet Explorer crashes when loading programs longer then approximatly 700 bytes
* when the frame containing c.php is loaded before creation of frame named 's', it causes javascript error; you should reload the page when this bug shows


in Opera the execution of the BASIC program stops when INPUT commands are being executed; it will continoue if you activate another tab, then return to the window of the Emulator (you should press RETURN)

An operating system in PHP

By Justin Silverton

Is it possible? a full-fledged operating system written in PHP? I never thought so before, but I recently found a great application that proves me wrong. Even though it has some help from java, flash, and javascript, it is still a very fast and functional OS. It is also open source, so you can install it on your own server, but if you don't have the hardware, a free account can be created on their servers.

first, here is some info on how to get it:

it's called eyeos and you can create a free account here: http://www.eyeos.info
the main site is located here: http://www.eyeos.org
API Info: http://www.eyeos.org/appsAPI
mini-server for windows: http://www.eyeos.org/miniserver
Source code: http://www.eyeos.org/Downloads


With eyeOS you can access your data and your applications anywhere, anytime. A virtual office in your hands, no need to install anything in the computer. Everything lives in the browser, for you and your work colleagues. eyeOS is open source and free software. Set up freely an account on our servers or, if you prefer it, install it in your server. Make your life easier with the virtual word processor, calendar, file manager, messenger, browser and other applications. And if you want more applications, just visit the eyeOS Application Database!

My review

Today, I created a free account online. Below is a screenshot of the built-in word-processor:

What I liked about it:

A) Very fast and Responsive Interface
B) Open Source and easy-to-use API
C) Written in PHP
D) eye candyish graphics

Where I feel it needs work

A) Not many apps. I think with an increase in user support, it will become more of a development platform than a proof of concept.


Although it may not have a wide variety of uses right now, it is very interesting to see that it is possible to create an entire platform using PHP and other web technologies.

Other Operating systems in PHP

Ssearching the Internet, I also found some other Operating Systems written in PHP:

Phoenixz: http://sourceforge.net/projects/phoenixz/

Jsuix (not PHP, but a unix like OS written in javascript): http://www.masswerk.at/jsuix/

Tuesday, April 25, 2006

Programming Languages you never knew existed

By Justin Silverton

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

Sunday, April 23, 2006

Top 10 PHP frameworks

By Justin Silverton

Below is a list of the top 10 frameworks for PHP:

10) Mobius

The Moebius PHP Library is a project that concentrates on building a set of classes that wraps around the built-in php functions. The idea behind the creation of this library is to create an object framework to work on PHP, going from mySQL management to Table manipulation. The site is powered in fact by the moebius library.

9) Blueshoes

BlueShoes provides developers with real-world solutions for common system components such as User Management, Session Handling, Closed User Groups, Exception Handling and Logging, Object Persisting as well as Form building and Handling.

8) Phrame

Phrame is a web development platform for PHP based on the design of Jakarta Struts. Phrame provides your basic Model-View-Controller architecture, and also takes a step further adding standard components such as: HashMap, ArrayList, Stack, etc...

7) Fusebox

Fusebox is the most popular framework for building ColdFusion and PHP web applications. "Fuseboxers" find that the framework releases them from much of the drudgery of writing applications and enables them to focus their efforts on creating great, customer-focused software.

6) Seagull

Seagull is an object oriented framework written in PHP that focuses on best practices, clean code and reusable components.

5) EZ Publish

eZ publish gives you control of your content. Create, handle, sort and store documents, files and images. Publish them in the format, channel or media you prefer.

4) Krill

Krill is a php Framework based on the MVC2 paradigm.

3) php-booba

Simple PHP framework for developing web applications.

2) edit-x

Edit-X CMS features enhanced tools for larger content management environments and offers support for multiple sites and unlimited authorized users. Users have an intuitive WYSIWYG (What You See Is What You Get) editorial interface that makes adding and updating content as easy as using a word processor. Edit-X CMS is designed to give organizations of all sizes a scalable solution for managing online information.

1) Binary Cloud

binarycloud is a web application framework for the PHP language. It provides a set of services that are frequently used when writing web applications and helps to improve reuseability by providing a modular application infrastructure.

Saturday, April 22, 2006

Converting php scripts to windows apps

By Justin Silverton

I came across this application the other day that will allow you to convert php scripts to native windows applications.

The application is called WinBinder and it is available Here

Some benefits of using winbinder

Some key benefits

  • Large installed base of PHP programmers.
  • No compiling and linking steps necessary: just code and run.
  • Access to the vast range of existing PHP functions and extensions, including databases, graphics, web functions, XML, PDF, and much more.
  • A small set of WinBinder functions encapsulates many complex aspects of the Windows API and makes programming for Windows an easy task.
  • Provides 100% native Windows classes and controls.
  • Interfaces directly to the Window API. This means fast execution, no extra libraries and no installation required.
  • Supports both procedural and object-oriented programming models.
  • High performance, compares favorably to most scripting languages.
  • Produces standalone applications that can be easily installed and removed with no reboot.
  • Small footprint. A simple Windows application, complete with the PHP runtime and SQLite extension, is smaller than 700 kB (zipped).
  • A database-independent framework allows easy coding (no SQL knowledge is necessary) and smooth integration with the WinBinder code.
  • No database server required if using SQLite.
  • Does not need to use to the Windows registry, but may use it if necessary.
  • More...
Simple Example

Here is the minimum code required for a Windows application:

include "../include/winbinder.php"; // Include WinBinder library
wb_create_window(NULL, PopupWindow, "Hello", 480, 500); // Create application window
wb_main_loop(); // Enter message loop

here is what the above will display when compiled:

add/remove program registry info

By Justin Silverton

For people that write windows applications, the following info will allow you to add your application to the add/remove programs menu.

Create a key with your app name name under HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall to add entries to the "Add/Remove Programs" section in the Control Panel.

For Windows NT (NT4/2000/XP), it's also possible to create the key in the HKCU hive, so it will only appear for the current user.

There are several values you can write to the key to give additional information about your application and the uninstaller.

Write a value using the WriteRegStr command (for strings) or WriteRegDWORD command (for DWORD values).


HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Product" "DisplayName" "Application Name"

Required values

* DisplayName (string) - Name of the application
* UninstallString (string) - Path and filename of the uninstaller. You should always quote the path to make sure spaces in the path will not disrupt Windows to find the uninstaller.

HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\myapp" "DisplayName" "This is my cool application"
HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\myapp" "UninstallString" "$INSTDIR\uninstall.exe"

Optional values

Supported on: Windows XP.

* InstallLocation (string) - Installation directory ($INSTDIR)
* DisplayIcon (string) - Path, filename and index of of the icon that will be displayed next to your application name

* Publisher (string) - (Company) name of the publisher

* ModifyPath (string) - Path and filename of the application modify program
* InstallSource (string) - Location where the application was installed from

* ProductID (string) - Product ID of the application
* RegOwner (string) - Registered owner of the application
* RegCompany (string) - Registered company of the application

* HelpLink (string) - Link to the support website
* HelpTelephone (string) - Telephone number for support

* URLUpdateInfo (string) - Link to the website for application updates
* URLInfoAbout (string) - Link to the application home page

* DisplayVersion (string) - Displayed version of the application
* VersionMajor (DWORD) - Major version number of the application
* VersionMinor (DWORD) - Minor version number of the application

* NoModify (DWORD) - 1 if uninstaller has no option to modify the installed application
* NoRepair (DWORD) - 1 if the uninstaller has no option to repair the installation

If both NoModify and NoRepair are set to 1, the button displays "Remove" instead of "Modify/Remove".

Supported on: Windows XP Service Pack 2.

* ParentKeyName (string) - If the program is an update of a parent program, specify the parent program subkey name. If "OperatingSystem", it's an update for Windows.
* ParentDisplayName (string) - If the program is an update of a parent program, specify the parent program name (as specified on the parent's "DisplayName").

Wednesday, April 19, 2006

php games

by Justin Silverton

The following are a list of free games written in PHP

http://www.heroesmini.com/register.php - Heroes of Might and Magic
http://dragon.se7enet.com/dev.php - Dragon Knight
http://sourceforge.net/projects/blacknova - black nova Traders
http://www.0php.com/reviews/0171.php - hangman
http://www.0php.com/reviews/0172.php - anoi towers
http://www.geocities.com/markoriedelde/life/index.html - Life
http://www.geocities.com/markoriedelde/Minesweeper/index.html - minesweeper
http://www.chipmunk-scripts.com/scripts/riddles.php - chipmunk riddles
http://www.chipmunk-scripts.com/killmonster/login.php - kill monster
http://sportsphool.sourceforge.net/ - sportsPHool
http://www.fightwith.me.uk/ - fightclub

Online Role Playing Games

http://phpolrpg.sourceforge.net/ - PHP online RPG
http://dragon-soldier.net/ - dragon soldier
http://www3.kingdomofloathing.com - kingdom of loathing
http://www.lotgd.net/ - legend of the green dragon
http://www.vendetta1923.com/ - vendetta
http://www.thecrims.com/ - the crims
http://www.travian.com/ - travian


http://www.blacknova.net - black nova
http://www.aatraders.com - aatraders
http://www.quantum-star.com - quantum-star


http://deepdungeons.sourceforge.net/ - This is a desktop app written in PHP+GTK it is called Deep Dungeons.
http://www.32cards.com - 2006 world cup game based on the PECL extension winbinder.
http://www.ogame.org/ - strategic space simulation game

free RSS to HTML PHP script

By Justin Silverton


FeedForAll has made available a free PHP program called rss2html.php, which can be used by webmasters to automatically display RSS feeds on their website. The resulting webpage will always show the RSS feed's most current data. The advantage of using the rss2html.php script is that the resulting webpage's contents will always be up to date, and can be easily spidered by search engines.

it can be found Here


- Create a webpage with an RSS feed's information
- Insert an RSS feed's information into a location in an existing webpage


FeedForAll's rss2html.php script uses templates to generate its output. The templates allow you to easily control what the resulting webpage will look like. A template can be used to generate a complete webpage, or a portion of a webpage like a table (which can then be included inside an existing webpage). The template's syntax is exactly the same as the syntax used in FeedForAll's export functions.

Templates are simply standard HTML documents, with special variables inserted where the RSS feed's data should appear. Usually the easiest way to create a template is to create a sample webpage with some real data in it, and then replace the feed's data with template variables, or modify an existing webpage, by adding template variables. Here is a list of the variables supported by FeedForAll's rss2html.php script:

~~~FeedTitle~~~ (The feed's title)
~~~FeedDescription~~~ (the feed's description)
~~~FeedContentEncoded~~~(the feed's description for the ContentEncoded field)

~~~FeedLink~~~ (the feed's link)
~~~FeedPubDate~~~ (the feed's pub date/time in RSS format)
~~~FeedPubLongDate~~~ (the feed's date in your Windows long date format) ~~~FeedPubShortDate~~~ (the feed's date in your Windows short date format)
~~~FeedPubLongTime~~~ (the feed's time in your Windows long time format)
~~~FeedPubShortTime~~~ (the feed's time in your Windows short time format)
~~~FeedImageUrl~~~ (the URL to the feed's image)
~~~FeedImageTitle~~~ (the title for the feed's image)
~~~FeedImageLink~~~ (the link associated with the feed's image)

~~~FeedMaxItems=X~~~ (the maximum number of items to appear on the webpage - replace 'X' with a number)
~~~SortByPubDate~~~(the items will be sorted by their PubDate, before they are displayed - newest first)
~~~NoFutureItems~~~(items with PubDates that are in the future will not be displayed until that date/time)

~~~BeginItemsRecord~~~ (repeat everything between this and the end marker, for each item)
~~~EndItemsRecord~~~ (repeat everything between this and the start marker, for each item)
~~~BeginAlternateItemsRecord~~~ (separates the ItemsRecord into alternating halves)

~~~ItemTitle~~~ (the item's title)
~~~ItemDescription~~~ (the item's description)
~~~ItemLink~~~ (the item's link)
~~~ItemPubDate~~~ (the item's pub date/time in RSS format)
~~~ItemPubLongDate~~~ (the items's date in your Windows long date format)
~~~ItemPubShortDate~~~ (the item's date in your Windows short date format)
~~~ItemPubLongTime~~~ (the item's time in your Windows long time format)
~~~ItemPubShortTime~~~ (the item's time in your Windows short time format)
~~~ItemEnclosureUrl~~~ (the item's enclosure URL)
~~~ItemGuid~~~(the item's GUID field value)

When the rss2html.php script runs, it will substitute information from the RSS feed into the location wherever a variable is found. For example, every time ~~~FeedTitle~~~ is found in the template's text, the Title from the RSS feed will be substituted.

Running rss2html.php from FeedForAll's public server

If your webserver doesn't support PHP, then you can run the rss2html.php script on FeedForAll's public server instead. All you need to do is setup a link on your website to access the script and resulting webpage.



The above URL should all be on one line, with no spaces.

Replace '' with the full URL to your RSS feed (ie. http://www.mydomain.com/myfeed.xml)

Replace '' with the full URL to the webpage template you want to use (ie. http://mydomain.com/mytemplate.htm)

Replace '' with the maximium number of items from your RS feed you want included on the webpage. The MAXITEMS variable is optional. If it is not included, all the RSS feed items will be included.


Running rss2html.php from your own webserver
Probably the best way to use rss2html.php is to upload it to your own webserver. This gives you two ways to access the script. First, you can setup a link on your webpage to access the script and resulting webpage.


Replace '' with the domain of your website

Replace '' with the full URL to your RSS feed (i.e. http://www.mydomain.com/myfeed.xml)

Replace '' with the full URL to the webpage template you want to use (i.e. http://www.mydomain.com/mytemplate.htm)

Replace '' with the maximium number of items from your RS feed you want included on the webpage. The MAXITEMS variable is optional. If it is not included, all the RSS feed items will be included.


The second option is to edit the settings inside of the rss2html.php script itself, and then just access the script as if it were a regular webpage.

With a text editor open up the rss2html.php file. Look for the line near the beginning that looks like this:

$XMLfilename = "sample.xml";

Replace sample.xml with either the local path or full URL to your RSS feed file.

Next, find the line that looks like this:

$TEMPLATEfilename = "BasicWebpage.htm";

Replace BasicWebpage.htm with either the local path or full URL to your template file.

Finally, if you want to specify the maximum number of items to include from your feed, find the line that looks like this:

$FeedMaxItems = 10000;

Replace 10000 with the maximum number of items you want.

Save the file with a new name (what you want to call it on your website), but make sure to keep the .php extension.

For example, if you named it 'myfeed.php', you can now access it from your browser by typing: http:///myfeed.php


Examples of the RSS to HTML PHP script in action:

http://www.feedforall.com/blog.htm (FeedForAll's main RSS feed, using the rss2html.php script)

http://www.feedforall.com/public/layouts.htm (lots of sample pages)

http://www.small-business-software.net (the main page is actually the rss2html.php script being run)

http://www.create-rss.com (the main page is actually the rss2html.php script being run)

RDP Server for linux

By Justin Silverton

While looking through the various open source projects on sourceforge.net, I found a very interesting application: an RDP server for linux. it's called XRDP, and it is available Here. Why do you need this? It will allow you to connect to a linux box using the RDP client built into windows.

How it works

Xrdp is the main server accepting connections from RDP clients. Xrdp contains the RDP, security, MCS, ISO, and TCP layers, a simple window manager and a few controls. Its a multi threaded single process server. It is in this process were the central management of the sessions are maintained. Central management includes shadowing a session and administrating pop ups to users. xrdp is control by the configuration file xrdp.ini.

RDP has 3 security levels between the RDP server and RDP client. Low, medium and high. Low is 40 bit, data from the client to server is encrypted, Medium is 40 bit encryption both ways and High is 128 bit encryption both ways. xrdp currently only supports low encryption. RSA key exchange is used with both client and server randoms to establish the RC4 keys before the client connect.

Modules are loaded at runtime to provide the real functionality. Many different modules can be created to present one of many different desktops to the user. The modules are loadable to conserve memory and support both GPL and non GPL modules.

Multi threaded to provide optimal user performance. One client can't slow them all down. One multi threaded process is also required for session shadowing with any module. The module doesn't have to consider shadowing, the xrdp server does it. For example, you could shadow a VNC, RDP or a custom module session all from the same shadowing tool.

Build in window manager for sending pop ups to any user running any module. Also can be user to provide connection errors or prompts.

Libvnc, a VNC module for xrdp. Libvnc provides a connection to VNC servers. Its a simple client only supporting a few VNC encodings(raw, cursor, copyrect). Emphasis on being small and fast. Normally, the xrdp server and the Xvnc server are the same machine so bitmap compression encodings would only slow down the session.

Librdp, an RDP module for xrdp. Librdp provides a connection to RDP servers. It only supports RDP4 connections currently.

Sesman, the session manager. Sesman is xrdp's session manager. xrdp connect to sesman to verify the user name / password, and also starts the user session if credentials are ok. This is a multi process / Linux only session manager. Sessions can be started or viewed from the command line.


Tuesday, April 18, 2006

migrating from Microsoft access to mysql

By Justin Silverton

Why use mysql instead of access?

Cost. MySQL is free. Access is not. Mysql can also run on a variety of hardware and operating systems, which does not limit you to proprietary software.

Multiple-user access.
MySQL can handle many simultaneous users. It was designed from the ground up to run in a shared environment that is capable of taking on a large numbers of clients.

Management of large databases. MySQL can manage gigabytes of data, and more. This is possible in access, but not recommended.

Security. When Access tables are stored locally, anyone can run Access, and see your tables. It's possible to assign a database a password, but many people forget to do this. When your tables are stored in MySQL, the MySQL server manages security. Anyonetrying to access your data must know the proper user
name and password.

Centralized backup location. If individual Access users each store their data locally, backups can be more complicated: 200 users means 200 table backups. While some sites address this problem through the use of network backups, others deal with it by making backups the responsibility of individual machine owners--which usually means no backups at all. Mysql allows you to have one centralized location that can be backed up on a regular basis by a system administrator or DBA.

Manually transferring your data

One way to transfer your data is export all the data from each table (using the file->export command) to a comma delimited text file (CSV). It can then be imported back into mysql using the following commands (from the mysql console client):

mysql> use mydatabase;
mysql> LOAD DATA LOCAL INFILE 'my_access_table.txt'
-> INTO TABLE mytable

you could also use mysqlimport

mysqlimport --local --fields-terminated-by=,
mydatabase my_access_table.txt

using a program

The following are program you can use to transfer the tables for you:

DBTools (free) Works with Access97, Access2000. DBTools actually is intended primarily as an application for administering MySQL, but it includes data import capabilities that can be used to read Access databases for transfer to MySQL. (It can also read data from other sources such as Excel spreadsheets, making it particularly useful for transferring to MySQL information that is stored in a variety of formats.) Because DBTools reads Access databases directly, you can use it to migrate Access tables even if you don't have Access installed locally, as long as you have the database files containing the tables to be transferred. DBTools does not require ODBC.

MySQLFront (free 30 day trial) MySQLFront is similar in many ways to DBTools. It can read Access97 and Access2000 files directly. If ODBC is installed, MySQLFront can import information into MySQL from ODBC data sources over the network.

Friday, April 14, 2006

PHP vs perl

By Justin Silverton

if you have a php, programming, or open source related blog, email me your url here: justin@whenpenguinsattack.com

PHP and perl are both powerful languages used successfully in a server environment. Here are some brief differences between the two languages:

  • PHP is built from the ground-up with database functionality built in, particularly MySQL functionality. Perl is not.
  • PHP code gets embedded into HTML pages, unlike Perl. This makes it very fast to code web pages and fast to deploy a new site, thus speeding up Web development and lowering overall cost of ownership. An important code management technique for programmers is separating code from data. This allows us to make changes to the code or data without affecting the other. PHP uses the tags to indicate "code inside". In Perl, however, programmers are encouraged to use print statements to generate the HTML. True it is possible to implement templates in Perl (with more difficulty than in PHP) to separate code and HTML, but 90% of sample Perl code on the web doesn't do that.
  • PHP is secure. Perl scripts tend to have more security holes. This is because PHP has built-in a lot of the internal operations of dealing with web page requests and serving information.
  • PHP is easy to learn in comparison to Perl. It's easier to learn than C, Python, Java, and most other programming languages used in web development, for that matter. The Perl style of programming is unique, and thus not universally applicable to or from other programming languages. Accessing web form variables in PHP is straightforward, but in Perl requires either detailed knowledge of either HTTP header formats or one of many Perl CGI libraries.
  • PHP takes less "overhead" than Perl, meaning that PHP scripts will run faster than CGI scripts written in Perl, and you'll be able to handle more simultaneous users on your site.
  • PHP code tends to be more consistent and modular than Perl.
some other differences can also be found here: http://tnx.nl/php

A few of them are listed below (the rest can be found at the website listed above):

PHP has separate functions for case insensitive operations

(This can be argued both ways. Some think it's good to have functions that combine functions, even if that means having dozens of extra names to remember)

In Perl, you use a double lc() (lowercase) or the /i flag where PHP usually provides a case insensitive variant. The case-insensitive versions have very inconsistent naming.

Perl: $foo cmp $bar                            lc $foo cmp lc $bar
PHP: strcmp($foo, $bar) strcasecmp($foo, $bar)

Perl: index($foo, $bar) index(lc $foo, lc $bar)
PHP: strpos($foo, $bar) stripos($foo, $bar)

Perl: $foo =~ s/foo/bar/ $foo =~ s/foo/bar/i
PHP: $foo = str_replace('foo', 'bar', $foo) $foo = str_ireplace(...)
PHP: $foo = ereg_replace('foo', 'bar' ,$foo) $foo = eregi_replace(...)

PHP has inconsistent function naming

  • Case insensitive functions have the 'i' or 'case' at different positions in their names.
  • There is no apparent system in underscore(s) versus no underscore(s):
    underscore               no underscore:

    stream_get_line readline
    disk_free_space diskfreespace
    is_object isset
    mcal_day_of_week jddayofweek
    set_error_handler setlocale
    snmp_get_quick_print snmpget
    get_browser getallheaders
    base64_encode urlencode
    image_type_to_mime_type imagetypes
    msql_num_fields mysql_numfields
    php_uname phpversion
    strip_tags stripslashes
    bind_textdomain_codeset bindtextdomain
    cal_to_jd gregoriantojd
    str_rot13 strpos
    Perl has no core function names with underscores in them.
  • PHP has unlink, link and rename (system calls), but touch (the system call is utime, not touch).
  • And they can't decide on word order:
    • object verb: base64_decode, iptcparse, str_shuffle, var_dump
    • verb object: create_function, recode_string

    Perl core functions are all "verb object" except the superseded dbm* functions. (Note that sys is a prefix, not an object. And that flock and lstat were named after the system calls. shm* and msg* are library calls)

  • "to" or "2"?

    ascii2ebcdic, bin2hex, deg2rad, ip2long, cal_to_jd (jdto*, *tojd), strtolower, strtotime,

PHP has no lexical scope

Perl has lexical scope and dynamic scope. PHP doesn't have these.

For an explanation of why lexical scope is important, see Coping with Scoping.

                       PHP  Perl
Superglobal Yes Yes [1]
Global Yes Yes
Function local Yes Yes [2]
Lexical (block local) No Yes
Dynamic No Yes

[1] Perl has variables that are always in the main:: namespace. These are like PHP's superglobals.
[2] Using a lexical variable in a sub routine's block, you get a function local variable.

PHP has too many functions in the main namespace

(Using the core binaries compiled with all possible extensions in the core distribution, using recent versions in November 2003.)

Number of PHP  main functions: 3079 [1]
Number of Perl main functions: 206 [2]
Median PHP  function name length: 13
Mean PHP function name length: 13.67
Median Perl function name length: 6
Mean Perl function name length: 6.22

Note that Perl has short syntax equivalents for some functions:

readpipe('ls -l') ==> `ls -l`
glob('*.txt') ==> <*.txt>
readline($fh) ==> <$fh>
quotemeta($foo) ==> "\Q$foo"
lcfirst($foo) ==> "\l$foo" (lc is \L)
ucfirst($foo) ==> "\u$foo" (uc is \U)

[1] Source: PHP Quick Reference
[2] Source: perldoc perlfunc

Wednesday, April 12, 2006

10 PHP speed improvement tips for apache

By Justin Silverton

A French Translation can be found here: http://www.vecteur-renaissance.com/vhoen/index.php/2006/04/15/27-10-conseils-pour-accelerer-des-scripts-php

  1. A PHP script will be served at least 5-10 times slower than a static HTML page by Apache. Try to use more static HTML pages and fewer scripts.

  2. Enable the compression of HTML by putting in your php.ini:

    output_handler = ob_gzhandler

  3. Install a PHP caching suite. I have personally used zend (commercial), turck mmcache, and ioncube, and they all work very well.

  4. Switch from file based sessions to shared memory sessions. Compile PHP with the --with-mm option and set session.save_handler=mm in php.ini. This can drastically improve session management performance.
  5. Another caching technique that can be used when you have pages that don't change too often is to cache the HTML output of your PHP pages. (a list of template solutions is posted within one of my previous articles).
  6. Use output buffering (See ob_start). This will speed up your PHP code by 5-15% if you frequently print or echo in your code.

  7. On Windows, FastCGI is the highest performance way of running PHP with Apache.

  8. In PHP4, objects and arrays should be passed to functions by reference (with &), and everything else by value. In PHP5, objects are already passed by reference. Here is an example:
    function &testfunc(&$test_array)
    return $test_array;
    $new_variable =& testfunc($my_testarr);

  9. Don't use images when text will do. Reduce your image sizes with a software like MacroMedia Fireworks or imagemagick.

  10. If possible, Run your database server on a different machine. If all static content is served from another server, then you can turn off KeepAlives in httpd.conf to speed up client disconnects.

programming in python

By Justin Silverton

What is python?

some interesting facts about python from wikipedia.com:

Python is a multi-paradigm language. This means that, rather than forcing coders to adopt one particular style of coding, it permits several. Object orientation, structured programming, functional programming, aspect-oriented programming, and more recently, design by contract are all supported. Python is dynamically type-checked and uses garbage collection for memory management. An important feature of Python is dynamic name resolution, which binds method and variable names during program execution.

While offering choice in coding methodology, Python's designers reject exuberant syntax, such as in Perl, in favor of a sparser, less cluttered one. As with Perl, Python's developers expressly promote a particular "culture" or ideology based on what they want the language to be, favoring language forms they see as "beautiful", "explicit" and "simple". For the most part, Perl and Python users differ in their interpretation of these terms and how they are best implemented (see TIMTOWTDI and PythonPhilosophy).

Another important goal of the Python developers is making Python fun to use. This is reflected in the origin of the name (after the television series Monty Python's Flying Circus), in the common practice of using Monty Python references in example code, and in an occasionally playful approach to tutorials and reference materials. For example, the metasyntactic variables often used in Python literature are spam and eggs, instead of the traditional foo and bar.

Python is sometimes referred to as a "scripting language". In practice, it is used as a dynamic programming language for both application development and occasional scripting. Python has been used to develop many large software projects such as the Zope application server and the Mnet and BitTorrent file sharing systems. It is also extensively used by Google. [1]

Another important goal of the language is ease of extensibility. New built-in modules are easily written in C or C++. Python can also be used as an extension language for existing modules and applications that need a programmable interface.

Though the design of Python is somewhat hostile to functional programming and the Lisp tradition, there are significant parallels between the philosophy of Python and that of minimalist Lisp-family languages such as Scheme. Many past Lisp programmers have found Python appealing for this reason.


Python can be found Here (windows and *nix flavors)

A Simple Example

operation = raw_input('Operation: ')
First = raw_input('Enter First number: ')
Second = raw_input('Enter Second number: ')

if operation == "+":
Answer = int(First) + int(Second)
elif operation == "-":
Answer = int(First) - int(Second)
elif operation == "*":
Answer = int(First) * int(Second)
elif operation == "/":
Answer = int(First) / int(Second)
print "An Error has occured"
print 'First Number: %s Second Number: %s Operator: %s' % (Answer, First, Second, operation)

The first part operation = raw_input('Operation: ') will assign the value someone types in to the variable operation so you can type +,-,* and /.

In the second part: First = raw_input('First number: ') and Second = raw_input('Second number: ')

int(First) and int(Second) converts the incoming variables to integers, so their respective operations can be calculated and stored in the Answer variable.

Sunday, April 09, 2006

lighttpd vs apache

By Justin Silverton

What is lighttpd?

it is designed and optimized for high performance environments. With a small memory footprint compared to other web-servers, effective management of the cpu-load, and advanced feature set (FastCGI, CGI, Auth, Output-Compression, URL-Rewriting and many more) LightTPD is the perfect solution for every server that is suffering load problems. And best of all it's Open Source licensed under the revised BSD license.

It can be downloaded Here

PHP Performance



  • Netgear GS108 8-Port Switch
  • Server:
    AMD Athlon XP 2000+ (1666 MHz)
    512 Mb RAM
    IBM IC35L060AVVA07-0
    Intel EtherExpress 1000
    Linux 2.6.6
  • Test Host:
    Via Samual 2 (600MHz)
    256 Mb RAM
    Via Rhine III
    (this is a VIA EPIA CL board)

The benchmark follows the rules of:



Concurrency Level:      1
Time taken for tests: 2.209 seconds
Complete requests: 200
Failed requests: 0
Broken pipe errors: 0
Total transferred: 503000 bytes
HTML transferred: 481400 bytes
Requests per second: 90.54 [#/sec] (mean)
Time per request: 11.04 [ms] (mean)
Time per request: 11.04 [ms] (mean, across all concurrent
Transfer rate: 227.70 [Kbytes/sec] received


Concurrency Level:      1
Time taken for tests: 2.789 seconds
Complete requests: 200
Failed requests: 0
Broken pipe errors: 0
Total transferred: 518600 bytes
HTML transferred: 480400 bytes
Requests per second: 71.71 [#/sec] (mean)
Time per request: 13.95 [ms] (mean)
Time per request: 13.95 [ms] (mean, across all concurrent
Transfer rate: 185.94 [Kbytes/sec] received

Doing the test via the loopback-interface on the Server-Host doesn't change the numbers dramaticly (+4-5 req/s)


lighttpd + fastcgi is more than 25% faster than apache + mod_php4.

For static files we already know that lighttpd is 4-6 times faster.



The purpose of the benchmark run was find out which opensource webserver leaves the system enough power to do additional work like handling php request and the like. It allows to estimate how the server would perform in a gigabit network.


The network was equipped with really cheap 100Mbit components like

  • Netgear DS108 8-port Hub
  • Server:
    AMD Athlon 1666 MHz
    512 Mb RAM
    IBM IC35L060AVVA07-0
  • Client:
    AMD Duron 1300 MHz
    256 Mb RAM
    Maxtor 33073H3

The benchmark consisted of 8 runs of apache-bench from the client against the server. index.html is about 4kbyte large, dummy.out has a size of 100.000 bytes. Each run is about 10s long for 4k and 60s for 100k.

/usr/sbin/ab    -n 10000 -c  100
/usr/sbin/ab -k -n 10000 -c 100
/usr/sbin/ab -n 10000 -c 1000
/usr/sbin/ab -k -n 10000 -c 1000
/usr/sbin/ab -n 5000 -c 100
/usr/sbin/ab -k -n 5000 -c 100
/usr/sbin/ab -n 5000 -c 1000
/usr/sbin/ab -k -n 5000 -c 1000

Each server was started within 'time' to get the user- and sys-time for the statistics.

time ./lighttpd -D -f ./lighttpd.conf
time ./mathopd -n -f ./mathopd.conf
time ./thttpd -p 1027 -d /home/weigon/wwwroot/servers
/grisu.home.kneschke.de/pages/ -l /dev/null -D
time ./src/boa -d -f boa.conf -c ./


boa performs fine but has a lot of work to do in user-mode when handling 1000 parallel connections. The network saturation for small files can be improved for keep-alive mode.

thttpd can't saturate the 100Mbit network because is still lacking keep-alive support.

lighttpd perfoms fine in all sections. apache uses far to much system resources but is stable. monkey failed in all tests.

mathopd was tested the wrong way and was removed from the benchmark for now.


lighttpd 1.0.2

        con   user         sys        [#/sec]     [Kbytes/sec]
4k file
100 0m0.260s 0m0.880s 1488.54 6889.75
keepalive 100 0m0.260s 0m0.870s 1788.59 8290.74
1000 0m0.350s 0m1.350s 1278.77 5983.60
keepalive 1000 0m0.410s 0m2.380s 1732.20 8333.10

100k files
100 0m0.490s 0m5.730s 81.67 8207.19
keepalive 100 0m0.250s 0m5.620s 85.16 8573.19
1000 0m0.920s 0m48.470s 77.04 8096.55
keepalive 1000 0m0.830s 0m41.480s 79.54 8552.96

thttpd 2.23b

        con   user         sys        [#/sec]     [Kbytes/sec]
4k file
100 0m0.280s 0m0.960s 1481.26 6814.43
1000 0m0.310s 0m1.270s 1300.39 6096.46
100k files
100 0m0.770s 0m5.870s 80.85 8130.32
1000 0m1.360s 0m51.270s 76.92 8085.59


        con   user         sys        [#/sec]     [Kbytes/sec]
4k file
100 0m0.420s 0m0.940s 1485.00 6778.21
keepalive 100 0m0.300s 0m0.790s 1466.92 6790.01
1000 0m0.330s 0m1.180s 1305.14 5986.00
keepalive 1000 0m0.900s 0m3.360s 1552.07 7529.29

100k files
100 0m1.000s 0m6.330s 81.33 8166.78
keepalive 100 0m0.890s 0m6.240s 85.16 8567.05
1000 0m10.790s 0m47.700s 78.70 8137.15
keepalive 1000 0m10.630s 0m46.600s 82.28 8512.32 [*]
[*] failed requests

Apache 1.3.28

As apache is a (pre-)forking server it is not that easy to measure

the time used by all childs in user- and kernel-mode. That's why we use a
guessed takes from top. This might not be completly correct but should
give you the right impression.

100% CPU Usage means that full 7-8s that the rest runs for the small files
are spent for handling requests. Just check the servers above to see that
same job can be done in 1 second.

          con   CPU Usage               [#/sec]     [Kbytes/sec]
4k file
100 100% 1482.80 6847.20
keepalive 100 80% 1466.92 6790.01
1000 100% 1318.74 6094.71
keepalive 1000 90% 1887.50 8797.84

100k files
100 30% 81.80 8227.11
keepalive 100 30% 86.71 8741.96 [*]
1000 33% 81.80 8258.31
keepalive 1000 33% 90.87 9225.39 [*]
[*] failed requests

Wednesday, April 05, 2006

How to install postgres 8 on Mac OS X

By Justin Silverton

step 1
: install the fink project, available Here

from the fink website: "The Fink project wants to bring the full world of Unix Open Source software to Darwin and Mac OS X. We modify Unix software so that it compiles and runs on Mac OS X ("port" it) and make it available for download as a coherent distribution. Fink uses Debian tools like dpkg and apt-get to provide powerful binary package management. You can choose whether you want to download precompiled binary packages or build everything from source"

Step 2: (install readline) (within a terminal) sudo /sw/bin/fink install readline

Step 3: give yourself root access with sudo and download the latest version of postgres with curl
note: this can be extracted into any directory, I just chose to use /usr/local/postgres_src

mkdir /usr/local/postgres_src
cd /usr/local/postgres_src
sudo sh
curl -O ftp://ftp.us.postgresql.org/pub/PostgreSQL/source/v8.1.3/postgresql-8.1.3.tar.gz
tar -xzvf postgresql-8.1.3.tar.gz
cd postgresql-8.1.3

Step 4: make and configure postgres 8

(within the postgres-8.1.3 directory)
./configure --with-includes=/sw/include/ --with-libraries=/sw/lib
make install

Step 5: add a new user that will have permissions on the database.

This can be done by going into System->Preferences->Accounts and "New User". Call this new user "postgres".

Step 6: Create postgres data directories and change the ownership to the postgre user that was created in step 5.

mkdir /usr/local/pgsql/data
chown postgres /usr/local/pgsql/data

Login to the postgres user account

su -l postgres

Step 7: initialize the database

/usr/local/pgsql/bin/initdb -D /usr/local/pgsql/data

Step 8: start the server

/usr/local/pgsql/bin/pg_ctl -D /usr/local/pgsql/data -l logfile start

Step 9: start creating tables

createdb test

Step 10: start executing commands on the newly created table. Postgres is now installed.

psql test (psql is a command-line utility for executing sql commands)

create table newtable (name varchar, email varchar);

insert into newtable (name,address) values ('John','john@email.com');

Sunday, April 02, 2006

How to cache smarty templates

By Justin Silverton

The Following is taken from the smarty manual:

What is caching?

Caching is used to speed up a call to display() or fetch() by saving its output to a file. If a cached version of the call is available, that is displayed instead of regenerating the output. Caching can speed things up tremendously, especially templates with longer computation times. Since the output of display() or fetch() is cached, one cache file could conceivably be made up of several template files, config files, etc.

Since templates are dynamic, it is important to be careful what you are caching and for how long. For instance, if you are displaying the front page of your website that does not change its content very often, it might work well to cache this page for an hour or more. On the other hand, if you are displaying a page with a weather map containing new information by the minute, it would not make sense to cache this page.

Setting it up

The first thing to do is enable caching by setting $caching = 1 (or 2).

Example: setting up caching

caching = true;


With caching enabled, the function call to display('index.tpl') will render the template as usual, but also saves a copy of its output to a file (a cached copy) in the $cache_dir. Upon the next call to display('index.tpl'), the cached copy will be used instead of rendering the template again.

Technical Note: The files in the $cache_dir are named similar to the template name. Although they end in the ".php" extention, they are not really executable php scripts. Do not edit these files!

Each cached page has a limited lifetime determined by $cache_lifetime. The default value is 3600 seconds, or 1 hour. After that time expires, the cache is regenerated. It is possible to give individual caches their own expiration time by setting $caching = 2. See $cache_lifetime for more details.

example: setting up cache lifetime

caching = 2; // lifetime is per cache

// set the cache_lifetime for index.tpl to 5 minutes
$smarty->cache_lifetime = 300;

// set the cache_lifetime for home.tpl to 1 hour
$smarty->cache_lifetime = 3600;

// NOTE: the following $cache_lifetime setting will not work when $caching = 2.
// The cache lifetime for home.tpl has already been set
// to 1 hour, and will no longer respect the value of $cache_lifetime.
// The home.tpl cache will still expire after 1 hour.
$smarty->cache_lifetime = 30; // 30 seconds

Caching Tips

Smarty caching can improve performance tremendously, but it doesn't always work the way that you think it should. In the following situation (which I have seen recently):

example: within (main.tpl) (this is a file named main.tpl)
{if some action}
{include file="menu1.tpl"}
{elseif some other action}
{include file="menu2.tpl"}

If the main template file (main.tpl) is cached, the includes template files will not get called properly. My solution is to separate the main file into cached and non-cached parts:

(within the PHP file that calls your smarty templates)

//do this on any separate template file that you want cached
$smarty->caching = true;
//the fetch command puts the output of a template file into a variable rather than //the screen
$menu1 = $smarty->fetch('menu1.tpl');
$menu2 = $smarty->fetch('menu2.tpl');

//set the main caching file to false
$smarty->caching = false;

(within the new main.tpl)
{if some action}
{elseif some other action}