Getting ruby Tracker to work

Posted November 8, 2009 by totalrecall
Categories: ruby

I had tried out Tracker recently (a simple bug tracker using sqlite as a backend). Gave errors, and the author reported that it had been a long time
and then he went silent. Today, made a few corrections and its working.
However, it is *very slow*. Each command takes a few seconds to respond. I am on 1.9.

I added require acts_as_list in environment.rb. You will need to install this gem in addition to active_record.

2 files contain :with_scope which is now protected.
Corrected as per http://ropiku.wordpress.com/tag/with_scope/. Now all the actions mentioned on the rubyforge page are working.

In the meantime, I had got ditz to work in ruby 1.9 but with *some errors* (using someones fork). So i am not
too keen on it, although i might start using it later. So i have adapted todo.txt (a cute shell script todo list manager) to create bug files. However, using flat files in email header format does limit the ability to do searches for multiple keys. Its like reinventing the wheel with multiple greps. Much better to use sql instead.

todo.txt is great for todo’s but only stores a line per todo, no comments, fixes etc so it can’t be used for tracking bugs. I really should redo this shell-script based bug tracker using ruby thor and highline.

rbcurse 0.1.3 released

Posted November 4, 2009 by totalrecall
Categories: ncurses, rbcurse

Just released 0.1.3 on http://gemcutter.org/gems/rbcurse containing a tiny bug fix in Listbox.

Silly of me not to have released a version for 1.9 when I had made the changes and tested out.
Without committing or releasing I started work on SplitPanes and Scrollpanes etc which have
resulted in major changes to base classes too. So now the first 1.9 version will have all these
additions and changes too.


# Instead of defining a local variable with some initial content (often just an empty hash or array), you can instead define it “on the go” so you can perform operations on it at the same time:

(z ||= []) << 'test'


— http://www.rubyinside.com/21-ruby-tricks-902.html

Command-line bug tracking

Posted November 3, 2009 by totalrecall
Categories: being_geeky

Have been using todo.txt for a few days. However, i find i am using it more
for recording bugs. todo.txt allows me to mark a task as done but not put
a comment or status. e.g. I need to put in details of what I have done as a bug-fix.

So I just checked up the net a bit and came across a bunch of command-line bug
trackers. Need something simple and CLI.

Two nice-looking projects are: tracker and ditz (coincidentally ruby, I hope
1.9.1). ticgit also looks good, but perhaps a little more complicated than what
i want.

Let me know if you are using something nice and simple for your small projects.

OUCH ! Both are giving errors! Tried tracker in both 1.8 and 1.9. There are some dependencies not mentioned. Gives an error in active-record.

$ trac bootstrap
/opt/local/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/base.rb:1667:in `method_missing’: undefined method `acts_as_list’ for #<Class:0×17973f8> (NoMethodError)
from /opt/local/lib/ruby/gems/1.8/gems/Tracker-1.0.0/bin/../lib/comment.rb:3
from /opt/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require’
from /opt/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require’

$ ditz

/opt/local/lib/ruby1.9/gems/1.9.1/gems/ditz-0.5/lib/model-objects.rb:1:in `require’: /opt/local/lib/ruby1.9/gems/1.9.1/gems/ditz-0.5/lib/model.rb:214: multiple assignment in conditional (SyntaxError)

The person on the ditz mailing list, says he is no longer maintaining it since it never really met his needs.

The saga continues:

I install gnu gnats (sudo port install gnats), installs fine, but on executing send-pr it complains it cannot find a file pr-edit.

I install another ruby bug tracker, ticgit. Seems to be for 1.8 since I ran into a “when :” error. Fixed that but it goes on to another.

$ ti new -t ‘my new ticket’
/opt/local/lib/ruby1.9/gems/1.9.1/gems/git-1.2.5/lib/git/lib.rb:329:in `chdir’: wrong number of arguments (1 for 0) (ArgumentError)
from /opt/local/lib/ruby1.9/gems/1.9.1/gems/git-1.2.5/lib/git/lib.rb:329:in `config_get’
from /opt/local/lib/ruby1.9/gems/1.9.1/gems/git-1.2.5/lib/git/base.rb:135:in `config’

So no command-line bug-tracking for me, … as of now at least.


Vim + Firefox: http://vimperator.org/

Progress on SplitPane and ScrollPane

Posted November 1, 2009 by totalrecall
Categories: ncurses, rbcurse, ruby

Great progress on rbcurse’s Scrollpanes and Splitpanes. Scrollpanes contain a viewport which handles the window or porthole into it’s child object. The scrollpane handles communication with the viewport, and the scrollbars. I’ve just added some neat scrollbars. However, there’s a lot of drudge work to be done such as event listeners, and allowing editable objects inside scrollpanes and splitpanes.

rbcurse scrollpane

Scrollpane using ncurses

Splitpanes: tested a splitpane with 2 splitpanes as its child components. However, have to use real world objects inside that. Objects that go inside scroll and splitpanes need to be buffered using pads. That and their handling of cursor position etc need to be taken care of.

SplitPane using ncurses (rbcurse)

SplitPane using ncurses (rbcurse)

A major change in the upcoming version (0.1.3), is that widgets will no longer write directly onto the screen. That was quick and easy and light. But for real world apps, when one has splitpanes, scrollpanes etc, then parent objects need to clip and place their child objects themselves. Child widgets don’t even know their coordinates. So using pads internally was required.

That means that most of the existing classes will need to be modified to use pads for painting. A lot of drudge coding. May need to make borders and scrollbars into classes. The upcoming version should be exciting. Now it should be possible to make a Tree class, too.


# print section of file from regex to end of file
$ cat | ruby -pe ‘@found=true if $_ =~ /regex/; next unless @found’

Fooling around with todo lists

Posted October 31, 2009 by totalrecall
Categories: being_geeky

I am finally trying out something called todo.txt
and this.

todo.txt looks good, is a bash script (sed heavy), generates a simple text file, allows for setting of project name, or tags, and priorities. Just the kind of simple thing I’ve been looking for. Over the years I’ve tried out many alternatives but given up. Most of these don’t generate a text file.

1. High-priority – nice Mac app, available on the top menu
2. todo app (a Dashboard widget), available on F12
3. todo list in iGoogle (i still have tasks in it)
4. Tasks in gmail (abandoned)
5. Using alpine for tasks, send them as emails, and flag them off (abandoned)
6. Using gmail itself for tasks, labelling them. (abandoned)
7. taskpaper – a vim plugin, installed it but was not impressed
8. I just saw doneyet, but I think it expects me to download a subversion project.

More thoughts on scrollpane and splitpane

Posted October 28, 2009 by totalrecall
Categories: rbcurse

More work on paper. I think now I am ready to start coding. Situations are like:
a splitpane contains one or 2 scrollpanes. The scrollpane contains, say, a table or list or form.
Now the table knows how to print itself, but the scrollpane must clip part of it, and the splitpane
may further clip more. So what’s shown on screen is after each layer has clipped. Getting this
into the existing framework required some thought.

Trickier is that when a scrollpane scrolls an object, the focus within that widget has to be adjusted
accordingly by the object. Similarly, when a user tabs past last visible object in a
scrollpane, object should scroll up.


# print the last 10 lines of a file (emulate ‘tail’); NOTE reads entire file!
$ cat | ruby -e ‘puts STDIN.readlines.reverse!.slice(0,10).reverse!’


HTML.vim,
mtsend.py

General and health update

Posted October 24, 2009 by totalrecall
Categories: rbcurse

Things have been slow. I was in the midst of a lot of testing out with pads, subpads, subwindows etc. Then my dad got hospitalized twice. In the middle of all that, I fell ill. I still have some chest congestion which is being treated (antibiotics). I simple can’t look at a comp terminal or book without eyes smarting after 5 minutes. Dad’s still bedridden, he’s almost 90 so life’s going to be mostly bed and loo for him now :-( .

So last few days, I’ve been mulling over how to get scrollpanes into rbcurse without the component having to be aware. It should be place-able into a scroll pane, that’s all. However, currently rbcurse components write directly onto the screen. OTOH, i was just reading that Java comps are double-buffered. The closest I can think of is a component writing to a pad. And then the pad is written onto the screen. As many pads as components. Or perhaps subpads on one large pad. Then any component or form can be attached to a scrollpane, which will show the appropriate portion of the pad.

Just remember with pads, you need to declare dimensions beforehand. If the components exceeds, need to create a nnew pad and copy stuff (this would be needed when we go in for tree components)


# Rescue to the rescue:

h = { :age => 10 }
h[:name].downcase                         # ERROR
h[:name].downcase rescue "No name"        # => "No name"


— http://www.rubyinside.com/21-ruby-tricks-902.html

Vim function for markdown maruku users

Posted October 12, 2009 by totalrecall
Categories: vim

For vim users who use markdown or maruku and need a little help surrounding words.
This function goes into your vimrc.
I’ve mapped it to “,m” in visual mode.

Select a word or line or block, press ,m
You are prompted for a char or chars. These chars are placed on both sides of the visually
marked block.

I use HTML.vim, for most serious work
but for simple NOTES, TODO, CHANGELOG, etc files I use markdown, and this helps a lot.
It’s a copy of a function called VisualHTMLTagWrap.

Splitpanes are possible using ruby ncurses

Posted October 6, 2009 by totalrecall
Categories: rbcurse

I have been thinking about how to implement split panes (like file explorers, or frames in a browser) in rbcurse.
While fixing some display issues in multi-column tables (when increasing the size of one column, other columns were printing slightly out of the table boundary in some stray cases), i had an idea of how splitpanes and scrollpanes could be implemented easily.

split pane

This should obviously not involve the component knowing it is in a split pane, or that it is currently not in view. Similarly, a screen like alpine’s (email client) custom setup (which is multi-page) should be possible without the user having to setup pages. The component automatically manages bringing components into view, and into focus as well. Once i am over testing rbcurse with ruby1.9 and maybe adding an edit screen to the sql client demo, I can start working on Splitpanes and Scrollpanes.


Some porting links:
http://boga.wordpress.com/2008/04/15/ruby-19-porting-notes/
http://blog.grayproductions.net/articles/getting_code_ready_for_ruby_19
http://www.scribd.com/doc/12942398/Migrating-To-Ruby-19
http://blog.nuclearsquid.com/writings/ruby-1-9-what-s-new-what-s-changed
http://www.davidflanagan.com/2007/08/changes-between-ruby-18-and-ruby-19.html

porting rbcurse to ruby 1.9

Posted October 5, 2009 by totalrecall
Categories: rbcurse

Started the porting of rbcurse (ruby ncurses widget ilbrary) to 1.9 today after ncurses started to work. Am totally new to ruby1.9, but examples from rbcurse are beginning to work.

Examples are all working, altho there could be some obscure bug with some key, or some string index that i’ve not caught.

Have tweaked TextArea a bit more.

This requires ncurses-ruby 1.2.4 since the older versions do not work with ruby 1.9. This may be found at: original or backup (and the ncurses-ruby gem in case you have problems creating it.)

After this is tested out, I will test out with ruby 1.8 and see if it can run under both. Then i can merge it back into the main. Please see github (branch rbcurse19) for work in progress. The README.txt has complete installation instructions.