

This is a simple blogging platform I wrote to replace my dependence on Movable Type. I suppose it will require me to actually learn some css/html.
Previously I tried updating my Movable Type install, but that wouldn't work.
So I tried installing the new version and uploading the backup to it. But that didn't work.
Next I tried a clean install of the old version, uploading the backup, and upgrading. But that didn't work
Finally I looked at the documentation online, but it was plastered with spam comments.
I really don't like being unable to get my data back in a nice parsable format.
So that's how this started. Blagr uses a simple plain-text format, one file per post. Blagr really isn't a blog or blog-engine by itself - it is only a transfer format. You can see the source to all my posts in the blog/input directory.
The format is quite simple - there are two parts, header and body, as well as a seperator between them: --- , that's three dashes in a row on one line. The header itself is a list of key-value pairs. Each line in the header has the key, then a colon, then the value. So you want to tag a post with pickles? Add Tag:Pickles to the header. The post body is XHMTL
The blog you are reading right now is statically compiled by a small python program that only knows how to read .blagr files, sort them, and output html.
Long ago, in the age of state-collegiate education, I had a class with Ted McCracken. On the first day, he announced we would be designing a computer. Specifically, a small 8-bit RISC machine. By some strange chance one of the best teachers at the school was having his course reviewed by the state. This terrible maelstrom yielded my semester of CpE315. We would cover 8086, 80386, brush on PowerPC, serial busses, parallel busses, memory and timing, segmented memory, virtual memory, pipelining, and would touch on nearly everything I would come to understand years later about electronics from diode-transistor logic to cache architecture on multicore devices.
The machine was done piecemeal - each student was given a few parts of the design, and the basic design was completed. The next step of the course was programming the system. Dr McCracken graded by stepping through the programs on paper. I would often make a simple error when translating the assembly to machine code. Eventually, I wrote a small virtual-machine and assembler so I could test my work before I submitted it. I added instructions as I needed them.
Years later, and a few OS-installs too, I've lost the code to the original 'Kraken' architecture emulator. So this is a new simple architecture based on many of the things I learned in CpE315, with more years of experience. I've also started on an assembler that uses a grammar parser instead of getline as the main text processing construct.
AVAILABLE COMMANDS DESCRIPTION ? This command list q Quit; Start Application; Run OS shell on console cls Clear Screen ver Display Product Version show Show all parameter values= Set LAN parameter, e.g., 'ip = 172.25.2.1' 'gateway = 172.25.100.1' 'netmask = 255.255.0.0' Set PPP parameter, e.g., 'local = 172.26.2.1' 'host = 172.26.200.1' 'comport = port1' (options are 'none', 'port1', 'port2', or 'internal') 'timeout = 60' (timeout may be between 0 and 999 seconds) 'baudrate = 9600' (options are 9600, 19200, 38400, 57600, 115200) 'modem prefix = at' 'modem init = z' 'modem dial = D' recover Recover system to the previous version. Enter a command, or '?' for help: ver Rapid Eye MULTI Configuration Shell Version 3.2 Copyright 1999-2000, Ademco Enter a command, or '?' for help: show Current LAN Settings: ip = 10.174.8.64 gateway = 10.174.8.1 netmask = 255.255.254.0 Current PPP Settings: local = 172.26.2.1 host = 172.26.200.1 comport = internal timeout = 60 baudrate = 115200 modem prefix = AT modem init = Z modem dial = D Enter a command, or '?' for help: q Configuration Shell Stopped... Attached TCP/IP interface to eeE
. ./streadir.dat ./STARTUP ./VERSION ./eventdup.dat ./JAV308.O ./system.log ./JAV306.O ./VXWORKS ./EVENTDIR.DAT ./TEMP ./KALATEL.O ./blockdir.dat ./PPPWAIT ./DAU ./storage.cfg ./streadup.dat ./alarmdir.dat ./PPPINIT ./PELCO_P.O ./MANUF ./serialid ./alarmdup.dat ./eventcol.dat ./SECURITY ./BOOTROM.SYS ./MTC ./MTC/SECURITY ./MTC/USR.INI ./MTC/LUCENT.INI ./MTC/config ./MTC/cfgdup ./GPOSTATE ./DELTA.O ./storage.csv ./CONTEXT ./PELCO_D.O ./DSH2 ./config ./DSHUNLD ./cfgdup
















An elderly indian couple crosses paths with me.
We smile and greet each other.
I have spoken to them a few times before.
Soon I am at the turn.
I found this place about a year ago.
An abandoned park bench, with no path, overlooking the lake.
I sweep away the leaves and sit down.
Almost a year ago I fixed this bench.
I measured and cut the lumber.
I tied it into a bundle, and carried it to the bench.
The ranger asked why i was carrying it.
He told me he had never been to my bench.
The next day I took the bench apart.
The next day I put it together.
The last day I stained it.
As i open my lunch bag, I spot a moth stuck in the velcro.
I carefully remove her.
She flutters away.
As I bite into the cheese and sausage, and listen to the crunch of the crackers, I am reminded of home.
My father showed me this place long ago, above a different lake.
I drink my 2.1 ounce yoghurt drink.
There is something in the brush.
It is a small dog.
He barks at me.
I offer some cheese and sausage.
He quiets down and I pet him.
Soon we both hear his owners calling for him.
He looks at me, the runs back through the brush.
He will not betrsy my citadel.
A goose squawks as it lands in the lake.
Another goose squawks back.
The first goose leaves.
I toss the last of the sausage into the lake.
Ths same catfish comes and snaps it up before decending down again.
I finish the cheese.
I wonder if anyone was here before me, maintaining the bench.
Perhaps feeding the same catfish, with the remains of simple meals.
I wonder who built it, so many years ago.
And i wonder, who i am.
#include <stdio.h>
#include <magic.h>
int main( int numArgs, char * args[] )
{
magic_t m;
m = magic_open( MAGIC_NONE );
magic_load( m, NULL );
printf( "%s", magic_file( m, args[ 1 ] ) );
magic_close( m );
}


Issues
Dependencies - install with the 'Package Manager'
Lua PKGConfig -here's my /usr/lib/pkgconfig/lua5.1.pc
prefix=/usrmajor_version=5.1version=5.1.4#prefix=/usr#major_version=5.1#version=5.1.0lib_name=lua${major_version}libdir=${prefix}/libincludedir=${prefix}/include## The following are intended to be used via "pkg-config -variable".# The location of the libtool library. This is used when linking to the Lua# library via libtool.libtool_lib=${libdir}/lib${lib_name}.la# Install paths for Lua modules. For example, if a package wants to install# Lua source modules to the /usr/local tree, call pkg-config with# "-define-variable=prefix=/usr/local" and "-variable=INSTALL_LMOD".INSTALL_LMOD=${prefix}/share/lua/${major_version}INSTALL_CMOD=${prefix}/lib/lua/${major_version}Name: LuaDescription: Lua language engineVersion: ${version}Requires:Libs: -L${libdir} -l${lib_name}Libs.private: -lmCflags: -I${includedir}/${lib_name}
Patch 1 - code/globalinc/pstypes.h
#define INTEL_INT( x ) ( x )#define INTEL_FLOAT( x ) ( *x )#define INTEL_SHORT( x ) ( x )
Patch 2 - code/fs2netd/tcp_socket.cpp and code/network/chat_api.cpp
#include <sys/ioctl.h>#include <sys/filio.h>
Patch 3 - code/starfield/starfield.h
int stars_add_sun_entry(starfield_list_entry *sun);int stars_add_sun_entry(starfield_list_entry *sun_ptr);int stars_get_num_entries(bool sun, bool bitmap_count);int stars_get_num_entries(bool is_a_sun, bool bitmap_count);void stars_mark_instance_unused(int index, bool sun);void stars_mark_instance_unused(int index, bool is_a_sun);const char *stars_get_name_from_instance(int index, bool sun);const char *stars_get_name_from_instance(int index, bool is_a_sun);const char *stars_get_name_FRED(int index, bool sun);const char *stars_get_name_FRED(int index, bool is_a_sun);void stars_delete_entry_FRED(int index, bool sun);void stars_delete_entry_FRED(int index, bool is_a_sun);void stars_modify_entry_FRED(int index, const char *name, starfield_list_entry *sbi_new, bool sun);void stars_modify_entry_FRED(int index, const char *name, starfield_list_entry *sbi_new, bool is_a_sun);
Patch 4 - code/starfield/starfield.cpp
int stars_add_sun_entry(starfield_list_entry *sun);sun with sun_ptrint stars_get_num_entries(bool sun, bool bitmap_count);void stars_mark_instance_unused(int index, bool sun);const char *stars_get_name_from_instance(int index, bool sun);const char *stars_get_name_FRED(int index, bool sun);void stars_delete_entry_FRED(int index, bool sun);void stars_modify_entry_FRED(int index, const char *name, starfield_list_entry *sbi_new, bool sun);
Patch 5 - code/starfield/supernova.cpp
void supernova_get_eye(vec3d *eye_pos, matrix *eye_orient);sun with sun_vecsun_temp with sun_vec_temp
Patch 6 - configure.ac
fs2_os_osx="no", add fs2_os_solaris="no"*-*-darwin*)*-*-solaris*)# Solarisecho "Using Solaris 10 defines (for $host_os)"fs2_os_solaris="yes";;elif test "$fs2_os_osx" = "yes" ; thenelif test "$fs2_os_solaris" = "yes" ; thenFS2_CXXFLAGS="$FS2_CXXFLAGS -I/usr/include/SDL"FS2_LDFLAGS="$FS2_LDFLAGS -lpng -lpng12 -ljpeg -lpthread -logg -lSDL -ltheora -lopenal -lsocket -lvorbisfile -lvorbis -lnsl -lGL -lGLU"AC_DEFINE([SCP_UNIX])AC_DEFINE([NO_DIRECT3D])## don't need the CFLAGS here if recent SDL is usedAM_CONDITIONAL(FS2_OS_UNIX, test "$fs2_os_unix" = "yes" || test "$fs2_os_osx" = "yes") with AM_CONDITIONAL(FS2_OS_UNIX, test "$fs2_os_unix" = "yes" || test "$fs2_os_osx" = "yes" || test "$fs2_os_solaris" = "yes")
Building
./autogen.sh or ./autogen.sh -enable-debugPKG_CHECK_MODULES, because you already installed all the prereqs...right?./configure againmake
Launching
unset LANG - This sorta fixes a solaris/SDL/X bug./fs2_open_r or ./fs2_open_d

First Impressions:
First power-on: Expect to spend about half an hour with the machine rebooting and installing software. It's a shame HP didn't think of doing this somewhere else. Maybe they could've done it in the factory, or maybe they could've done it as an OS image. About a minute after finally booting into Windows, the machine went into suspend. After it woke up, it died. Now it seems to be working fine.
Screen: Screen seems pretty bright and quite clear. Resolution is 1366x768, which isn't bad for a screen that size. For comparison, my macbook is a 13.3 inch 1280x800 screen. Slightly more pixels in a smaller screen is a good thing. Also, since the screen is LED backlit, there shouldn't be any inverter problems like the macbook was plagued with ( 5 inverters have tried and failed, Apple keeps feeding the machine new ones ). I haven't had a chance to take the 311 outside in direct sunlight yet, but I have high hopes.
Keyboard: The keys are nicely sized, but there's little border between the keys themselves. This leads to often losing where your fingers are located. Also, the blind-person nubs are real short and easy to miss.
Trackpad: I like the trackpad. The trackpad is large for this size of laptop, it is smooth, and the built-in gesture support is great. However, it would be nicer if the trackpad weren't at the same height as the buttons. This often leads me to graze the trackpad when clicking, making the cursor fly off to the corner of the screen, although I'm sure I will get used to it.
Bloat-ware: Expect a few columns of icons on the desktop, about 7 or so in the tray. HP was even so nice as to include another Internet Explorer Toolbar!!! Can you guess what it does? It does an MSN/BING search, just like the built-in search bar.
Networking: There are three wireless options available for this machine: Wifi, Bluetooth, and 3G. I went with Wifi and Bluetooth, planning on tethering through my phone while away. I went with the upgraded A/B/G/N Wifi card. It's a Broadcom, but seems to work fine. However, HP installed a generic wireless card manager ( It handles Bluetooth, Wifi, and presumably 3G ), and so Wndows fights with this thing constantly. Once you kill off one of them the Wifi works great. Bluetooth tethering was painless. I did notice that HP opted to cut the ethernet port down to 10/100 instead of 10/100/1000 like the ION chipset supports.
Video Card: I bought this machine specifically because it has built-in NVIDIA ION graphics. I wanted to play with CUDA, and I was tired of my Intel 945 software-emulated GPU. It appears that this laptop does not come with NVIDIA ION, it comes with NVIDIA ION LE. I appears to use 128 Megs DDR3 ( other real ION systems use 256 ), and may have some other limitations. I am not amused and will be calling HP about this.
Thoughts: Pretty sweet. Time to set up some games.
configure: Configuring Subversion 1.6.6
configure: creating config.nice
checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking for g++... g++
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking how to run the C preprocessor... gcc -E
checking for a sed that does not truncate output... /bin/sed
checking build system type... i586-pc-linux-gnu
checking host system type... i586-pc-linux-gnu
checking target system type... i586-pc-linux-gnu
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking whether ln -s works... yes
checking for a BSD-compatible install... /usr/bin/install -c
configure: Apache Portable Runtime (APR) library configuration
checking for APR... no
The Apache Portable Runtime (APR) library cannot be found.
Please install APR on this system and supply the appropriate
--with-apr option to 'configure'
or
get it with SVN and put it in a subdirectory of this source:
svn co \
http://svn.apache.org/repos/asf/apr/apr/branches/1.2.x \
apr
Run that right here in the top level of the Subversion tree.
Afterwards, run apr/buildconf in that subdirectory and
then run configure again here.
Whichever of the above you do, you probably need to do
something similar for apr-util, either providing both
--with-apr and --with-apr-util to 'configure', or
getting both from SVN with:
svn co \
http://svn.apache.org/repos/asf/apr/apr-util/branches/1.2.x \
apr-util

On second thought, maybe those caps are just a little overkill.








Networks have been big endian since the beginning of time(teletypes), and from the time x86 workarounds have been in place, programmers have been using things like htons() and ntohs() to make sure their data is in the proper format for networks( big endian ). Not so with JAUS! With JAUS, x86 programmers no long have to worry about network byte safety, because everyone else will!That's the level of enthusiasm about this particular item the speaker had. I suspect that the JAUS folks first started laying out some code and later discovered that JAUS on Macs couldn't talk to JAUS on PCs. Next they probably figured out what endian-ness is. The speaker basically recommended I keep two copies of all code: One for big-endian, and one for little-endian.
We're going to need an array of counters for this next trick, something like "unsigned long long counters[65536];" And we'll just increment the 1337 counter by one. For the next 24,999,999,999 unsigned shorts, we'll do exactly the same thing. Now we have an array containing counts from one to (at worst) 25,000,000,000. All we have to do is traverse the array, reassembling the sorted structure.So how long would it take to sort 50GB of files holding Unsigned Shorts? About as long as it takes to read the unsorted files and write the sorted files. I discovered this algorithm last week on a robotics competition, while trying to solve Case A. (it's actually been done before-right here is a great paper on it-I wasn't the first. I was a little disappointed.) But anyhow, it has some great features:
So to start, search through the picture until a white pixel was found. Set the pixel to black, check if it can be stored in a known blob (if a blob is adjacent to it), otherwise create a new blob, and recursively scan the 8 pixels around this found pixel.This algorithm has two failing points. The first, is that the recursive factor will scan each pixel more than once. This isn't optimal, especially if we're looking to make this go fast. Secondly, since my blobs are made of vectors, not only must we search through each blob, we must search through every single pixel. Thankfully, I added a little hack, some range checking. Each blob knew the ranges it spanned(MaxX, MaxY, MinX, MinY), and so often checking an entire blob for adjacency with a pixel would only take a few operations, but other times it took an entire linear search. I could have sorted each blob internally by some characteristic, say X or Y, but this is just building on a broken machine, like ripplesort is to bubblesort.
So, in much the same way, search through the image, creating new blobs if needed and appending to existing blobs. But, if you ever find a pixel that is adjacent to two blobs, mark it in the table and combine them later.This is a little slower, because each pixel has to be compared against every single blob, regardless of a previous match, but it is much faster than my recursive solution above. What may perform even faster, is combining blobs on the spot.