NEW: Seemy integration of Vim in Eclipse

author Posted by: whaledawg on date Aug 2nd, 2009 | filed Filed under: general

So in my last post I mentioned that I want to start doing mobile apps and I chose to work with Android(I’ll explain why later). And Android has proven to be great, but developing in it has forced me to use Eclipse, which is…less than great.

Now when I say forced it’s not like anyone from Google came to my house and threatened me but all the learning material I’ve come across, from the free stuff on the web to published books to what Google puts out themselves, assumes that you are using it. There are some explanations of how to do things without Eclipse but when you’re learning something you should always try as best you can to mirror the environment of who ever’s teaching. It helps narrow down the origin of errors.

And when I say it’s less than great I don’t mean it’s bad. I just don’t like IDEs, and for 2 main reasons. They hide things I should know from me and force me to do things their way. As an example of the first one, Eclipse has this nice feature that allows you to hit CTRL-SHIFT-o and it will automatically import any packages you need for a java file. Very convient. Except now I don’t know what packages corrolate with which objects. Even the most dynamic of languages force you to import foreign code expliciatly, that tells me that this is information the programmer should know.

As an example of the second one, it’s a pain in the ass to edit files in Vim. Every other text editor is notepad to me. I tried googling around and there are a few ways. The first if viPluggin, which seems good but it’s not free and to be honest I’m going to try and ditch Eclipse as soon as possible. Theres vimpluggin which I installed but it doesn’t work right/well. I couldn’t get arguments to Vim and I kept having to right-click and open-as to switch between Vim and the native text editor. And cosidering I sent a question to the support list and was promptly offered a deal on pills to make it ‘Thicker, longer, better.’ I’m going to assume it’s not supported anymore. I didn’t try Eclim but that seemed to be going backwards, adding Eclipse features to Vim. I need to make sure my developement environment is as close as possible to standard.

So what am I really looking for? I’d like to be able to edit files with full Vim functionality(including using my .vimrc file) and use the full feature set of Eclipse at the same time. And I’d like to be able to jump from one to the other seemlessly. That I did not accomplish(hence the title) but I have a hybrid approach that comes pretty close.

HowTo

So my two pronged approach involves installing VRapper so I can quickly switch to a Vim like navigation scheme within Eclipse. 4 keyboard strokes and I’m there. But it doens’t have the full functionality I need or take rc files(I can’t live without the elflord) so I used Eclipses built in ability to use an external editor. It’s a bit slower to start and switch back and forth but it works adequatly.

Elflord

Setting up VRapper

VRapper is an open source project that is constantly evolving and adding new features, but currently missing quite a few. Still, being able to navigate with the home keys and yank lines makes installing this worthwhile.

First, you have to add the repo path to your software updates. Click on Help->Software Updates:

You should the software window. Click on the tab Available Software and the button Add Site:

You’ll get a popup window that let’s you…add a sight. Go ahead and put in http://vrapper.sourceforge.net/eclipse-update-site

Then click OK and you’ll have this repo added to your list. Select Vrapper and then press Install

Then just click through until it starts installing and restart. You should now notice a new button on your toolbar:

Pressing the button toggles Vim edditing mode on and off. Congratulations, you now have some vim functionality available to you. However, it’s still kind of a pain to use. You have to close whatever you’re working on, click the button then open it again. I could open it in Vim for that much effort.

So what we’re going to do is set up a hot key to toggle Vim mode, then we can switch back and forth from VRapper to native Eclipse editing with a few keystrokes.

First we need to open up the preferences. Go to Window->Preferences

Then expand General, select Keys and type vrapper into the filter.

Then type any key combo you want into the binding box(I chose VV) and done. Now typing those keys toggles Vim mode on and off. You still have to close and reopen the file, but I can do entirely from the keyboard(CTRL-W closes, F3 opens a file). So I type CTRL-W SHIFT-v SHIFT-v F3 and I can jump from one mode to the other. There’s probobly a way to macro that all into one keypress for Eclipse but that’s fast enough for my needs.

However, VRapper is still missing a lot of Vim functionality. No macros, no rc files, etc. So I also want to be able to open files from Eclipse directly in gVim.

Setting up gVim

This is actually pretty easy using Eclipse’s ability to call external editors. If I could find a way to do this with keystrokes instead of using the mouse I wouldn’t even bother with VRapper.

optional

I don’t call gVim directly from Eclipse because I want it to behave slightly differently when I’m editing files from Eclipse. This means I set up a little bash script in my home directory that looks like this:

/usr/bin/gvim -U /home/whaledawg/.vimeclipserc -- $1

That calls gVim and gives it an rc file I use just for Eclipse. The rc file looks like this:

set noswapfile
set nobackup
set noswapfile
set nobackup

Note: if you do this then the bash script must be named gvim. gVim checks the name of whatever calls it and it must be gvim or it won’t work.

/optional

OK so again we need to go to Window->Preferences, expand Gernal but now we’re going to choose File Associations. If you click add you can add new file associations here(you may need to do this for *.java files) and if you select a file type you can see all the associated editors in the bottom window:

Clicking Add(next to the associated editors) allows us to add a new editor to that file type(these are the editors that appear when you right click a file in Eclipse and choose “Open with”) From the pop up window select External Programs and then click Browse. If you created my bash script above, then you would browse to tha script(make sure it’s permissions are executable) or if not you will browse to wherever gvim is on your system.

Now if you right click on a file of that type and mouse to Open With you’ll see gvim as an option. Hurray.

There’s still a minor problem though. If you have a file open in Eclipse and open it again with gVim it will either not update the changes to Eclipse or will give you an annoying prompt. Let’s fix that.

Again under Window->Preferences->General, we’ll find Workspace. You don’t need to expand Workspace, just select it and you’ll see some options. Check Refresh Automically and it will automatically update your open files in Eclipse if you edit them with an external editor.

Click OK and that’s it.

Now you have a quick way to get most of the functionality in Vim and a slightly more cumbersome way to get the full functionality. While far from perfect, this approach has worked for me so far, at least until I’m able to dump Eclipse completely(which I hope to do in the near future).

An app of terrible genious

author Posted by: whaledawg on date Jul 9th, 2009 | filed Filed under: general

In searching the Market for a new not taking app for the G1, I happened across Magic Note. I was intrigued because it said it was based on pbwiki. I thought that a very smart idea, as my traditional note tool was TomBoy and I always thought that if you took it one step further you basically had a wiki.

So I install it, and go about the very basic task of making a grocery list. The UI is very simple: a name for the note, a text area and 2 buttons. Load and Save. I type in the name “grocery list”, add my items and press Save and at the bottom I get a message:

You can edit this not on your computer at notes.pbwiki.com/grocery-list

And I realize, it’s not some striped down version of the pbwiki source code creating a simple database on your phone. It just uploaded my grocery list to a wiki. WTF!

In fact, go to http://notes.pbworks.com/grocery-list right now. You can edit my grocery list. Go ahead, add “penis”. I know you want to.

In case you are at all unclear on what I just said, my basic note taking app uploads my personal notes to the internet and allows anyone to edit them. And when you go there, sure enough you can see other notes people have recently posted. Under http://notes.pbworks.com/concert you’ll find:

Marina del rey symphany @ 7pm..

Did I say 7? Better make it 6. Or 5, can’t be to sure. I wouldn’t want to miss the symphony(at least the wiki will allow me to fix this guys spelling).

And in case you’re doing the math at home, this seems like a recipe for namespace collisions. I can’t imagine I’m the only guy who wants a grocery list. I doubt the next one will want exactly the same things(unless he loves penis as much as I apparently do. Who keeps editing that?)

But if you want to access notes you created from your phone, you’d better remember what you called them. Because this app stores nothing on your phone. It has no idea what notes you’ve created, so if you need to load it onto your phone you need to remember exactly what you called it. Maybe that’s why that other guy called his note “concert” and not “symphany”.

So, in conclusion, Magic Note is perhaps the worst note taking application ever. I expect 2 things from my note app, it should store what I write and make it easy to access/search for my notes. Magic Note half does one of those things.

But……

While I found this to be an atrocious note taking app, it’s a pretty decent wiki accessing app. The experience is at least streamlined, not always easy with a phone app. And if you fixed the things that stop this from being a great ‘wiki page editor’ app, you’ll also make it a somewhat decent note taking app at the same time. So here’s where I think this should go:

  1. Give me an identifier field. Something to distinguish my grocery list from someone else’s or a simple form of classification. Hell, just slapping my initials on the front increases the namespace by 45k. I know you could do this inside the name box but that’s confusing to users, so they won’t.
  2. Don’t list the most recent edited files on the web page. That’s not going to be useful to anyone except griefers.
  3. Give me a damn history. I should be able to hit menu and get a list of the pages I’ve viewed/edited in order. Otherwise you can’t have more than 3 notes.
  4. Make it easy to share this page with friends, family and colleagues. I know you tell me the URL, but being able to pop up a list of contacts and email them a link would be worlds better. It would actually make this useful.

I think this app was made by a smart guy who wanted to make an Android app, but didn’t want to really think about how users were going to use this app. But a little inovation(linking it with pbwiki) means he’s actually very close to a great app. Just not the one he set out to write.

Brave New World

author Posted by: whaledawg on date Jun 14th, 2009 | filed Filed under: general

I like my job. It’s 2 minutes from where I live(and I like where I live), it doesn’t take up a huge amount of time and I’m pretty good at it. It’s a teaching job and truthfully there are very few people who can teach technical things. In fact, I could be pretty bad at it and still be pretty good at it if you know what I mean.

But, much as I like it, it’s time for a change. My job is fun but not challenging, I’ve never come across a real ‘problem’ to be solved. It’s doesn’t have a huge amount of corporate bullshit, but it does have some and that’s more than I like. I had to be ‘counseled’ yesterday because I filled out too many Attendance Change Forms. I filled out 2 in 6 months. Because I clicked an ‘A’ instead of a ‘P’. Twice.

And while not working too many hours has been enjoyable I’m not sure it’s the healthiest thing for me right now. Basically it’s a great job to retire to, not from.

But looking for programming jobs, even with a Masters in CS, has been spotty. The interview process is almost always tough(as it should be). But that means that even if they love you they suspect you. “Why is this guy doing well, am I missing something?” And if you have a few years break from programming it’s very easy to assume “Yes I am, lets get the next guy.”

And even if the interview does go well I don’t have any code to give as a sample and my contacts/references are from years ago. My last programming boss was in another state!

And then even when I get passed all that, it’s still a pain in the ass. I applied at a game company, they didn’t contact me for 6 months. Then after I passed their programming test I had to wait a month for a phone interview! Then I had 2 more phone interview(a month apart) before waiting 2 months to come in and take a grueling programming test in their offices(which was kind of fun actually).

After that they told me no about 2 weeks later, then 2 months later said everyone I had interviewed with had left the company and would I like to start the process again. Hm…..fuck your mother. But at least I never expected anything from them.

I actually received a job offer from one company(at the money I asked for, which I didn’t expect) but then the paperwork kept taking forever to go through. I assumed that is was some bullshit with the recruiter but it turned out they were losing money and were about to instigate a hiring freeze. I had already quit! They emailed me 6 months later and said they were hiring again. Once more…fuck your mother.

It’s just stressful and work and for what. What do I get for it? Another job. A longer commute. Especially in California, where every 10 ft takes about 20 minutes. Will I make more money? Sure, but it will still be less than I want and more than they think I’m worth. So essentially I’m killing myself looking for a job so I can have the privilege of putting up with their bullshit.

Fuckem, I’m going mobile. There’s a unique oppourtunity now to make money selling apps for mobile phones. It’s a new market, it’s not entirly settled what people want(that means you can still strike it big). It’s growing every day, especially as Apple slashes prices, Android comes out on over 20 phones this year and Palm releases it’s WebOS. And all the marketing, purchasing and distribution is in place already. All I have to do is code.

What the hell?

author Posted by: whaledawg on date May 3rd, 2009 | filed Filed under: general

While I’d love to be playing Warhammer right now, Charter’s service is screwy today. It’s not slow, but I’m getting 10-30 second spans of no activity. Which means I am wandering around the server like a ghost as everyone fades in and out, but that’s only interesting for so long.

So I decided to sit down and get Android running, which I’ve been poking at for weeks. I was hesitant because you have to install Eclipse and some special pluggins and blah blah blah.  So I install it and the Android SDK and create a project and…nothing. I’m looking at the same welcome screen I’ve seen the whole time.

Eclipse welcome

I assumed when you create a project it would open it up, probably in a tab next to the Welcome tab. So I check the files, everything was created. Delete, restart Eclipse and do it all over again. Still nothing. Can’t open a project under File or the Project menu.  In my random attempts to get something to happen I click on the X next to Welcome and boom, there’s my project.

So the people who make Eclipse essentially decided to add a fake tab at the top of a Welcome screen that covered up any work you tried to do. So anyone who fires it up for the first time is actively fooled into clicking through the Welcome interface.

At what point did free software become evil?

A simple highlight/syntax tutorial for Vim

author Posted by: whaledawg on date Apr 23rd, 2009 | filed Filed under: general

As much as I love Vim, it has some issues that I’ve pointed out before. Chief among them are the little ways that it proves to be inconsistent. The other day I found another one. Highlighting.
Vim has a very robust system for highlighting and coloring various categories of text, that’s one of the things that makes it a great editor. But finding out how to do it yourself was monstrously difficult for a couple of reasons:

  • There are examples, but they are kept in 2 different files. The color scheme file(usually under $VIMRUNTIME/colors) holds some of the info and the syntax(automatically loaded from a syntax file in $VIMRUNTIME/syntax) holds the rest. And you’ll be looking for examples because
  • The :help files are confusing. The same command is used 2 different ways to set up a highlighting scheme, so unless you read the entirety of the help files before you start then the example commands you are looking at are nothing like the description of those commands in :help. And the help files are huge. This is because there is so much you can do with syntax in Vim, but it makes it impossible to get started with a little tweak you want to make.

So with that in mind here is my goal. I want to present a quick, simple tutorial on how to alter the coloring and highlighting in Vim short of making your own syntax files. If you want to get that deep into you you’ll just have to wade through the whole country mile of :help pages.

First the theory. There are 2 commands you need to be concerned with, :hi and :syn. :syn is the syntax command. It has three ways to define a syntax group, and we’ll take a look at each in turn.

:hi is the highlight command. It allows you to set the coloring(foreground and background) of a syntax group. It’s simple really, but nothing in the :help explains this info :/

So why don’t we start our tutorial with a scenario:
Let’s say we have a weird text file that configures an obscure application. We only need to look at it every 6 months or so but it would be helpful if it was easier to read. It looks something like this:

  %% These files hold database information %%
  llv require("File1")
  llv require("File2")
  llv require("File3")
  %% This file holds user names %%
  llv require("File4")
  %% Output is written %%
  ${DUMP}("File5")

I’d advise you copy/paste this into Vim while you follow along

Basic Matching

It would be much easier to read if we could do a little coloring. Lets start with comments. You first need to set up a syntax group for comments using the syntax command. The simplest way of doing this is with something like this

  :syn match myComment "^%%.*%%$"

So we’re using the match type of syntax command. That will match a regular expression. Then we create a syntax group called myComment and we list, inside quotes, the regular expression we want to use to define myComment. In plain English it says to match if the line starts with 2 percent symbols, then has anything, then ends with 2 percent symbols.

And if you type all that in you get..nothing.
That’s because you haven’t told Vim to highlight that syntax group yet. If you type in

  :hi myComment term=bold ctermfg=DarkCyan guifg=#80a0ff

Then(assuming you’re on gVim) it should look like this

  %% These files hold database information %%
  llv require(”File1″)
  llv require(”File2″)
  llv require(”File3″)
  %% This file holds user names %%
  llv require(”File4″)
  %% Output is written %%
  ${DUMP}(”File5″)

This highlight command is pretty simple to break down. The first argument is the syntax group you want it applied to, in this case the myComment group we just created. The following arguments are for each of the Vim environments

guifg=#80a0ff

Says that if this is being displayed in gVim, set the foreground color of this group to the hex value 80a0ff(Dark Cyan).

  ctermfg=DarkCyan

Says that if this is being displayed by Vim running inside a color terminal, set the foreground color of this group to the named color DarkCyan.

  term=bold

And if this is Vim running inside a black and white terminal, set this syntax group to bold.

Region

Using the match argument with :syn is very powerful because of the flexibility with regular expressions. But sometimes we don’t want to add that much complexity but we still want to be able to identify whatever is between 2 markers. For that we can use :syn region.
We probably want to clearly identify the strings inside this file for easy reading, so we want to create a syntax group that concerns the region between quotes. We can use

:syn region myString start=+"+ end=+"+
:hi myString term=underline ctermfg=LightRed guifg=LightRed

And it should look like this

  %% These files hold database information %%
  llv require(“File1″)
  llv require(“File2″)
  llv require(“File3″)
  %% This file holds user names %%
  llv require(“File4″)
  %% Output is written %%
  ${DUMP}(“File5″)

So a region is similar to a match except we’re defining a start and end pattern each delimited by plus signs. Anything in between(and including) will be part of this syntax group. By the way you don’t have to use plus signs, you can use any single character at the begging and end, but you should avoid characters that are within the pattern(in this case double quotes). You could have also typed

:syn region myString start=|"| end=|"|

Keywords

There’s one other common syntax situation, the keyword. Luckily, :syn has the keyword option just for this(and it works pretty much as you’d expect).

  :syn keyword myKeywords llv
  :hi myKeywords ctermfg=Blue guifg=Blue

And your text should look like this

  %% These files hold database information %%
  llv require(“File1″)
  llv require(“File2″)
  llv require(“File3″)
  %% This file holds user names %%
  llv require(“File4″)
  %% Output is written %%
  ${DUMP}(“File5″)

The list of keywords being space separated.

Linking

Now there’s one more thing, let’s assume that ${DUMP} is a macro of some kind. Now let’s also assume that we always want it to look the same as myKeywords. Defining the syntax group is easy

  :syn region myMacro start=+${+ end=+}+

And we could highlight it with the following

  :hi myMacro ctermfg=Blue guifg=Blue

But what if we were on a computer where that color didn’t look good? Or if some other syntax group made that one hard to pick out? We would have to change myKeywords and myMacro separately. And if we have tens of syntax groups that we want to look alike this can get complicated.
An easier solution is to link them together like so

  :hi link myMacro myKeywords

And now the highlighting of the syntax group myMacro is linked to the highlighting of myKeywords.

  %% These files hold database information %%
  llv require(“File1″)
  llv require(“File2″)
  llv require(“File3″)
  %% This file holds user names %%
  llv require(“File4″)
  %% Output is written %%
  ${DUMP}(“File5″)

So that’s about everything you need to start tweaking your text colors in Vim.  Knowing this will make it a lot easier to go through and read the actual :help files now.

Remember that you can store a bunch of common commands into a file and load it using :source if that’s more convenient. Also remember that Vim commands without arguments give you a list of all current options. So if you type

  :syn

You’ll get

  myComment      xxx match /^%%.*%%/
  myString       xxx start=/”/ end=/”/
  myKeywords     xxx llv
  myMacro        xxx start=/${/ end=/}/
                     links to myKeywords

Which is very useful for debugging your highlighting.

I watched The Watchmen

author Posted by: whaledawg on date Mar 8th, 2009 | filed Filed under: general

I was…let’s say disinclined to see Watchmen for a very long time. It seemed pointless(the story was told as well as it could be in the comic form) and I’ve seen neato special effects before. I couldn’t imagine what this film would have to offer me. Until I saw this:

Is this genius? Not really. Any geek with the time, inclination or an animation studio could have thrown that together during the past 20 years. But that’s kind of what got me excited.
This video was proof that, if nothing else, they got me. They understood what I wanted to see. That doesn’t mean the movie’s good but at least I know if they hit their mark I won’t hate it.

As opposed to say Transformers where apparently they thought my childhood had been lacking in extraneous explosions and characters(really, what was the point of Glen Whitman? if you physically edited all his scenes out of the film could you tell the difference?)

So I broke down and saw it and I give it a meh+
It’s not brilliant and I wonder if anyone who hadn’t read the comic would enjoy it at all. But it didn’t shit on anything. And while the film doesn’t add anything to the story I have to admit that the film version adds some things to the experience. It’s visually very good and it probably uses it’s soundtrack better than any film since Almost Famous.
So if you’re a fan of the comic(graphic novel if you’re feeling upity) then you can see the film without worrying if it will make you question how much you enjoyed the original. You don’t get the brilliance of a whole issue illustrating how Dr. Manhattan experiences time(they cut it to a scene), but you do get to understand why everyone wanted to bang Silk Specter.
But you can also skip it and not worry that you’ve missed anything. At it’s best it’s still a lesser form of the orignial story.

What’s wrong with vim

author Posted by: whaledawg on date Feb 13th, 2009 | filed Filed under: general

I’ve been getting more and more heavily involved in Vim recently(in no small part because I’m avoid doing actual work) and I’ve been ruminating on what’s wrong with it. It has 2 seemingly obvious flaws, it’s not graphical and it’s not intuitive. But I’ve come to realize those aren’t so much flaws as a consequence of design. You can’t fix those without breaking Vim. The real problem, however, is something eminently fixable if someone sits down and doe s the work.

The Red Herrings:

Firstly, it is true that Vim is not very graphical. Even Vim’s well to do cousin gVim makes using the mouse regularly a painful experience. And the feedback is entirely textual, with coloring of syntax being as much as you’re gonna get. But even though that’s a response to the limitations of terminals that Vim originally had to run within, this system has some advantages.

Coloring of syntax is about as graphical as you want to get. Typesetting and fonts give useful information to clue readers into how to interpret their text, but just get in the way of editors. They force the editor to make choices about what should be emphasized or stand out. These are not things you should be focused on while coding.

And while using a mouse as a primary input device seems to be the way to go these days, it has some real drawbacks. It slows down advanced users to the point of tears, and in a text editor it creates lots of ‘switches‘, places where I have to move from 2 hands on the keyboard to one hand on the mouse, one on the keyboard. That kills flow.

Secondly, while Vim is unintuitive due to it’s modal way of doing business that’s not a bad thing. People aren’t used to modal tools but if you told someone that they had to design a program that kept a users hands on the keyboard at all times(preventing ’switching’) there’s only 2 solutions you would come up with. Modal(like Vim) or meta keys(like Emacs). I doubt people would call holding Ctrl-Alt-Shift-X to move around intuitive.  Nothing intuitive can keep both your hands on the keyboard because users are used to mouse based, graphical interfaces.

The Real Issue:

So what is Vim’s big flaw in attracting new users? Discoverability. This is a concept that’s explored quite a bit in The Art of Unix Programming (one of my favorite books of all time). Good systems should be discoverable, the user should be able to learn new ways of using them within the system. If a program is hard to use and unintuitive but still discoverable, the user will learn it(as long as the tool is better than what their using, which Vim probably is).

To me discoverability entails 3 things:

  1. Help is available, thorough, contextual and easy to use. Vim’s help is available and thorough, but falls flat on other accounts. There’s nothing built in to give you help on whatever it is your currently working on(like hitting <F12> on the command line if you start typing :%s/ ). And it is far from easy to use. It’s set up as a series of related text files that tie into each other, but finding a help term that gets you near what you’re looking for is nearly impossible. For example, what if you find ‘:set <M-x> XXX’ in one of your scripts? There is no way to find out what’s going on there.
  2. The system is easy to experiment with, with no penalties. Now here Vim does quite well, except for finding what you want to experiment with. Which leads to
  3. The system is consistent and builds upon itself in a meaningful way. Here’s where Vim really craps it’s pants. Within certain sub-sections it’s consistent, but across the board it’s not.What shows me all the current variables? ‘:let’ Oh, except for the Vim options, they’re under set. So I should type ‘:set’, right? Actually it doesn’t list all of them, for that I need to use ‘:set all’. Oh, except for termcap options which are under ‘:set termcap’ or any other option sets they decided to make separate which I may not know about. It’s difficult to discover information about my system when each way of querying is different.

Now I know why Vim is this way. It’s a program that’s been ‘grown’ over 20 years and things get added one piece at a time. But I think that it’s about time Vim was refactored with the goal of having a better user experience overall. I suggest(in no particular order):

  1. A unified, searchable help database built into Vim(EDIT:turns out this is on the Vim ToDo list) and preferably crowd sourced. I’m tired of struggling to do something for hours, poping into #vim on irc.freenode.net and someone just says :help XXX and I find the solution right away. Vim’s helpfiles are great, I just need a way to get to the ones I want.
    And building in crowdsourcing would be a huge boon. if someone searches the help files, a way to indicate that a particular page answered their question could be massively useful data. Again this should(ideally) be built into Vim.
  2. An easy way to source the current buffer so I don’t have to save it to a file every time I make a change. This would only speed up script writing, but anything that tightens the read-eval-print loop is welcome.
  3. All variables, functions, options, etc stored within one dictionary. Currently this is how global, local and script variables work(for example g: is a dictionary you can search or step through). As a caveat to that I’d like options to go from being some special variable to just another variable set(so I could use ‘:let o:sethidden = 0′ instead of ‘:set unhidden’ which is weird and inconsistent.
  4. Examples. This is the one place that the current helpfiles need more content. Every command/function should have examples for every option. The help could even have a howto.txt set up similar to a faq, making it easier to find the help the user needs within the tool itself.
  5. Get rid of the function/command distinction. Either pick one or do the perl thing where the parens are optional. Having to write a command to call a function, having some functions called by their placement and others need to have the :call placed in front, all of this makes VimL less consistent.

Whoa, this turned out longer than I thought. I’ll stop here since I have no power to make these changes anyways, but I think it’s a good start toward fixing a lot of Vims real usability flaws and getting programmers on board with the greatest editor ever.

Tempted

author Posted by: whaledawg on date Feb 11th, 2009 | filed Filed under: general

I recently asked this question on Stack Overflow and man, I am now seriously tempted to see what it’s like to build a byte code compiler. As I mentioned there, I have built a compiler before(for school). It was a trivial example and I remember that taking an obscene amount of time.

Fleshing out the VimL language with a byte coder is insane. It’s years of work when I have other things I want to do and other things I need to do. Most people don’t write VimL code long enough to get an advantage from it to begin with.
But still, the thought haunts me.

I’ve been away because I don’t want you to see me like this

author Posted by: whaledawg on date Jan 19th, 2009 | filed Filed under: general

Well the project is finished. Has been for over a month. And it’s a total failure.

Which is probably why I haven’t been posting. It’s something I’ve been a bit embarrased to address. But it’s done(that phase of it anyway) and I think it’s time for a little post-mortem. Examining why it was a failure is the first step to figuring out how to succeed.

  • Too Much: The scope was just way, way too broad. I wanted to create a solid, reliable, simple, cross-platform OpenGL based game engine coded in it’s entirety by me. What the hell? Even if I just picked one of those goals, “game engine” is just way too much for one person.
  • Too Little: I had no idea how much time anything would take, so I assumed it would take very little. I think this topic has been addressed before.
  • Dilbert.com

  • Rejected Libraries: I spent the majority of my time trying to kludge together my crappy GUI because I didn’t wan to use GLUI or GLUT. That was retarded. Code reuse is the cornerstone of good software development and I ignored it just so I could say “mine.”
  • Wrong Goals: Did I expect to make a game engine the open source community embraced and used to make 3D games? No.  I wanted a good code sample to take to game companies to show them what I can do. Then why did I try to make a whole game engine? Are they going to look at all 10k lines? Of course not.  I should have focused on a succession of smaller projects that could contribute to a larger one like a game engine.
  • Working != Progress: It’s difficult to measure progress in software engineering, so I fell into the trap of confusing working on a program with a program that works. That(combined with the next point) led to too much code and all of it clunky.
  • Not Enough Design: I was so eager to get going with each part of my game engine that I didn’t stop to think about it. How will this whole system work? How will it fit in with the rest of the game engine? What technical challenges will it have to overcome? Consequently I ended up with code that was clunky, inelegant and big. More time spent with the pencil and less with the text editor would have made my life much easier.

So, what now?

Well I’m restarting my project with some leaner, more focused goals. I want:

  1. Something cross-platform
  2. Usable by the software community at large
  3. A good code sample

One thing that I did like about my project is it’s inclusion of .OBJ files. They are a standard that every 3D editor can output to but there’s very little open-source support currently.  Now as it’s currently implimented my .OBJ support is horrible. It’s large(5k lines) and directly pluged into my other code so as to make it very difficult for an outsider to use.

So my first project is write a flexable, elegant .OBJ toolkit. It should read in .OBJ files and store them in a simple data structure that a calling program could easily convert to their own and it should have multiple “hook points” that another system could use to make it output exactly what they want.  I’m currently still desgning it. My goal is actually a 5 to 1 design to code ratio. I’m hoping that will produce better results than I’ve had before.

When complete I’d like to get this project on sourceforge or some other  open-source project site. I think these more modest goals are more in line with what I should be focusing on right now and will get me closer to my goal of a programming job in the game industry.

Can we just remove “slow” from the programmer vocabulary please?

author Posted by: whaledawg on date Nov 26th, 2008 | filed Filed under: general

Fast

So I answered this question over at Stack Overflow and another poster said this:

glReadPixels/glDrawPixels is slow.

Now, assuming he’s correct(has OpenGL really figured out a way to optimize everything but bit blitting?) you still have to ask “Slow for what?” If you’re only reading and writing pixels every 10 seconds who cares how slow it is.

Working on my game engine, I’ve come up with 4 scenarios:

  1. Happens once at load
  2. Happens every time a user enters input
  3. Happens every time an internal alarm goes off
  4. Happens every frame

So is reading/writing pixels slow at load time? Who cares? Every time a user enteres input? That only happens a few times a second. When an alarm goes off? This could get costly, but you can also control the granularity here. Every frame? Well, that’s 30-60 times a second. Now speed might actually count for something.

But if some asshole on Stack Overflow convinces me that it’s slow, I won’t use it the 75% of the time when its speed is irrelavant. Fuck Your Mother. I’ve just made a whole lot of things I may need to do take 10 times longer for no visible gain.

These “slow” decriers are the same people who convinced me for years not to use virtual functions. They have “overhead”. Do you know what the overhead on a virtual function is vs. a regular function call? A table lookup. Fuck Your Mother it’s just a table lookup to see which function to call. So I cut out a huge amount of object oriented technique(and most of the interesting stuff) to avoid a God Damn table lookup.

Anytime anyone calls a technique slow we should remember that “slow” is a relative term. 9 times out of 10 the “slow” technique takes me much less time. I’ve come to the conclusion that my time is more valueable than the fucking computers, and if you feel differently I have to question your actual knowledge as a programmer.