Headlines | Linux | Apps | Coding | BSD | Admin | News
Information for Linux System Administration 

Space Tyrant: A multiplayer network game for Linux


Since the last release of Space Tyrant, it has gained some actual game-like functionality. The new code can be downloaded from st2.c. Download it as well as the shell script you’ll need to compile it:

It’s now possible to connect to the game via telnet and to create an account, log in, and be issued a ship. Once you’re logged in, there is a universe to explore filled with ports for buying and selling goods and planets for scooping free goods. From those trading activities you can earn money, called microbots. Other than trading to earn more money, you only use your microbots to buy fighters -- which you can use to attack other players or the neutral fighters that guard some sectors.

The neutral fighters are only good for parking under while you’re not playing. They afford a little bit of free protection for your ship since no one can attack you until they first destroy the neutral fighters. Note that you can attack other players whether they are logged in or not and any fighters with their ship will automatically try to defend them.

Each player starts out with a specific supply of fuel, called antimatter. Each minute a small amount of additional antimatter is issued by a function called updatefuel(). If you’re not logged in, fuel just accumulates in your ship. This continuous allocation of fuel makes Space Tyrant a type of turn-based game. Unlike traditional turn-based games, however, you can play your fuel all at once or a little at a time and completely independently of how and when other players play.

You can also talk to other players on the radio. There is only one channel so everyone who is logged in hears everything that is said on the radio.

The game isn’t yet playable in any reliable sense, however, because it doesn’t yet back up and reload the data from disk files. The software creates an instance of the game when you run it and it remains running until you stop it or the system goes down. There is also no way to establish a time limit on a game.

That’s pretty much the extent of the functionality changes. Now, on to the code.

First, there is a login function. That function looks in the player database struct and, if the player name doesn’t already exist, it creates an account there. If the name does exist, it prompts for a password, matches it against the stored password, and logs you in if the two match. There is not yet a way to change your password.

Once a player is logged in, he is faced with a sector description and a ‘choice:’ prompt. Any character that the player types at this prompt is immediately acted on as if it were a command. There is a string called ‘commlist’, short for command list, containing the letters and characters that are used as commands. A function pointer array, ‘fp[]()’, is used to store the locations of the command functions. Another function called ‘commscan()’ looks up the command letter typed and returns an index into the fp[]() function pointer array. This combination of the commlist string, the commscan function, and the fp function pointer array constitute the command processing loop of the game, as shown below:


These lines are embedded in a loop where each user’s input thread, represented by the variable ‘th’, is examined for new input. The new input arrives in string called inbuf. Since each thread has several buffers, an index called inptr is used to keep track of which one is currently being processed.

And, as described above, commscan is used to extract the appropriate function index and place it in a variable called ‘userndx’. Then, userndx is used to index into the fp function pointer array and the thread index (th) is passed to the appropriate command-processing function.

There’s a small amount of misdirection in that first line but, once understood, it becomes trivial to add additional commands. Basically, you just need to replace the placeholder function, ‘nullrtn’, with your new function name adjacent to the command letter you select in the fp[]() definition list.

The new functions are discussed below.

In keeping with the evolving game nature of this project, several actual game functions have been added. The first new function, makemap(), builds a 20,000-sector single-galaxy universe and populates it with objects. By changing the GAMESIZE constant, you can build a universe of arbitrary size, but make sure you don’t try to build a universe so big as to consume too much of your system’s memory. I’ve tested universes of up to 1,000,000 sectors, which seem to work just fine. The makemap() function randomly puts ports, planets, fleets of neutral fighters, and nebulas in various sectors throughout the universe, and interconnects the sectors with randomly-generated one-way ‘warps’. Note that planets and ports are randomly given varying productivity's and random initial inventories of our three commodities: Iron, Alcohol, and Hardware.

Note that makemap() builds each sectors array of six warps, sorts them into ascending order, and then looks for duplicate warps. If any duplicates are found, it decrements the loop-controlling variable and simply rebuilds that entire sector from scratch. The sorted warps are a convention that we will maintain throughout the project. Each new galaxy type that we add in the future will adhere to that convention and other functions (and users) will be allowed to assume that warps are in ascending order.

We have added a function to simply list the implemented commands and a short line of description. For now, the function is attached to the command letters ‘?’ and ‘H’ via the function pointer array and the commlist array. This function is mostly useful to illustrate a design limitation. The output of any single sprintf buffer-building function cannot exceed the MAXLINE buffer size constant. This function produces a single buffer out output very near the current 511-byte limit and will soon have to be split to produce two buffers of output. Assuming, of course, that we don’t increase the MAXLINE buffer size.

The ‘J’ command activates the jettison() function. It’s only purpose is to dump any cargo out of your cargo holds. It illustrates the method we use to let a function that requires multiple characters of input -- or simple confirmation -- to temporarily turn off command processing and send the next character of input back to it. Jettison requires confirmation so that you don’t accidentally dump your cargo just by hitting the J key. (Since all commands operate as ‘hot’ keys you do not have to hit the [Enter] key to activate a command -- each command immediately executes as soon as you press a key.)

Each command function has the ability to set the thread’s control variable to it’s own command letter. That way, the command processing loop can simply check ‘control’ pass the next buffer of input directly to whichever function is indicated.

The warprtn and jumprtn functions process requests to move to another sector. warprtn() processes the commands 1, 2, 3, 4, 5, and 6, which represent a user’s request to move to the first through the sixth sector number in the warp list, respectively. jumprtn() processes requests to move to a randomly selected sector in the warp list via the ‘-’ (or ‘=’) key. jumprtn() also implements commands to move to the next larger sector, the next smaller sector, as well as the largest and smallest sector number via the ‘.’, ‘,’, ‘>’, and ‘game design and the programming model. The second article discusses the IO handling code and more of the details of the programming model.]

[Update, June 25, 2005: A Space Tyrant home page has been created as a central index to the various ST articles, links, and files.]

[Update, March 21, 2007: Space Tyrant now has a website of its own!. This site is new but growing and will be the quickest way to find new information and code on the Space Tyrant project.]
mail this link | permapage | score:9024 | -Ray, May 30, 2005 (Updated: March 21, 2007)

Space Tyrant: A threaded C game project: First Code


First code: This is the first code release of Space Tyrant. This is an early stage of development and, at this point, only implements the listening thread, the two IO threads for each player connection, and a skeletal game logic thread that does little beyond proof-of-concept code.

The design of the code was discussed in this article so you should probably go back and read that article if this is your first brush with this project.

The first code release -- what we will be discussing in this article -- is online as spacetyrant1.c. Download it as well as the shell script you’ll need to compile it: The script should work under both Linux and Mac OS X. The code will require a single line change to compile under Mac OS X. Search the code for the string OSX to find the line to decomment and the corresponding line to comment out.

Currently, the program allows multiple people to connect using telnet and echos anything they type to all other connected sessions. Some familiarity with the C programming language will be assumed in this article and those to follow.

Configuration constants: There are several ‘configuration constants’ defined by #define statements. The key constants and their meanings are:

MAXTH: This number represents the maximum number of users that can connect simultaneously. This constant is used to set limits on loops and to define the number of elements in various arrays. This number must be a power of 2.

MAXTHBITS: This is simply the number of bits necessary to form an unsigned int to index into arrays of MAXTH size. This number is used to declare bit fields for use with various items that occur MAXTH times. In the code we use a MAXTH of 256 and since 2^8 equals 256, MAXTHBITS is set to 8. Note that if you change MAXTH, you must make an appropriate change to MAXTHBITS!

MAXBUF: This is the number of buffers used in various places. For example, the input threads each get MAXBUF numbers of buffers.

MAXBUFBITS: This number matches MAXBUF in that it is the number of bits necessary to express the number MAXBUF in the same way that MAXTHBITS relates to MAXTH.

MAXLINE: This is the maximum length (in bytes) that is allowed for network input and output. The IO buffers, for example, are declared to be size MAXLINE + 1. The ‘+ 1’ is to allow room for a terminating 0.

RADPAD: This is added to MAXLINE to determine the length of a radio buffer. Radio buffers need to be larger than IO buffers since they must allow room for headers.

Data structures: Next, we declare a struct to contain most of the data associated with each thread. Note that this struct contains no player-specific data; it is used only to contain the data necessary to define an input thread and an output thread used to define one user connection. ‘threc’, as we will call the struct, will be an array with MAXTH elements. It will contain the thread ID of both the input and output threads, the timestamp of the last input from the input thread, the number of the socket descriptor, and various flags and indexes that will be used to coordinate the activities of the input, output, and game logic threads. Look at the code comments themselves for details on the variables.

Note that MAXBUFBITS is used to declare the size of inndx, outndx, inptr, and outptr. These variables, when incremented past the number of buffers, wrap back to zero, making it easy to implement ring buffers. That is why the MAXBUF number must be a power of 2.

The thread functions: In this program main() has two primary functions. First, it calls any initialization functions and clears the various data structures and spawns any other permanent threads. Second, it goes into an endless loop of accepting user connections and spawning IO threads to handle the newly connected users.

The next thread function, gameloop(), has the hard job. It constantly loops though the input buffers, looks for input that needs to be processed, and does it. While looping around the buffers, it also looks for input threads that have gone idle and terminates (‘reaps’) them. Currently, the only input processing it does to call a function named broadcast() with any data it finds in the input buffers. The broadcast() function simply copies the input to output buffers. This bit of processing is for proof-of-concept purposes only and will be replaced by actual game logic as it is developed.

The last important thread functions, userin() and userout(), exist in multiple pairs to perform network input and output duties for each connected user. The userin() thread reads the network connection and loads data into the next available input buffer (‘inbuf’). It then timestamps it, and goes back to waiting for more input. The userout() thread loops continously waiting for anything to appear in the next output buffer (‘outbuf’). When new data is placed in an output buffer by the gameloop() thread, userout() writes it to the user’s network socket.

Note that because userout() and gameloop() loop continously, they sleep after each ‘idle’ loop. That is, when they pass through their logic loop and find no actual work to do, they call the usleep() function to sleep a tiny fraction of a second. This sleeping prevents them from consuming unnecessary processor cycles.

[Update, June 25, 2005: A Space Tyrant home page has been created as a central index to the various ST articles, links, and files.]
mail this link | permapage | score:9022 | -Ray, March 27, 2005 (Updated: June 25, 2005)

Space Tyrant Index Page: Linux game server development project


This page links to the various articles that have been published about Space Tyrant, a multithreaded, network socket programming Linux game server project in C.

Read below for the history and overview or just click these links for the articles:Space Tyrant is a C language Linux game server development project. It started out in February, 2005 as a humble echo server with high ambitions. On March 18, ST had its design and intentions announced to the world.
Today we kick off a new multithreaded, network socket programming project which we will call Space Tyrant. Our mission is to write an open source, multiplayer, networked, strategy game in the C programming language. The goal of this project is to make a solid code base which implements a simple space trading game upon which other games can then be built. The game will be a subset of The Last Resort (TLR) that currently runs at This project will be a learning exercise for me as well as for any interested readers. The current state of the source code will be released with each article update.
Source code to ST, then just an echo server, was not released.

Then, on March 27, 2005, ST was promoted to a crude chatserver.
This is the first code release of Space Tyrant. This is an early stage of development and, at this point, only implements the listening thread, the two IO threads for each player connection, and a skeletal game logic thread that does little beyond proof-of-concept code.
Next, on May 30, 2005, ST started to resemble some sort of incomplete text game.
It’s now possible to connect to the game via telnet and to create an account, log in, and be issued a ship. Once you’re logged in, there is a universe to explore filled with ports for buying and selling goods and planets for scooping free goods. From those trading activities you can earn money, called microbots. Other than trading to earn more money, you only use your microbots to buy fighters -- which you can use to attack other players or the neutral fighters that guard some sectors.
As of this release, the source code was placed under the GPL, version 2.

On June 26, 2005, Space Tyrant was released with many shiny new abilities. Players can now deploy fighters to guard sectors, navigate with the aid of an autopilot, rank the various players in the universe, and sleep peacefully knowing their alternate universe is being backed up constantly by a sporty new backup thread. Yes, good times are surely upon us.
If you’re looking for a planet, type the ‘L’ command that you would normally use to land on a planet in your sector. In the absence of a planet, the L key will engage the autopilot which will search for the nearest planet and give you a ‘/’ command to autowarp to it.
There is normally a copy of the development version of the server running on my decTOP on port 23. To access it, type (or click, if it works for you) the following command:

(telnet to my ST server)

The current development version of the code is usually at but the individual articles link to the specific versions discussed in each article.

You can mail me about the project at spacetyrant [at] -- or you can just telnet into Space Tyrant, as listed above, and send me a radio message. I'm likely to get that faster. ;)

The Space Tyrant project has a new website,, where the latest source code is always available. Also, new articles about ST programming and about ST gameplay will be posted there as they come available.

Information on The Last Resort follows. TLR is one of the two games that Space Tyrant is intended to replace someday. Space Tyrant has a long way to go before it replicates TLR's 25,000 lines of C code. So far, it has reused only about 40 lines of TLR code, a handy 'bit-plane' sort dating back to 1998.

  • TLR Survival Manual
  • Is this game for you?
  • mail this link | permapage | score:9013 | -Ray, June 25, 2005 (Updated: April 26, 2011)

    Expect Script Examples


    Expressions, if statements, for loops, and while loops examples are covered in this mini-tutorial:
    This article explains the following in the expect scripting language.
    • Expressions – arithmetic operation
    • if construct in expect
    • looping constructs
    permapage | score:8985 | -Ray, January 21, 2011

    Mono-culture and the .NETwork effect


    Consider a future where Microsoft has succeeded in migrating most Windows development to the .NET framework. With the considerable power that Microsoft wields over corporate desktop computing, the success of .NET is easy to foresee.

    Now, imagine for a moment that Mono, following in .NET's footsteps, is also hugely successful. Further, imagine that, in its success, Mono displaces a large portion of traditional Linux software development over the next few years.

    I believe that if the above scenario becomes reality it could lead to a disaster for Linux. In such a future, Microsoft would have tremendous leverage over Linux, Linux programmers, and businesses using Linux.

    Microsoft can, at a carefully selected time, change key interfaces, sue for patent infringement, and release otherwise standard .NET components that break or obsolete pieces of Mono. They can also use the powers of the DMCA to prevent Mono developers from gaining access to obfuscated components of .NET technology. While hobbyists and Linux-centric companies will be able to withstand such inconveniences (with the possible exception of patent suits, of course), general businesses and organizations will not be able to resist such pressure.

    Of course, Microsoft is well aware of how this scenario could unfold and has thought of many more exploitable details than a casual observer such as myself.

    Mono, if successful, is a gift from heaven to Microsoft that, when the timing is right, can be used to set Linux deployment back years, or worse, depending on the devastating psychological and economic effects such a maneuver would have on Linux developers and businesses.

    For Microsoft, their best strategy to do real damage to Linux is to make it easy for Mono to succeed while carefully laying their traps. They can quietly go about the business of patenting all of the key functions of .NET. Anyone who has followed the trend of software patents must realize that Microsoft could have dozens of patent claims covering .NET before Mono rises to prominence.

    Then, Microsoft need only wait. The optimum time to shut down Mono will be after much Linux development has committed to it. By then, Mono technology will have infected many projects. Perhaps worse, it will be easier for Mono programmers to simply switch platforms and become Windows developers rather than learn alternative methods and tools of Linux development. Programmers have to eat and software development houses must pay the bills. In such a scenario, there is not a year to burn while everyone ramps up their skills with new tools and practices.

    Meanwhile, businesses will be forced to abandon any Linux packages that are .NET-encumbered. Since a .NET version of each Mono-based program would already exist, it would take only a few such packages to convince a business to migrate off of Linux. The headaches of replacing such packages under Linux need only exceed the alternative headache of simply switching to Windows.

    A company with their own custom Mono-based software would have fewer options. Microsoft, however, would likely provide an easy solution; simply move the Mono software to .NET and it will all be legal.

    I am not the first person to have thought about this. Several Slashdot users have posted cautionary messages about developers placing their trust in the good intentions of Microsoft. [1, 2, 3, 4, and 5].

    Dave Winer also seems to wonder about Microsoft's oddly open behavior:
    The first clue should be that Microsoft is not protecting the source of .NET, in fact they're publishing it, with some constraints, but if you want to see how they do it, they say there will be no mysteries and no poison pills. So they're making it not impossible to clone. Why are they being so generous? (A little sarcasm, sorry.)
    Even Miguel de Icaza1, the founder of the Mono project, acknowledges the compatibility hazards:
    If Microsoft decided to make our life really hard in terms of compatibility, it would also hurt its own customers. If it changes the APIs, that affects its customers as well. So I think the APIs will remain fairly stable, and I hope that Microsoft won't go into proprietary protocols or protocols that would make it really hard for us to implement Mono. There's is always the possibility it will do so. Microsoft has some strange patterns in terms of how it competes. I really hope it will "behave like a good citizen," as Steve Ballmer said recently it would.
    What I've described here is probably a worst-case scenario; in all likelihood Mono will not be so successful as to cause a large problem for Linux if and when Microsoft decides to kill it. However, even in a favorable sequence of events, Microsoft will still hold the power to cause a large amount of open source effort and code to be lost.

    1. Miguel rebuts one of my points here.
    mail this link | permapage | score:8973 | -Ray, October 13, 2003 (Updated: October 14, 2003)

    Better Grails apps with CSS


    This article focuses on dramatically changing the look and feel of a Grails application. With a few lines of CSS, you can change colors, fonts, and the spacing around block elements. Through partial templates and TagLibs, you can create some reusable snippets of code. In the end, you have all the benefits of the Grails framework and an application that has its very own look and feel, that looks nothing like an out-of-the-box Grails application you have ever seen.

    (check out this dramatic canvas prints)
    mail this link | permapage | score:8968 | -solrac, January 22, 2009 (Updated: April 24, 2012)

    Build Apps with Android SDK, Eclipse, PhoneGap (Ubuntu 10.10)


    This tutorial describes how you can set up a development environment for building Android apps on an Ubuntu 10.10 desktop using Eclipse, the Android SDK, and PhoneGap. I will describe how to build Android apps from the command line with PhoneGap and from the GUI with Eclipse and PhoneGap and how to test them in an Android emulator and on a real Android device. PhoneGap allows you to develop your Android applications using web technologies such as HTML, CSS, and JavaScript (e.g. with JavaScript libraries such as jQuery/jQTouch), and it will turn these web apps into native Android apps (in fact, PhoneGap supports multiple platforms such as Android, iPhone, Palm, Windows Mobile, Symbian, so you can use the same sources to create apps for multiple platforms). read more...
    mail this link | permapage | score:8965 | -falko, January 27, 2011

    Compile Crystal Space in Ubuntu 10.04


    If you are a budding game developer, there is a wide selection of 3D engines that you can use to get your ideas off the ground. The first step when using a 3D engine (or any library distributed as source code) is to compile it. Crystal Space is no different. The steps below will show you how to get Crystal Space up and running on your Ubuntu PC. read more...
    permapage | score:8950 | -mcasperson, July 2, 2010

    Programming the Sony PS3 SPE cores under Linux


    Take even greater advantage of the synergistic processing elements (SPEs) of the Sony PS3 in this installment of Programming high-performance applications on the Cell BE processor. Part 2 looks in depth at the Cell Broadband Engine processor's SPEs and how they work at the lowest level, while Part 1 showed how to install Linux on the PS3 and explored a short example program. read more...
    mail this link | permapage | score:8913 | -Ida Momtaheni, February 21, 2007

    Scripting: Put a clock in your bash terminal


    In the original version, the cursor positioning didn't work on my Mac OS X system. If that happens to you, try this simplified variant:
    while true
    tput sc
    tput cup 0 60
    echo -en `date +"%H:%M:%S %F"`
    tput rc
    sleep 1
    Also, note that you'll need to run either script in the background to use your terminal.
    The script saves the current cursor position with an ANSI escape sequence instruction. Then, using the tput command, the cursor is sent to row 0 (the top of the screen) and the last column minus 19 characters (19 is the length of HH:MM:SS YYYY-MM-DD). The formatted date command is displayed in green inverted color. The cursor is then sent back to its original position with another ANSI sequence that restores the original saved position.
    mail this link | permapage | score:8890 | -Ray, January 22, 2008

    Pattern matching in shell scripting


    This article is excerpted from the book Beginning Portable Shell Scripting.
    Shell programming is heavily dependent on string processing. The term string is used generically to refer to any sequence of characters; typical examples of strings might be a line of input or a single argument to a command. Users enter responses to prompts, file names are generated, and commands produce output. Recurring throughout this is the need to determine whether a given string conforms to a given pattern; this process is called pattern matching. The shell has a fair amount of built-in pattern matching functionality.
    mail this link | permapage | score:8875 | -Ray, January 1, 2009

    Why Programmers are not Software Engineers


    People toss about the term 'software engineering' as if programming were just another engineering discipline.

    Programming is 100 percent design. And that design is vastly more complex than the typical true engineering effort of comparable cost. Said another way, an engineering project of similar logical complexity to a software program is far more expensive.

    Much of the reason for that low cost is that programming has no comparable build phase that, in some other field, might consume the vast majority of the total cost.

    Programming is dramatically cheaper than a similarly complex physical project.

    Programming doesn't fail in the same sense that an engineering project can fail. Programs never fail because of faulty materials or shoddy workmanship -- except in the compilation phase, perhaps, but in that case the program doesn't even exist. Programs don't fail because of use beyond their rated capacities, although they may fail because they foolishly accept input or a load beyond their capacities.

    Programs only fail due to design flaws.

    Ignoring terminology for the moment, the reason that software quality is so much lower than one might expect is fundamentally economic. The 'engineering' phase, the design, represents nearly the entire cost of the actual development. The only place where costs can be shaved is design. The building blocks of the actual construction, opcodes, are essentially free.

    Software doesn't meet engineering standards, largely for economic reasons.

    And, lastly, an engineer is one so designated by government. With that title comes certain legal responsibilities. 'Software engineers' are neither designated as such nor are they held to engineering standards.

    Engineer is a title conferred by the state and it may not even be legal to call yourself a 'software engineer'.

    On the other hand, the best programmers I've met don't call themselves engineers at all. They call themselves programmers, coders, and hackers. Evidently, there is no shame in that. Let's leave the engineering title to those who have earned it and accept the responsibilities that come with it.

    We should be thankful that we aren't held legally responsible for the performance of our designs.
    mail this link | permapage | score:8856 | -Ray, November 25, 2002

    DWR Java Ajax: User Interface (pdf)


    Caution: this article is in PDF format. -Ed.

    In this article, the author of the book DWR Java Ajax Application shows how to develop samples based on DWR, which demonstrate how to dynamically change the common user interface elements such as tables, lists, and field completion. It also covers steps to make a dynamic user interface skeleton for these samples.

    The section on dynamic user interfaces shows how to get started with a DWR application, and it presents a user interface skeleton that will be used to hold the tables and lists sample, and the field completion sample.

    The article is divided into the following three sections:

    • Creating a Dynamic User Interface—starts with creating a web project and a basis for samples mentioned in this chapter
    • Implementing Tables and Lists—shows us how to use DWR with them
    • Implementing Field Completion—has a sample for typical field completion
    mail this link | permapage | score:8844 | -Niraja Mulye, December 30, 2008

    Tutorial: Socket Programming in C


    Windows is also discussed for those not familiar with Linux or Unix.
    In this tutorial I will introduce you guys how to use socket programming routines in your C code .The tutorial assumes that you know well C programming and also that you are familiar with the operating system Linux or Unix or FreeBSD...
    Update April 4, 2005: Librenix is now featuring a Linux multithreaded Socket programming game server project in C. The Space Tyrant design is covered here and the first Space Tyrant code release is discussed here.

    Space Tyrant now has its own programming website.
    mail this link | permapage | score:8842 | -Ray, April 26, 2003 (Updated: March 20, 2007)

    Why software sucks


    I've heard widely varying opinions on why software is so lousy, the most recent from this article by Charles C. Mann. Mr. Mann makes an excellent anecdotal case for just how bad software has become. Then, he concludes that perhaps a bit more litigation would help matters. While one of the perpetrators of bad software he cites is Microsoft, they, and other wealthy software development companies, might be among the least vulnerable to lawsuits brought over poor software. As is frequently the case, increased litigation would probably put the small developer at even more of a disadvantage relative to the large software corporation.

    But more to the point, why is software so bad? Programming is sometimes compared to an engineering specialty and the point is made that product standards are much lower for software. Software, unlike building construction, for example, is pure design. The actual programming phase is just a finer grained version of what we programmers normally call 'design'.

    Software development is one hundred percent design.

    Consider the implications of that statement for a moment. Virtually all of the cost of software development is, directly and indirectly, the cost of design. If a student architect could design a skyscraper, push a button, and have some futuristic genesis device instantly construct the building at virtually no cost -- and at no danger to anyone -- and with perfect components throughout, would he not do so? Further, imagine that with a push of another button, the entire building could be reduced back to its constituent atoms.

    The student could try and try again, refining his design until it was finally just what he wanted. Now, imagine that there was no danger in occupying such a building. Would it change the way we make buildings? Given the alternative of spending millions to build the building the old fashioned way versus spending a fraction of one percent of that to do only the design -- and automate the remainder for virtually nothing -- I suspect that the market would choose the vastly cheaper method.

    For software that doesn't involve life-or-death applications, the development cost model closely resembles our fictional architectural scenario.

    People are understandably reluctant to add real engineering discipline to software development. While there is no physical building phase, the complexity of a large application is staggering. A large program might have millions of (logically) moving parts, all interrelated. To prove that it all works correctly, as specified, might be more than just prohibitively expensive; it may well be impossible. And even if such verification were possible, proving the correctness of a large program would greatly delay the release date.

    Perhaps life support systems, X-ray machines, and other such critical programming does belong in the engineering realm with formal education requirements, legal responsibilities, and state certification. But for my favorite projects, I think the status quo is just fine.

    Yes, software sucks -- but it's usually cheap. Further, in my experience, the cheapest software, free, seems to suck the least.

    Fast, good, cheap: choose two.
    mail this link | permapage | score:8836 | -Ray, June 19, 2002 (Updated: April 26, 2011)

    Perl One-Liners Explained: Handy Regular Expressions


    This is the seventh part of a nine-part article on Perl one-liners.

    Perl one-liners are short programs that do one and only one task well and they fit on a single line in the shell.

    Perl is not Perl without regular expressions, therefore in this part I come up with and explain various Perl regular expressions. Please see part one for the introduction of the series.

    This part explains the following regular expressions:
    • Match something that looks like an IP address.
    • Test if a number is in range 0-255
    • Match an IP address
    • Check if the string looks like an email address
    • Check if the string is a decimal number
    • Check if a word appears twice in the string
    • Increase all numbers by one in the string
    • Extract HTTP User-Agent string from the HTTP headers
    • Match printable ASCII characters
    • Match text between two HTML tags
    • Replace all bold tags with strong tag
    • Extract all matches from a regular expression
    mail this link | permapage | score:8828 | -pkrumins, November 11, 2011

    Beginner and Intermediate / Advanced SQL Tutorials


    For the advanced and intermediate SQL tutorial, go here.
    This unique introductory SQL tutorial not only provides easy-to-understand SQL instructions, but it allows you to practice what you learn using the on-line SQL interpreter. You will receive immediate results after submitting your SQL commands. You will be able to create your own unique tables as well as perform selects, inserts, updates, deletes, and drops on your tables. This SQL tutorial currently supports a subset of ANSI SQL. The basics of each SQL command will be covered in this introductory tutorial. Unless otherwise stated, the interpreter will support everything covered in this course.
    mail this link | permapage | score:8828 | -Ray, June 8, 2003

    Dojo for Java programmers


    Many developers have strong skills in Java programming, but only limited experience in JavaScript. They can struggle with the conceptual leap from a strongly typed, object-oriented compilation language to a dynamic, weakly typed scripting language. This article helps you bridge the gap from Java code to Dojo, shows why it may be necessary to set context, and describes how to go about it. read more...
    permapage | score:8818 | -jmalasko, October 21, 2008

    Review: DevelopGo: A Linux Live CD for Programmers


    DevelopGo is a special Live CD released by the Onebase Linux Project. As the name indicates, it is meant exclusively for programmers.

    Although I am a Windows Programmer, I was searching for such a Live CD that would allow me to experiment with different types of toolkits and IDEs available in Linux. DevelopGo matched exactly what I wanted with a suite of developer tools and compilers.

    After downloading and trying it, I found it very useful and would like to share my thoughts with other Linux programmers who might be interested.

    About the DevelopGo Live CD
    The booting speed of the Live CD was fast and it loaded into a full blown KDE desktop. I liked the theme, as it gave a 'Programmers' look and feel.

    On the Desktop there were many icons like Editors and Utilities which contained shortcuts for accessing programs. Another Icon, named Getting-Started, was a single page catalog of all the software present in the Live CD.

    The list was huge and covered most of the popular tools available for Linux. It was a total development environment that included header files and libraries of all the compiled applications. It included other features of Onebase Linux like Hard-Disk Installer, Docking, USB disk save, etc., which are beyond the scope of this article.

    Languages and Toolkits
    As mentioned in the Onebase's Website, the user is to ready to program by simply booting a CD in over 11 languages and 5 toolkits. The following programming languages are supported in DevelopGo 1.0:
    • High-level Languages: Java, C, C++, Obj C, Mono C#, Boo, COBOL
    • Scripting Languages: Perl, Python, BASH, TCL, Ruby, LUA
    • Toolkits and Bindings available in this Live CD
    • Toolkits: QT, GTK+, TK, Lesstif, FLTK
    • Bindings: Ruby-Gnome2, KDEBindings, PyKDE, PyQT, PyGTK, Gnome-Python
    This gave me the opportunity to learn and program with many languages and toolkits.

    Since my programming interest is based on scripting, the different bindings helped to select a suitable toolkit for my software development right away. But there were tradeoffs like an old GCC version 3.4.3. This is understandable as the new GCC 4.0 provides many new changes and features but is not quite stable. A major Perl GTK binding was not included with DevelopGo.

    IDE and Editors
    DevelopGo comes with a number of Editors and Integrated Development Environments to choose from.
    • Java Programming - The Popular Eclipse IDE version 3.1
    • Mono C# Programming - MonoDevelop .NET development environment with API documentation
    • C, C++, Obj, QT, TK, Perl, Python, Ruby - KDevelop 3.1.2 IDE
    • GTK and GNOME programming - Anjuta 1.2.2 Development studio
    • Web Programming - BlueFish Editor
    • Python and Ruby Programming - Eric IDE
    • GUI Designers - QTDesigner, Glade and Kommander
    • Apart from this list, there were also other console based editors and compilers.
    The Loading time of these applications were good. Most of these editors were stable and ran without problems. Except, BlueFish could have been replaced for Nvu, Otherwise the inclusion of editors like MonoDevelop, Eclipse was great.

    Many useful developer utilities were present such as CVS, a version control system, Debugger (GDB), and a Project Management Tool called Planner.

    There is also DistCC for performing distributed compilation of code and ccache which caches object files and compiles only the changed files making compilation faster.

    Another interesting part of DevelopGo is that it includes lots of offline developer documentation on various subjects, despite most of them have been taken from the Internet. These documentation includes guides, API Reference and Code Examples for various compilers and IDEs.

    There were firefox bookmarks to Linux based Programming Websites and Pages.

    I felt that the main missing factor from this Live CD was the non-availability of DataBase Languages like MySQL. However this can be overcome by installing it to Hard-disk and downloading the available Database servers from the Onebase Software Gallery.

    Overall I feel DevelopGo is complete and valuable for a Linux Programmer and a good starting point for building Linux Applications.

    Visit the Onebase Website for more information and to download the DevelopGo ISO.
    mail this link | permapage | score:8813 | -kumpd, August 25, 2005 (Updated: March 21, 2007)

    Comparison: Zend PHP vs. Symfony vs. CakePHP


    This article walks through extending the sample application, Blahg, in each of the three frameworks (Zend PHP, symfony, and CakePHP). This is a great way to see each framwork in action by examining their similarities and differences while applying each framework and extending a sample application. read more...
    permapage | score:8793 | -solrac, December 19, 2007
    More coding articles...
    Buy Large Abstract Art Prints

    coding headlines

    Tutorial: Write your own operating system

    Install WebSphere MQ on Linux

    Tutorial: Linux Dialog Boxes

    Tutorial: Write a Qt program with Qt Designer

    Programming Language Tradeoffs: 3GL vs 4GL

    The Real Microsoft Monopoly

    PHP vs. ASP

    A multithreaded web server for Linux (source code)

    Online Ruby Interpreter

    Tutorial: Install the Aptana AJAX IDE on Ubuntu

    Monitor a Linux service with watchdog scripting

    The life cycle of a programmer

    perl dispatch table examples

    Java J2EE Tutorial: Secret Santa Web Application

    Scripting: Bash Array Tutorial

    Unix: Shell Script Wrapper Examples

    Mac Shell Scripting Tutorial

    Tutorial: Write plugins for Nagios

    Open source Cloud Computing with PHP and MySQL

    Perl tips

    GWT and PHP

    Best practices for XML in Java programming

    Download: Java 5 for Linux

    Tutorial: Using Eclipse to develop grid services

    Apache Derby Tutorial

    HTML5: Drag and Drop to a webpage

    Command line functions

    Java API: NamespaceContext sample code

    Bash Functions

    Tutorial: Android development environment on Fedora 14

    Example code: A PHP/Ajax chat application

    kdb: Initial steps of dump analysis

    BASIC for Linux

    Tutorial: Install and test C, C++ Compilers in Ubuntu

    Tutorial: UDP socket based client server C programs

    Tutorial: Database Connection Management with Spring

    PHP / MySQL Cheat Sheet

    Tutorial: Creating graphics with PHP

    Tutorial: Create a video site with PHP

    How to debug a Linux Shell Script


    Firefox sidebar

    Site map

    Site info

    News feed


    (to post)


    Articles are owned by their authors.   © 2000-2012 Ray Yeargin