Thursday, August 27, 2009

Horizontal Scrolling in Windows

You can use the scrollwheel to navigate up and down a page. What about left and right? Hold down the SHIFT key! After 6 years as a dedicated Windows user!

Saturday, August 22, 2009

NEdit = Super Edit

Somewhere along the line, they upgraded to full regex support I believe. The backreference thing didn't work well for me, but anyway. Here are the things I've added (though the menus, but you can cut&paste) to get syntax highlighting with Autohotkey code. A true software type might do a much better job at this.

In each section (denoted by nedit.whatever - shown here just as a label - don't add this line) add the lines given

nedit.highlightPatterns: Ada:Default\n\

Autohotkey:1:0{\n\
comment:"(;.+$)|(^/\\*.+^\\*/)":::Comment::\n\
hotkey:"^[ \\t]*[^:]+(?=::)":::Flag::\n\
command:"^ *[a-zA-Z0-9_]+(?=($|[ \\t]*,|[ \\t]+[^ \\t:=(]))":::Keyword::\n\
string:"""[^""]*""|'[^']*'":::String1::\n\
builtin:"(?iif|loop|return|break|continue|while)\\s*(?=\\()":::Subroutine::\n\
expression:"^\\s*\\w+\\s*(?=[:=])":::Storage Type::\n\
}

nedit.languageModes: Ada:.ada .ad .ads .adb .a:::::::\n\
Autohotkey:.ahk::Smart:None:4::".,/\\\\`'!$@#%^&*()-=+{}[]"":;<>?~|":

nedit.macroCommands: \
Comments>Comment@Autohotkey:F3::: {\n\
replace_in_selection("^", "; ", "regex")\n\
process_cancel()\n\
}\n\
Comments>Uncomment@Autohotkey:F4::: {\n\
replace_in_selection("^; ", "", "regex")\n\
}\n

Thursday, August 20, 2009

Correctly Setting Your Prompt in tcsh or csh

This is *the* way (no arguments please)

set prompt='%~/ !>'

How to set your PATH - the wrong way :

(wrong)

setenv PATH whatever
or
set PATH ($PATH:/dir/dir2)

right way :

set path ($path /dir/dir2)
(that's magic, $PATH gets set automatically, in tcsh or csh - bash is crap of course)

Good aliases to set

ll ls -l !\*
lt ls -lt !\* \| less -X
nes echo \$cwd/!\*

Wednesday, August 19, 2009

Perl Tk Tutorial

I mention this just so it'll be easy for me to find in the future. I'm running this on WinXP Cygwin btw.

http://www.bin-co.com/perl/perl_tk_tutorial/contents.php

I tried starting a debate on which was better for what I wanted to do - perl or autohotkey. Looks like I end up with people tell me how to do what I want in AHK. AHK is super - light, has a basic visual frontend for simple GUI creation, is dead simple to install, no dependencies, and generates executable. Perl is super for serious stuff though.

Guruspeak :

Problem with AHK solutions is that they are tied to a specific platform. Tools like Perl and Java are generally more portable. (With Perl it depends on the availability of the module for multiple platforms esp. with GUI.) You can also consider using Qt directly since it is cross platform. This was built by a company called Trolltech who were acquired by Nokia http://qt.nokia.com/products and this is the backbone for KDE's GUI.

Response :

All too heavy. Autohotkey seems to be the only thing that's light and comes with a decent visual WYSIWYG frontend. And they have a forum with great people who help you out.

Tuesday, August 18, 2009

The Hardest Part - Made Easy

For a CS guy, this would be a breeze - a GUI that lets you talk to your chip, load macros, save macros. But, me, I have to suffer. Fortunately, through the great work of Mr. Rajat, of Autohotkey fame, I don't have to mess with crap like java AWT or M$ VB or VC++. SmartGui Creator does the work for you - creating the GUI that is, you still have to fill in stuff..



The "macros" part promises to be interesting. I've never done anything like it before. But, my recent brush with iPhone programming has me thinking along the right lines I think - though a true CS programmer might get a shock at my approach :

Have your utility functions
Have an execute queue
Have macro queues
When an event needs to be handled, add the required function call to the execute queue and to the "history" macro queue; then call the execute function which takes that queue as its input
When a macro is called, dump all of its contents into the execute queue and call the execute function

So, you're really building a parser and an exec function, etc. Like I said, a CS man would know exactly where to look to get this done in 5 minutes. Good programmers can code. Great programmers can reuse.

Image courtsey of flamingtext.com btw - see your name in big lights, make cool logos.