Saturday, June 27, 2009

LUA_PATH on OSX

Earlier today I was playing around with Lua and luarocks on my laptop (which happens to be a MacBook Pro). I thought maybe I'd try re-writing telechat in Lua with the LuaSocket package. After I'd installed Lua 5.1.4 via mac ports along with luarocks:
$ sudo port -v install lua luarocks

I installed LuaSocket.
$ sudo luarocks install luasocket

I was under the mistaken impression that when I tried to run some example code, the ENVIRONMENT would be setup and functioning properly. Unfortunately this was not the case:
$ lua
Lua 5.1.4  Copyright (C) 1994-2008 Lua.org, PUC-Rio

> require "sockets"
/opt/local/share/lua/5.1/luarocks/require.lua:256: module 'sockets' not found:
        no field package.preload['sockets']
        no file './sockets.lua'
        no file '/opt/local/share/lua/5.1/sockets.lua'
        no file '/opt/local/share/lua/5.1/sockets/init.lua'
        no file '/opt/local/lib/lua/5.1/sockets.lua'
        no file '/opt/local/lib/lua/5.1/sockets/init.lua'
        no file './sockets.so'
        no file '/opt/local/lib/lua/5.1/sockets.so'
        no file '/opt/local/lib/lua/5.1/loadall.so'
stack traceback:
        [C]: in function 'plain_require'
        /opt/local/share/lua/5.1/luarocks/require.lua:256: in function 'require'
        stdin:1: in main chunk
        [C]: ?

After some investigation I'd realized that the LUA_PATH wasn't set up by the packages that were installed. Since I'd installed the LuaSocket package as the administrator (with the sudo command). I needed to include the system-wide path to the rocks libraries. I did this for my user only by editing my .kshrc file. If  I'd wanted to do the same thing in bash I could have used .bshrc or .bashrc. To do it for every user of the system I could have use /etc/profile and /etc/login.  In any case I put in this line:
export LUA_PATH="/opt/local/share/lua/5.1//?.lua;/opt/local/lib/luarocks/?.lua;;"

After that was included everything ran fine (don't forget to reload your environment.

Adventures in Lua (I)

After studying and working with Lua for about a year now, I find it to be a very powerful and innovative language. While the syntax is not my favorite, overall it's fun to work with. Recently I started using the standalone lua interpreter for some general purpose scripting which has revealed to me a few key reasons that Lua (the language) or at least lua (the interpreter) won't be readily employed for system scripting on a large scale anytime soon.

  • GetOpts - Doesn't exist. Which isn't really a big deal for me.. sure the (korn) shell has it but plenty of other scripting languages don't have it (like AWK)

  • DELIMITERS - in the LUA_PATH environment variable the delimiters are semicolons(;) as opposed to the colons(:) used in most posix apps.

  • RegEx - Lua doesn't have the Posix Regular Expressions Engine nor GNU's or Perls. There are some very innovative constructs for complex (and simple) pattern matching and an equivilent to back references called yank but it's going to take you some time to get used to if you're accustom to regular Unix REs.

  • ARGV[] & ARGC - They don't exist... well not as you might expect them to anyway. There is an arg or args table created with the values passed to the script as command line arguments, however I was told that args is deprecated or will be shortly.

  • COMMENTS - Okay this one is really a minor issue. If you're used to SQL comments as opposed to those in the shell, AWK, Perl, bc, etc.. then you're in good shape. In Lua Comments begin with a double hyphen or dash (--)


As I said before, I really enjoy working with Lua. The systems engineer/hacker in me wants to find as many ways to utilize it as possible. (Yes, I'm crazy like that.) We'll see if I've reached any new conclusions after I've done more applications programming with lua.

Saturday, June 20, 2009

WebOS 1.0.3 available for the Pre but no new Apps.

Earlier today (okay technically it was yesterday) Palm made version 1.0.3 of WebOS available for Pre users. While I'm sure it may have many goodies to increase performance or reliability. The one thing it most certainly doesn't have is a way to magically make Palm get off it's ass and release their damn SDK and get more apps in the App Catalog.

So far I've been relatively pleased with the Pre. There are some sticking points which I presume will be addressed in fairly short order. The thing that's made me most want to chuck my little "river stone" into the river is the fact that there are only (as of this writing) 30 apps available for download from the App Store.. I mean App Catalogue err uhh Catalog.

What are they Thinking?


SmartPhones and mobile internet devices live and die by the applications that run on them. There is no one who should understand this better than the people at Palm. They basically created the SmartPhone with the HandSpring VisorPhone in 2000 and before that they helped create the mobile applications market with PalmOS running on the Palm Pilot 500 and beyond.

What made the Palm Pilot so popular wasn't the ease with this one could pick up Grafiti or the number of stylus taps it took to get to a contact or create an appointment. It was the ability to download new applications and write some of your own.

Seriously release it already


There will likely be a swell of development for the platform once the tools are made available. That is if they don't kill all of their momentum by making us wait too long. They've built a fairly nifty device with a great interface. It's something you want to keep in your hands and play with. The only problem is that there's nothing to keep you occupied while you're holding it.

Friday, June 19, 2009

An AWKing we will go

I've been meaning to setup awkscripting.com for a while. Well it's finally up. There's not much there yet but as I collect resources on awk and continue to write scripts for which most people will call me crazy, it should hopefully grow.

Wednesday, June 17, 2009

Why I'm not doing Plone anymore (for now)...I think

I've been a fan of Plone for 7+ years. I've developed apps based on it and done much consulting related to it. I've contributed monetarily to the project and various members of it's community and as of right now I have no desire to work with it.

While that could change, it's not likely to happen in the next 2 years or so.

The Good


Plone was/is(?) very innovative in the area of Content Management and Web Applications development. It could possibly be the most advanced Content Management System on the market today. The technologies made accessible through/with Plone are amazing and it helps you build powerful multifaceted sites and applications with relative ease.

The Bad


The stack is probably the biggest stumbling block for building applications in Plone. When I'd decided to build a site with Plone (back in 2002), I thought it would be pretty straight forward to get up and running. It was. I thought it would be relatively easy to maintain. It was. I thought upgrading would be a little tricky but easily palatable. It wasn't. Some where around Plone 2.1 they had switched from using "Zope Native" content types to something called "Archetypes" which was supposed to be more flexible and make it easier to build your own custom content types and therefore your own applications. I should have seen the writing on the wall at this point but I was blinded by enthusiasm and ambition.

Plone is an application built on Zope CMF. Zope CMF is a Content Management Framework that runs on the Zope Application Server. The Zope Application Server is written in a combination of Python (for flexibility and rapid development) and C (for optimization and speed).

One of the first problems I'd come across was migrating all of my content from Zope "native" Content Types to Archetypes based Content Types. Then updating/porting my programs to do the same. This was an annoyance at the time but I figured it was well worth the headache as it was making me more familiar with the underlying technologies. My Python hacking was getting better, I'd picked up a little JavaScript, and I could sort of understand the transactional database used to power the applications.

As time went on I got more and more confident in my Zope/Plone hacking abilities because I'd been working on my sites and applications. When I say "working on", I really mean "working on". Methods and functions were constantly being deprecated, if not by the Plone Core Dev. Team then by CMF or by Zope or possibly rearranged by the new version of Python. Between the 2.1 and 2.5 versions of Plone, I'd done no fewer than 12 updates to one application just to address deprecations. Then there's the fact that over the course of 4 years we'd gone from Zope Packages to Zope Applications, to Plone Applications, to Python Eggs as mechanisms for getting 3rd party software installed on a Plone based site.

The Ugly


Many things are changing which I believe could be a great thing in the long run. In the meantime it requires you to be diligent on a number of fronts. Zope Corp. has released Zope3 which has technologies that are being back-ported to Zope 2 (the version that Plone is built on). Those technologies are making their way into Plone and eventually Plone will/should/may run on Zope3. Python 3 is out. Zope may or may not support this new version of Python, which is not backward compatible with previous versions. All of this spells a bunch of heartache in trying to maintain applications written for Plone.

Hope


The community has been great. The list of people to whom I owe a great debt of gratitude for help on things from the minute to the momentous includes

  • Andy McKay

  • Mikko Ohtamaa

  • Alex Clark

  • Ross Patterson

  • Alexander Limi

  • Fabrizio Reale

  • Steve & Donna (at csquaredtech.com)

  • Lorenzo Musizza


That's just to name a few. There are really smart people with great ideas working on Plone. Development is moving at a very quick pace and I think it will get to a point where the product is once again the write solution for many problems. I eagerly await this day. Until the underlying stack is more stable and there are fewer new things that break older ones.. I'll be stearing clear.

Monday, June 15, 2009

Bah hum bug!!!!

I've tried many other engines (SimplBlog, BBlog, S9y, Quills, Plone) and now here I am running on Word Press. I'm not a fan of  Word Press but it does have the advantage of having a very active community and many plugins that provide the functionality that I would otherwise have to build myself. Hopefully having gotten this site/system setup, I can focus on documentation and development as opposed to tweaking and break/fix issues.... we'll see.

Tuesday, June 9, 2009

Pre mature infatuation


Okay so I got my Pre and everyone has been asking me what I think about it. The short answer is "I like it". Those who know me would suspect that there's much more to it than just that. So here is the skinny....

Continue reading "Pre mature infatuation"