Maintaining a Personal or Project Journal in Linux

Linux Journal

Lately I spend most of my time in a Linux terminal. One of Linux’s strong points is that you will always have a way of writing at hand no matter what. Just open up a terminal and type “vim” (or your own editor of choice) and you can type anything, save it and quit. The text you save can be a script, some code, a to-do list, a phone order for Chinese food–whatever you decide.

Late last year I decided to store a day-to-day account of what’s going on in my life and how I feel. It’s given me a lot of insight already and it’s a great way to remember when stuff happened. I originally started this in Google docs, however after a certain length Google docs can become extremely slow. Hell, Google docs is slow all the time. I realized that splitting the files up would be necessary. I wasn’t ready to do that with Google docs because it would make them impossible to search and sort through. I opened up a terminal and made a series of nested folders.

I started with a journal folder in my home directory. Then I added 4-digit year, then 2-digit month. Days were then simple text files stored under each month folder. It looks like this:

~/journal/2012/08/30
~/journal/2013/05/21

Note that nothing would really stop you from putting these text files all in a single folder or grouping them all by year, etc. It’s up to you to organize them how you like. I recommend that you keep the date format, though (YYYY-MM-DD) because alphabetical sorting of the files would then be the same as chronological sorting.

The flexibility of this system means that you can create a new entry just by opening up a text editor to the day:

vim ~/journal/2013/04/25

You just write what you need in there and save.

Some Tricks

You can do this for more than just a personal journal. You can use it to chronicle a project you’re working on, keeping a dieting journal, or using it as an hour tracking or work log.

Want to read all of your entries from a particular month?

cat ~/journal/2013/04/* | less

My advice is to use short, succinct sentences, and limit to one sentence per line. Use your words to describe a situation, your feelings, your progress, and your hopes. Don’t limit yourself and be honest because this is for you. Using this brief method will help you describe something quick and easily without turning something into a piece of prose. It will also make it more searchable using grep.

Keep writing quickly for as long as you want, and in the order that it comes to you. You may also group segments of thoughts by inserting an extra new line between paragraphs.

Example

I spent $56 on groceries today
It made me go over budget
Upsetting, but hopefully I have enough of a buffer to make it work

This project at work is carrying on way too long
The reason why is because the project manager missed a detail in the quote
I’m usually the one who gets blamed for it
Not today

While keeping track of details like this is good, a better example would involve a little more depth, introspection, and feeling. Something beyond what you would share on a blog. You will be amazed at how many things you lose track of on a daily basis.

Here’s an added bonus. I wrote a Python script that will compile all your journal entries from every year, month, and day into a single HTML file. It assumes you’re using the same folder and file structure that I do (~/journal/YYYY/MM/DD). Just drop it into your journal directory and run it to create a fully searchable, no-frills HTML file. Load it up in Lynx to search or scan through your entries by typing:

lynx index.html

Also note that it has FTP support in case this is being used to generate project logs. It’s commented out by default, but I use it to keep track of the VTL flight computer software that I’m working on. I even created a simple cron job that compiles and uploads my progress every night.

Here’s the script:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82
#!/usr/bin/python
 
import glob
 
# uncomment for FTP support -- requires ftplib
#from ftplib import FTP
 
output = open("index.html", "w")
 
html_escape_table = {
"&": "&",
'"': """,
"'": "'",
">": ">",
"<": "&lt;",
}
 
# Credit: http://stackoverflow.com/questions/2077283/
def htmlEscape(text):
return "".join(html_escape_table.get(c,c) for c in text)
 
def startBody():
output.write("<!DOCTYPE HTML>\r\n<html><head><title>My Journal</title></head><body>")
output.write("<h1>My Journal<h1>")
 
def endBody():
output.write("</body></html>");
def startEntry(date):
output.write("<h2>" + date + "</h2><!--startentry-->");
 
def endEntry():
output.write("<!--endentry-->");
 
def insertParagraph(paragraph):
p = paragraph.strip()
if p != "" and p != "\n":
p = htmlEscape(p)
output.write("<ul><li>")
output.write(p.replace("\n", "</li><li>"))
output.write("</li></ul>")
output.write("<br>")
 
#BEGIN
startBody();
 
#list all journal files and sort them in reverse chrono order (newest first)
#directory structure should be in ./YYYY/MM/DD format like so:
#./2013/04/31
files = glob.glob("./*/*/*")
files.sort(reverse=True)
 
# loop through journal files
for fileitem in files:
# read the journal file
f = open(fileitem)
j = f.read()
j = j.replace("\r", "")
 
# split into paragraphs
j = j.split("\n\n")
 
startEntry(fileitem)
# loop through paragraphs
for p in j:
insertParagraph(p)
 
endEntry()
 
endBody()
 
output.close()
 
# additional feature!
# uncomment the code here to upload this file to an FTP site:
 
#ftpuser="FTPUSER"
#ftppass="FTPPASS"
#ftphost="example.com"
 
#ftp = FTP(ftphost, ftpuser, ftppass)
#ftp.storlines("STOR index.html", open("index.html"))

Bricks Arcade Announcement, Updates

Bricks ArcadeI’m going to be releasing Bricks Arcade, an Android version of my desktop arcade game by June 1st.

There are also new details on my projects page to include engineering projects I’m working on. I have a lot of notes to parse through and compile for both the junkyard jet engine page and especially the more lofty VTVL one. I plan on making the latter a community-based project and will likely create a separate forum and software repository to allow interaction for it, considering the size.

As a side note it has been stated on electrical engineering StackExchange that hardware projects are notoriously less “open source” because of the amount of cost that goes into prototyping, the ubiquity of software compilers and tools in comparison to open circuit testing software, and so forth. I think it’s also a matter of fandom for the subject, which was high in the Silicon Valley days but dropped off in recent times. Don’t get me wrong, you still see people hand-wrapping home-made Apollo Guidance Computers, but with the advent of ICs the homebrew electronics crews just seem to vanish. It’s sad, being such a personal fan of hand-craftsmanship I want to see more of these projects thrive.

Bricks 10 Year Anniversary

Bricks

10 years ago today I publicly released my first PC game. It was my first jump into C++. Today I recompiled it in Visual Studio 2012 and aside from a couple of hiccups in the upgrade process it runs just as well as it did while I was in High School.

I think it has the neatest code I’ve ever written, but uses some defunct APIs and calls that shouldn’t be used anymore. As a result it probably doesn’t handle Unicode very well.

Download Bricks (.zip)

Unzip it into a folder and double-click the executable. It spits out some files in its working directory for settings and high scores and such.

Working on Linux, Week 1

Yesterday marked my first full week of using Ubuntu Linux 12.10 at work. In short: Well naturally, I totally love it.

Is Linux For You?

It’s excellent for every-day PC users, perfect for web workers, developers and engineers, but it would fall short for most graphic designers[1].

A quick search reveals that you may get most common audio and video production tools running under Linux. I’d guess that it would be clunky and not worth it for most. Specialized software that was designed to run exclusively on Windows will usually run into noticeable performance issues in a virtualized environment.

On the upside, writers would be sated by Linux’s wide array of free writing and typesetting software. Engineers also have an array of CAD and electrical design automation (circuit design) applications. These tools go outside the scope of this article, but I recommend you look further into them anyway as interesting and viable alternatives.

Linux gamers aren’t being ignored any longer either. Steam is working on porting their software to Linux. Humble Indie Bundle also famously supports Linux. There’s a number of cool smaller games you can get from the Ubuntu Software Center too for casual players. For hardcore gamers, Play On Linux has a compatibility guide to see which AAA Windows titles will run smoothly on Linux using their software.

Logistics aside–if you’re a person who’s especially passionate about the inner workings of computers, Linux is a great way to learn more. Conversely, if you want to take more of a hands-off approach and just want a secure and reliable computer to check email, read news, and write documents on then Linux is equally suitable.

I am looking forward to expanding on this more in the future because I have quite a few tools that I want to share.

Footnotes

1. Disclaimer: This is assuming most designers are going to be using Adobe products. Adobe and GIMP do not inter-operate very well from my experience, so there are instances where you may not have a choice. However, if you work better with GIMP and Inkscape than Photoshop and Illustrator then more power to you; you’re using software that has similar features and you don’t have to pay $600 for it! More on this later, though.

Back to top

Officially Switched to Ubuntu 12.10

I’ve officially dropped the axe on Windows for good. In the past Linux seemed to be too unstable, but after evaluating a full install of Ubuntu Linux 12.10 I’ve determined that it works beautifully and much more effectively than Windows 7 ever did. (As a side note I also use a Mac at work and I’m a big fan of them too.)

Why?

Ubuntu works well for every day uses: editing documents, spreadsheets, and presentations, securely browsing the web, checking email, chatting, playing web games, and so on. For an average computer user, you’ll find it has everything that you need without having to install additional software.

Security for the platform is unparalleled, and you can expect to never run into viruses and malware as one typically would on a Windows computer.

Hardcore gamers will also be delighted that Steam is preparing to launch on Linux soon.

Getting It

If you want to make a bootable USB drive to install Linux, I recommend you check out unetbootin. Aside from saving you the CD, it’s also faster to run off of and a great way to evaluate it before you install. Unetbootin is available for Windows, Mac and Linux. If you are coming from Windows, Ubuntu 12.10 is extremely user-friendly, refined, and works great out of the box. You can also install new software really easily by using the Ubuntu Software Center.

12.10 is not available for unetbootin by default, but you can download the iso from http://www.ubuntu.com and then open it from unetbootin.

Running Windows Applications

If you still use proprietary software for Windows, you can usually use Wine to run them under Linux seamlessly. Wine can be installed easily through the Ubuntu Software center with just a few clicks.

An Important Note About Corona SDK

I’m posting this because hopefully it may save a few people out there some time and frustration:

If you specify a scale mode in your config.lua file, you will no longer be able to get physical dimensions of the screen.

The reason for this is because if you set scale to anything other than “none” you’re not working with direct screen coordinates, but rather relative coordinates within a viewport that you’ve now specified. In other words: regardless of the devices resolution, you will always be working with the width and height you specify.

For games, you might want to thoroughly consider which zoom mode you want to select.

  • letterbox – Useful only if you can bleed your background content beyond the normal viewport stage. Don’t ever release a game or app with black letterbox bars for everyone’s sake; follow Corona’s best practices to fill the black letterbox regions.
  • zoomEven – This zooms the viewport until the entire screen is covered. This means you can almost always count on part of the viewport getting cut off. Don’t put text or interactive elements near the edges of the viewport that you’re working with because they will not be seen on some devices.
  • zoomStretch – Absolutely useless garbage. Don’t even consider it. What is this even for?
  • none – This is your true 1:1 mode. You have to consider this mode very carefully because on higher-resolution devices your elements may show up smaller. However, if you have a heads-up display or visual elements that need to be at the corner of the screen for usability, then this is your only true option.

Check out this post for more information:
http://www.coronalabs.com/blog/2010/11/20/content-scaling-made-easy/

My first 3D application

I made my first 3D application when I was around 14 years old. It was on a small palmtop organizer that had a 13MHz processor. I created an entire library and had big plans with it, but never ended up making anything with it other than the initial demos.

Click for a larger picture.

I managed to find the find the hardware (mostly broken) and salvaged it to take one last screenshot.

Redesign & Project Backlog

I don’t fancy myself a designer, so when I tasked myself with a site redesign I took a minimalist stab at it. Now, with Photoshop closed I am shooting toward finishing off some of my larger projects. They’ll show up in the Projects section of the site in a few days. I’m meticulously going through the trouble of documenting them so I can post the progress here.

See you soon.

Cool Things Happening in Medicine Lately

I was beginning to wonder if I would ever see any major medical advances in my lifetime, due to the lack of any trend in this area lately.