Thursday, November 18, 2010

Hacker Monthly - Free for students.

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
-- -- -- -- -- -- -- -- -- -- -- -- -- --
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: compiled the code, and released the binary to launchpad.

I wake up and read this article by "Software Joel" 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 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.

Saturday, September 18, 2010

CodeAssistor - external editor notification on mac

When an external editor (or application such as touch) touches the file you are working on in CodeAssistor, the program now pops up a message asking if you would like to discard your changes and reload from the harddrive

Monday, September 13, 2010

Whyfor CodeAssistor?

Time for some introspection. Why did I create the CodeAssistor? Isn't there lots of text editors? Why Open Source? What have I learned about Open Source so far?

Initial Inspiration (the itch!)

It was late 2009, and I was interested in looking at the Android RIL code. I work for research in motion on the QCT radio team and was interested in how Android did their system determination stuff for multimode devices. I wanted to look at some of their source and compare against some of the code that I work on everyday. I downloaded the code and started using "xed" to view the source. Xed was my only editor that I had on my Mac at the time.

(BTW, all the really interesting code is hidden from you in Android, at the time Qualcomm had not open sourced the libraries underneath the basic high level stuff... I seriously doubt that they've open sourced the interesting stuff even now... a word of warning for those of you who hold up Android as a pinnacle of freedom and open sourced software... I wasn't able to glean any useful information)

Xed is the editor component for the xCode IDE created by Apple, and although xCode has some terrific components xed started to annoy me for two reasons:
  1. when you run xed, you start up the whole xCode IDE - This takes time to load, sometimes 5-8 seconds. Since Im not working on the code itself, I am simply reading it I didn't want a full IDE, and I wanted some snappy performance, so I could open/close source files quickly
  2. xed uses a different look and feel from all other editors I've used - It's rather hard to describe the look/feel of xed, for those of you who have used xed, you'll know what I mean. While other people may like how xed runs, I wanted something more traditional.
So I downloaded some other editors. I tried TextWrangler first. With TextWrangler I found some bugs relating to opening files from a state where the application is not running... I'd have to open the file twice! Very annoying. Its not open source, so I felt no compultion to submit bug reports (if you are Cathedral style, you're bugs are your own). I then tried Mac ports for VI and eMacs... but I dont really know how to use those editors (I can survive on vi, but I dont want to... I am completely lost in emacs), so they were out. Then I tried jEdit. jEdit was pretty good, but it has the same problem every other java program has... its slow to start.

All these editors that I tried were also very feature rich. Overly feature rich, I simply didn't use most of the features, and the menubars were too full of things. I got lost. Not only this, but the feature-riches bloated the overall size of the executables. Some of them are 30Megs or more in size!

In parallel to this, I use an amazing source viewer at work called SourceInsight. SourceInsight is ABSOLUTELY the best code reading software on the market. This software is like a graphical cscope, but more robust and reliable. Unfortunately SourceInsight has a few major problems:
  1. It's Windows Only - no ways around this... I'd have to run a virtual machine to use it
  2. It's extremely expensive - something like $250 a license
  3. It's not maintained anymore - features like code folding are not supported.
  4. It's an MDI application, yet all editor windows are bound inside a master window... thus it doesn't let you take advantage of multiple monitors
  5. I dont think it supports Objective-C
So I got to thinking... what if I created my own editor. If I created my own editor I could
  1. add a source analyzer engine similar to cscope (like sourceinsight) for easy code jumping
  2. make it small
  3. make it run quickly
  4. make it simple to use
  5. make it support all the languages I care about (Objective-C isn't well supported in editors)
I've succeeded in items 2-5 (#1 is a doozy, its going to take a really long time to do that)

Beginning to Code (Enter the Scintilla!)

It is quickly apparent that writing a whole editor from scratch is a hugely difficult task. Luckily Scintilla handles all the editing tasks for me (folding/colourizing/etc). Unfortunately I found two problems with scintilla
  1. Scintilla is a second class citizen on Mac
  2. I dont like how Scintilla's folding
Regarding #1. Scintilla has been ported to MacOSX in two ways. A Carbon based port, and a Cocoa based port. I actually built a small editor (no frills like saving or anything... but you could type in it) in Carbon, and I found that programming in Carbon is rather disgusting. Its way overly complex and requires a huge learning curve. Add to carbons detriments the fact that programs written in it will never be 64 bit, and I abandoned this and moved to Cocoa.

Cocoa had it's own problems. The first is that at the time, it was only buildable via xCode (isn't moving away from xCode one of the major reasons Im making an editor?). There is a simple solution to this... learn about the xCode build process, and port the building of Cocoa-Scintilla to makefiles. This wasn't an easy task, but I got it done. I submitted my fixes into the official tree of scintilla, so I got a warm feeling for contributing back to the community; I also learned a lot about makefiles which has become useful for my dayjob. Cocoa's second problem is that it uses ATSUI (hehehe Dave are you reading this? Remember that the stuff I was looking at for DPS was ATSUI stuff?).

While ATSUI is great, its carbon based and will hold back porting to 64bit. The new Mac Text stuff is now CoreText. I haven't yet begun to port Scintilla to use CoreText, but its on my future TODO list (its important to simply get the editor working with what exists right now).

Regarding #2. I figured out the way Scintilla folds and did some kludging to make it work the way I want it to. I haven't proposed this code back to the scintilla because what I've written isn't production level code... its a dirty hack. I've released my patches for anyone to see if they are interested in how I am doing it. Sometime soon I plan on cleaning things up, doing it properly and proposing the code back to the Scintilla team.

Why Open Source?

Like I described with TextWrangler, if you run a Cathedral style project, you're bugs are your own. However with open sourced bazaar style, bugs belong to the community. As a single developer I simply dont have time to fully test my code (did I just admit that? did I just say I was a lazy programmer! yes indeed I did. If you've got a problem with that YOU CAN HELP ME OUT). I cant run through every usecase on every platform, but I CAN run through all the use cases I care about (I use CodeAssistor at work (windows port) and at home (mac port)... I'll find most of the normal use use-cases via regular usage... you'll note that I've left out linux port for regular usage HINT).

Using the bazaar style of project management, any bugs that I do not find via regular usage can be found by my users. As a bonus, my users are all programmers, so if they find bugs I think it more likely that they'll help me via patches since they can examine the code.

As a side note: This is why I chose Launchpad to host my source code. Launchpad makes "drive by contributions" much easier than sourceforge or google code. Go read up on it here.

Why BSD? Complex answer, I think BSD is more free than GPL. The BSD is truly free in that people can use the code to do nearly anything with the code (see my license). GPL restricts people from doing potentially interesting stuff with the code. To say that people wont submit code back to BSD where they would submit back to GPL is silly... if someone else has patches on top of my code they recently got SCREWED because I did some major refactoring; they'll now have to do a lot of work to maintain their patches... its easier and better for them to submit code to be incorporated into the trunk of the code.

Short Answer: GPL is way to legalize for me to truly comprehend it... best not to use licenses you don't really understand. BSD is simple and does what I want it to do.

What Have I Learned from Open Sourcing CodeAssistor?

The most important thing I've learned is that it doesn't really matter if you are open sourced or not via the standpoint of bugs until you can create a community. I've had nearly 550 downloads of version 0.0.5 and not a single bugreport (I found a major one while I was late into 0.0.6). "If you build it they will come" is not the way of open source... creating a community is something I'll have to work on, and it's going to be a difficult task.

As a plug, 0.0.6 is the most interesting time to jump on board the codeassistor community. Its now running rather well on the three major platforms, but there are lots of features still to do (the most interesting features at that!).

Another thing I've learned is that there are lots of shareware sites which will grab your stuff, claim it as "shareware" , and use it to promote their sites. Some of them technically they violate my license because they dont include my license demand #3 (see the licence). It's not worth it to hire a lawyer, and Im kind of thankful that they are trying to get the software into the hands of more people. Some of them like Softpedia were very nice in sending me an email and asking if it was ok to include the software, and making sure that my name is on the site as the author; in cases like this these sites are Win-Win.


I'm really looking for some contributors now. CodeAssistor is on the cusp of doing some really interesting stuff soon; CoreText implementation in Scintilla, cleaning & submitting the fold hack back to the Scintilla community, source code analysis engine. At +4000 lines (66,000 for scintilla), CodeAssistor is small enough to be quickly understandable, yet big enough to be complex and intellectually stimulating. It's a lead in towards Scintilla, winner of the Project of the Month for July from Sourceforge, and one of the truly inspirational open source libraries with an active community It uses three different languages (plain C, C++, and Objective-C), and runs on three major platforms, so it's an interesting learning opportunity towards cross-language cross-platform coding.

With help, I think that CodeAssistor can be a meaningful and widely used editor.

CodeAssistor v0.0.6 final release

Some minor tweaks to Linux (single instance app, icons in the menubar). Ready to Ship!


Sunday, September 12, 2010

CodeAssistor v0.0.6 in Beta

Quite a bit of (win/lin) refactoring done during my vacation in Alberta. The GTK/Linux menu is now ready, including accelerators. 0.0.6 is ready for Beta.

Get your Executables while they are hot!


Wednesday, September 8, 2010

GTK Nearly Finished

I've finished most of the functionality of the GTK/Linux port. Only thing left is the menu accelerators and polishing. Has all the features of Windows (nearly all the features of Mac... Mac has a nice "opened recently" thing that cocoa gives you for free), but accelerators (aka ctrl+s does not save) are not finished.

A rather major find bug was fixed in windows too. I highly suggest you get 0.0.6alpha if you are running 0.0.5-final/beta

Time to release the Alpha


Tuesday, August 24, 2010

GTK coming along

GTK is opening up the file, folding the code. I have an initial menu (although there are no items in the menu... its a start).

Im having a good time doing GTK programming. I love to learn new (and useful) APIs, and GTK programming is pretty straightforward.

On a not so fun note, I got a bad review on Fossforus :( a user didn't like it that CodeAssistor doesn't have tabs and therefore called the program "useless" . I have to defend my creation... CA is far from useless, I use it everyday at work, its folding capabilities and simplicity really help me. But yeah, tabs would be nice in the future. When you get, say, 7 or more editor windows, things start getting cluttered, and you start to realize that tabs would be nice.

More important than tabs are basic features that all text editors need (eg. search and replace).

That said, I am up to 430 downloads of 0.0.5 :) hopefully someone is finding the program useful.

Soon, very soon!

Monday, August 23, 2010

More Linux Work

Linux work is slowly progressing. the XC files have been set up for linux compilation and my ScintillaControllers are working on linux. I know very little about GTK so going will be slow until I am comfortable with the API.

One noteworthy thing... Version 0.0.5 just passed the 360 mark for total downloads from launchpad (this says nothing about how many downloads have occurred on all those shareware sites). Im scratching my head at how this happened. Last night there was a total of 91 downloads, and I am unaware of any "lists" that I would have been put on lately.

Im curious about who has downloaded CodeAssistor, and Im especially interested in bug reports. So if you are out there, you're reading this, and you use CA, send me an email or post a comment or file a bug-report :)

Sunday, August 22, 2010

Here we come Linux

Some refactoring has been done, more refactoring will come as I learn more about GTK and see more stuff that I am doing wrong.

Thats said... basic (very very basic... ie it only opens a basic text editor) has been implemented on GTK for CodeAssistor.

I've tested the windows version under WINE and it works really well... but lets make a native app.

Linux here we come

Thursday, August 19, 2010

CodeAssistor v0.0.5 final release

Found one bug from beta, fixed it, ready 2 go so lets shipit!

Grab the final version of 0.0.5

Change Notes
- Single Instance on Windows (already single instance on mac)
- Drag and Drop support
- Folding Fixes


Sunday, August 15, 2010

Well that was easy

So I was able to get the drag'n'drop on windows complete in less than an hour. This is a really quick release timeframe so far, considering that these features are quite major.

Anyway, grab the beta and raise some bugs please

Able to get stuff done thanks to a bum knee

I've been able to churn out a bunch of code this weekend thanks to a bum knee keeping from leaving my computer-den.

I've implemented the single instance application on windows, fixed a small folding bug, and implemented drag'n'drop on mac. I think I may drop the commandline tools for mac from 0.0.5 since well... I dont really need them. That leaves implementing drag'n'drop on windows and ready to release.

might even go straight to beta passing over the alpha phase, we'll see if I can get the win drag'n'drop done tonight.

Saturday, August 14, 2010

CodeAssistor Feature Plotline

So here is what I am thinking for the work items to do for CodeAssistor before I give it the full v1.0.0 treatment

- Single Application in Windows
eg. Right now when you double click on a .c file, a separate instance of CodeAssistor will be started, even if there is an application running at the moment
- Mac Commandline utilities
eg. Cannot demand codeAssistor to start at a particular line of a file like you can with windows
- Drag and Drop
eg. Drag a file from finder/explorer into the editor, editor should display file
- Folding fixes

v0.1.0 - major update
- Refactoring
eg. quite a bit of duplicated code has crept in (like notification stuff)
- GTK port
- Update the file if the file is changed by an external editor
- Compile on Windows via Visual Studio

- Upgrade all dialogs
- Add Search & Replace
- Add replace all instances of word

- Change appearance dialogs (fonts, colours, backgrounds)... store the prefs
- highlight all instances of a selected word

After these tasks are complete, I think CodeAssistor will be a full fleshed out (although bare) Editor. I can start building outward from there

Post 1.0.0 ideas (small/tight IDE)
- Macros/Scripting
- Cross Reference
- VI controls
*- CoreText rather than ATSUI on Mac
- Project like control over many files
- gdb integration

Friday, August 13, 2010

CodeAssistor Major folding bug fixed

CodeAssistor has had a rather nasty corner case bug re:folding since I initially implemented the feature. It's somewhat difficult to find, but its bothered me since day1. I've had to work around the bug as best I could, but all workarounds were less than optimal. Today, I received a patch from the Scintilla team that would allow me to have an optimal folding experience; gaahhh its 2 days after I released 0.0.4!

Well anyways, the nasty folding problem is gone and the code is in my repos. There is a second folding bug I've found now relating to "fold all" on very simple files... I guess 0.0.5 will be a bugfix release?

Tuesday, August 10, 2010

CodeAssistor v0.0.4 final

Bugs fixed, updated the windows compiler to 4.5 (new scintilla requires TDM mingw 4.5). Time for final release.

So I updated the binaries, uploaded the SRC zip, alerted Fossforus and freshmeat. Time to move on to 0.0.5.

Minefields "copy link location" seems to be broken today, so here is the link to all relevant downloads (

Tuesday, August 3, 2010

CodeAssistor Release Candidate 1 for v0.0.4

after fixing some bugs found during beta testing, Ive decided that 0.0.4 is ready for the "release candidate" label.

Download it

Saturday, July 31, 2010

Scintilla update inspires CodeAssistor 0.0.4 beta 3

Scintilla has updated to 2.20. I did the merging of the current Scintilla-Cocoa project on Launchpad (owned by MikeLischke), and proposed that for the trunk branch.

Then I took the proposed change and added all my folding hacks and created the mpatch2.20 branch. CodeAssistor runs off of the mpatch2.20 branch now after some minor changes to the CScintillaController.cpp file

No user experience changes, just a better underneath library

you can find beta 3 here:

Sunday, July 18, 2010

CodeAssistor 0.0.4 in beta 2

Major tweaks to folding (performance & functional), and running windows as a static compile.

Thursday, July 1, 2010

CodeAssistor 0.0.4 in beta

If finished the feature work on 0.0.4 and am therefore going to put it into beta stage

- Proper Java colurizing. all classes from Java API 1.5 are colourized similar to how the c standard library is coloured in C code
- python, php, perl, batch, bash colourized
- python, php, perl, bash folding
- better scrolling
- horizontal mouse scrolling on mac improved
- wider line number margin
- hpp files now recognized
- preprocessor Cstyle folding
- default style is objectivecpp
- can open to a specific line on windows version
- Warnings when attempting to save a file with access restriction.

Download the beta at: Windows or Mac

Thursday, June 24, 2010

CodeAssistor - Scrolling and Folding

I got a little off track today, rather than looking at stuff on the version 4 list, I fixed up some folding and scrolling stuff... now the editor doesn't fold away the cursor during a fold all. when fold all is performed, the cursor line is moved to the top line of the editor. when Unfoldall is performed the cursor stays at the current position (was getting lost before).

Also, now you can only hori-scroll the size of the longest line (plus a little bit of buffer), and horizontal scrolling via mousewheel was fixed on mac.

Ohh yeah, margins are a solid colour on mac now... rather than those nasty lines.

Wednesday, June 23, 2010

CodeAssistor - version 0.0.4 started

Version 0.0.4 is started. Java is colourized properly, and includes colourization of all the classes from the 1.5 JavaAPI. Python support is in both windows and mac and is colourized and folds properly... I dont use Python much so I am going to have to depend on other people to raise bugs against python.

Speaking of bugs... no one has raised any yet (I know they exist!), yet I've had ~65 downloads (I make the assumption that there are 15 users from that amount of downloads) since 0.0.3 was finalized. If you users are reading this, thanks for using the software and that your comments/critisms/bugfinds are welcome. Also, Launchpad makes "drive by" contributions very easy if a developer wants to join me by adding Linux support.

Saturday, June 19, 2010

CodeAssistor - version 0-0-3 Final

After fixing a few more bugs than I expected, the CodeAssistor version 0.0.3 is completed and barring any major bugs, finalized. I've updated Freashmeat and FOSSFORUS, placed the binaries and the source as zip files for general consumption.

The major task for 0.0.3 was windows support, however, since CodeAssistor is my primary editor now, I added functions that I really really wanted (such as foldAll).

Version 0.0.4 will target UI polish. I want to do things such as
- Better Java colouring
- Add Python/Perl/PHP/Win-Batch colouring and folding
- Darkmode where a darkcolour is the background ... lots of people like dark backgrounds
(note: I do not want to give the user the power to chose their own colour scheme... this may seem fascist or lazy of me, but my main goal is to have a very simple feature set... adding user defined colour schemes and font schemes adds a LOT of feature complexity, adds to the size of the final binary, and is sort of antithesis of what I want to accomplish... Im not just creating a notepad++ clone, I purposefully want something smaller... and yes, its a lot of work to add that stuff :P)
- Better Windows dialogs - Should be more similar to Windows Notepad.

Windows Executable
Macintosh Application
Source Code (including my version of Scintilla for superior folding)

My Triple Screened setup

A program called "Air Display" allows Mac users to use their iPads as an additional monitor. This gives me the ability to have three monitors. See screenshot

Friday, June 18, 2010

CodeAssistoro - Scratchpad of what needs polishing

Need to do all these things before version 0.0.5

5- Cut/Copy in finder window
3- CTRL+Z should not go before open point
4- Should pop warning to say "cannot save due to file access restrictions"
5- Only a single instance of the application
4- batchfile colourization
4- widen margin to accomidate 99,999 lined files
5- "dark mode" for those who like the dark
3- About Dialog
4- show if text is "dirty"

4- python perl php bash colourized
4- better java colour
3- all forms of makefile
3- About dialog

Thursday, June 17, 2010

CodeAssistor - version 0-0-3 release candidate 1

I've improved CodeAssistor in many ways over the past couple of days.
Find is fixed (it wasn't the compiler, see previous blog entry).
FoldAll and UnfoldAll have been added (Man this is sooooo useful!!!)
Long Line wrap has been added

My only concern is that pasting into the search box doesn't work in windows... no idea why.

Anyway, grab it while its hot.

Tuesday, June 15, 2010

Never blame the compiler

In my previous post, I demonstrated how I could get codeassistor to perform the exact same sequence of inputs in different ways depending on if the code was optimized or not. Turns out, I was improperly using a structure (didn't set all the values of the structure properly).

Never blame the compiler

Sunday, June 6, 2010

An interesting finding about compilers

In our binary world of software, a set of consistent in-volatile variables has one and only one path it can take through a static codebase. Bugs exist because variables are never consistent or in-volatile; except during unit testing. Unit testing should use a large enough data set to test all possible variable combination sets, but it is nearly impossible to thoroughly unit test certain codebases (eg codebase for a user experience), thus bugs exist.

However, what do you do when your set of variables passing through a static codebase is the same, with two exceptions.
1) user input timing
2) compiler optimization options

Case: "Backwards Find in Windows & TDM of Mingw"
I cannot be entirely scientific with this. Heck this is a blog post and I've found a workaround for my problem. I highly encourge you "the reader" to investigate this more thoroughly and tell me I've overlooked some stupid thing

Problem Desc: When using the backwards find in Codeassistor, backwards find does not wrap around to the bottom of the sourcefile and search upwards for the search term if the search term cannot be found from the current point of the cursor to the beginning of the sourcefile. Unless the codebase is compiled using the -O0 optimization option.

Steps to reproduce
1) grab the codeassistor source and the mullinpatches branch of scintilla.
2) compile the code via "make -f -j5"
3) after the test application has popped up, press CTRL+F for find and type "ei" (no quotes) then ENTER.
4) Alt+Tab from the find popup to the editor window
5) press F3 for backwards search multiple times

Expected Result:
The editor will jump to the bottom and find the last occurrence of the string "ei"

Actual Results:
The editor will highlight the second character of the sourcefile (in this case a "*")

6) Quit Codeassitor; type "make -f clean" ENTER
7) Edit and change -Os to -O0
8) repeat steps 2-5

Results (expected and actual):
The editor will jump to the bottom and find the last occurrence of the string "ei"

It seems like the -Os (for that matter all -O optimization except O0) performs the test one way, and the -O0 performs another way.

-Os drops my final executable IN HALF! from 250KB to 124KB. I am not supremely concerned about this because 250 is acceptably small... but what happens if my executable grows to be 10MB ? I would much prefer a 5MB exe to a 10MB one.

Note: the bug might be in the codeassistor, however the code is acting differently to a non-volitle (except user timing) dataset depending on compiler option.

Ipad review after day one

OVerall there are slight problems but it's features make up for them

Typing is much more difficult than a laptop or even a blackberry for that matter. Holding the internet in your hand is they way it's supposed to be. Reading books on an eink screen is nicer on the eyes but the iPad is still acceptable. Watching is great. Reading technical papers is good. The speed of the software is amazing.

Saturday, June 5, 2010

Smegol says "It's my birthday, and I wants it"

I bought myself an iPad today. Cause I wanted one.

I want a larger screen book reader for technical papers ( I'll give you a review later on.

Thursday, June 3, 2010

CodeAssistor on Windows : Alpha Release

Super Dooper Alpha release for windows

Find/Colouring/Goto all the stuff that mac has... but there are bugs
- cannot wrap backwards on find

Im sure there is more, I didn't test very thoroughly, but its bedtime and I'd like to have this available to download on other machines for testing tomorrow morning.

Wednesday, June 2, 2010

Find: codeassistor on windows

I have to implement a "Find" dialog for windows. The popup-edit box method I use in mac doesn't work so well because Scintilla takes over from my search-edit box whenever I click the search edit box (the search-edit box is inside the bounds of the scintilla editor).

Im going to have to implement find dialogs anyway, so that there is some better control over find... but yeah, I had to do it for windows right from the get-go.

Anyways, basic find is completed for windows, though there are bugs, you can at least find stuff with it.

Next step is the line-goto dialog.

Saturday, May 29, 2010

CodeAssistor on Windows coming along nicely

Folding/colourizing/etc all major features that the Mac version supports are supported in windows now with the exception of

- shortcut keys
- find/linegoto.

Here is a screeny of Windows and Mac side by side.

Friday, May 21, 2010

CodeAssistor on Windows

CodeAssistor can now open files on windows... looks ugly as sin, but hey... thats windows for you.

Wednesday, May 19, 2010

CodeAssistor work on Windows

I've done some initial work (read VERY initial) for a windows port of codeassistor.

I've only got an editor window open now (no loading/saving/etc, no colourizing). Most of the work was on the makefile to get the project ready for development.

Sunday, May 16, 2010

Beware using google groups

Google groups just ate my homework. MotherFunk!

Neil has been doing some work with Lexers and released a zip file of his latest work on his website. His work wasn't compiling against MacOSX, so I took it upon myself to get the compiling/linking etc done. After about two hours I had everything running and zipped up my work and uploaded it to google groups (the scintilla interest group)

I deleted the file from my hd believing that google had safely stored the info... of course, Google funked up and the file cannot be retrieved.


Friday, May 14, 2010

CodeAssistor version 0-0-2

CodeAssistor version 0.0.2 has been released. This version includes CODE-FOLDING (wohoo!) and GOTOLINE functionality.

Sunday, May 9, 2010

CodeAssistor listed on the Scintilla "Related Projects" site

Neil has put the CodeAssistor onto his list of projects related to Scintilla

Happy Day!

CodeAssistor once again compiles against vanilla Scintilla-Cocoa

Mike Lishke has merged all of my changes (mullinpatches/mousewheel/makefilework) into the trunk of Scintilla-Cocoa. Version 66 of CodeAssistor will compile against Version 34 of Scintilla-Cocoa (lp:scintilla-cocoa).

Mike Lishke has also merged in all of Neil Hodgson's main scintilla changes + added some helper functions in the ScintillaView for Font changing and Text searching.

Looks like a good day as far as Scintilla-Cocoa goes :)

Saturday, May 8, 2010

Goto Line added to CodeAssistor

Hmmm... so thats why you do requirements analysis, because if you dont, you forget an important feature (like find... or like line-goto).

Im lucky this time. I was able to "tack on" Finding and line-goto w/o much hassle (its a homework task for my readers to see if my design could have been better if I had remembered these tasks).

Anyways. CodeAssistor now has the ability to Goto lines (CMD-G). interestingly I had to add an "owner" property to the upstream ScintillaView class. I had to add this so that Scintilla notifications would be percolated all the way up to the NSDocument (or NSObject if a Single document model is used) that controls the ScintillaView. I did this so that I could hide the Finder/Goto TextEdits when the ScintillaView regains focus.

Because of this change, revision 66 (and onwards) of CodeAssistor now _requires_ my mullinpatches (lp:~masmullin/scintilla-cocoa/mullinpatches) and will no longer compile against vanilla Scintilla-Cocoa. Previous to this, Vanilla Scintilla-Cocoa could have makefiles hacked up (my mullinpatches has some changes to the vanilla makefiles-which I supplied in the first place anyway) and work properly with CodeAssistor, Although I've fixed a few bugs in Scintilla-Cocoa that MikeLischke hasn't integrated yet, so you would want to use mullinpatches anyways.

The amount of divergence mullinpatches is from vanilla Scintilla-Cocoa is starting to worry me. Right now, I think it's still possible to do a pretty clean merge of mullinpatches onto vanilla since vanilla is static, but if other developers start fixing bugs on vanilla Im going to have an additional chore of updating my mullinpatches.

Not only that, but Im concerned that Scintilla-Cocoa isn't integrating changes from the main Scintilla code stored on sourceforge (eg there was some changes done by Neil Hodgson to the main Scintilla code just 3 days ago... these havn't made it into Scintilla-Cocoa).

Looks like Im going to have to get myself a good visual diff tool (gah, I dont really wanna fork over the cash for Araxis, but it's the supreme tool for this purpose).

Friday, May 7, 2010

Where do I find CodeAssistor?

Today Dave left a comment on my last post suggesting that I post links of where to find CodeAssistor... SOOOOO..... without further wait.

You can check out the source using bzr via "bzr branch lp:codeassistor"

You can download v0.0.1 executable @

The project homepage is found @

Note to anyone who wants to contribute: Launchpad and bzr make "drive by contributions" VERY VERY easy to do and offer some highly professional workflows (code reviews, bug-tracking, revision control). I highly suggest that all developers create themselves a launchpad account.

HINT FOR STUDENTS: If *I* were to go back to school again, I would ask my teachers if I could use Launchpad for all my coding projects.

Wednesday, May 5, 2010

The CodeAssistor released v0.0.1

I've released my first version of the CodeAssistor software. CodeAssistor is an extremely simple MacOSX code editor that works with c,cpp,cxx,h,m,mm,xc,java, and txt files.

Whats an .xc file you ask? Well because CodeAssistor will one day become cross platform I wrote a few helper functions to facilitate using either ObjectiveC code or C/C++ code (via #ifdefs). On Macs the .xc file will be compiled using -x objective-c++ and on other platforms can be compiled as c or c++ code.
With the help of these helperfuncs I've been able to keep the Scintilla Controller classes strictly c++ rather than Objective-C++, and therefore it will be easier to port to windows/linux.
Basically .xc stands for "Cross C"

I like using it a lot. It's my main editor now. I like creating it a lot. There are still LOTS of features to work on (anyone feel like helping? contact me at

I released it under the BSD licence, so yeah... have at'er.

Friday, April 30, 2010

Scintilla Cocoa Bzr and Launchpad

I've started investigating the software product Scintilla. I'm specifically looking into the mac versions of scintilla (cocoa and macosx inside the source tree).

After doing some work with both the cocoa and the macosx version, I truly appreciate how much extra "stuff" apple gives you with the cocoa platform.

In exchange for some control over how things work (ie certain tasks become automagical) Apple gives you really easy ways to implement saving/opening/multipleDocs/"dirty-alert" etc. It's really quite amazing.

I've managed to work on a few bugs for this software because launchpad-bzr is VERY VERY easy to to drive-by-contributions.

So far, I've contributed
- mouse wheel fixes (zooming more like firefox, horizontal scrolling no longer needs holding the shift key, no more zooming 'jumpyness' when using the magic mouse)
- makefiles to build the cocoa project and makefiles to build the sample application

Im currently creating my own Source code Text editor called CodeAssistor because there is a serious lack of light-weight text editing software on the mac.

CodeAssistor is actually pretty solid right now, and I use it for all my editing needs (C,C++,ObjC,make,txt... java is there too but sorta tacked on). The application is comparatively tiny, only 2.5MB (TextWrangler is 28.8MB, TextEdit is 16.3 MB, jEdit is 30.8MB) and blazingly fast. Unfortunately it lacks a Search feature (DOH!) which I totally forgot about when I was thinking about the UI and now have to figure out how to not make the program ugly.

What kind of text editor doesn't have a search feature? DOH DOH DOH. Thats why i have yet to release the software. A textEditor w/o search is just plain stupid.

Saturday, February 6, 2010

eBooks, music, and the DRM

Debate is raging about DRM enabled books throughout the Nerdverse. With Apple releasing a new ebook reader (iPad), which will soon be competing with the Amazon Kindle and the Sony eReader, blogs are abuzz with debate on the merits and flaws of DRM and eBooks in general.

On one hand, text is the -absolutely- easiest commodity to pirate on the internet. The internet was basically constructed to send text messages. Think about it, if the internet were created to distribute video or audio, it would have been named "television" or "radio" (respectively). Sharing textual information is primal to the Internet's nature. Now that eInk devices are being widely distributed, and with them the ability to easily consume stolen text, book piracy will shoot through the stratosphere!

I cant stress this enough; piracy of books is 100x easier to pirate than music, the only mitigating factor against absolutely wide spread book theft is that books lack a medium to consume the pilfered pirate gains. eReaders are this medium. The Amazon kindle is to books what the Mp3 player is to music.

DRM can protect against the impending rampant piracy. DRM can limit the majority of society to be unable to freely redistribute digital purchases, thus ensuring that the costs of creating artistic works is covered.

There are, however, some serious drawbacks to DRM for our societies general social wellbeing! DRM allows a corporation-which by definition, is solely dedicated to profits- to be a single access point to art. DRM allows a company such as Amazon to control what access YOU have to your favourite books. Amazon has already proven its 'culture controlling' power when it removed access to the novel 1984 from customers who had previously purchased it. This power provided by DRM technology is akin to giving a company the ability to remove everyone's Beatles albums!

For the record, there has never been a greater irony on this earth than a corporation causing denial of access to the novel 1984.

Even beyond corporations willful denial of access to art is the unfortunate but accidental ways DRM can cause customers to lose access to their purchased books. If amazon were to to suddenly experience bankruptcy and stop producing the Kindle reader, customers would lose access to their purchases once their Kindles wore out and were unable to be replaced. If all of society used Kindles rather than paper books, this would be a societal disaster akin to the bank implosions of 2007-2009.

My answer to the eBook DRM paradox- where it is a cultural necessary to limit access to media in order to ensure the continued creation of art, yet it is a cultural necessary to NOT limit access to media in case of irrevokable artistic loss and degredation of consumer freedom- is to establish a benevolent hegemony which righteously and judiciously oversees and controls the usage of DRM.

I suggest either the establishment of a government agency to be a central repository for DRM keys and DRM decryption, or some heavily regulated corporation to perform the same task. An entity similar to the public library system or Canada Post. DRM is sadly, a necessity. However it is necessary to remove the overwhelming power granted by DRM out of the control of profit interested companies.

Any thoughts?