Saturday, January 29, 2011

OMG Seriously? Yes Seriously

If any of you have done mac programming, you've probably pondered this one question "how do I get tabs like firefox/safari/chrome without doing much heavy lifting"

If you haven't, heres a user exercise. Go to xcode and see what you can get done with an NSTabView... go head, I'll wait.

If you want a hint, here is what you can do.
But finally, some smart guy has come to rescue us from our misery.

Rasmus Andersson

you are my new hero.

Rasmus is the primary developer for Kod - a Mac based programmers editor. As part of Kod, he has developed a project called Chromium-Tabs, which basically gives programmers a nice - easy to use - API for creating beautiful browser like tabs (some say they look like Chrome).

So, I've promptly made a makefile so I dont have to deal with that nasty xCode IDE (yuck!), and integrated the Chromium-Tabs framework into my CodeAssistor project. Now I have a nice beautiful looking TABBED editor :)

All in all, the makefile took me 5 hours, and learing-integrating chromium tabs into codeassistor took 14/15 more.

If you want to play with the Alpha release of 0.0.8 (Mac Only so far), here you go

EDIT: Kod and Chromium Tabs Source

Thursday, November 18, 2010

Hacker Monthly - Free for students.

http://hackermonthly.posterous.com/students-read-hacker-monthly-for-free

I really enjoy receiving this magazine in my email every month. The premise of the magazine is that they take the best blogs highlighted on Hacker News and bundle them up into a nice looking Digital and Paper magazine. Better than 2600 because it's geared towards programmers and start-up entrepreneurs.

I highly recommend getting it.

While Im at it... you should all be reading Hacker News. Much better blog aggregate than Slashdot.

Saturday, October 16, 2010

CodeAssistor - Command Entry Implemented

So for the past week I've added the Command Entry to CodeAssistor.

Right now I've only implemented the search/replace functionality, but the framework now exists to start adding all sorts of awesomeness

So how does it work?

Open up a file and press the ESC key. You'll notice the entry popup

type '/' to start searching, then type in a regular expression (thats right, I said regular expression!)
eg "/#define (.*?) " (thats a space after the (.*?) , dont include the quote marks)

This will find the first #define XXX (but only #define XXX even if there is a #define XXX YYY)
Press ENTER. You've now moved to the next occurrence.

So what about replacing?

Ok continue your Command Entry so that the string looks like
"/#define (.+?) (.*)$/#ifdef \1\n#undef \1\n#endif\n#define \1 \2"
you'll notice that this doesn't replace. It's important to give the user a method of writing out the full regular expression and replacement string.

To actually replace the find add a final "/" to the command entry string... like this:
"/#define (.+?) (.*)$/#ifdef \1\n#undef \1\n#endif\n#define \1 \2/"

The library I am using for regular expressions (the basic scintilla regular expressions derived from Ozan Yigit's library plus some '?' extensions I did myself) doesn't (yet) understand the | metacharacter, so you'll have to write a separate line for "/#define ([^\s]+)$" (aka empty macros)

Thursday, October 14, 2010

Half a Days labour

Hello Source fans!

I just realized a nice anecdotal metric due to some CodeAssitor work I did today.

I noticed when I sat down to work on some regular expression stuff for CA that it was ~1:30 in the afternoon, for some flakey reason, my brain made a mental timestamp. When I finished the feature I was working on I noticed that the time wasy ~5:30.

What's interesting is I completed one whole feature (or at least got the feature from 0 to code complete... which means there hasn't been extensive testing), and quite literally nothing else (no washing breaks, no coffee reheats, no email checking, nothing but code.

The day previous I worked on adding the 0-1 quantifier (?) to Scintilla's basic Regular expression code (RESearch.cxx), and got that feature code complete... unfortunately I didn't notice the time and I was very distracted watching the Chilean miners get free (CHI-CHI-CH LEI-LEI-LEI!), and was doing numerous other things.

Anyway... So I sit down in front of my computer to work on some CodeAssistor stuff and notice the time is 1:34. I check the Scintilla Mailing list to see someone had posted a reply to my ? quantifier work, and someone had. Here is Philippe's email:

On 13/10/2010 20:36, Michael Mullin wrote:
> I've added a small patch to add the ? operator to the built in regular
> expressions in the scintilla version used in CodeAssistor. I haven't
> done any extensive testing, so I guess this is a bit of a 'code
> review.'
> Anyone see bugs? Do you think this patch is useful for the main
> scintilla branch?


Yes, if it works... For this, you should:
- Fix indentation...
- Add documentation of the new operator in the documentation at the start of the file.
The semantic of the operator isn't clear. From a quick glance at the code, it looks like
it is used in place of * with the meaning of 0 or 1 occurrence of the previous token, not
as a modifier to make an operator non-greedy, right?
The latter would be more useful, but it much harder (if possible) to inject in the current
engine. The former can still be useful, though...
--
Philippe Lhoste
-- (near) Paris -- France
-- http://Phi.Lho.free.fr
-- -- -- -- -- -- -- -- -- -- -- -- -- --
So for the next 4 hours I
1) added the lazy operator functionality
2) did up the spacing how he wanted + documentation

Anyways, it was 5:27 when I finished.

The most interesting part of this endeavor is that you can see just exactly what I accomplished during those 4 hours.

Anyways, I thought this was an interesting piece of data. Especially because I wasn't planning on timing myself, so I didn't change my work effort at all.

Note: its 5:44 as I finish this blog.

Saturday, September 25, 2010

CodeAssistor meets Joel on Softwares "12 steps to better code"

Last night I fixed a crash in CodeAssistor (see: https://bugs.launchpad.net/codeassistor/+bug/647139). compiled the code, and released the binary to launchpad.

I wake up and read this article by "Software Joel" http://www.joelonsoftware.com/articles/fog0000000043.html and get to point 2 "Can you make a build in one step"

By this I mean: how many steps does it take to make a shipping build from the latest source snapshot? On good teams, there's a single script you can run that does a full checkout from scratch, rebuilds every line of code, makes the EXEs, in all their various versions, languages, and #ifdef combinations, creates the installation package, and creates the final media -- CDROM layout, download website, whatever. If the process takes any more than one step, it is prone to errors. And when you get closer to shipping, you want to have a very fast cycle of fixing the "last" bug, making the final EXEs, etc. If it takes 20 steps to compile the code, run the installation builder, etc., you're going to go crazy and you're going to make silly mistakes
Crazy thing is, I ran into this problem this morning! I had to come into work and put in some "overtime," while I am here I'll get the latest CodeAssistor to work with. Unfortunately, I forgot a critical step in the build process... I forgot to type STATIC=yes on the make command. Thus the build required Scintilla as Dynamic libraries, which I of course, didn't add to the zip file.

Thus codeAssistor-v0.0.7-winExe-alpha4.zip is unrunable. DOH

I'll have to create some sort of "make distribution" command.

Wednesday, September 22, 2010

CA update

external editor updates feature complete in linux (thats all platforms), autoindent feature added due to request.

Tuesday, September 21, 2010

CodeAssistor - external editor notification on windows

feature complete on the update stuff for mac and windows.... linux todo.