Editors and IDEs

Comments on editors and IDEs, as I think of them...

 

  • vim
  • NetBeans, Netbeans Ruby IDE, Netbeans Erlang IDE
  • jedit
  • emacs
  • UltraEdit

Erlang and Yaws on Windows With Cygwin

Most instructions on the net seem to assume that you are using the Windows binary of Erlang. I didn't go that route, because dealing with the mix of Windows paths and UNIX paths just bums me out. Everything below is done via a Cygwin bash prompt.

  • wget the Erlang source and tar -zxvf the tarball
  • cd to the source directory
  • ./configure --prefix=/usr
  • make
  • make install
  • Smoke test erl (I just did help(). and q().)
  • mkdir /var/yaws
  • wget the Yaws source and tar -zxvf the tarball
  • cd to the source directory
  • ./configure --prefix=/usr --localstatedir=/var --sysconfdir=/etc
  • make
  • DESTDIR=/. make install
  • "yaws -i" crashes. Oops!
  • Edit /etc/yaws.conf. Comment out localhost and SSL entries; set the remaining http server to use port 8000 instead of80
  • Still crashes. Bummer!

Rollback -- try again after deleting all YAWS and Erlang from Cygwin

  • Download WINDOWS Erlang (R11B), and install to K:\erlang
  • Add K:\erlang\bin to PATH
  • Open a cygwin bash prompt, and
    • smoke test erl (I just issued "q().")
    • tar -zxvf yaws-1.71.tar.gz
    • cd yaw*
    • ./configure --prefix=/usr --localstatedir=/var --sysconfdir=/etc
    • make
    • DESTDIR=/. make install
    • edit /etc/yaws.conf and
      • comment out the SSL server and the localhost server;
      • change the port on the remaining server to 8000;
      • prepend "L:/cygwin" to all paths
      • Remove "/usr" from the first ebin_dir and include_dir
  • "yaws -i" still crashes.
  • Try "make local_install"
  • Edit~/yaws.conf and replace all "/cygdrive/k" with "k:"
  • "bin/yaws -i" still crashes. I give up. I'll install it all under Ubuntu in a VMware virtual machine.
  • Wait! I found a pointer. Trying the following command line from a Windows command prompt appears to start YAWS successfully!
    • erl -pa L:\cygwin\lib\yaws\ebin -yaws debug -run yaws -conf L:\cygwin\etc\yaws.conf -yaws id default
  • Ahhh! Now I see the problem in bin/yaws -- the final line does an eval, and the eval consumes the backslashes. My solution is, near the top, to change the case statement to look like this:


<table border="0"><tbody><tr><td> <pre>case uname in</pre><pre> CYGWIN*)</pre><pre> yawsdir="L:\\cygwin\\lib\\yaws\\"</pre><pre> werl="/cygdrive/k/erlang/bin/werl"</pre><pre> delim=\;;</pre><pre> *)</pre><pre> delim=/</pre><pre>esac </pre><p> </p></td></tr></tbody></table><p>
So my final bash command-line looks like this:</p><p>yaws -i –conf L:\\cygwin\\etc\\yaws.conf </p>

Ubuntu Notes

I'm installing XUbuntu 7 as a 'hypervisor' on my desktop pc.

  1. Partitioned a 9 GB / partition and a 2 GB swap partition
  2. Booted the livecd and told it to install
  3. Reboot when install done
  4. Settings/Login Window/Remote
    1. Style=Same as Local
    2. Configure XDMCP:
      • Turn OFF "Honor indirect requests"
  5. sudo apt-get install xinetd
  6. sudo apt-get install x11vnc
    1. This is because the built-in System/Preferences/Remote Desktop does not support clipboard transfer.
    2. I *could* use TightVNC server, but it doesn't seem to be possible to make it share display 0 with the real console.
    3. In addition to clipboard transfer, I think x11vnc supports some of the TightVNC enchantments to base VNC, so it works well with a TightVNC client.
  7. sudo vi /etc/gdm/Init/Default
    •  Add to the end, just before the "exit 0": "/usr/bin/x11vnc -display WAIT:0 -rfbauth /home/kevin/.vnc/passwd -o /var/log/x11vnc.log -forever -bg -shared -loop -noxdamage &"
    • Note: Until I added -noxdamage, I had the symptom that when the VNC client connected, it would display the current content of the desktop (good), but zero update/refresh/repaint happened (bad). Keyboard and mouse input was getting passed to the server, but no screen updates from the server were getting displayed.  XDamage is an extension to XWindows that attempts to detect "damaged" windows (i.e. they need to be repainted).
    • Note: I tried NoMachine's NX with its "shadow" of the console, and it had the same problem.  I was unable to tell NX not to use XDamage, so I uninstalled it.
  8. sudo vi /etc/gdm/gdm.conf-custom (didn't record the changes)

Download vmware player tar format

  1. gunzip *.tar.gz
  2. tar -xvf *.tar
  3. cd vmware*
  4. sudo ./vmware-install.pl
  5. take the default on all prompts

Notes Learning Haskell

Good wiki book at http://en.wikibooks.org/wiki/Haskell

 

  • Assignment is prefixed with 'let' in ghci but not in ghc or loaded .hs files
    • let x = 3
    • x = 3
  • Assignment of the result of an IO action is via <-
    • x <- getLine
  • Function declarations do NOT use parenthesis or comma.
    • funname parm1, parm2 = parm1 - 6 * parm2
  • List literals use square brackets and commas; they can also be written with colons and an empty list
    • x = [1,2,3]
    • x = 1:2:3:[]
  • List elements must have the same type (i.e. the list's type is "list of x" and not just "list")
  • True/False are written in title case, and have type Bool.
    • True
    • False
  • Strings use proper direct-quote marks. They have type 'list of Char' in addition to String.
    • "string"
  • Characters use apostrophes (a.k.a.single-quotes)
    • 'x'
  • Colon is used to prepend a single value to a list
    • value:list
  • Tuples use parenthesis and commas and need not have elements of the same type
    • x = (1, "b", False)
  • fst and snd retrieve the first and second items from a pair respectively (i.e. a 2-tuple)
  • if statements are of the form:
    • if condition
      • then value
      • else value
  • case statements are of the form:
    • case var of
      • pattern1 -> result1
      • pattern2 -> result2
      • _ -> result3
  • Function composition: the following are equivalent
    • (f . g) x
    • f(g(x))
  • Local variables:
  • let a = 3
    b = 2
    in (blahblahblah,
    bleebleeblee)
  • type names are in title case
  • Basic output:
    • putStrLn <string>
    • show <variable>
  • To monadify something, use 'return'
    • return "abcd"
  • To de-monadify something, use '<-'
    • x <- return "foo"
  • (more coming)

All Computer Languages Stink

All computer languages stink. Some stink less than others.

It is a predictable pattern:

  1. I meet a new language.
  2. I become infatuated with it.
  3. I become disenchanted with it.

I think I have reasonable expectations. A language (and/or its development environment) should be able to:

  1. Use a Windows COM/ActiveX/OLE object via dynamic dispatch.  Visual Basic version 5 is the gold standandard, against which others will be compared.
  2. Call a routine written in C (static linked and dynamic or shared-library).
  3. Parse an XML tree containing thousands of complex records in a few seconds.
  4. Provide list comprehensions.
  5. Support functional programming (including tail recursion optimization).
  6. Have a first-rate debugger. At a minimum, I want single click (or keyed-in command) to set a breakpoint, run-to-breakpoint, step-into and step-over, view content of a variable.
  7. Support working at a high level of abstraction. (i.e. Be highly expressive.)
  8. Serve dynamic web pages from data in any one of the popular SQL databases.
  9. Run on Win32 and Linux.
  10. Support code editing during a debug session to the level provided by Visual Basic 5.

What I don't like about:

  1. Erlang - they retired the interface to OLE/COM/ActiveX (Comet). I use Windows (in addition to other platforms). You can get Comet to work if you don't mind tinkering with the code to support the revised native interface. They say that its type system prevents errors. What I see is that, in order to get any real work done, you end up passing lists of tuples around, and those lists get interpreted on-the-fly, leading to typos in atom names not getting resolved until runtime. The development environment is pretty rudimentary; Erlide, Erlyweb, and Emacs; only Emacs supports debugging (via Distel) and I don't need to get "Emacs pinky."
  2. Ruby - beautiful language; slow execution; threading doesn't actually run parallel due to global interpreter lock; you really must do test-driven development, because it is really hard to write bug-free code with almost nothing checked at compile-time. Also, error messages tend to give the last line in the file as the source of the error, without regard for where the syntax error really happened. (Is this an artifact of having such flexible syntax?) I'm not too enthused about investing a lot of effort in becoming expert in a language that depends upon one man for its definition.
  3. Python - Comparable to Ruby in power; the infrastructure is more mature than Ruby. In principle, I like indentation better than "end" or "}" for marking the end of a block because it is more succinct; in practice, I'm constantly nervous that a tab character snuck into my code, or that something 83 lines earlier got indented by 5 spaces instead of 4. (You know, I'd like an editor that converts leading spaces into 4-column tabs; the oposite of what most editors do, in converting tabs into spaces. That way I could be sure that I didn't accidentally get 3 or 5 spaces when I meant 4.) While I have nothing against Guido personally (never having met the guy), when I read his pronouncements about Python, I do hear the Dictator in BDFL (Benign Dictator For Life). Contrast this with Matz ruminations, which are pretty hard to get upset over. ("Do it this way, the correct way," versus, "Do it the way that that brings you joy." I'm not too enthused about investing a lot of effort in becoming expert in a language that depends upon one man for its definition, although Google might hold things together if Guido were in a car wreck.
  4. SmallTalk -- Remind me why I didn't like SmallTalk? Was it the whole image thing? Would that be OK if I just drank the Kool-aid? Avi seems like a pretty smart guy. (I've not met him, but we did exchange email, and Seaside is pretty slick -- even if it did take me a while to wrap my mind around it.) Small syntax is good. I still love Pascal's one-page syntax chart. (Pascal from Jensen and Wirth's second report -- not Delphi or Free Pascal.) It is almost as slow as Ruby. It doesn't appear to make use of multiple-core CPUs.





  • Free Pascal
  • OCaml
    • COM via http://tech.motion-twin.com/ocamole.html
    • OCSIGEN provides web application framework
  • Lua
    • COM via LuaCOM
    • Web Application framework is Kepler (Xavante helps deploy in Windows)
  • GHC
    • COM via HaskellScript
    • Testing (ala test-o-matic) via QuickCheck
    • HAppS provides web application framework
    • I built HAppS. It doesn't look like Haskell has a package manager, so I had to fetch dependencies based on error messags from "runhaskell Setup.hs configure". The good news is that configure/(fetch/build-fetched/install-fetched/)repeat/build/install, worked smoothly, and the resulting system ran a HelloWorld app without any errors or surprises.
  • Scala(JVM)
    • COM via Java via JACOB
  • Java
    • COM via JACOB
  • Python
    • pywin32
  • Ruby
    • win32
  • Groovy
    • COM via Scriptom (layered on top of JACOB)
  • C++
    • COM native access
  • SBCL
    • COM is apparently unavailable
  • Erlang
    • COM via Comet (which is obsolete and doesn't work with current Erlarg without rework)

SQLite and Ruby on Rails

Sqlite DDL

C:\work\rb\test>sqlite db\test.db
SQLite version 2.8.16
Enter ".help" for instructions
sqlite> create table articles
...> (id integer primary key,
...> title varchar(255),
...> text varchar(1024)
...> );
sqlite> .quit
(or create table articles (id integer primary key, title varchar(255), text varchar(1024) );

C:\work\rb\test>dir db
Volume in drive C has no label.
Directory of C:\work\rb\test\db
14.04.2005 14:14 4 096 test.db
1 File(s) 4 096 bytes
C:\work\rb\test>

Configure database.yml to use sqlite

<p>SQLite does not use authentication and needs only a pointer to the database file.
The adapter parameter tells Ruby to use SQLite for a database.</p> <pre>development:
adapter: sqlite
dbfile: db/dev.db

test:
adapter: sqlite
dbfile: db/test.db

production:
adapter: sqlite
dbfile: db/prod.db
</pre> <p>If you are using SQLite3 use “sqlite3” instead of “sqlite” for the adapter.</p><p> </p><p>(Swiped from a site whose URL I’ve misplaced </p>

GTD Weekly Review (My Checklist)

  1. Clear your desk
  2. Gather all loose papers and process (desktop paper, refrigerator top paper, hipster paper, wallet)
    1. Actionable? Choose one of:
      1. < 2 minutes - do
      2. Convert it to a task
      3. Delegate
    2. NOT Actionable
      1. Trash
      2. Someday
      3. File for reference
  3. Check last week's calendar for carry-forward tasks
  4. Review upcoming calendar
  5. Empty your head
  6. Review my action lists and waiting-for - “What do I really need to accomplish this week?”
  7. Review project lists. Identify the next action to keep the ball rolling.
  8. Review Someday
  9. Update MIT, MIT-week, MIT-month, MIT-year

Using Punch Software to Create a House Plan

Punch architecture software is a lot like democracy - it is the worst alternative, except for all the others we've tried to date.

Here's how I created a house plan with Punch AS 4000 Version 10.

  1. Start Punch
  2. File/New
  3. Start Topo Designer (powertool)
  4. Design/Lot Properties= 180x180. You want a multiple of 3 feet in order to match up with the grid Punch uses for landscape. This is NOT your lot size -- it is the size of your universe. Make it bigger than your lot; include the right-of-way plus a little of the surrounding world, unless you really want the edge of the Earth to be at the edge of your lot. Don't make it too big, or it will slow down Punch.
  5. Save the topography and exit the topo power tool.
  6. Change to floor 1 (click the little house with a 1, 2, or a 3 in it, near the lower-left corner).
  7. Select the exterior wall tool and draw the complete perimeter of the basement, including the foundation wall under the garage.  Draw each wall. You don't have to get the dimensions perfect. Just make sure you enclose the entire foundation.  Don't use exterior walls other than for perimeter walls.

Continuous Integration Rules

There are seven practices that we've found work well for individuals and teams running CI on a project.

                  <ul><li>                            <p>Commit code frequently</p>                         </li><li>                            <p>Don&#39;t commit broken code</p>                         </li><li>                            <p>Fix broken builds immediately</p>                         </li><li>                            <p>Write automated developer tests</p>                         </li><li>                            <p>All tests and inspections must pass</p>                         </li><li>                            <p>Run private builds</p>                         </li><li>                            <p>Avoid getting broken code</p></li></ul><em>From http://www.javaworld.com/javaworld/jw-06-2007/jw-06-awci.html?page=3</em>