The Accidental Rubyist

invalid byte sequence in UTF-8

Archive for October 2009

Fooling around with todo lists

leave a comment »

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.

Advertisements

Written by totalrecall

October 31, 2009 at 6:09 pm

Posted in being_geeky

More thoughts on scrollpane and splitpane

leave a comment »

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

Written by totalrecall

October 28, 2009 at 9:26 am

Posted in rbcurse

General and health update

leave a comment »

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

Written by totalrecall

October 24, 2009 at 11:21 am

Posted in rbcurse

Vim function for markdown maruku users

leave a comment »

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.

Written by totalrecall

October 12, 2009 at 11:23 pm

Posted in vim

Splitpanes are possible using ruby ncurses

leave a comment »

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://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

Written by totalrecall

October 6, 2009 at 10:05 am

Posted in rbcurse

porting rbcurse to ruby 1.9

leave a comment »

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.

Written by totalrecall

October 5, 2009 at 3:06 pm

Posted in rbcurse

ncurses not working on ruby 1.9 ?

leave a comment »

Well, after making changes to the ncurses-0.9.1 source, compiling, creating a gemspec, building a gem and installing it… it still won’t work under ruby 1.9.1. The examples give this error:

form.rb:21:in `’: undefined method `new_field’ for Ncurses::Form:Module (NoMethodError)

I went to the elliottcable version (which compiled) — he’s already made the corrections to ncurses, and the examples give the same error. So now I am wondering … is this a 1.9.1 issue ?

Written by totalrecall

October 3, 2009 at 2:36 pm

Posted in ncurses, ruby