Friday, December 02, 2011

A Hymn Before Battle

"A Hymn Before Battle" (John Ringo) - This is the first "Posleen" book.  The Posleen are a race of centaurs who have high tech weapons and are invading the Federation.  All the Federation races are pacifists, so they come to Earth to recruit an army.

There is obviously a lot more going on (I know it won't be resolved, because I have read "Eye of the Storm" which takes place after all these).  Some hints have already been dropped.

It is very much the best of Ringo (I don't see how he keeps it straight in his head against the "Looking Glass" series).  Fun space opera combined with good mil-SF.

Thursday, December 01, 2011

Caught in the Crossfire

"Caught in the Crossfire" (David Drake) - This is a collection of Hammer's Slammers stories (two longer pieces, two short stories, and one intermediate).

Pretty typical Slammers and Drake, although two of them showed a very ruthless side of the Slammers that you don't normally see.

Tuesday, November 15, 2011

Memory In






Been a while since the last update!

I put the keymap in earlier, but didn't pull a screen shot (wasn't a whole lot to see, characters instead of scan codes).

This last changeset has been more "fun".  Trying to update the page tables to reflect all the available memory (lots of alignment to 2M boundaries).

I've also started running under Virtual Box.  Performance is a lot better, and it will be a lot easier to enable the network (plus, I might get some graphics capability).  This turned up a small bug in the parsing of the ACPI tables.

I should have a steady stream of updates for a while.  Trying to get a simple shell going...

Monday, November 07, 2011

Time to Play

(continuing my review of Facebook games)

It's ironic that the two best games, Robot Builder and Nitrous Racing have both come to (bitter) ends.  While the terrible games continue unslowed.

As I've looked for a game to replace NR, I uncovered a new failure mode for FB games: limited time to play.

The amount of time it takes to play a game is a continuum.  You have minesweeper or solitaire which take just a few minutes, to RPG's which take tens of hours.  The nice thing about a short game, you can string the games together to play for an hour or two.

Unless they are Facebook games.


I'll mention two by name, but I'm sure they are not unique in this regard (indeed you see  it in the Frontierville model, where you only have so much energy, and then you have nothing to do).

Diamond Dash
This is a typical matching game like Dr. Mario or Bejeweled.  Game play is typical, and it tracks level (a sort of function of number of games played).  But it only lets you play 1 game every 8 minutes (games are fixed at 1 minute).  And you can only accumulate ~5 games.  So, you play for 5 minutes, then you have to go away for an hour.

Triple Town
This actually has some promise.  It is a twist on the typical matching game, in that matches are "upgraded" instead of removed (I feel like I have played this style before, but I cannot place it).  Successful play is rewarded with coins, which can assist in future games.
Except, you only get one move per minute, and can only bank 75 moves.  So again, you play for a few minutes, then you're forced to move on.

What is the reasoning behind this?  I cannot imagine.  It cannot be server load, because these are Flash games which run locally.  Worse, leaving and returning forces a re-download of the app, which must spike their bandwidth usage (although Triple Town seems a lot smarter about caching).

Tuesday, September 27, 2011

Eye of the Storm

"Eye of the Storm" (John Ringo) - This is a Posleen spin-off.  I never read the Posleen books, because the library doesn't have the first one.  When did libraries stop carrying old books?  It's sad that you can't get anything more than ~10 years old at the library.

I really appreciate Ringo's sense of humor.  He's clearly setting up some sort of anime parallel, but I don't know enough anime to be sure if it is exactly the same as one of them, or just flavored for them all.  The mil-sf portions are good, as always, and he throws in a good twist at the end.  Hopefully the library has the next one, as it is a cliff-hanger...

Thursday, September 08, 2011

Version Control By Example

"Version Control By Example" (Eric Sink) - I got this book for free (thanks Reddit!)

I admit I was skeptical at first.  The book includes discussion of a new DVCS (Veracity).  The DVCS environment is already very crowded (git, hg, bzr, bk, fossil, darcs).

The version control by example part is straight forward and pretty well done.  There is one example which is repeated four times (svn, git, hg, veracity).  But the author's humor resonated with me, and I found myself looking for the slight changes (which were always funny).  It makes for a fast read.

The two big players right now are git and hg.  I like git, but I will be the first to admit it is special.  It makes a lot of sense to a hacker, and very little sense to anyone else (especially those who are used to svn).  git really needs a front-end with a command set oriented towards people used to svn.

As I've mentioned, I hate hg.  I shouldn't, but using it everyday in a fashion it's not really designed for makes me blame it.  About once a week (twice this week), it just flakes out and refuses to work with any command (even hg log).  Then I have to find the documentation on how to fix it, and I lose a half hour.

Fossil has some people excited because it integrates a few developer tools (wiki and bug tracking, IIRC).  Veracity is similar, it has a distributed/versioned database which is used to implement these sorts of things (and user permissions).

As Sink points out, what good is it to commit code offline, if you can't update the documentation and the bug database?

I still have worries that veracity (vv) is oriented towards the svn/hg mindset (immutable history).  If it can support all the flows from git, I could make the switch...

Sunday, September 04, 2011

Some Golden Harbor

"Some Golden Harbor" (David Drake) - This is actually an older book in the Lt. (now Commander) Leary series. It's interesting to read about the effects of some stressful event first, then go back and read it as it happens afterward.

Thursday, August 11, 2011

Stormy Red Sky

"In the Stormy Red Sky" (David Drake) - Another Lt. Leary (now brevet Admiral!). I'm impressed how Drake continues to deliver solid characters and action. These are turning out even better than the Hammer's Slammers books.

Monday, July 25, 2011

Exits In

Oh yea!



One of the last things I need ALH for is the underworld walls. Foolishly, I had assumed that every adjacent hex is connected to every other (and x wraps, but y doesn't). Of course, once my units started exploring the underworld, I realized I was wrong.

So, I had been tabbing back and forth, entering orders into my client, while looking at ALH for walls.

No more!

I've also added some niceties, like the total number of men in a unit ("1 men").

Saturday, July 23, 2011

D20

(continuing discussion of game characteristics)

There is a subtle but important element into how you generate random numbers for your game (I'm assuming most games will have a random element).

There actually is a game system called "D20" (where all decisions are made by rolling one twenty sided die). I prefer the GURPS system, which uses (mostly) 3d6.

The two systems are superficially similar. The range is about 20, and the average is around 10.

These are the probability (PDF, blue) and cumulative (CDF, orange) distribution functions for a d20. Totally flat. This means that any number from one to twenty is equally likely, similarly going from N or lower to N+1 or lower is always a 5% increase in probability.

So, a bonus which gives +1 is always worth 5%, whether your an expert or a novice.


These are the PDF and CDF for 3d6. Notice the distinct bell curve for the PDF, and the CDF resembles a sigmoid (which has characteristics similar to an exponential curve at the bottom, and logarithmic at the top).
This captures ideas like "diminishing returns". It also means that an "expert" (someone who could make a roll at 16 or lower) is less affected by difficulties (say, -1 on the roll) - going from 16 to 15 is a drop of ~3%. The same -1 is a 12.5% drop for an average person (10 or lower).

GURPS is limited by the human element. People must roll and count the dice, and increasing the number makes it more likely that one will go off the table, etc. A computerized system can generate any curve we like, with any range we like.

I'm thinking either 1-100, or 1-1000 - with this same bell shape. Something like 17d6.

Sunday, July 17, 2011

Drake

"When the Tide Rises" (David Drake) - Another Lt. Leary (now Commander). More solid work from Drake.

Thursday, July 14, 2011

Atlantis Updates

Some good new stuff!

I've lightened the hex borders (due to a request by a potential user). I've also added icons for taxing, production, shafts, and buildings. I also modified the city icons to reflect the size: villages are '-', towns are '+', and cities are '*'.

The new window is for production. Currently, I am just showing the maximum production values. But you can sort on the production name and value columns.

Thursday, July 07, 2011

Roads in!


With the near completion of the Rycdome-RathLuire highway, I needed to get that done :)

Monday, July 04, 2011

Stuff I've Read Lately

"The Dog Said Bow-Wow" (Michael Swanwick) - A collection of short stories. Not too bad. Nothing spectacular.

"When All Seems Lost" (William Dietz) - A fun mil-SF. The first two pages set the tone - after a page and a half of introducing the characters of a ship:
"What followed took place so quickly Tanaka and his crew, and the ship's computers were just beginning to process what was waiting for them when ten torpedoes scored direct hits on the destroyer escort and blew the ship to smithereens."

Wednesday, June 29, 2011

Game Characteristics

Games can be characterized as having "perfect" or "limited" knowledge. Also, they can be "deterministic" or "random".

Another important aspect of a game is what sort of "models" one must build for your opponents (and what is the cooperation model).

Chess is a deterministic game of perfect knowledge. So are: tic-tac-toe, checkers, and go. These games are of limited interest to me, because they are effectively searches of a state space. This limits the opponent model to estimating how well they can search the state space. The simplest being, "assume they can search the space as well as I can". This makes the game no different from playing oneself.

Most games include a random element (usually dice, cards, or a spinner). The simplest games are entirely random (they could be reduced to a coin toss to determine the winner). Examples of these are Candyland and Chutes and Ladders, which are really just tools for teaching game mechanics to children.

The only example that comes to mind of a deterministic game of limited knowledge is Stratego.

Also worth mention is Poker, which is often entirely random (stud vs. draw) and may have zero public information (a counter example is Texas Hold'em). Here the outcome of a player model is boolean (bluffing or not bluffing), but coming to that decision requires great skill.


A complex game will include all of these elements: combinations of public and private information, randomness and certainty, complex models of player behavior (driven by a wide choice of possible moves at any point) and player cooperation.

A good game can be built from a simpler set, but this space tends to be better explored (will you make a chess analogue?)

Monday, June 20, 2011

New Space Opera

"The New Space Opera" (ed. Gardner Dozois and Jonathan Strahan) - There were a lot of good stories in here. It's good to see there is still some space opera being written today.

Sunday, June 19, 2011

Icons

Getting close!

I've been putting off doing the math for the icons :) Lots of radical threes.

Here we can see the three main icons - * for a city, ! for enemy units, @ for my units. ALH also has icons for ships, taxing, production. It also differentiates between my units on guard vs. not on guard. Not sure how important that is (although I need ships)...
I also still need to add roads and buildings.

Wednesday, June 08, 2011

Show Production

My goal is to get this thing to the point where I can do my turns. I added exporting orders yesterday, now I can display the region production.

I'm using a wrapping label, which seems less than ideal. But I wasn't sure what else would look good...
Now I need to show whats for sale (and maybe what they'll buy, but that is less useful). I also need to show unit skills somewhere.

Monday, June 06, 2011

Z Problem

Programming is all about assumptions. You have to make certain assumptions about what your software is going to encounter, and how different modules will work together. To do otherwise would require total knowledge, and the development of a system that could handle anything (which would make it smarter than any human, so you'd be developing strong AI).

As long as your assumptions hold, your software will work well. And if new features fit in with those assumptions, they will be easier to add. If they violate the assumptions, you're in for a world of hurt.

When I started the True Atlanteans client, I knew it was possible to have a z coordinate for hexes. But I didn't have any test cases, and I figured it was a long way off. Well, I just got some test cases, so I guess I have come a long way!



Once again, Tcl and Sqlite made things pretty easy. I rebuilt the tables with a z coordinate and added a couple of entries to the right click menu (yea, I have a right click menu, unlike ALH).

I also fixed the one man unit bug in the old style parser. Rereading the last blog entry made me realize that items have [ABBR], while flags do not.

Sunday, June 05, 2011

Items Up!

I must say, working with Tcl and Sqlite has been a real pleasure. Adding orders required changes in about 3 places, most being one or two lines of code: import the data from the TON file, pull the data during unit update, build the GUI items.

The items changes were about the same. My original thinking was that I would need a separate table for items, keyed by the unit id. But Sqlite lets me toss a whole Tcl list into a cell, so I just went with that...

The item box is above the old order box. I figured it would scroll pretty often, so I stuck a scrollbar on there right away (orders might need a scrollbar).

This example shows the frustration inherent with trying to parse the old file format. Units with one man don't get that man in the items (Fast Couriers are one man units in my empire).

Why?
Here is the entry for Fast Courier 416:
* Courier - Fast (416), Last Outleans (6), avoiding, behind, revealing
faction, holding, receiving no aid, nomad [NOMA], 14841 silver
[SILV], 20 horses [HORS], 5 herbs [HERB], 2 mink [MINK], 4 velvet
[VELV], ivory [IVOR], mithril [MITH], 2 chocolate [CHOC], pearls
[PEAR], 2 spices [SPIC], 2 roses [ROSE], 2 caviar [CAVI], 2 cashmere
[CASH], iron [IRON], silk [SILK], pick [PICK]. Weight: 1089.
Capacity: 0/1400/1415/0. Skills: combat [COMB] 1 (30).

The star ('*') indicates this is a full data report ('-' is limited data, '+' is buildings). Then comes the unit and faction names. After that are the unit flags, then items.
Everything is comma separated, with big groups period separated (items, weight, capacity, skills).

But there is no way to tell when flags end and when items begin.

My parser is looking for a number (no flags have numbers, and any item count above 1 will have a number). I suspect ALH understands all the men types, and is checking that... or it understands all the flag names and promotes mismatches. I guess I could tell by making a new flag and seeing if ALH promotes it to an item with count 1 :)

Thursday, June 02, 2011

Orders are in!

Lots of furious Tcl (and SQL) hacking behind this!


Pretty close to ALH. I just need to capture changes to orders, and add hex decorations. Then it will be on to new functionality!

Wednesday, May 25, 2011

git avert disaster

Let me start by saying I hate hg. I should like it, since it is fundamentally the same as git. I want to like it, but it just is unlikeable.
  1. It is too complicated. In git there are commits (patches, content) and heads (names). Mercurial has versions, patches (in mq), branches, tags, bookmarks. Maybe more.
  2. It is disjointed. In git, everything is integrated. In hg, everything is an extension. The extensions work fine, one at a time. But bringing multiple extensions together doesn't always work well. Also, the tab completion only supports some things.
  3. It keeps messing up. This is the really scary part. I haven't lost anything, but twice now all my subrepos have gone into a "disconnected head" state (once after a crash, but once all by itself). I also sometimes get weird "unknown version" errors. It generally just requires "hg onsub 'hg up'", but sometimes greater voodoo is required.
That said, I encountered my first git problem recently.
  1. Install Cygwin git on Windows
  2. Intall Linux dual boot, boot in Linux, install git
  3. Mount the NTFS under Linux (hmm, maybe not a good idea here!)
  4. Use Linux git to manipulate the Cygwin repo (playing with fire!)
  5. Rebase the repo
  6. Boom
Yea, maybe I was asking for this one. The problem is that under Cygwin all the files have 644 permission, while Linux mounts NTFS with 755. Git stores the permissions flag under version control, so it is seeing every file change all the time. Rebasing causes massive conflicts all the time (since the history is all 644, but the mount point won't allow anything but 755).

So, here I am in some disconnected head state, with all my patches gone from the rebase. What to do?

I forgot what I did, but I got most of my patches applied. Except one fell on the floor, and didn't show up in the history anymore (well, the commit was there with the log message, but the patch was empty).

Fortunately, there is a file in .git called "ORIG_HEAD" or something similar. Cat it, and "git checkout". Cp the bad files off to a separate space and "git checkout" back. Diff and patch, commit. All fixed!

Yea git!

Sunday, May 22, 2011

Stuff I've read lately

"The Oxford Book of Science Fiction" (ed. Tom Shippey) - This was really excellent. It covers about 100 years of SF, and most of the stories I hadn't read before. Really unusual.

Thursday, May 19, 2011

String Madness

I read earlier today that Denis Ritchie (or Brian Kernigan, I get them mixed up) hates C++.

Now, why would anyone hate C++?

Oh wait, I had to do some case insensitive string compares today in C++. Let's see how to do it:
  1. Solution 1, download hundreds of megabytes of Boost - meh
  2. Comment #2, Unicode is broken, yea Unicode!
  3. Solution three:
struct ci_char_traits : public char_traits<char> {
static bool eq(char c1, char c2) { return toupper(c1) == toupper(c2); }
static bool ne(char c1, char c2) { return toupper(c1) != toupper(c2); }
static bool lt(char c1, char c2) { return toupper(c1) < toupper(c2); }
static int compare(const char* s1, const char* s2, size_t n) {
while( n-- != 0 ) {
if( toupper(*s1) < toupper(*s2) ) return -1;
if( toupper(*s1) > toupper(*s2) ) return 1;
++s1; ++s2;
}
return 0;
}
static const char* find(const char* s, int n, char a) {
while( n-- > 0 && toupper(*s) != toupper(a) ) {
++s;
}
return s;
}
};

typedef std::basic_string<char, ci_char_traits> ci_string;

Muahahahahahaa! That's evil (Note: I handled all the freaky <> using Tcl, yea Tcl!). In case you're wondering:
string map "< {&lt;} > {&gt;}" $code


Solution 4, fall back to C. Thanks, that's great. Also, note it is different on different platforms, yea C. It also doesn't work on Unicode.

In Tcl?
string compare -nocase $str1 $str2


Works on most Unicode, but, hey Unicode is broken what do you want?

Sunday, May 15, 2011

True Atlanteans

Lots of progress, haven't had time for updates. I am building a client for Atlantis, similar to Atlantis Little Helper (see screenshot).

Here is what I have so far:

Obviously, not as much functionality right now, but it is improving quickly. The main advantages will be that I can understand this code (currently less than 500 lines of Tcl).

Also, the code uses an internal database to store the turn information, so should be less vulnerable to disruptions (and more easily support multiple games).

This will be the main visualization tool for any changes we make to Atlantis (currently, I have already hacked in the new turn format).

Thursday, May 05, 2011

Tcl Object Notation

In the beginning, everything was a plain text file or a binary file. Binary files were easy for computers (just copy the bytes from disk into memory) and hard for people. Text files were easy for people and hard for computers.

On top of this, things were always changing. So the binary files from Word 1.0 didn't want to be read into Word 2.0 (well, 2.0 would upgrade them - but eventually, support could disappear). Text files have a way of expanding into their own Turing-complete language.

Then some mega-genius said, "Hey, let's make a text format that easy for computers and people, and backwards/forwards compatible! We'll call it XML."

And so we got this:
<?xml version="1.0"?>
<NSTARS_UNIV DIMENSIONS="2" X="400" Y="400">
<UNIV_HDR>
<STAR_COUNT>2</STAR_COUNT>
</UNIV_HDR>
<GAME_YEAR>2406</GAME_YEAR>
<TECH_COSTS>50 80 130 210 340 550 890 1440 2330 3770 6100 9870 13850 18040
22440 27050 31870 36900 42140 47590 53250 59120 65200 71490 77990 84700</TECH_C
OSTS>
<COMPONENTFILENAME>newStarsComponents.xml</COMPONENTFILENAME>
<HULLFILENAME>newStarsHulls.xml</HULLFILENAME>
<PLAYERFILEBASENAME>tiny_sparse</PLAYERFILEBASENAME>
<MASTER_COPY>1</MASTER_COPY>
<NUMBER_OF_PLAYERS>2</NUMBER_OF_PLAYERS>
<PLAYERDATA>
<RACELIST>
<RACE>
<SINGULARNAME>Ugly Duckling</SINGULARNAME>
<PLURALNAME>Baby Swans</PLURALNAME>


That's the first 771 bytes of the NewStars master file (which is 3530 bytes in full). That's turn 6 for a tiny universe. I generated a huge turn once, it was many megabytes... Every AJAX request is generating and shipping around stuff like this. If you wonder why servers can't handle many clients, why the Internet is so slow (even though we have a lot more bandwidth than the old 56k modems), and clients are so slow - XML is a big part of it.

Then another (smarter) genius said, "All these angle brackets and matching tags are just a pain. Why can't we have a simpler format?" That gave us JSON (JavaScript Object Notation, and AJAJ). Here is the JSON file from my Space Battle project:
{
"force1" : {
"name" : "Imperials",
"ships" : [
"idest"
]
},

"force2" : {
"name" : "Bugs",
"ships" : [
"bship"
]
}
}


A lot more concise. But, why do I need all the quotes and colons? Why are some things in square brackets, while others are in curlies? We can do better:
Name {Tester (3)}
FactionType { (War 1, Trade 1, Magic 1)}
Month March
Year 1
VerString {4.1.0}
Rulesetname {Ceran}
Rulesetversion {2.0.4 (beta)}
Newssheet 1
Password {none}
TurnCountdown -1
Quit 0
TaxRegion 0
MaxTax 10
TradeRegion 0
MaxTrade 10
NumMage 1
MaxMage 2


This is "Tcl Object Notation" (TON). Just as JSON yields a JavaScript dictionary, this is a Tcl dictionary. Since everything is a string, no quotes needed. No colons (dictionaries are lists with "key" "value" pairs). You just need {} for things which might have spaces (or sub-dictionaries).

This will be the turn file format for the True Atlanteans, Atlantis PBEM GUI Client.

Wednesday, April 20, 2011

Peak Civilization

(a recent article at CNN has got me all depressed)

A few years ago the drumbeat of "peak oil" picked up. Now, it seems to be mostly taken as a given. With the recent Japanese nuclear disaster (among other things), I can't help but think we have reached "peak civilization".

Early science fiction (1900, up to the 60's, even parts of the 70's and 80's) was decidedly optimistic (although not entirely). Mankind was seen as making use of greater and greater stores of energy, and going far. Stories assumed galactic civilization (some took place after many cycles of rise and fall of galactic empires).

At some point, something changed. Perhaps it was the nuclear accidents of the 70's and 80's, or the failure of fusion power. The failure of the space program (which we now see the culmination of, in the last shuttle flights - which will end the American manned space program). Science had promised us the stars, and failed to deliver.

Now, the spectre of global warming is pushing back against greater carbon based energy production. The Fukushima disaster will likely hinder, if not stop nuclear production. Green sources are notoriously inefficient, in terms of land use and construction overhead - they might replace our current production, but growth will be limited.

Science fiction has picked up on this ennui (I don't think it has caused it). Stories of galactic empire are few and far between (John Scalzi is the only current writer I know). Most stories tell of introspective and decadent remnants of humanity, living in dirt (at least, metaphysically, if not physically).

Much of our economy is based on an assumption of growth. It's unclear how we can adapt (we see this in the repeated "bubble" growth and pop cycles). Even population growth is leveling off.

Asimov wrote about computers stretching underneath the whole world (plantary AC). Now, we strive to make computers smaller and less powerful.

It seems we are destined to simply fizzle out. Staring at our belly buttons until the lights go out.

Sunday, April 03, 2011

Edge of Battle

"Edge of Battle" (Dale Brown)(audio) - This one was bizarre. I don't know if his editor came to him and said "You're scenarios are too believable, it's scaring people". Here we have a group of Mexicans who believe the western US belongs to them. Then they engineer border skirmishes and steal nuclear weapons (not sure what they want the nukes for, they get blown up (reeeaal goood) before we can find out).

Why? To force the US to implement a guest worker program.

The book turns all cheery 1984 at the end too; with the Mexican and American presidents gulping down nano-tracking pills and smiling for the camera (only people with something to hide avoid swallowing nano-tracking pills!).

Wednesday, March 30, 2011

Why Not Linux

(This is about why NedOS will not be a Linux clone)

There are three main operating systems today: Windows, Linux, and MacOS.

Windows is just terrible in every way, and getting worse. It used to be that Windows had the best support for hardware. I believe Linux is better now and can only get better, and Windows will get worse. This is because Microsoft has taken to enjoying changing their driver model periodically, and that breaks old stuff. I do most development on Windows under Cygwin, and I would very much like to stop using Windows entirely.

MacOS is a non-starter. I'm not going to give Apple more money (long story). Also, MacOS is basically BSD (a Unix derivative), plus some stuff.

That leaves Linux. Linux is really very good. But it is a Unix derivative. Some say Unix is bad because it is old. Being old is not necessarily bad, but you must re-examine the assumptions, circumstances, and goals that went into the old design. Where there are changes, it may necessitate a new design.
  1. Unix was designed as a simplified alternative to Multics (hence the pun in the name). That no one is making Multics clones today tells you this was probably a good move. That Unix is considered complex hints at how complex Multics must of been (I have no idea)
  2. Unix was meant to be run on multi-user computers. You would have one computer for possibly a dozen people to use at the same time. There might be dozens of accounts, some of whom are total strangers (paid accounts).
  3. Unix was created for hackers, by hackers. As much as possible, it is intended that users should be able to write their own programs, and those programs should be able to access only the resources available to that user - and no more. Thus we see all the jockeying for "root shells" and counter security practices to prevent that.
  4. Unix was meant to run on different types of machines. Linux has done really well here. You can run Linux on a "wall wart" (computer in a power plug), laptop, or supercomputer. In every case, you get the most out of your computer.
#1 - Simplicity. This was key to Unix's success. It will have to be a main stay for NedOS. Complexity leads directly to effort, and effort is going to be a key bottleneck.

#2 - Multi-user. This is a source of some complexity that I will be able to avoid. NedOS will be largely single user, with the possibility of some user specific configuration (a family likely has multiple computers, but different people may be on different boxes at any given time).

#3 - Software development. This will be the biggest change. All software functionality will be set at boot time. This should make things simpler, and more secure. I am considering some level of user scripting, but I'm not sure about that.

#4 - Multi-platform. This is a sore spot. I would love to run on all the hardware that Linux supports. But this is a source of complexity (and a huge effort sink). I will be forced to stick to Bochs (which should transition to Qemu for speed). I might be able to run on some real hardware at some point. But consider that my developing a 64 bit kernel means only 64 bit hardware support. 32 bit would double most of my effort.

Monday, March 28, 2011

It's a Cookbook!

A COOK BOOK!
(apologies to the Twilight Zone)

I have completed my read through of "Tcl/Tk 8 Programming Cookbook". It reads very much more like a cookbook than a novel or textbook.

I see three possible consumer groups:
  1. People who are experts at finding information from man pages (like me, and 1% of the rest of the world)
  2. People who don't like reading man pages, and are interested in learning Tcl.
  3. People who have "that Tcl app" at work, that they need to maintain once every six months.
I don't think group 1 will get a lot out of this book (I did find some lesser known switches of some commands).

However, groups 2 and 3 should benefit.

Beginners will need to read the whole book to cover everything they need. However, the "cook book" style allows you to jump to any point and try something out. That is important for a beginner, to keep the interest up ("is there something new and interesting here that is worth my learning it").

You can jump right into GUI development. That is what got me hooked on Tcl/Tk.

For people less interested in learning Tcl, but needing to solve a particular problem - the table of contents should allow you to jump right to it. No need to sift through man pages of sometimes historically named commands.

This book is up to date, preferring dictionaries (new) over arrays (old). Most of the other Tcl books are from before dictionaries. It also mentions using the new themed widgets (ttk).

Saturday, March 26, 2011

Tcl and Greek

While some may say that Tcl looks like Greek to them, I have Tcl doing my Greek homework!


This is a window with just an single line text entry. It is built with the following code:

toplevel .t
pack [entry .t.e]
bind .t.e <return> {
set s [.t.e get]
.t.e delete 0 end
.t.e insert 0 [revGreek $s]
}
When I hit enter, I get:


My English/Greek transliteration uses the "_" character as an escape (to handle the two letter English versions, and s/s at the end). The revGreek function is a simple state machine to check for _, and build the escaped sequence. Everything is passed through a dictionary which maps English sequences to Greek letters.

Here is the Greek to English map:
set greekDict {α a β b γ g δ d ε e ζ z η _ae θ th ι i κ k λ l μ m ν n ξ x ο o π p ρ r σ s ς _s τ t υ u φ _ph χ _ch ψ _ps ω _oe}

Greek can be converted to English with a simple function:
string map $greekDict $s

This is because each Greek letter is all by itself.

Building the English to Greek map is easy:
foreach {g e} $greekDict {
dict lappend revGreekDict $e $g
}

Where the Greek to English map is a simple list (where the first subelement is one Greek letter, and the second element is the English transliteration), the use of multiple English characters requires a full map (or "dict" in Tcl).

Sunday, March 20, 2011

Strike Force

"Strike Force" (Dale Brown)(audio) - Brown must have a lot of fun writing these books. The protagonist is an American general in charge of the "Air Battle Force" (basically guys with rudimentary orbital dropships and power armor). He is so aggressive as to make Douglas Macarthur look like a peacenik.

In order to make this guy look sensible and righteous, the evil guys are almost comically evil (although, they are in Iran, so it's not entirely unbelievable). Many explosions ensue (including a ground to orbit laser attack from the Russians! pew! pew!).

Tuesday, March 15, 2011

Book Review Coming

I have been asked to review a recently published book on Tcl (the cover is below)

I'm always glad to see any interest in Tcl, so I am looking forward to this.

Saturday, March 12, 2011

Houston, we have a keyboard

Nice!

I had a feeling once I got past the interrupt barrier things would move a lot more smoothly.

I quickly got the keyboard interrupt working (it puts the scancodes into a queue and returns as quickly as possible).

Then, I changed the final idle loop into a loop to empty this queue. Right now, it is printing the scan codes - you can see the keyboard scancodes (in hex) for "Shift, h, i, space, k, e, y, b, o, a, r, d". I am ignoring all break codes, so you don't see the Shift key released.

It was a real pain getting the screen shot for this one. I couldn't hit print screen in Bochs, no telling what that funky scan code would do to my handler :) I had to make a tiny notepad window active (you can see it peeking over the left edge), and do a full screen capture.

How Things Work

and Stuff. (At CMU, CFA - which some people said stood for "Can't Friggin Add", while others said it stood for "Can't Friggin Spell" :P - had three courses, the first "How People Work", and the second "How Things Work", and the third "How People Work and Things").

I've been studying computers for a long time. I got started seriously the summer I visited colleges (between Sophomore and Junior year in High School). I got a book on DOS programming from the MIT bookstore, and read it the whole rest of the trip.

It's only today that I figured out why the "mouse" and "keyboard" PS/2 connectors on the back of the computer are different!

You know which ones I mean. The are different colors, with the plugs on the mouse and keyboard color coded to match.

I always looked at them, and said "Why should it matter?" The plugs are the same, why can't the computer just figure it out!

Then I saw the figure at the OSDev Wiki page for the keyboard.

The IRQ line from the keyboard connector is hardcoded to IRQ 1, and the mouse goes to IRQ 12. There is no identifier from the hardware to easily figure out which is which (they both send bytestreams of input, worse they send the data to the same port). You might be able to decode which is more likely, but it isn't easy. Then you would have to switch your interrupt handlers. I guess most people don't bother.

Friday, March 11, 2011

Interrupts Online!

Wow! That was a pain!

This isn't much to look at, but it is vital to making any more progress. I now have interrupts turned on - the interrupt handler increments r9 and returns. You can see r9 is 1, then four interrupt/exceptions occur, then r9 is 5.

There were a lot of barriers to this:
  1. Several system tables had to be filled in: the IDT, TSS, and IOAPIC redirection table being the biggest ones (I am making things somewhat harder on myself by skipping the legacy interrupt mode). The TSS required another entry in the GDT. Also, I had to add a page table entry for the LAPIC, and set it up as well.
  2. I had to go through several rounds of IOAPIC settings. At first I was using lowest priority, logical, active high. Then I tried ExtInt. Finally, I figured out that I needed physical mode (the default LAPIC id is 0, which doesn't match any logical bit setting - I peeked at the Bochs LAPIC implementation!).
  3. I encountered a couple of triple faults. The first was due to trying to poke directly into upper memory region (mov [0xfee0_00f0], 0x100). The immediate value gets sign extended, and ends up off the end of virtual memory. Another was due to using segment selector "1" for my interrupt handler (because I want entry 1). Of course, the bottom three bits of the selector are shifted off, so I need "8".
  4. You can't just iret from a 64 bit interrupt handler. For some reason, you have to hard code in the word size override ("db 0x48; iret").

Sunday, March 06, 2011

Amanda Knox

I just finished watching the Lifetime movie about Amanda Knox (the American student charged with murder in Italy).

First off, way too soon. The appeal is still underway!

Second, I admit to going into it thinking she was totally guilty (yea, I'm a cynic - I prefer the term "realist"). If the goal of the producers was to portray her as guilty (which seemed to be the complaint some people had), the producers failed.

If the goal of the producers was to make the Italians look inept and corrupt, they succeeded beyond their wildest dreams.

My biggest take away was that the Italian police MO is similar to that of the Inquisition. Round up some likely suspects, torture them into confessing and implicating others; pick up those implicated; rinse, torture, repeat.

Saturday, March 05, 2011

Sci Fi

I have found the most remarkable collection of SF short stories. It is called "The Oxford Book of Science Fiction Stories". It has stories from 1903 to 1990.

Just the first three stories:
"The Land Ironclads" (H.G. Wells, 1903) - a surprisingly prescient description of tanks used in trench warfare. Of course, in researching this post, I checked Wikipedia, and it cites this story... They fail to mention that Wells was somewhat off on the scale:
"It might have been from eighty to a hundred feet long"
He also describes them as using automatic weapons (which had been deployed in 1889 according to Wikipedia).

They also had an interesting fire control and "fly by wire" (or fire by wire) system:
"sights which threw a bright little camera-obscura picture... marked with two crossed lines... A little twisted strand of wire like an electric-light wire ran from this implement up to the gun... when the land ironclad moved forward the sights got a compensatory deflection in the direction of its motion"
That last bit is what's is called a fire control system and wasn't deployed until WWII (on ships as analog computers, and in planes as the Norden bombsight). I don't think it was until modern times (say, Abrams) that tanks got them.

"Finis" (Frank Pollack, 1906) - An interesting story that reminded me of a story where the sun releases a huge flare that cooks the planet. In this version, scientists calculate that there is a giant sun at the center of the universe, whose light is just about to reach Earth (after "a thousand years"?). This is interesting because the idea of a limited universe didn't become popular until Hubble's investigation of 1919-1929.

"As Easy as ABC" (Rudyard Kipling, 1912 - expansion of a story from 1909) - Most people know of Kipling for his poems, and "Jungle Book". I also remember him for Gunga Din. I never knew he wrote SF! And some remarkable stuff:
"An ABC [Aeriel Board of Control] boat does not take the air with the level-keeled lift of a liner, but shoots up rocket-fashion like the 'aeroplane' of our ancestors" (the story is set in 2065).
The ships appear to be some sort of blimp (there is reference to floating and mooring). They also travel a shocking "320 m. p. h.", and cross the Atlantic in 10 hours - not bad considering the Wright brothers had just gotten started in 1900.

There is also a very weird society - world population is down to 600e6 (in 1900, the world population was around 1.5e9). People no longer gather in crowds, and there is no voting for things (sort of a hyper-individualism).

The story involves a group of "voting evangelists" who trigger a riot. The ABC is forced to suppress the rioters with sensory overload (intense light and sound). There is also an interesting sort of force field ("ground-circuits") which can slow or stop movement.

Friday, February 25, 2011

Stuff I've read lately

"Nebula Awards 33" (Connie Willis ed.) - They've changed the format, and I must say I like it. Each story is followed by a note from the author describing the conditions that led up to writing it. It's interesting how good stories come from flimsy circumstances, and less interesting stories often come from well thought out approaches (and vice versa). Also, there is a classic story from the golden age of SF.

Thursday, February 24, 2011

Stuff I've read lately

"Act of War" (Dale Brown)(audio) - I have to wonder who is the target audience for Dale Brown's work. Do they appreciate the cheesiness? Or do they actually take it seriously? I mean, the "good" people are all super-good (and beautiful) - while the "bad guys" eat kittens (and are usually ugly and scarred).

That said, I did have to appreciate this book codifying the phrase "he's got the atomic bomb!" (said in the same vein as "he's got a knife" or "he's got a gun"). Not that anyone actually said it, but Brown set up the situation.

Brown did manage to set up a surprise at the end, although the voice acting gave it away somewhat earlier than would probably come about from just reading it.

Saturday, February 19, 2011

Aerostats

Interesting news article I found in my archives:
"This so-called graphene sealed microchamber is impermeable to even the tiniest airborne molecules, including helium."
Fiction involving nanotechnology often has objects called "aerostats", basically floating machines (usually equipped with fans or jets for movement).

If the balloon wall is impermeable to most atmospheric gases, then the balloon might be able to be "filled" with a vacuum (assuming air pressure won't collapse it). Making it the best lighter-than-air material.

Wednesday, February 09, 2011

Stuff I've read lately

"iWoz" (Steve Wozniak)(audio) - I was really looking forward to this. Woz was somewhat of a hero for me, what with my first computer being an Apple II. It also seemed like he had had just a bad experience with Apple as I had.

Sadly, Woz gives Apple a bye. He even lets Jobs off the hook.

It was interesting to hear the story of how Jobs used to wirewrap boards for Woz.

Monday, February 07, 2011

I say

we take off - nuke the site from orbit. It's the only way to be sure.

I just read something at Ars that makes me physically sick. Farmville for Dummies.

At least the interview with the author is good for a laugh:
"The first time Orland played Farmville he had to give himself a goal to maintain interest: to recreate the first level of Super Mario Bros. out of haybales. After that, his interest waned and he left the game."

Saturday, February 05, 2011

NedNews: XML, Again

Isn't the point of XML that you can load in all sorts of data, and everyone can pick out what they need?

I just try fetching from a different RSS feed, and all the data is in different places! What a pain.

Regardless, I'm now satisfied that I can get all the data into the database. That will be the next step before trying to show article bodies (because article lookup should pass through the database).

NedNews: Pics

Ok, I'm slowing down, the fatigue is starting to build up!

I need to have something I can show, in case my brain shuts down entirely.

Let's get the titles from our RSS feed into out header window.



Ok, that is a screenshot of the Tcl window (still called tMain for now) over top of NewsFox (with my subscriptions and the other columns hidden).

Not too bad. I had to shuffle things around, because I forgot the scrollbar (I always do that!)

NedNews: HTML

Ok, I little distraction from the HTML. Sadly, there isn't a really good Tcl widget that automatically handles HTML (this is something I'd like to work on, I'd call it InterNed Exploder).

There is an old project called tkHtml. Surprisingly, I was able to get the source and build it with no problems. I have it in a git repo, and can push it to github if anyone cares.

I think I'm tackling enough with NNTP, RSS, and a database backend. I am going to punt on the HTML, knowing that there is one ok solution, and it's something I'd like to work on.

NedNews: XML

Ok, now we have our XML data (in the string variable httpData).

Let's see if it looks good (in my wish session):

% llength $httpData
list element in braces followed by "&lt;/div&gt;</summar" instead of space
% string length $httpData
101373

I am so used to using llength instead of string length, I mistyped it the first time. No worries, Tcl tries to interpret the string as a list, but it is malformed. The second time around I get the length in characters (Tcl will handle multibyte character strings automatically).

Let's parse this into a tree.
set doc [dom parse $httpData]

Ok, let's look through the tree (the dom interface returns a list of child nodes), and see what we got (llength is "list length" and lindex is "list index", where 0 is the first in the list):

% llength [$doc childNodes]
2
% [lindex [$doc childNodes] 0] asText
type="text/css" href="http://semipublic.comp-arch.net/wiki/skins/common/feed.css?270"
% [lindex [$doc childNodes] 1] asText
(pages and pages)

Ok. Pesky. The top of the tree has just two nodes. The first gives us the stylesheet. The second has all the real content...

% set docTop [lindex [$doc childNodes] 1]
domNode00BFCF48
% llength [$docTop childNodes]
38

In my final code, I will try to use XPath to extract the vital goodies. But we can poke around by hand here.

I can see that there are some initial fields ("id" - the URL I used to get this, "title", "link" - which also seems to be the URL, "updated" - with some time info, "subtitle", and "generator"). Then there are "entry" fields with the posts. So, the "updated" field will come in handy when I want to look for updates, "title" might be useful for populating a description. Otherwise, I just want the "entries".
set entries [$doc selectNodes -namespaces {atom http://www.w3.org/2005/Atom} /atom:feed/atom:entry]
There is a slight complication here. The Atom tags are referenced against a URL, so I need to supply that for XPath...
I can see each entry has 6 fields, an "id" - which is the link to the full post, "title", "link" - which also links to the full post, "updated", "summary" - the body, "author". Perfect.

I would pick the one feed and entry which is full of HTML. I will post a bit on that next...

NedNews: HTTP

At this point, I would like to set up my database schemas. I'm very familiar with Usenet, so I think I can lay out everything there. However, I am less familiar with the XML that comes in RSS feeds, so I want to sift through some of that before committing to a database layout.

An RSS feed is indicated by a URL, and is XML content delivered via HTTP. We will need to load packages to handle this for us:
package require http
package require tdom


tdom is the package I use for parsing the NewStars XML turn files. It has an excellent XPath system.

We'll need a URL to fetch the data from (this should come from a subscription list, but we will hack it in for now):
set url "http://semipublic.comp-arch.net/wiki/index.php?title=Special:RecentChan
ges&feed=atom"


This is the list of recent edits from Andy Glew's informative Comp.Arch wiki.

Now, let's fetch some data. Things are somewhat complicated by the asynchronous nature of HTTP (we fire off a request, then some period of time later, we get data). So, we will need a callback to handle the eventual arrival of data. Ideally, we would handle multiple outstanding requests, but let's deal with one right now...
set httpData ""


This is a global variable which will store the result of our http request (this is why we can only handle one request at a time).

And the callback:
proc httpDone {token} {

set fail 0
switch [::http::status $token] {
ok {
if {[::http::ncode $token] != 200} {
puts "HTTP server returned non-OK code [::http::ncode $token]"
set fail 1
}
}

eof {
puts "HTTP server returned nothing"
set fail 1
}

error {
puts "HTTP error [::http::error $token]"
set fail 1
}
}

if {!$fail} {
set ::httpData [::http::data $token]
}
::http::cleanup $token
puts "HTTP Done"
}

The handler is complicated by how the HTTP package decided to handle errors and odd conditions. Ideally, it would roll bad "ok" states into "error" (and probably the "eof" condition as well), but there it is. Again, ideally, we would handle what errors we could (possibly with a retry), and notify the user in a better way (but I am the main user!)

Here we can see Tcl's switch statement. Pretty straightforward. The first argument provides the string that will be matched. The body consists of tuples. The first part of the tuple being the string to match, the second being code to execute on a match. There is no provision for fall-through, although you can handle multiple patterns with a single body:
switch $status {
eof -
error { puts "Not good" }
}

Now we are set to fire off a request:
set httpToken [::http::geturl $url -timeout 5000 -command httpDone]

I punch all this right into my wish session. Then I wait for some output... My first attempt used the "-channel" option, but it appears that requires an already open channel - so the command failed. I can rewrite my handler to not use the channel, paste it into my session, and reissue the command, without restarting (if you create a proc that matches an existing proc, the old one is overwritten).

Which reminds me. proc is just another command in Tcl. It takes three arguments: the name of the procedure, the arguments, and the body. Any Tcl command can be overriden this way (although it is best to rename the original to something else so you can get to it). I use this to trap the exit functionality:
rename exit origExit
proc exit {} {
# closeout some resources and cleanup some stuff
origExit
}


The second time I get:
HTTP Done

NedNews: GUI

The other "Hello world to RSS reader" series tack on a GUI at the very end. One of the draws for Tcl is the easy integration with a GUI (using Tk). For small projects, seeing something right away is helpful for keeping focused and motivated.

Let's start with the GUI right away!

I have set up my code on Github, so you can see it all there!

Getting started:
I am on a Windows machine, using a "batteries included" Tcl install from ActiveState. Tcl is cross platform, so everything should just work on Linux or MacOS. You may need to install various packages (probably Tcl, Tk, and Sqlite). Also, I heavily recommend tkcon on Linux. I am using Tcl 8.5 which includes a lot of improvements over 8.4.

I do most of my development "live" (inside a Tcl windowed shell - wish). That gives me instant feedback on changes, and allows me to test code in the running environment. No compile, breakpoint, test loop!


wm withdraw .
toplevel .tMain


This is a little bit of boilerplate I use on all projects.

Wish will give you a default top level window (named "."). The problem is, if "." is destroyed (closed), then wish will exit, and you lose your session.

Using the window manager command (wm), I "withdraw" the default toplevel (which causes it to disappear). That way, I can't accidentally close it.

I then create a new toplevel. Putting everything into a new top level allows me to close it, and start over, while keeping the rest of my session.

Let's create our three pane display. There is one pane on the left, to show all the news sources. The right side is split into a top and bottom, showing headers and bodies.

## a splitter for left and right windows
pack [ttk::panedwindow .tMain.splitLR -orient horizontal] -expand 1 -fill both
# a tree for news sources
.tMain.splitLR add [ttk::treeview .tMain.splitLR.tSrcs]


Here we can see a comment (starting with "#"), and a line using nested execution. Execution begins inside the square brackets. I use the new (to Tk 8.5) "Themed Tk" (ttk) namespace command "panedwindow", which will divide up my window into panes (duh).

This is our left-to-right split. All of the Tk widget commands return the widget name (.tMain.splitLR in this case). That allows me to chain the command into pack.

pack activates the packing algorithm. Many GUI systems require you to place widgets at specific x,y points. This then requires a GUI builder to arrange everything so it looks nice (there is a GUI builder for Tcl called "v", which uses the place layout algorithm).

Not so pack. I can just give all my widgets over to pack, and it does a good job of arranging them all neatly. The arguments -expand and -fill tell it I want all the window space given to this big widget (it helps to have all the documentation open, so you can see all the options for these commands).

We pile in some more widgets in a similar way (note that the panedwindow is its own sort of packer for the sub-windows)

## a splitter for top and bottom (headers and bodies)
.tMain.splitLR add [ttk::panedwindow .tMain.splitLR.splitRTB -orient vertical]

# a tree for headers (threaded view)
.tMain.splitLR.splitRTB add [ttk::treeview .tMain.splitLR.splitRTB.tHdr]

# textbox for bodies
.tMain.splitLR.splitRTB add [text .tMain.splitLR.splitRTB.xBdy -state disabled]


Eighteen lines of code, five of which are blank, and six are comments. And a lot of explanation on this blog. That's why I like Tcl. Very concise.

NedNews: Overview

Ok, that was long and involved! Let's get coding!

First, we should do a little planning...

Most news readers are three panel. That will be fine for our purposes.

We are going to support both RSS (XML) and Usenet (NNTP). This will add a little complexity, but it is what I want :)

The other thing I want, which the other series did not cover, is persistence. I want to remember what posts I have read, and I want to store posts as long as I want (not as long as the server decides to keep them!)

digitalmars.D (one of the Usenet groups I read) has 20,000 posts. I previously mentioned that NewsFox breaks down at several thousand posts (which tells you I often let my RSS feeds accumulate thousands of posts).

Storing this amount of data should be done in a database.

Fortunately, the popular embedded database engine Sqlite is actually a Tcl extension (it also provides a C api, which is what most people use).

We will need to think through some database schemas, but it will be worth it. The database file can be shared between machines, and across the network through a service like DropBox. (As long as we are careful not to update it simultaneously from different machines.)

NedNews: Background

The main idea behind Tcl is "everything is a string". Code is a series of strings evaluated in a particular context. Lists are strings formatted in a particular way. (There are also maps from string to string)

This might seem stupid or limiting, but it actually flattens interfaces - now you don't need to worry as much about how to interface different components.

You have production and consumption of strings (somewhat like command pipelines in Unix).

Tcl looks enough like C that it can be misleading:

for {set i 0} {$i <= 10} {incr i} {
puts "Hello $i"
}

It can be more helpful at times to actually think of it as a stripped down Lisp-like:

(for, (set, i, 0), (<=, $i, 10), (incr, i) (puts, "Hello $i"))
(which makes more sense if you are used to Lisp, else little sense)
  • The first command on each line in Tcl doesn't need parens (and the whole program doesn't need parens).
  • Arguments are separated by whitespace instead of commas. Double quotes surround arguments which contain white space.
  • Curly braces are used to protect strings from variable substitution (when variables will get substituted later).
  • Square brackets enclose nested commands (arguments which need to be evaluated as function calls)
  • New lines are significant, for is really a procedure which takes the body as an argument - lambda programming from the beginning!
That last point means:

for {set i 0} {$i <= 10} {incr i}
{
puts "Hello $i"
}

won't work (for will fail to find its body argument).

In other words, the Tcl parser is very simple. It processes one line at a time (concatenating lines inside curlies or that end in "\"). It then breaks the line up into "words" based on spaces and tabs. The first word is used as the command, and the other words get passed along as arguments. Substitution is done to all words, except inside of of curly braces ("{}"). Square braces ("[]") trigger nested execution. That's it!

Let's say you want to display the results of some math:

puts "Two plus two = [expr 2 + 2]"


Again, in Lisp, this is:

(puts, "Two plus two (expr, 2, +, 2)")
(assuming Lisp would expand inside quotes, which I don't think it does)

The brackets trigger execution inside the currently executing line of code. The first word is the command ("mathematical EXPRession"). expr takes any number of word arguments, which get evaluated as math.

2 + 2 can't work because "2" is not a command. Some people create commands for "+,-,/,*" - then you can do "+ 2 2". That is good for RPN people, but I don't see the benefit.

NedNews: Motivation

I've long desired to write my own news reader. I currently use the Firefox plugin Newsfox for RSS, and Outlook Express (which is far superior to Outlook) for old-school Usenet (NNTP) news.

I would like something which I can access from multiple computers, but all the web based news readers I looked at did not store which messages are read versus unread. They also tend to only show the last few posts (I sometimes leave posts in the queue for months, and my NNTP backlog goes back two years).

Plus, Newsfox has eaten my archives on two occasions now (it seems to have problems once a feed gets to several thousand posts). And Outlook Express uses some cryptic Microsoft method for storage, which would be a pain to try and share across computers.


I have seen two posts now on Reddit, talking about "Hello world to RSS reader" (Scala and Prolog). I figure, this is the perfect time for one on Tcl!

The redditor takes a month for his projects. Given that I already have experience with Tcl, and have thought a fair amount about my newsreader - I am going to see how much I can get done in one day!

Tuesday, February 01, 2011

Got a funny feeling

you don't love me anymore.

If you don't mind me asking,
what's this poisonous cobra
doing in my underwear drawer.

Got a funny feeling, you don't love me anymore.

You drilled a hole in my head,
then you dumped me in a drainage ditch
and left me for dead.

Ooo, oh, oh, you never acted this way before,
honey something tells me,
you don't love me anymore.

Sunday, January 30, 2011

Stuff I've read lately

"L is for Lawless" (Sue Grafton)(audio) - Ironically, this brings me up to date with the series (which is currently at "U"). This one was pretty interesting, Kinsey managed to keep the body count to two (and she didn't kill anybody!) There was even a bit of a mystery element, where is the money hidden? Is there even any money? Quite gripping.

Saturday, January 29, 2011

Liberty Ship

I forget where I first saw this... I was poking around on the Internet a couple of years ago, and found a lot of good stuff, this was probably in there. (Related to the Project Rho site, which I've mentioned before).

The Liberty Ship is truly impressive, something for our generation akin to the Saturn 5 rocket. A shame it will probably never be built...

I wanted to run some of the numbers, because I keep getting them jumbled (stupid units):
Mission mass: 2.722e6 kg (6e6 lbs)
Dry+empty mass: 7.258e5 kg (1.6e6 lbs)

The power is given as 80 GW, and the fuel mass flow is 178 kg/s. That translates (via ve = sqrt(2E/m)) to 29,981 m/s exhaust velocity (which matches well with the given 30k). That power sounds high, I will probably examine that in a separate post.

Thrust is ve * fuel mass flow, which yields 5.337e6 N (which roughly corresponds to the given 1.2e6 lbs, if 4.4N=1 lb force - which is what Google implies).

The biggest problem I ran into was finding the right delta v for LEO. Project Rho gives it as 11,180 m/s (before aero and grav drag). Wikipedia gives it as 7.8 km/s without drag (and 1.5-2 km/s drag).

The other problem is the total thrust is very low. With 7 engines, thrust is 37.357e6 N. Dividing that by the loaded weight (mission mass) gives an acceleration of 13.726 m/s^2 (1.4 g's). This will cause a very long lingering in the Earth's gravity well (rockets often use 10 g's for liftoff).

I'm not certain how to calculate the gravity drag. Project Rho gives vd = vo / a, which seems to allow for any velocity. It seems unlikely that any acceleration below 1 g can ever escape, but perhaps I am wrong...

Regardless, this gives us v_drag of 5,575 m/s - which cuts heavily into the given mission dv of 15 km/s (perhaps that is the intent). It is unclear what effect a lifting body has in these figures...

One alternative is to increase the fuel flow (to increase thrust, and decrease linger time). Unfortunately, this cuts into ve. The mass ratio (full mass divided by dry mass) is equal to exp(delta v / exhaust velocity) (that's the natural number, e, to the x power).

So any drop in exhaust velocity has an exponential effect on the mass ratio, which drives up propellant mass, which drives down cargo mass.

You can drive ve back up with engine power, but ve is the square root of power, so half ve must be made up with 4x power...

Friday, January 28, 2011

Stuff I've read lately

"Nebula Awards 27" (James Morrow ed.) - I like reading these short story collections. They give exposure to a lot of authors who I might not normally read. And coverage of a lot of areas. Plus, if I don't like a particular story, it's over quick!

Sunday, January 16, 2011

Stuff I've read lately

"Paradise Lost" (John Milton)(audio) - This is one of those books you always hear mentioned by name, but no one ever talks about the details. Probably because the details are incredibly long winded...

I think the most amazing part was the whole thing is nine hours, and most of the time is spent with demons giving speeches to each other (and bizarre battle scenes where I lose track of who is fighting). In the last half hour, Milton covers all of history from Adam to the (his) present (~1600).

Friday, January 14, 2011

Failville

(continuing my review of Facebook games)
I don't know why I keep giving Frontierville another chance... I keep thinking it has to get better at some point...

There is an interesting correlation between games I enjoy and games that allow non-paying players access to the for pay item. For example, Robot Builder and Nitrous Racing (which needs its own reviews) are my two favorites - both allow you to get the bonus items without paying (of course you can pay to get more).

Frontierville gives you 1 per level (called "horseshoes"). Stupid decorations cost 10 or more (the treehouse is 100). You might need 4 or 5 just to finish some building that all your friends are done with (so they stop sending you the materials).

When I signed in last week to help some friends with items they needed, I was notified of a chance to win 50 horseshoes by completing 6 missions.

So, I churned hard on those missions - harassing my friends like never before. As the deadline approached, I was starting to finish!

Then, what do I see?

The missions are multi-part! Each one I finish gets backed by "Phase 2". Yea, no chance of success.

Thursday, January 06, 2011

Stuff I've read lately

"K is for Killer" (Sue Grafton)(audio) - Yet another last minute killer reveal. Plus, I can't even figure out if the killer was strategically bumped off by Kinsey or simply disappeared to start a new life (she called someone who she thought was a mobster - it was unclear if the killer was working with them). Another big body count: the original victim, her friend, an old guy, his gardener - plus maybe the killer.

Monday, January 03, 2011

Riverworld

I finally saw the Sci Fi channel movie adaptation of Riverworld (by Philip "The Outlaw" Jose Farmer).

I was mostly impressed. The story is fairly true to the original (including the important aspect of grail slavery). They even managed to fit in the airship, although some characters were shuffled.

The most disappointing aspect for me was the not-so-fabulous riverboat. It looked like an ordinary riverboat. And instead of steam-driven machine guns, it had a small cannon on the front (like an age of rifles cannon).

I was also surprised by the ending. Although the books didn't exactly end well either (I don't even remember the ending!)