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

Create a bootable Ubuntu 10.04 USB drive from Windows

Up
vote
Down

Put Ubuntu 10.04 in your pocket on a USB thumb drive from your Windows box...
The first method will create a bootable USB stick with a live version and the second process will create a live version with persistence. Both methods are an excellent way to always have your favorite Ubuntu system and software with you at all times and it makes for one of the simplest ways to conduct an install to a hard drive.

First you need a linux image to put on your USB drive. You can obtain the latest Ubuntu file from this location. http://releases.ubuntu.com/lucid/ Unless you have some specific reason to choose differently, choose the Ubuntu Desktop 10.04 LTS (32 bit) file.
read more...
mail this link | permapage | score:9195 | -Ray, May 2, 2010

The best lightweight Linux

Up
vote
Down

A subjective assessment of several leading small-footprint Linux distributions...
In selecting our shortlist, we've left out some contenders either because they didn't support older processors, they wouldn't install in 4GB or less of space, they simply didn't work on our hardware or they're no longer being maintained (as is the case for both RULE and U-Lite). The one exception to this is Damn Small Linux - although it has been over a year since the last release, and the homepage is as quiet as the LXF office at 9.30 on a Monday morning, this is still such a widely used and influential project that it was considered worthy of inclusion.
read more...
mail this link | permapage | score:9176 | -Ray, April 11, 2010

Space Tyrant: Multithreading lessons learned on SMP hardware

Up
vote
Down

There is much to report in this update of Space Tyrant. Before getting into the new features and functions, I’ll dispense with the crisis of The Bug.

For a couple of weeks, we had been noticing odd anomalies with Space Tyrant (ST) running on the virtual server at Ioresort.com (now offline -Ed.). We never saw the problem on any other box -- and it was tested on at least four other Linux boxes and a Mac OS X system. We did all manner of stress testing, locally and over the Internet, script based and even feeding the game the output of /dev/random. Nothing caused the anomaly on any other box.

At first, I suspected that it might just be an obscure problem with the virtual server itself; after all, I had been forced to modify the TLR code to get it to run properly there. That problem turned out to be merely a limitation of NFS, not a bug with the virtual server software. However, the environment was clearly different from any other system I had used which raised my suspicions -- and reduced my urgency about looking for the bug.

While the bug wasn’t frequent, it was persistent. The bug appeared to be related to corrupted buffers or corrupted buffer indexes. Out of idle curiosity, I lowered the number of buffers used by ST to see if that affected the bug. Somewhat counter-intuitively, it substantially raised the frequency of the problem.

Brian Estabrooks (the hero of this release) and I spent more and more of our efforts hunting this incredibly elusive bug until that was all we were doing. I implemented various diagnostic routines hunting for clues. The all seemed to point to buffer indexes being changed incorrectly. Both Brian and I audited the code. It seemed impossible for the indexes to be changed improperly. Brian even went so far as to replace the ring buffer scheme with a high watermark approach but to no avail.

While I continued to suspect it to be a simple logic error in the code, Brian turned his efforts elsewhere. What he came up with was quite interesting. It seems that on many hardware architectures (most? all?), modifying a bit field can temporarily modify other bit fields in the same word! Now, this isn’t a problem on a single-CPU system; it repairs the damage in the same operation, making it, effectively, atomic. On an SMP machine, however, two different CPU’s working on different bit fields of the same word simultaneously create havoc. The operation isn’t really atomic and it doesn’t work.

Did I mention that the virtual server is a 4-way Xeon system?

The ring buffer indexing in ST relies on unsigned integer bit fields to automate wrapping back around to the first buffer after using the last one. My parsimonious programming, of course, packed all the bit fields together, several to a word. Brian’s test version of ST added a pad after each buffer index to round it out so that each bit field lived alone in its own complete word. We abused the new version for nearly an hour before either of us would dare say it. The bug was gone.

Yay!

So, the moral of this story is: Operations on sub-word fields affect other bits in that word (at least on many hardware architectures). Tread very carefully if multiple threads are accessing different bits in shared words. It may appear to work perfectly, only to crumble into a pile of smoldering rubble the first time it's loaded on a multiple CPU system!

Other than the primary lesson, some other good things came out of (the search for) the bug. Several other latent bugs were found and fixed and Brian and I are both much more intimate with the code.

And, on to the enhancements. ST is starting to look like an actual playable game. The following functions implement the new major features.

players(): We now have player rankings. It works by adding all the players’ ship resources to an integer array. Then it scans the universe looking for deployed fighters and adds those to the array as well. Currently, those two items comprise the total strength of a player.

It then sorts the array with a recursive bit-plane sort that I wrote for Starship Traders in 1998. The qsort() function in the C library was plenty fast, but took too much memory for my taste. Memory was a bit scarcer in those days and, worse, the SST software model gave each player his own copy of the server.

The sort reorders the array in place as follows. It scans the high-order bit in each element of the array. It then moves all elements starting with ‘1’ bits to the top and all starting with ‘0’ bits to the bottom. Next, it calls itself twice to reorder the first and second chunks of the array on the second bit. Each of those two instances of the sort then call the sort twice again, now giving 4 new sorts for the third bit, and so on. When all 32 bits are accounted for, the array is in the correct order with the top player on top, etc.

Scanning the entire universe can be expensive with a large map. Therefore, the player rankings function keeps the result and time stamps it. If another player asks for a player ranking within five seconds, the system just gives them the old one. After five seconds, however, any new request triggers a fresh listing.

autopilot(): We’ve added an autopilot to let a player find a specific sector -- or to locate the nearest planet. If you type a ‘0’ (zero), you’ll be prompted for a sector number within 1000 of the sector you’re currently in. You then will have the option of pressing ‘/’ to automatically warp to the destination sector.

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.

The new autopilot function consists of two other functions in addition to autopilot(), which is merely a control function. I had intended to use the old shortest path algorithm function from TLR but it was big and complicated. I decided to try to write a simpler, recursive shortest path algorithm instead. The new recursive function is much simpler but not quite as efficient as the giant for loop in TLR.

The actual algorithm is implemented in two functions called pathdepth() and pathcalc(). The pathdepth() function repeatedly calls pathcalc() with an increasing ‘depth’ parameter. ‘Depth’ tells pathcalc() how many levels deep to search before giving up.

The pathcalc() function simply looks to see if the sector it is looking at is the target sector. If not, it calls itself for each new sector that the current sector connects to. If the current sector is the target sector, it starts filling in an array for the autowarp() function to follow to reach the target sector. As the previous recursive calls to the pathcalc() function exit, they fill in the remainder of the path array.

And, yes, I seem to like reinventing the wheel. ;-)

The other interesting addition to the code is the backup thread. It is implemented by a function called backupdata() and works as follows: It scans the player data, the map data, and the history data looking for ‘dirty’ flags. (Whenever any persistent data is changed anywhere in the game, a dirty flag is set to tell the backup thread to write it out to disk.) This process is quite fast for a small game, but for a game with millions of sectors, it’s a significant waste of resources to scan the dirty flag array frequently.

Therefore, for the map and history data, I’ve implemented a ‘dirty block’ scheme as well. When a dirty flag is set, its corresponding dirty block flag is set too. Then, the backup thread need only scan the dirty block arrays, typically only about one percent the size of the arrays it represents. When a dirty block is found, only the hundred or so records it points to are scanned to find the actual dirty records for backup.

The backup file, named ‘st.9999.dat’ -- where ‘9999’ varies with the port number you run the game on -- goes into the current working directory from where you start the daemon. If the file doesn’t exist, a new game is started. Also, if you’ve modified the game in a way that changes the size of the data -- by increasing the map size, for example -- it will start a new game upon startup.

The game can be shut down from the command line by sending a signal 15 (kill -15 pid) or by the admin with the ^ command. Note that the first player to create an account in a new game automatically becomes the admin of the game!

makehistory(): The storing of historical data is new as well. Whenever another player attacks your ship while you’re logged off, you’ll get a report of the action and any losses when you next log on. Also, for remote deployed fighters, you never get immediate notification, so that information is stored in the history log even if you're logged on when it happens. You can view any accumulated event information since your login time by pressing the ‘e’ key.

deploy(): This simple function allows a player to deploy, or retrieve, guard fighters in a sector. Those fighters will not let another player pass through or view any of the contents of that sector. Any ships parked under the fighters are automatically protected against all attacks except for an attack by the fighters’ owner. Once the fighters are destroyed, of course, all ships there are visible and can be attacked.

There is also a newly implemented time limit in the game to limit the total online time of a day’s sessions to 4 hours. Like most other parameters, it can be changed by modifying a #define statement near the top of the code.

command(): The help page, a menu of available commands that a player can perform, has been redesigned and rewritten. This menu is attached to the '?' key.

The old debugger thread is gone, replaced by an in-game command function called showdata(). Press the ‘z’ key to see information on buffers, buffer indexes, and the backup thread’s state and history. Only if you’re serious about modifying the code will this information be useful.

The section of the gameloop thread that broadcasts radio and news messages has been modified to show only one of each type of message per pass. That way, replaying a long radio history won’t flood the output buffers and longer radio and news histories can therefore be retained.

The old jumprtn() movement function has been consolidated into the warprtn() function. It’s only slightly more complicated than having them separate.

The current source code can be downloaded from http://librenix.com/st/st.158.c. and the original article in this series is here. As usual, the compile script is embedded in the comments at the top of the source file. You’ll have to rename the source st.c for the script to work unchanged.

[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:9148 | -Ray, June 26, 2005 (Updated: July 26, 2008)

perl dispatch table examples

Up
vote
Down

Dispatch Table: The fancy name for a hash of code-refs...
In perl, code is a first class data type... you can talk about it in the same way you would talk about arrays or hashes, you can take references to them (giving you a code-ref ) and you can de-reference them (which runs the code);

Code-references are just scalars that refers to something, and you get them by using the reference-to operator:
read more...
permapage | score:9141 | -f00li5h, December 17, 2010

Digipup: A ham radio Live Linux CD

Up
vote
Down

Puppy Linux has a new pup...
Puppy Linux is a lightweight live Linux distribution that you can boot and run from a CD, USB stick, or DVD. One of its features is the ability to create specialized "pups" -- new versions of Puppy Linux geared toward a specific purpose. Digipup is one such example, with a focus on amateur radio. I spun it up, and found Digipup to be a great way to check out amateur radio utilities for Linux.
read more...
permapage | score:9110 | -Ray, May 6, 2007

Download: Ubuntu Linux Live CD ISO

Up
vote
Down

Here's a downloadable .iso image of Ubuntu's new Live Linux CD. There is a direct download link as well as a bittorrent link available.
This CD will allow you to try out Ubuntu before installing it, without repartitioning or overwriting any existing software or data. Just place it in the drive and reboot your computer.
[Alternatively, you can download the latest release directly from Ubuntu. -Ed.] read more...
permapage | score:9100 | -Ray, October 11, 2004 (Updated: March 19, 2007)

Tutorial: Introduction to Linux files

Up
vote
Down

This newbie-level Linux tutorial is an introduction to handling files from the Linux command line. It will cover finding files, determining their type, renaming, copying, examining their attributes, reading their contents, and, in the case of binary files, how to get clues to learn something more about them. Further reading will be suggested for editing files since that topic is beyond the scope of this article.

Getting Started
The reader of this tutorial is expected to have access to a Linux system and to perform the example commands as we progress through the tutorial. Once logged in to your Linux system, open a terminal session. Under Red Hat Linux, terminal is found in the 'system tools' section of the menu. (Your system may, alternatively, use a terminal program called 'konsole', 'xterm', or 'shell'. Look around your system for a menu with 'tools' or 'utilities' in the name if necessary.)

ls: Listing files
Let's start with the ls command. ls is an abbreviation for list files. Type ls now, then press the 'enter' key to see the names of the files in your current directory. The results from my 'tmp' directory are listed in bold below:

 $ ls /tmp
tardir.0.log
$
Note that I said 'your current directory'. To get the a listing of files in another directory, enter ls [dir] where [dir] is the name of the directory you wish to look at. For example, to see the file names in your top level directory, '/', type the following:
 $ ls /
bin dev home mnt
proc sbin tmp var boot etc
initrd lib opt root sys usr

$
For more information on the files, use one or more of the ls command line switches. Here I use ls with the -l switch for a 'long' listing:
 $ ls -l
total 14
-rw-r--r-- 1 root root 9649
Mar 28 02:47 tardir.0.log

$
Note that with the -l switch we get the file permissions, the inode links, the owner and group names, the file size in bytes, and the timestamp of the file as well in addition to the name. The ls command has many more options. Type man ls for a full list of options.

file: What is this file?
Linux also provides a handy command to help determine what type of files you are dealing with:

 $ file tardir.0.log
tardir.0.log: ASCII text
$
The Linux (and Unix) file command knows about, and can detect, many different file types. In our example, file tells us that tardir.0.log is a simple ASCII text file.

less: Paging through a file
Now, to actually look at the contents of a text file, we have many options. The most common is the more command and a more elaborate, newer command is less. I like less because it lets you use the arrow keys for scrolling and the pgup/pgdn keys for paging through the file. The following is a condensed page from the command less tardir.0.log:

 home/tfr/
home/tfr/doc/
home/tfr/doc/1-WAY
home/tfr/doc/0
home/tfr/doc/ADMIN
[ . . . ]
home/tfr/doc/BAT
home/tfr/doc/BATT
:
From the ':' prompt we can page or scroll forward or backward. We can also type /star to search for the next occurrance of the string 'star'. Enter man more or man less for more information on the more or less commands, respectively.

mv: Renaming a file
Now, suppose we want to rename a file. Under Linux (and Unix) we 'move' it with the mv command as follows:

 $ ls
tardir.0.log
$ mv tardir.0.log tar.log
$ ls
tar.log
$
Note that the mv command only produces output when there is an error. In this case, we encountered no error so mv quietly performed its work.

cp: Copying files
To make an actual copy of a file, we use the cp command. For example, to make a backup copy of tar.log named tar.log.2, we enter the following:

 $ cp tar.log tar.log.2
$ ls
tar.log tar.log.2
$
Again, we get no output to the screen when the cp command is used without error. We had to use the ls command to see the result of the command. Enter man cp for more details of the cp command.

strings: Looking for text in a binary file
Now, to actually look inside an unknown binary file for text strings there is a command called, appropriately enough, strings. For example, if we run the strings command on the 'echo' program, we get, in part, the following:

 $ strings /bin/echo
Copyright (C) 2004 Free
Software Foundation, Inc.
Written by %s, %s, %s,
%s, %s, %s, %s,
%s, %s, and others.

$
Type man strings for more information.

grep: Finding particular strings in a file
To look for a particular text string in a file, we use the grep command:

 $ grep html tar.log
home/tfr/timeout.html
home/tfr/hello.html

$
And, of course, man grep will retrieve additional instructions for the grep command.

find: Finding files by name
To find all files with a particular name on your system, use the find command. For example, to find files named 'echo', enter the following:

 $ find / -name 'echo'
/bin/echo
/etc/xinetd.d/echo

$
Further, to find all files in the /var filesystem with the string 'echo' in their names, enter this:
 $ find /var -name '*echo*' 
/var/mod/mod_echo.html
/var/mod/mod_echo.html.en

$

More information...
To get started editing text files try this tiny vi tutorial. After going through the quick tutorial, you can click the contents button and reach an advanced vi tutorial as well as other vi information.

For information on moving around in a Linux filesystem try this Introduction to Linux in ten commands. That article also provides additional examples on some of the commands covered here.

mail this link | permapage | score:9086 | -Ray, April 2, 2005

Configure Samba (CentOS)

Up
vote
Down

How to configure Samba shares under the Centos Linux server distribution...
Fortunately, there is a GUI tool for just about everything. This too goes for configuring Samba. In the CentOS distribution, the task of administering Samba shares is handled by system-config-samba. This tool is easy to use, but must be run as the root user. If you do not have access to the root user, you will have no luck starting the tool. But with that coveted root user password you can start up the Samba admin tool with the command system-config-samba.
read more...
mail this link | permapage | score:9084 | -Ray, December 15, 2010

Gnome Encfs Manager

Up
vote
Down

The Gnome Encfs Manager (or short GEncfsM) is an easy to use manager and mounter for encfs stashes featuring per-stash configuration, Gnome Keyring support, a tray menu inspired by Cryptkeeper but using the AppIndicator API and lots of unique features. Whether you want to let it do things as simple as mounting a stash at startup, which is often used in conjunction with cloud-synced folders on services like Dropbox and Ubuntu one, or whether you want to let it automatically mount and unmount your stashes on removeable drives like USB-sticks, SD cards or even network-resources, GEncfsM is designed to do all the work for you. read more...
mail this link | permapage | score:9083 | -gg234, June 19, 2013

Tutorial: Linux Dialog Boxes

Up
vote
Down

Dialog lets you create dialog boxes from Unix/Linux shell scripts...
'dialog' is a utility for building console-based 'front ends' in UNIX like operating systems.

In this brief tutorial I am mentioning the usage of few important basic controls available with this 'dialog' utility and later I have created a very simple front end application in UNIX bash scripting using dialog.
read more...
permapage | score:9080 | -Ray, January 1, 2010

DokuWiki plugins

Up
vote
Down

Using plugins in DukuWiki -- and a few plugins you might want to consider using...
DokuWiki, for example, is a great wiki system by itself, but since it can accept plugins, you can easily add some nifty features to it.

The best place to find DokuWiki plugins is the DokuWiki Plugins page, which acts as a central repository and discussion forum for plugin-related stuff. But before you can make use of the plugins, you need to know how to install them.
read more...
permapage | score:9073 | -Ray, October 16, 2006

Pattern matching in shell scripting

Up
vote
Down

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.
read more...
mail this link | permapage | score:9062 | -Ray, January 1, 2009

Free versions of Arial, Courier New, and Times New Roman fonts

Up
vote
Down

Red Hat releases free replacements for Windows core fonts...
Available for immediate download, the Liberation fonts are intended to let users share documents between free operating systems and Windows without involuntarily reformatting the documents because the fonts don't match. The Liberation fonts are designed to be metrically equivalent to the Windows core fonts, with each letter occupying the same horizontal space as its equivalent in a proprietary font.

Red Hat has a long history of interest in high-quality fonts that allow interoperability between operating systems.
read more...
mail this link | permapage | score:9062 | -Ray, May 19, 2007 (Updated: May 20, 2007)

Ubuntu 11.04 Preview

Up
vote
Down

An early look at the next release of Ubuntu Linux...
Ubuntu 11.04 (Natty Narwhal) Beta 1 is powered by Linux kernel 2.6.38, GNOME 2.32.1 and X.Org 7.5. It will included applications such as LibreOffice 3.3.2 as the default office suite, Banshee 1.9.4 as the default audio player/organizer and Mozilla Firefox 4.0 as the default web browser.

A set of seventeen new and beautiful wallpapers will also be present in the Beta release, to please every Ubuntu user out there. And now, the features we've promised...
read more...
mail this link | permapage | score:9061 | -Ray, April 1, 2011

The Virtual Private Nightmare: VPN

Up
vote
Down

Maybe the 'P' really stands for Public...
Here's a question: What's the number 1 vector for security outbreaks today? Given the title of the article we hope you answered Virtual Private Networks (VPNs). Today's convenient world of mobile access to critical applications and information has come with a hefty burden for the world's already overburdened security teams.
(and here are some nightmare prints) read more...
mail this link | permapage | score:9054 | -Ray, August 4, 2004 (Updated: April 24, 2012)

Space Tyrant: A multiplayer network game for Linux

Up
vote
Down

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: makeit2.sh.

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:

userndx=commscan(
tolower(
threc[th].inbuf
[threc[th].inptr][0]
),commlist
);
result=fp[userndx](th);

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.

makemap()
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.

command()
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.

jettison()
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.

warprtn()
jumprtn()
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:9050 | -Ray, May 30, 2005 (Updated: March 21, 2007)

Currency Traders on Raspberry Pi

Up
vote
Down

You can now run Currency Traders on your Raspberry Pi. It is extremely efficient and takes only about 2.2% of the memory of a 512MB RPi and less than 0.5% of the CPU. More CPU will be consumed when players are online, of course, but it should support up to a hundred or so concurrent players on a normally clocked Pi.

The installation is four quick steps, described in the readme.txt file. The entire system is a single binary, available either dynamically linked or statically linked. The static version should work on most any Pi running most any Linux. The dynamically-linked version was compiled and tested on Raspbian Wheezy and may work without library fiddling on other Pi Linuxes. [links removed]
read more...
mail this link | permapage | score:9046 | -Ray, March 3, 2013 (Updated: May 13, 2014)

Smbind: Web management for DNS

Up
vote
Down

Manage your DNS server and tables from a web browser with Simple Managment for BIND (Smbind)...
Smbind is a PHP-based software tool for managing DNS zones for BIND via the web interface. This supports the per-user administration of zones, error checking, and a PEAR DB database backend.
read more...
permapage | score:9044 | -Ray, April 26, 2007

Scripting: Put a clock in your bash terminal

Up
vote
Down

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:
  #!/bin/bash
while true
do
tput sc
tput cup 0 60
echo -en `date +"%H:%M:%S %F"`
tput rc
sleep 1
done
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.
read more...
mail this link | permapage | score:9021 | -Ray, January 22, 2008

Microsoft to push unlicensed users to Linux

Up
vote
Down

Microsoft has long had a conflict of interest about software piracy. By pretending not to notice, they encouraged the use of unlicensed Microsoft software, thereby letting dependence on their formats, packages, and protocols grow. The time is approaching when that will change.

Microsoft has historically made much noise and took little action against unlicensed users of its software. In the case of some developing countries, the reason was obvious. Let them develop a US-style de facto Microsoft business standard and they then become owned by Microsoft.

We've all seen Windows users circulate simple text-only notes in Microsoft Word .doc files. While it may be annoying to those without .doc capabilities (including users of older versions of Word, itself), it is a beautiful thing from Microsoft's point of view. It perpetuates their monopoly while forcing upgrades among the faithful, all in the same simple act. The widespread use of proprietary formats tends to lead to even more use of those same formats.

However, as Microsoft's markets in the US approach the saturation point -- and start to recede -- they are faced with a dilemma. Do they try desperately to hold on to as much market share as possible, or do they cash in while accepting -- and accelerating -- the inevitable decline in share?

I think Microsoft will be increasingly choosing the 'cash in' option as the pressure rises to keep earnings high. The first victims of this gradual policy shift will be business and government users in developed countries with strong IP protection laws.

Next, in approximate order, comes consumers in developed countries and business / government users in rapidly developing countries -- especially those countries seeking easy access to western markets. Last to pay up will be students and consumers in the poorest developing countries.

But, for all of you still getting a free ride from Microsoft, the good times will inevitably come to an end. They are simply waiting until you, and your compatriots, are too invested in the knowlege, skills, and standards of Microsoft products to quit. Then, they will charge you.

If you are an unlicensed Windows user who can't afford to someday become a profit center in the vast Microsoft empire, you should consider the alternatives. I recommend you start by downloading and burning a live Linux CD of Knoppix, booting it up on your Windows box, and trying it out. It's free and since it runs straight from the CD, you don't need to install it on your hard drive.
mail this link | permapage | score:9015 | -Ray, August 1, 2005
More articles...
Abstract Art in North Florida

Recent headlines

Tutorial: Install Debian 7 (testing) with debootstrap from a Grml live Linux

Linux mail command examples: send mails from command line

Sagemath in the Cloud and Sagemath 5.11

Tutorial: Replace Windows with Ubuntu 13.04

Unix: Shell Script Wrapper Examples

Tutorial: Running CS-Cart on Nginx on Debian 7/Ubuntu 13.04

Using Multiple PHP Versions (PHP-FPM FastCGI) With ISPConfig 3 (Ubuntu 12.04)

Hand of Thief trojan and your favorite Linux distribution

Plasma Media Center 1.1 and digiKam 3.3

Linux Iptables Examples

OpenShift Online: a non-developer guide

Nuvola Player: Enjoy all your Cloud music services from one interface

Tutorial: Automatically add a disclaimer to emails with alterMIME (Postfix on Debian 6)

Set up Oneiric PVHVM at Xen 4.1.2 Ubuntu 11.10 Dom0

Ubuntu is not a community distribution

Lynis: Security and system auditing tool

Tahoe Least-Authority File System for secure, distributed data storage

TuxOnIce: Hibernate Linux

Tutorial: Ubuntu Jeos 12.04 LTS Spam Filter Gateway Server

LinSSID – Graphical wireless scanning for Linux

Build a Mail Server on CentOS 6 with Postfix, Dovecot, PostgreSQL

How to install Ajenti on Ubuntu 13.04 server

Google Chromecast and the new Nexus 7

Installing Nginx, PHP5, PHP-FPM, MySQL on Debian 7

VPS: Xen vs. OpenVZ

Active Directory Integration with Centrify DirectControl Express on Ubuntu 11.10 (Oneiric)

Tutorial: Install a Streaming Audio Server with Icecast 2.3.3 on CentOS 6.3 x86_64 Linux

Install Cinnamon on Fedora 19

PC-BSD 9.1 preview

Pre-release Ubuntu 12.10 has partial support for manual LVM and disk encryption

How to install Orange in Ubuntu 13.04

Add Video Streaming to C/C++ apps with Nex Gen Media Server API

StartOS 6 GNOME 3 and KDE preview

Fedora 16 KDE review

Giada – Audio tool for DJs, live performers and electronic musicians

Apache2, mod_rewrite tutorial: Redirect requests by device

Reviewing Kali Linux - the distro for security geeks

Fedora 17 GNOME, KDE, LXDE and Xfce beta

Conky Manager – Simple GUI for managing Conky config files

Arronax: Nautilus Plugin to create and modify Application Launchers

 

Firefox sidebar

Site map

Site info

News feed

Features

Login
(to post)

Search

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