Wednesday, September 8, 2010

Where I have been

I haven't written an entry on this blog for about a month and a half. I stopped posting because I was unsatisfied with the quality of my entries. In a word, they sucked.

I realized this after listening to 149 Surprising Ways to Turbocharge Your Blog With Credibility!, Merlin Mann's and John Gruber's talk at the SxSW Interactive conference. Their advice to aspiring writers is simple: write well about topics which interest you.

Before now, I was putting frequency before quality, partially due to a foolish commitment to write one blog post a week during this year. I was writing pointless updates because I didn't have the time to create anything meaningful. Now I know that was a mistake. I am not a blogger; I'm a college student who enjoys writing.

Of course, this isn't the end of Welcome to Obscurity; it's the end of the shallow updates that have composed most of this blog's content for the last year. I will be writing infrequent, in-depth, polished entries about things about which I care.

Other news

Although I haven't been updating this blog lately, I have been blogging elsewhere. I started Life at the U to share my college experience with my family. It's been a huge hit within my social circle, so I've been updating frequently, sometimes multiple times per day.

Thursday, July 22, 2010

New look, same direction

Well, I've finally ditched my custom template for a generic Blogger template. The reason? I wanted to use Blogger's native share toolbar, and my template didn't support it. I simply don't have the time to wade into the HTML and add the feature, so it's time to bid farewell to originality and let Blogger handle my layout. That is, until I find the time to switch to Tumblr.

In addition, I've disabled comments. This blog isn't meant to be a noisy discussion by a large group; it's a platform for me to talk about what I find interesting: myself, my projects, and other things. If you'd like to respond to one of my posts, feel free to by posting an entry on your blog or sending me an email at [redacted]. I'd love to hear from you!

Saturday, June 26, 2010

Neocubes mini review

I can't remember what I did before I carried a Neocube around with me. I must have waited quietly at doctor's offices, staring blankly at the walls or perhaps skimming the ancient magazines. Now, I simply pull my Neocube out of my pocket and begin constructing a polyhedron. If I don't have long to wait, I'll wrap the chain of spheres into a solid tetra- or icosahedron. If the other waiters are glancing at watches and complaining about the wait, I'll attempt a modular dodecahedron or a wireframe truncated icosahedron. I can fight off boredom for hours when I have my Neocube with me.

However, I'm not the only one to enjoy playing with a Neocube. Every person to which I've shown my Neocube, from little kids to my own Grandpa, has been mesmerized. Some people make jewelry, some construct flat shapes, and some just like coiling the chain of magnets, but everybody enjoys playing with them. My extended family liked playing with my Neocube so much that I purchased a big batch for gifts.

Neocube is one of the best pocket-sized time-waster I've ever seen, comparing favorably in wait-time compression with the iPhone and iPod Touch. If you want to have a 'cube of your own (and send me some pocket change), you can buy one from Amazon for only $16 (at last check). Don't miss this deal!

Thursday, June 24, 2010

You. Will. Be. Cancelled!

The words popped up every few sentences, turning the already repetitive lecture into a free-form poem of dullness. The comptroller missed no opportunity to remind students — in broken English — that there would be consequences for missed late payments, including cancellation and late fees. He loved to use the phrase "It's gonna cost ya!" to emphasize that the comptroller's office would be more than happy to take your money.

The USF comptroller's presentation dragged on for an eternal fifteen minutes before the incident. The comptroller asked a simple question about the repercussions of a missed deadline, expecting to answer it a second later. Instead, a student in the balcony shouted "You. Will. Be. Cancelled!" and laughter rippled through the auditorium.

Suddenly, the atmosphere of the lecture changed completely. When the comptroller concluded the answer to his own question with "You might be cancelled," the audience burst into laughter. He immediately recognized his newfound catchphrase and began using it to spice up his presentation. He loosened up, and the students began listening intently to wait for the next catchphrase. When he concluded his presentation with "Don't get cancelled!" the entire audience applauded loudly.

In my opinion, this dynamic lecture was the highlight of the whole orientation.

Sunday, May 30, 2010

Porting OpenInkpot: the Hanlin V3

Ten days ago, I received device that will monopolize my summer: the Hanlin V3. The performance of this e-reader — or rather the lack thereof — is the primary motivation for my project. According to the OpenInkpot community, this device has a slow processor and little memory. My project's goal is to reduce the memory footprint of OpenInkpot in order to improve its performance on devices like the V3. I decided to purchase the V3 to better empathize with the benefactors of my project and to help motivate myself. If I want a faster e-reader OS, I must build one for myself!

I'd like to write about the V3 soon, but I haven't used it enough to make a fair assessment. Thus far, it appears that the device deserves its reputation for sluggishness; however, I won't speculate on the source of the poor performance. I'll write more later.

Monday, May 10, 2010

GSoC project status update

Now that I've finished this semester's final exams, I've started working on my GSoC project: porting OI to uClibc, the featherweight C standard library. I'll post project updates periodically, saying what I'm doing and relaying what I've learned. I promise they won't all be this boring.

The first step of my project is adding my new architecture, Linux based on uClibc, to dpkg, the foundation of the Debian package management system. dpkg plays a part in packaging code, installing applications, and compiling binary packages; it's a very important tool. Before I start modifying dpkg, I plan to learn about dpkg and the relevant build systems; I'm starting by reading the Debian New Maintainer's Guide.

Thursday, May 6, 2010

I'm a GSoC student!

After months of hard work, I was chosen by the OpenInkpot organization to port OI to uClibc. I will be spending my summer reducing the memory OI consumes to allow it to run on e-readers with little memory. If you're curious about the Google Summer of Code, check out the official FAQ.

Friday, April 9, 2010

Port OpenInkpot to uClibc

This GSoC proposal is for OpenInkpot, a Debian-based e-reader OS.

Project proposal

I plan to port OpenInkpot to the lightweight uClibc C library in order to improve its memory usage. Here are some of the other benefits this project could provide.

Possible benefits

  • Increase number of devices on which OI could run
  • Improve performance
  • Decrease compile time
  • Reduce firmware transfer and installation time
  • Simplify porting OI to other architectures

Plan of action

Follow these instructions for porting IPLinux to a new architecture.

  1. Acquire target device (my own e-reader!)
  2. Add new architecture identifiers (uclibc and ucarmel) to dpkg.
  3. Build and package toolchain for new arches.
    • Cross-compile existing packages to new arches with toolchain, starting with most important packages
    • Build and test firmware once the necessary packages (uClibc, dpkg, and BusyBox) have been packaged
    • Test packages on device with chroot
  4. Test complete firmware and allow autobuilders to start porting packages to new arches

Background

Programming experience

I've been programming for about two years. I've primarily used five programming languages: Javascript, PHP, ActionScript 3, Python, and C++. I've finished several small independent programming projects, but two in particular have taught me important lessons.

Last fall, I created an example game for Pygame2, a low-level Python wrapper for SDL. The game ran, but it was worthless as an example because my clumsy graphics abstraction obscured the underlying Pygame2 graphics calls. From this failure, I learned to never lose sight of the purpose of my project. My initial announcement for the flawed example.

Earlier this year, I decided to rewrite my Flash app for drawing snowflake patterns with Javascript and SVG. Once I chose the right data structure, the whole library fell into place. This project taught me that few programs must be complex; with enough thought, you can find a simple solution to many complicated problems. Read more about the SVG snowflake micro-library.

Personal qualities

I'm hard-working
When I am assigned a task, I feel compelled to do it as well as I can. I find it difficult to walk away from an unfinished task.
I'm self-motivated
Events in my life have taught me to work independently and seek out my own answers. When I discover a problem I don't know how to solve, I start looking for a solution. I check any relevant manuals, search for tutorials, look for examples, and — if I still haven't found a solution — ask for help. Finding answers on my own gives me a feeling of satisfaction and accomplishment.
I love programming
Writing code is my favorite hobby, and I will someday make it my profession. I'm not participating in the Google Summer of Code because I really need the money or I want another bullet point for my resume; I'm participating because I want to create software and learn more about software development.

Open-source experience

In addition my recent OI patch, I've spent some time working with Pygame2. While developing an example game with the unstable development version, I found, isolated, and reported several bugs.

GNU/Linux distributions development experience

I've used Ubuntu for about a year, learning much about Linux and Debian. I've become proficient at finding, installing, and upgrading Debian packages. I packaged my first .deb and started my own repository in order to test my fix for Ticket #834. I've compiled my share of source code, and I'm familiar with the GNU build system as both a user and a developer. I've written several bash scripts, and I'm comfortable with the major Unix commands and concepts. I've even spent some time configuring and troubleshooting the GRUB bootloader.

Kernel hacking

Unfortunately, I haven't worked on the Linux kernel yet.

Replace dap-server WWW Interface

Below is my GSoC proposal to OpenDAP, the developer of a scientific data server. You can see the official proposal here.

Have you contributed to any open source projects in the past? If so, which ones?

I've worked two open-source projects other than OpenDAP: Pygame2, a low-level Python SDL wrapper library; and OpenInkpot, a Debian-based e-reader OS. While developing an example game with Pygame2, I found, isolated, and reported several bugs. In preparation for my OpenInkpot GSoC application, I added a feature to OpenInkpot, closing Ticket #834.

What are your other summer plans?

I plan to go on a vacation with my family for a week or two. I'm not taking any college courses, and I have no other commitments.

Where are you going to school?

I've graduated with highest honors from Broward College with an Associate in Arts degree, but I'm still picking up some prerequisite classes before I transfer. I plan to pursue a BS in Computer Science at the Massachusetts Institute of Technology, the University of Florida, or another school — I haven't decided yet.

Have you used any of our software in the past? If so, which?

My first experience with your software was installing Hyrax from source (from this branch.)

What experience do you have that's relevant to your project?

Code

I've been programming for two years. Writing code is my favorite hobby, and one day, it will be my profession. I love to develop software, and I read everything I can to improve my skills.

Examples

Javascript
Javascript snowflake SVG micro-library
JSON Javascript slideshow
C++
I've taken a college course on C++, and I've read Effective C++, but I haven't published any C++ code yet. If a code sample is required, I could send you one of my class projects.
Shell scripting
OpenInkpot patch
Several system utilities for my personal use

Website creation

I've developed more than ten commercial websites from the ground up. I'm proficient in (X)HTML and CSS, and I'm comfortable with SVG. I enjoy creating simple, usable websites.

Examples

Software development

I've been developing software on Ubuntu for about a year. I've compiled several applications from source, and I'm familiar with the GNU build system as both a user and a developer. I'm comfortable using the major Unix commands and chaining them together into useful shell scripts. I've used both SVN and Git to retrieve and commit code. I have all the necessary skills to collaboratively develop software.

Project proposal

I plan to replace the dap-server WWW Interface with a more intuitive data request form.

Plan

  1. Remove WWW Interface from dap-server
  2. Create new BES module for generating data request forms
  3. Design intuitive HTML form for constructing data request URLs
  4. Write server-side form generator
  5. Write Javascript to read user input, construct request URL, and send data request
  6. If I have extra time:

    1. Write server-side data request generator to improve accessibility
    2. Add JSON format to dap-server to simplify Javascript metadata access

Goals

  • More logical, easier-to-use interface
  • Simpler, more readable code due to separation from dap-server
  • Greater accessibility with semantic XHTML form

Execution

  1. BES receives request for data specification form
  2. Request is sent to form-generation module
  3. Module generates data-specific data request form
  4. Form is sent to user
  5. User specifies desired data through form
  6. Javascript constructs data request URL
  7. User clicks on generated link
  8. BES receives data request and sends it to dap-server
  9. dap-server returns requested data

Why not Ajax?

  • Server-side caching
  • Greater speed
  • Fewer HTTP requests
  • Easier to implement

Sunday, March 14, 2010

InstaPyGame progress report

I spent the last three days working on a prototype "space shooter" module for my InstaPyGame framework. I had hoped to have a prototype ready today, but the framework isn't usable yet. You can see my progress so far at my Google Code repository, but be warned; the code is messy and inconsistent, and nothing is set in stone.

However, I have created an API with which I'm satisfied. Making the sample below work properly is my goal for this prototype.


from insta.spaceshooter import *

def startDemo():

    game = Game(640, 480)
    
    player = Player()
    player.setSprite('resources/ship.gif')
    
    player.when(player.moving, 'left').setSprite('resources/bankingleft.gif')
    player.when(player.moving, 'right').setSprite('resources/bankingright.gif')
    
    shot = Shot()
    shot.setSprite('resources/shot.gif')
    
    player.setAmmo(shot)
    
    enemy = Enemy()
    enemy.setSprite('resources/alien.gif')
    
    boss = Enemy()
    boss.setSprite('resources/angryalien.gif')
    
    mapGen = LevelMapGenerator({'0' : None, '1' : player, '2' : enemy, '3' : boss})
    
    level = Level(mapGen.generate('data/levelmap1.txt'))
    level.setBGSprite('resources/space.gif')
    level.setBGMusic('resources/spacemusic.ogg')
    
    game.setLevels([level])
    game.start()

if __name__ == '__main__':

    startDemo()

Right now, I'm working on the event system and the controls, but the event system appears far more challenging. I'm planning to encapsulate the data for the "Player" and "Enemy" objects within another object, protecting the data behind its member functions. This should allow me to create a special data object that will apply its changes only when a condition is fulfilled.

Although the framework is far from complete, I'm excited about the possibilities. I have plenty of work ahead of me, but I think my goal is worth the effort.

Sunday, March 7, 2010

GSoC project idea: Insta-PyGame

I'm still trying to choose new GSoC organizations to join, but I know one of the organizations to which I'll apply: PyGame, the SDL-based Python multimedia library. I plan to write a micro-framework on top of PyGame to dramatically simplify the creation of conventional games.

The Problem

PyGame is a wrapper for the C SDL library. Some of the library hides the complexity of the underlying SDL library, but in most areas, PyGame is simply a Python binding for SDL. For that reason, you often need to write several lines of code to accomplish a simple task, such as checking whether the user has pressed a button. In addition, many pieces of the API are based on C coding idioms that are unfamiliar to most Python programmers.

The Plan

I propose the development of a new framework on to of PyGame that operates at a much higher level of abstraction. Through this new framework, people would create games by declaring the sprites the characters use, the arrangement and graphics of the levels, and the interactions between the player and the contents of the levels.

The framework would be divided into modules with each module representing a genre. The "platformer" module would contain everything necessary to create a platformer game, including a physics engine, a tile map engine, and enemies that die when you jump on them. In contrast, the "scrolling shooter" module would contain tools for controlling the behavior of projectiles and enemy ships.

Here's an example of the type of code games using the framework could look like. I haven't put much thought into the API, but I would like game code to be written at this level of abstraction.


from insta.menu import *

from insta.platformer import *



def startMenu():

    titleScreen = Screen(600, 400)
    titleScreen.setTheme(themes.MEDIEVAL)
    titleScreen.setTitle("Porcupine's Tiny Adventure")
    titleScreen.setOptions(["Play", "Controls", "Credits"])
    titleScreen.getOption("Play").setAction(startGame)
    # More code for other menu options

def startGame():

    game = Game()

    hero = Player()
    hero.setSprite("standing.gif")
    hero.setRunningSprites(["running1.gif", "running2.gif", "running3.gif"])
    hero.setJumpSprite("jumping.gif")
    hero.setDeathSprite("gravestone.gif")

    hero.setMovementTriggers(constants.ARROW_KEYS)
    hero.setJumpTrigger(constants.SPACE_BAR)

    goal = Item()
    goal.setSprite("bigring.gif")
    goal.setBehavior(constants.FLOATING)
    goal.setAction(game.nextLevel)

    itemGenerator = ItemGenerator([None, goal, hero])

    '''
    Tile generator translates level maps (text files full of numbers) into tile
    maps in a context-sensitive manner
    '''
    tileGenerator = TileGenerator()
    tileGenerator.setFloorSprite("levelground.gif")
    tileGenerator.setUndergroundSprite("underground.gif")
    tileGenerator.setPlatformSprite("platform.gif")
    # Edge and corner sprites could also be set

    mushroom = Enemy()
    mushroom.setRunningSprites(["step1.gif", "step2.gif"])
    mushroom.setDeathSprite("explosion.gif")
    # Some simple behaviors would be pre-defined
    mushroom.setBehavior(constants.WALKING)

    bird = Enemy()
    bird.setFlightSprites(["flap1.gif", "flap2.gif"])
    bird.setDeathSprite("feathers.gif")
    bird.setBehavior(constants.FLYING)

    # List associates enemy types with numbers in the text file
    enemyGenerator = EnemyGenerator([None, mushroom, bird])

    level = Level()
    level.setTileMap(tileGenerator.generateTileMap("levelmap1.txt"))
    level.setEnemyMap(enemyGenerator.generateEnemyMap("enemymap1.txt"))
    level.setItemMap(itemGenerator.generateItemMap("itemmap1.txt"))

    level.setBackground("background.gif")
    level.setBackgroundOptions([constants.TILED, constants.PARALLAX])

    game.setLevels([level])
    game.start()

if (__name__ == "__main__"):

    startMenu()

The Goal

I want to free PyGame developers from thinking about the hows of game development, allowing them to focus on the whats of their ideas. By freeing game creators from thinking about the implementation of their games, I hope to allow them to explore new ideas in video game design, such as dynamically-generated levels, media mashups, user-created content, and AI.

This is just a rough outline of the framework I'd like to build and the effects I hope to see. I plan to start work on a prototype soon if the PyGame community appears receptive to my idea.

Sunday, February 28, 2010

Picking an OSS project

The Google Summer of Code is rapidly approaching, and I'm looking to join up with an open-source software organization to do a summer project. I'll need to get up to speed in about a month, so I should probably pick a project in my current area of expertise: Javascript, PHP, ActionScript 3, Python, and C++. However, I can't resist looking at some projects that would require a new language. Here are a couple of the projects on which I'd like to work.

Linear window manager
As I wrote in my blog entry on the aging desktop metaphor, I'm sick and tired of touching my mouse to manage my windows. That's why I'd love to work on a new window manager for KDE, Gnome, or another desktop environment to create a new Con10uum-inspired interface. Unfortunately, I'm not sure if any of the orgs would be willing to spend one of their valuable students slots on this project.
Writing Haskell
I'm quite interested in learning about functional programming through Haskell, but I'm not sure if I can find a Haskell project that's basic enough for me to accomplish over the summer, but useful enough for Haskell to sponsor me. Perhaps I should give up on this one.
Working on the ES OS
I think the ES OS concept is highly interesting, and I now know C++, the language in which ES is written. However, this org's projects might still be too advanced for me. I really don't know where to start learning with a project this large.
Writing Python
If I can find a small, interesting project that I could do with Python, I'll try to join. However, the last "Python" project I tried to work on was actually written primarily in C. I'll have to be more careful.

If your OSS organization needs a volunteer over the summer, I encourage you to apply for the GSoC. If you're looking for a hard-working Python or Javascript developer, I'm your man.

Monday, February 22, 2010

My software development goals

I just recently finished my UF application — Woo-hoo! I'm glad to have it done, but I actually enjoyed writing one of the "statement of intent" essays. Here's the thought-provoking prompt.

What are the core skills and knowledge you hope to acquire by completing a degree in this major and how do you plan to apply these when you graduate?

I enjoyed elucidating what I hope to learn in my Computer Science program and how I plan to apply that knowledge. In the end, I came up with the following goals for my education and my career.

What I want to learn about programming

Good software design
In order to write readable, efficient code, I need to see examples of good code and learn what makes it good. I plan to study algorithms, design patterns, and best practices to learn how best to solve common programming problems.
Alternative programming methods and languages
If I only learn about common solutions to problems, I could never discover new solutions. That's why I'm going to learn about some of the more obscure and academic regions of software development, including functional programming, declarative programming, and other programming paradigms I don't even know about yet.
Low-level programming
I know that if I want to create truly groundbreaking software, I won't be able to rely on high-level languages and pretty abstractions. I'm going to learn about Assembly language and C in order to increase the efficiency of my own applications and to create entirely new OSs and languages.
Writing concurrent code
One of the safest bets in predicting the future of technology is that future computers will have an increasingly large number of processors. Applications that can't take advantage of multiple cores will soon be surpassed by programs that use concurrency effectively. I want to be on the winning side, so I'm going to learn to write concurrent applications with STM, Erlang, and *shudder* even threads. I believe knowledge of concurrent programming will be critical to many of my future projects.

How I will use my programming skills

Creating useful software
I have resolved to never work on an application that doesn't do something useful. Innovative code is nothing if it's part of a worthless piece of shovelware or a soulless enterprise application.
Making my software intuitive
I'll also try to make all my programs intuitive and easy-to-use. When I can, I'll put the needs and wants of the user first, before application structure, technological achievement, and even code readability, although I hope I never need to make that choice. I want my software to make a difference; it's rare that an application or library with an arbitrary, complex interface changes the world.
Improve the process of programming
I plan to work on projects that will not only serve typical computer users but also help other software developers. My goal is to make it easier for coders to write readable, efficient, correct code and create helpful, intuitive interfaces for their applications. I want to leave programming in a better state than I found it.
Explore new technologies
Memristors. Quantum computing. Optical processors. Biological computers. All these rapidly-approaching breakthrough computing technologies will require new programming methods to match. I will always be looking for opportunities to push the field of programming in new and exciting directions.

I know that I may not be able to learn all that I plan to learn, and I might not accomplish all that I hope to accomplish. However, writing out my programming goals has helped me to realize precisely what aspects of programming I find most interesting and important. I think every college student should list his education and/or career goals, if only to provide a derisive laugh or a grin of satisfaction when he reaches the end of his career.

Monday, February 8, 2010

Broward College engineering club

This semester, I have decided to participate in Broward College's engineering club. Each semester, Professor Rolando Branly gathers a group of students from the Physics classes and labs he teaches to work on an engineering project. Last semester, he and his group built a mockup capsule for low-gravity research in cooperation with Masten Space Systems. This semester, we have a more concrete project.

Professor Branly is working on securing a slot on the last shuttle mission for our experiment. We will be attempting to crystallize proteins in space!

The plan

Of course, the process begins long before the shuttle launches and ends long after. Here's a brief summary of the process.

Choose target proteins
Professor Branly has already narrowed our options down to a few proteins related to metabolism and diabetes research, but we still have a couple options. PPAR gamma is our leading choice.
Manufacture proteins
Once we've found a protein of interest, we need to acquire enough with which to work. Hopefully, we will be able to outsource this step to the chemistry/biology department, but if not, we'll need to genetically engineer a colony of E. coli bacteria to churn out our protein. Then, we must isolate the protein from the bacterial solution.
Crystallize proteins
This promises to be the most difficult and complicated step. We plan to send the proteins to the International Space Station on the last Shuttle flight, let them crystallize in anti-gravity for about two weeks, and retrieve them on the return flight of the Shuttle. Unfortunately, protein crystallization is a developing art known to few and mastered by none — Professor Branly calls it a "black art." We'll test many different solutions and methods here on Earth to try to find the perfect setup.
Shoot x-rays at our protein crystals
If we can successfully crystallize some proteins, we will analyze the crystals through a process called x-ray crystallography. In brief, we will shoot a laser of x-rays at a rotating protein crystal and record the diffraction pattern of the x-rays. I'm not sure whether we will be imaging the crystals ourselves or sending them off to a specialized facility for examination.
Analyze diffraction patterns
Finally, we're going to analyze the x-ray patterns with crystallography software. We'll use either Phenix or CCP4 to convert the patterns of x-ray dots into 3D models of the crystallized proteins. These models will allow drug companies to create molecules that can enhance or inhibit the functioning of the proteins in human cells.

Engineering club information

If you want to join the club or help us with our project, you can join our Facebook group, email our coordinator, Professor Branly, or visit our new website, BrowardEngineering.info. We'll need all the help we can get!

Monday, January 25, 2010

Breaking windows

There's been a lot of uncertainty going around the standard desktop computer model recently. More people are using smartphones, netbooks with custom interfaces, and other non-traditional interfaces than ever before. People are questioning many aspects of the desktop computing model: the typical separation between the client and server data (Google Chrome OS), the exclusive right of the browser to access internet content (Moblin), and even the traditional software distribution and installation system (iPhone App Store, Linux repositories).

All of these trends are interesting, but my favorite upcoming innovation is the disposal of the desktop metaphor UI idiom.

Desktop metaphor summary

The desktop metaphor is a method of computer interaction based on an office desk. Applications are run in windows, each one representing a document or tool lying on a desk.

Screenshot of the Gnome desktop

A screenshot of a typical UI based on the desktop metaphor.

The windows can be moved around, minimized, and closed through keyboard shortcuts and mouse interaction.

Problems

Unfortunately, the desktop metaphor has the same shortcomings as a real desk. Just as in meatspace, I constantly have to move things around to see what I want to see, and when I run out of space, I have to move things off the desktop. Some applications take up less space by allowing me to run multiple instances in separate tabs in the same window; most web browsers and my text editor (Notepad++) have this feature. Although these tabs simplify the interface of the application, they add complexity to the desktop as a whole. Every tab-based application works slightly differently, with different keyboard shortcuts for tab management and different tab behavior. It's a mess.

Possible solutions

Right now, there are several approaches to improving application management that ditch the desktop metaphor entirely.

  • 10/GUI

    10/GUI proposes a new form of interaction to replace the mouse along with a new application management system suited to the new control method. It's concept is a multitouch slate capable of registering 10 simultaneous inputs (fingers) along with pressure for each input. The new app manager places all the "windows" in a continuous horizontal band that extends beyond the left and right edges of the screen. Various combinations of finger presses allow the user to scroll within a single application or scroll the entire band to expose other applications. You really need to watch the slick concept video to understand.

    Unfortunately, the video is only a concept, and the creator doesn't appear to have any plans to actually implement the system. In addition, the system would require an entirely new interface device to work as planned. However, I believe the new app manager could be beneficial without the new input mechanism. It's still significantly simpler than the current window-based disaster.

  • Chromium OS

    This revolutionary open-source OS ditches the idea of multiple applications entirely, confining all actions to a single tabbed browser (Google Chrome). Client-side applications are mostly replaced by web applications and windows are replaced by browser tabs. This OS's radical UI was designed for small-screened netbooks, so it's obviously not suitable for all computers. However, I appreciate this spartan interface's extreme efficiency.

In my opinion, a rethinking of the desktop metaphor would be the most beneficial change to the desktop computer experience. I eagerly anticipate the alternatives to this outdated model.

Wednesday, January 13, 2010

Compiling C++ from command line

I'm finally taking an introduction to C++ class at college, and I needed to install a compiler. I had intended to use the GCC, but I chose the Microsoft Visual C++ compiler instead because I wanted to become familiar with multiple compilers and because it was dead-simple to install.

Unfortunately, it was not dead-simple to use. After building and running only a simple "Hello, world!" test script, I longed for a simpler way to compile and run my scripts. I found a command-line compiling tutorial in the documentation and tried it out. The procedure worked fine, but it required starting a new terminal through a shortcut in the "Start" menu. I'm allergic to the "Start" menu, so I figured out how to setup the necessary environment variables from the command line. Now, I just run setupcppenv to prepare the environment, and I can compile 'till the cows come home (pardon the idiom).

Requirements

This tutorial is written for people who prefer to use the Windows terminal, so a familiarity with the command prompt is assumed. Also, you'll need to download and install the Microsoft Visual C++ Express Edition compiler; don't worry, it's free.

How to set up Windows to compile C++ from the command line

  1. Create a configuration script

    In order to simplify the configuration process and give us an easy command to remember, we're going to use a batch script to configure the environment for us. VCE comes with a setup script, but it's hidden in the directory in which VCE was installed.

    Find the shortcut "Visual Studio 2008 Command Prompt" in the "Start" menu under "Microsoft Visual C++ 2008 Express Edition > Visual Studio Tools" and view its properties. Create a new file in Notepad or the text editor of your choice, and copy the contents of the "Target" field into the new text file. Save the file as setupcppenv.bat on the desktop and click on it. If you see a command prompt pop up with "Visual Studio 2008 Command Prompt" in the title bar, your new batch script is working.

  2. Modify the batch script

    Unfortunately, the script works a little differently than I would like. To see what I mean, bring up a command prompt and cd to the desktop (or wherever you put the setup script.) Run the script with setupcppenv, then type in exit to close the command prompt. It didn't work, did it. That's because the batch script starts a new cmd process with the variables configured instead of just configuring them in the current process. In order to remedy this behavior, we'll have to modify our batch script.

    Right now, my script looks like this:

    %comspec% /k ""C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\vcvarsall.bat"" x86

    Yours will probably look different if you're using a 32 bit Windows version. To prevent the command from starting a new process, we need to take out %comspec% /k and convert the double double quotes into single double quotes. After that change, my script looked like this:

    "C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\vcvarsall.bat" x86

    Now, our command prompt will terminate on the first exit.

  3. Set up script bin

    Right now, our setup script works fine, but it only works on the desktop. Obviously, storing all our source files on the desktop is a bad idea, so we need to make our script accessible to the whole computer. We can do that by adding it to the Windows Path.

    Path is an environment variable on Windows systems that lists places for the OS to look for scripts. When you run a command from the command line, Windows looks in all the directories listed in the Path for a script matching the command you entered. If it finds one, it runs it.

    We could, of course, add the script's current location to the Path and use our script anywhere; however, we would have to keep the original script on the desktop forever in order for it to remain accessible. Instead, we will create a dedicated directory for storing command line scripts. We will call it bin and place it in the home directory. You can find your home directory by running echo %homepath% from the command prompt. Create a directory called bin in there, and move setupcppenv.bat into the new directory.

    Now we will add bin to the Path. Open the Control Panel, and find the "System" options (you might have to switch to Classic View in Vista). Open the "Advanced system settings" dialog box and click on "Environment Variables". Edit Path under "User variables". Path is a list of directories separated by semicolons; add your new bin directory to it by appending a semicolon and the new directory's full path (C:\User\Sage\bin for me) to the Path. Don't add any spaces between the semicolon and the paths. If the field is empty, put in just your bin path. For example, the Path C:\Program Files\Acme Corp;C:\Program Files\Omnisoftware would become C:\Program Files\Acme Corp;C:\Program Files\Omnisoftware;C:\User\Your user name\bin. Save your change by hitting "OK" in all the dialog boxes.

  4. Test everything

    Now, we need to make sure everything has come together properly. Start by creating a new file in your text editor and plugging in this code:

    
    #include <iostream>
    
    int main() {
    
        std::cout << "Everything is working properly!\n";
        return 0;
    }
    

    Save the file as test.cpp on the desktop, then open a command prompt. Set up the environment with setupcppenv, cd into the desktop, and compile your C++ test script with cl /EHsc test.cpp. Run test.exe and revel in the simplicity of your new build procedure.

Now that I'm learning C++, you may start seeing some C++ on this blog. Don't be alarmed; I'm not turning into a pointer-crazed, multiple-inheriting C++ coder, thanks to my strong Python foundation. I plan to stick to the somewhat-comprehensible features of C++.

Saturday, January 9, 2010

Snowflake SVG developer release

Recently, I have been learning SVG scripting by porting my old branching-web AS3 script to Javascript. This time around, I wanted to remedy some of the shortcomings of the previous incarnation. Here's a list of some of my goals and how they turned out.

Goals

  • Allow the user to customize each node individually, but don't add too much complexity.

    Success. The interface has become slightly more complex, but it's still relatively simple.

  • Let a node have only one child, allowing the user to taper the branches.

    Success. This effect is highly useful for creating snowflake patterns.

  • Improve the demo interface, enabling interactive editing of each node.

    Pending. I plan to tackle this feature next.

Demos

Classic snowflake

Screenshot of a classic snowflake drawn by my library
Click to view as SVG.


function startup(evt) {
    var svgDocument = evt.target.ownerDocument;
    
    var rect = svgDocument.createElementNS(svgNamespace, 'rect');
    rect.setAttributeNS(null, 'fill', 'skyblue');
    rect.setAttributeNS(null, 'width', '100%');
    rect.setAttributeNS(null, 'height', '100%');
    svgDocument.documentElement.appendChild(rect);
    
    var endPoint = createDataNode(0, 0, 0, []);
    var endCap = createDataNode(0, 5, 10, [endPoint]);
    var middleNode = createDataNode(60, 50, 10, [endCap, endCap, endCap]);
    var centerNode = createDataNode(360, 30, 10, [middleNode, middleNode, middleNode, middleNode, middleNode, middleNode]);
    
    var web = createWeb(centerNode, createPoint(0, 0), 0);
    
    var snowflake = createSnowflake(web);
    
    var snowflakeSVG = snowflake.toSVG(svgDocument);
    snowflakeSVG.setAttributeNS(null, 'fill', '#fff');
    snowflakeSVG.setAttributeNS(null, 'transform', 'translate(250 250)');
    svgDocument.documentElement.appendChild(snowflakeSVG);
}

Gothic cross snowflake

Screenshot of a gothic snowflake drawn by my library
Click to view as SVG.


function startup(evt) {

    var svgDocument = evt.target.ownerDocument;
    
    outerPoint = createDataNode(0, 0, 0, []);
    
    taperFork = createDataNode(0, 5, 10, [outerPoint]);
    
    bigFork = createDataNode(180, 25, 10, [taperFork, taperFork, taperFork]);
    
    nextFork = createDataNode(180, 25, 10, [taperFork, bigFork, taperFork]);
    
    innerFork = createDataNode(360, 15, 10, [nextFork, nextFork, nextFork, nextFork]);
    
    var web = createWeb(innerFork, createPoint(0, 0), 0);
    
    var snowflake = createSnowflake(web, innerFork);
    
    var snowflakeSVG = snowflake.toSVG(svgDocument);
    snowflakeSVG.setAttributeNS(null, 'transform', 'translate(250 250)');
    svgDocument.documentElement.appendChild(snowflakeSVG);
}

Nodes displayed as points

Screenshot of a web of nodes drawn by my library
Click to view as SVG


function startup(evt) {

    var svgDocument = evt.target.ownerDocument;
    
    var endPoint = createDataNode(0, 0, 0, []);
    var middleNode = createDataNode(180, 50, 0, [endPoint, endPoint, endPoint, endPoint]);
    var originNode = createDataNode(360, 50, 0, [middleNode, middleNode, middleNode, middleNode]);
    
    var web = createWeb(originNode, createPoint(0, 0), 0);
    var webSVG = web.toSVG(svgDocument);
    webSVG.setAttributeNS(null, 'transform', 'translate(250 250)');
    svgDocument.documentElement.appendChild(webSVG);
}

Download

I've packaged up all the necessary scripts and SVGs into one tiny .zip archive for your hacking pleasure. If you'd like to see what I'm working on next (and possibly help), you can view my Google Code project repository. Everything is licensed under the Apache 2.0 license, so you can use it in a proprietary application, modify it in any way you choose, or pass it to all your friends provided you indicate where it initially came from. If you do anything interesting with it, tell me about it. Happy hacking!