Marzhill Musings

Learning Erlang

Published On: 2007-09-17 03:21:21

I have taken on the task of learning erlang. I was trying to decide between
learninng Haskell, OCaml, or Erlang. OCaml, I decided against since it had too
close a similarity to C and I wanted to really stretch myself.
Haskell and Erlang both fit that bill however I found the Erlang
Documentation to be far better for someone completely new to the functional
programming world. Haskell's idea of a tutorial tried to cover too many
concepts at once and took too long to get to the hands on stuff. Also erlang
offered the opportunity to learn Distributed programming concepts along the way
so erlang it was. You can see my first erlang project
etap here.


Tags:

Bricklayer::Templater is on CPAN

Published On: 2007-08-14 16:20:30
And I have registered its namespace so it shows up in the module list. This means the Bricklayer::* namespace can now be used to begin build the various components of my evolving frameworks Bricklayer::Templater

Tags:

Would you like a little Moose with that?

Published On: 2007-03-20 15:57:54
I have found a great new tool in CPAN. Moose is an extension of the perl OO system. It implements metaclasses in an intuitive and easy to understand way. Getting started with Moose couldn't be easier. Make sure you use v0.18 though because the previous version has a few quirks that get in the way. Basically to get started all you need to get started is install Moose from CPAN. I recommend doing so from CPAN because a lot of the distros are behind a little and 0.18 has some fixes that will make your life a great deal easier when using Moose. Once you've installed Moose it's time to start building your classes. In this tutorial I'm going to highlight the most used (in my opinion) features of Moose.
  • has
  • after
  • subtype
A class is composed of attributes and operations for the most part. Some OO systems further divide these into private and public methods/attributes. For this tutorial though we will just keep it at those two. The first thing you have to do in your class is use Moose at the top to import the Moose package.
package MyClass; use Moose;
Now your commited. That use Moose statement has forever altered the way you write this class. Well not really you can turn it off but lets not worry about that right now. Moose does a lot of heavy lifting for you in the background so it's best to just use the moose feature set to build your class from here on out. The first thing we need to do is start writing your classes attributes. For this we will need our handy dandy 'has' function. 'has' will create our attributes for us and automatically do type restriction, create accessor methods, and police reading and writing to them. So what does 'has' need? It needs two arguments a scalar and a list of key value pairs with a minimum of at least one but I recommend 2 keys at a minimum. The scalar is the name of the attribute. The list describes the attribute for Moose so it knows how to set it up for you. The first key, and the absolute must, is the 'isa' key. This key tells Moose what type to restrict the attribute to. It can be a class name or predefined subtype. You can see a list of Moose's of already defined subtypes for us Here : http://search.cpan.org/~stevan/Moose/lib/Moose/Util/TypeConstraints.pm#Default_Type_Constraints You should be able to use those to get started. The second key Moose needs is the 'is' key. This key tells Moose how to police reading and writing to this attribute. A value of 'rw' in this key tells Moose this attribute can be read and written. A value of 'ro' in the key tells Moose this attribute can only be read and not written to. So lets add a couple of attributes to this class.
has 'Name' => (is => 'rw', isa => 'Str'); has 'Purpose' => (is => 'ro', isa => 'Str');
Now our class instances can have a name and a purpose. We can see that both attributes are strings and that the name is readable and writable while the purpose is only readable. This is actually a fully functional class now. It only works to store things since we don't have any operations yet but it is fully useable. A few things to keep in mind is that Moose automatically adds Moose::Object as your classes base class. So you do have a few operations: ->new() is a constructor that Moose::Object provides for you. This allows Moose to properly set up your classes accessors and constraints for you. We could use this class now by calling
my $obj = MyClass->new();
We can set our name by calling
$obj->Name('test');
We can retrieve that name by calling
my $name = $obj->Name();
But wait our Purpose attribute is not writable and nothing is stored in it. How on earth do we get something in there? Ahhh, now we come to Mooses little secret: You don't have to use the methods to access those attributes. $obj->{Purpose} = 'To Show off Moose'; will work just as well with a few caveats. (You see it really is just an extension of the Perl OO system.) Moose doesn't do any policing when you access them this way. This means people who use your class and regard it properly as a black box shouldn't be doing this. Which brings us to two more really handy keys in our descriptive list we are passing to has: 'default' and 'required'. Up to now our attributes have not been restricted from being undefined. setting the required => 1 key/value pair in our list takes care of that. If we do that though then we have to define a default value for the attribute or our class will error on compile with Moose telling us that the attribute is undefined. That's what the default key is for. default => 'To Show off Moose' will set the default value for the attribute to our string. Now our class looks like this:
package MyClass; use Moose; has 'Name' => (is => 'rw', isa => 'Str'); has 'Purpose' => (is => 'ro', isa => 'Str', default => 'To Show off Moose', required => 1);
When we create a new instance of our class with
my $obj = MyClass->new();
our Purpose attribute will be preset for us and not modifiable (without breaking the rules which you would never do of course). That's enough for this post. I'll be posting next on the benefits of after and subtype when it comes to your attributes and Object Integrity.

Tags:

Blender - It's more than a modeller

Published On: 2007-03-12 23:00:55
Blender is known as the most complete Open Source 3D modeller out there for open source. It also has a reputation for being one of those love it or hate it software packages with a steep learning curve. Blender is more than just a 3d content creation package though. It also happens to be perhaps the best video compositing and Non Linear editor available for open source. Cinelerra has a lot of power but isn't particularly great when you need to do a lot of keyframing. Jahshaka has a lot of potential but is unstable and still has a long way to go. Kino only does Digital video. But blender?.. Blender has it all. Blender is quite possibly the only package that gives you an end to end solution for content creation. What can blender do for you as a video editor? Well Just about anything actually. In can composite images and video/animations. It has a non linear video editor. It has an audio seqencer. In just under an hour I did the following short video clip using three still images. Compositing Still Image Test Video Blender has introduced node based compositing and as of 2.43 it has become quite powerful in that arena. The .blend file to do the effects seen above can be downloaded here. Hopefully it will show you some of the power that blender can bring to a video production pipeline.

Tags:

Bricklayer Refactored and other news

Published On: 2007-01-16 23:42:54
Bricklayer has been heavily refactored for more modularity. You can see the much changed codebase at the new svn repository Instructions for SVN Checkout can be found here: SourceForge SVN Checkout Current is the trunk branch in the repository tree structure. Documentation and some examples for the new API will be forthcoming shortly. Including the new DataBase Access API concept I will be introducing. A preview of the proof of concept code is in the Bricklayer/Data libraries directory.

Tags:

The Value of Open Source Platforms

Published On: 2006-04-03 22:34:45
People ask me at times why I like Open Source so much. It's true that OSS can sometimes take a little more work up front. Sometimes, however, OSS is the only way to solve a problem quickly and with the least amount of trouble. Take my current project for example. I have a client with legacy code on an IIS server written in ASP/VBScript. Now I have nothing particular against ASP. In many ways I cut my teeth on ASP. However IIS CGI scripting has a nasty little bug which is rare but just happened to affect me. Certain Database connections will cause the IIS and the CGI application to get out of sync. The result of which is that the webserver sends absolutely nothing to the browser. No error page. No data. Nothing. Now how are you supposed to fix that? The client can't just ditch his legacy code. He can't upgrade IIS without a significant cost. And there is no Patch. There are some workarounds but none of them work predictably 100% of the time. So what is an enterprising Programmer to do? Introducing Apache as a backend server. Apache just happens to be completely unaffected by this little problem. So my solution? Set up Apache2 and Modperl to serve out the data to the IIS server. Use an MSXML object in the ASP code to retrieve the page and display it right along side the legacy code to the browser. Now the legacy code can exist side by side with the new code and In addition we can kill two birds with one stone by taking one more step toward the goal of migrating the application to an Apache/Perl/Mysql orPgSQL infrastructure. What was the advantage of OSS in this situation? It provided a solution that I could implement immediately with no licensing changes, no cost, and no problems. I didn't have to talk to a sales rep. I didn't have to talk to tech support. I just went ahead and implemented it. Now try doing that with a closed source solution. OSS has readily available solutions with little or no overhead. I guess that's why so many hacker types like the environment to work in. We like to solve problems. We don't like waiting on other people to solve them for us.

Tags:

OpenOffice.org || A real competitor to Office?

Published On: 2005-11-07 06:59:30
OpenOffice.org Is it a real competitor to Office? Well now that depends on how you define competitor. Lots of people define competitors to MS Office by the level of interoperability with Office. This has the effect of ruling out pretty much every non microsoft product out there. I'm going to take a slightly different look at the picture. The real question here is can OOo (eg. OpenOffice.org) do everything you need your office suite to do. This is a real world look at what you really need and whether OOo does it and does it well. So lets get on with the review shall we? The list of things your office suite needs to do can be summed up fairly easily. There is the basic functionality that the average home user or small business requires. Then there are the advanced features that the power users and task automaters want. And finally there are the enterprise class features that large organizations want. Here is my semi-detailed list.
  • Basic Functionality
    • Write and Format Text Documents
    • Create spreadsheets to track and analyze numbers
    • Create Presentations
    • Create and embed Diagrams and Illustrations
  • Advanced Features
    • Connect to Databases and use their data
    • Automate Standard and repeatable tasks
    • Creation and Use of Templates for common document look feel
    • Extend the functionality of the app with scripting and or plugins
  • Enterprise Class Features
    • Share and Publish Data
    • Enforce Document Standards
I hopethis will be a useful review that helps you determine if you can use OOo on your desktop at home or at work. OpenOffice.org Writer When you think about it word processing hasn't really had or needed much innovation since the first WYSIWIG editor came out. WordPerfect 5.1 pretty much had all the important formatting features all sewn up along with a lot of the power user features as well. In fact Word 97 was pretty much the top of the word processing evolutionary chain. As for Writer, it has all the elements needed to edit and create documents. You can format them just as easily as Word. You can integrate data from other sources. You can create complex documents and Layouts. So does Word, WordPerfect, and just about every other Word Processing app out there though too. How does a Word Processing program stand out in such a market? While Writer may not have anything earth shattering to offer it does have some pretty nice features to make the task of editing easier. Particularly when working on large complex documents. All the standard word processing features are there including spell checking, multiple fonts and sizes, positioning, lists, and tables. However, Writer does offer something not present in most of the other word processing applications, the Stylist and the Navigator. No doubt inspired by the XML underpinnings of the OpenDocument format, these two features help Writer stand out from the crowd. The Stylist makes using and keeping track of styles easier than ever. It harnesses the power and flexibility of CSS and brings it to the Word Processor. The concept is simple. You can create a library of styles for you document and edit them from a central location. All your headers, all your lists, even your paragraphs can be modified at once. If you change your text-body style in the stylist then every place in your document that uses the text-body style will change at the same time. You can edit them and keep track of them, all from one location. You can even use them again in later documents. This time saving feature comes in very handy and after a while you will wonder how you ever got along without it. The Navigator makes finding that paragraph you need to edit a little easier. It shows you the structure of your document. Need to find that section on grandma's pumpkin pie recipe? Find the subheading in the navigator. Need to find that section on the employee dress code in the company handbook? Look in the Navigator. Where is that chart of the companies quarterly earnings in your report? Yep you guessed it, look in the navigator. In fact, Writer has everything you need to write quality Documents for Home or Business. As far as sharing those documents with others, Writer has a number of options for you. You can export to PDF if preserving the formatting perfectly is your first concern and modifying it is of no concern. If you need them to be able to edit the documents that won't work quite so well though. For that purpose you can export and save the documents to most other common formats. Or you can choose door number three. Offer them OpenOffice to edit and save the documents themselves. It's free and you have every right to distribute it yourself. Burn them a CD and they can modify your document all they want. Trust me, Not using MS Office won't be a deal killer. Not if you provide a quality product and quality service. And for the Home User, there is absolutely no reason Writer won't work for you. OpenOffice.org Calc Calc is the spreadsheet element in the OOo suite. It gives you some serious number cruching power. All the standard functions to sum, analyze, and otherwise manipulate your numerical data is here. It even has everything you need to organize and display that data in all the standard and not so standard charts. Pie charts, bar charts, line charts, and even snazzy 3d charts are all here. The standard stuff all works exactly like spreadsheets have worked since Lotus 1-2-3 was on your local accountants computer. So just how does Calc stand out? OOo is all about sharing information. It's open source, so sharing information is no threat to it's business model. The DataSources panel puts it all at your fingertips. And the Datapilot Wizard walks you through it. Chances are, no matter what database you data is stored in (or you intend to store it in), OOo has a way to connect to it...(out of the box) Oracle, Mysql, SqlServer, Access - OOo has inbuilt connectors for all of them ready to go. Few other spreadsheet applications have this degree of connectibility with this price tag. And it works out of the box. Now, no discussion of spreadsheet functionality, is complete without including the subject of macro's. I've known people who turned macro's into an artform. People who used them to automate so much of their job that they could do the work of 10 people without breaking a sweat. And Calc rises to the challenge. There is nothing Open Source programmers like better than being able to modify the software they use. And OpenOffice Basic puts that power at your fingertips. Whether you just like to use powerful spreadsheet functions or build full blown apps OpenOffice has the macro tools you need to get the job done. If you willing to put in the time to learn you can do anything with them. You won't find you are missing any functionality in this area. Documentation on the other hand can be a little difficult to understand. I and others plan to help with this, so I'm sure it won't be long before that problem is remedied. Will Calc fit your needs in a spreadsheet application? The answer is yes. It has all the functionality you require to process and analyze your data. As for sharing that data? You can of course export Calc documents to PDF should you care to, and save them to the standard formats. A better question to ask though is do you really want to share your data in spreadsheet form? Databases and reports are a much better solution than a spreadsheet. Very few people indeed need to share editable spreadsheets outside of their company or group. And if you do you can always choose door number three again. Nothing stops you from making OOo available to them for their own use. Again, not having Excel, is probably not going to be a deal breaker in your dealings with other people and companies. That, quality product and service aspect, is of much more importance. OpenOffice.org Base A database application was the one thing missing from previous releases of OpenOffice. OOo always had database integration from the ground up with the data-sources panel. And you could use that to generate reports and analyze database data. But no native database interface application was provided. Competing with the hugely popular Access in MS Office OpenOffice came up looking a bit weak. Enter Base, the OpenOffice database application. Base is much more than just a native Database application. It also is a fully functional portal to any database you want to use. you can generate reports, create forms, and edit modify or delete the information for any database you have. Base doesn't care what database you use it just gives you a friendly interface to the data. As far as what kind of functionality that interface provides you, it's pretty much all there. The best part of OOo's database integration is how pervasive it is. It's perfectly possible to do a database report in Writer with all the formatting power that gives you. You can process the data in Calc first, also with all the power that gives you. Base gives you everything you really need when dealing with your databases and the data in them. I don't think anyone will find they are missing functionality here. OpenOffice.org Impress Presentation Software, the app with a niche audience that everyone thinks they need. Personally I think presentation software is overused and misused perhaps 95% of the time. But for that other 5% it's a very handy tool. If your one of those people who use presentation software and actually need it, then Impress has all the tools you might need. It even has some features you might find very handy. That stylist I was talking about makes an appearance here, as well. It's just as handy in Impress as it is in writer. Impress has all the animations, transitions, effect, and formatting options you could possibly need. The same Data integration abilities available elsewhere are here too. You have drawing tools, and you can embed charts, tables, and other elements in your presentations. Presentation software at it's core is like word processing software. It just has to do a few things and there really isn't much innovating left to do. Impress fits your needs just fine in that regard. OpenOffice.org The Suite As a whole the OpenOffice Suite has every feature you might need in an office suite. Whether you need enterprise integration, or just a simple office suite for home use or somewhere in between OpenOffice can scale to your needs. And you certainly can't beat the price.

Tags:

OSS Roundup Series - I trust Open Source

Published On: 2005-10-26 00:14:19
I'm planning to write a series of articles on Open Source Tools and Applications that I feel are ready for prime time desktop useage. I'll write one article for each app and list their relative strengths and weaknesses. If any of you read my stuff for any period of time you'll know I tend to use a lot of Open Source Software. This is for several reasons:
  1. I can't afford to buy commercial stuff
  2. Open Source is one way I am a good steward
  3. I trust Open Source Software
I can't afford to buy commercial I mean really. I have 5 kids, I'm technically below the poverty level, and I need a working decent computer with software to do my job. How am I supposed to shell out 300+ dollars for an operating system, 399 dollars for a low end office suite, 109 dollars for the lowest end development environment, and we haven't even touched the ancillary stuff I'd need. Furthermore I'm supposed to shell that out every couple years? I'm sorry that just won't cut it. If I had to do that I'd have to get out this business altogether. Open Source is one way I am a good steward This relates to the above. I'm a christian so I believe God holds me accountable to how I spend my money. Hardware leaves me little choice. I don't buy top of the line but I do have to buy it. That comes out to a couple hundred here, a couple hundred there. Software is the only place I have an opportunity to cut spending. And I only have that opportunity because of Open Source. Where else can I get an entire operating system, plus a development environment, plus an office suite, plus a whole host of ancillary apps to help me do my job for the low low price of 80 dollars in a boxed set, or 0 if I have an internet broadband connection? Certainly not in Closed Source Software. I trust Open Source Software We've all seen some of the fear being spread around about open source software. It's volunteer driven, it must be lower quality. It's a free for all, anyone might put a security hole in there. You don't have any protection if stuff goes wrong. Who do you turn to when you need help. Let me just say. I've dealt with my share of Commercial Software companies. I've had to wait on the line for tech support. I've used the commercial offerings. They all had bugs. They all people with no clue taking tech support calls. In short it's no better on the Commercial Side than it is on the Open Source. It's a level playing field. At least, if your using open source, someone like me doesn't shudder when you ask if we can help fix your computer. We might even enjoy doing it. More and more software companies are putting out software that phones home. Right now it's optional. Soon it won't be. I have no control over what information is collected about me. So what? you might say. I don't have anything to hide. Well just think about the amount of spam you get. Now multiply that by a large number and imagine your spam filters trying to cope. Outlook Express? It's toast baby. It's not just about having something to hide. Can you trust that company to keep the information safe? Maybe the company has no nefarious plans for it but what about the employees? Or that clever hacker who just found a way in. Can that company keep your information safe from prying eyes? In my line of work I read every day about some major company that had somehow leaked personal information about it's customers. Lives were destroyed, Credit Ratings went down the tubes. I'm sorry but the less people who have copies of my Info the better. I can be sure that mainstream Open Source software doesn't phone home. Because if it did, Someone out there would have blown the whistle. I would have blown the whistle. On the whole us OSS types are pretty sharp about that stuff. So in short, I Trust Open Source.

Tags:

Yet another who doesn't get it...

Published On: 2005-09-18 06:30:50
Stephen J Marshall CEng MBCS CITP betrays his ignorance in an article I found through Slashdot. Now I'm not a OSS fanatic for the most part. I use it and can't justify paying for software when I don't have to. But I don't go around yipping about how Closed Source is BAD. Folks like Mr. Stephen Marshall however really get my goat. Either they don't understand or they don't want to adapt. Let's take a look at his points one at a time.
  1. Intellectual Property:
    Mr. Marshall brings up a favourite recent trend in OSS detractors. IP or the percieved lack of it. He brings up a point about how british patent law may conflict with most paid OSS volunteers. Namely that all the work a british programmer does is owned by his employer, Even work done after hours on his own time. All well and good sounds like the british have an IP law to fix. How does this affect the rest of the world though? Furthermore, most programmers who contribute to OSS as part of their jobs are specifically paid to do so. In those cases the company is expressly releasing their patent rights to the work by giving their programmers time to the project. In fact this is the primary form of quality OSS development. Companies like IBM, Hewlett Packard, even Dell pay programmers to work on OSS. They see it as a viable way to compete with or escape the stranglehold of a software monopoly. Welcome to the free market economy. No monopoly can exist. Someone somewhere will find a way to compete even if it means giving away their software for free.
  2. Conceptual Integrity:
    I am so tired of this argument. Mr. Marshall has obviously never tried to contribute to a thriving, quality OSS application. Believe me it's not a free for all. They don't give away CVS Commit access to just anyone. You have to prove your worth first. And there most definitely is a Gatekeeper. In the case of the Linux kernel its Linus Torvalds. And most every other major OSS endeavor out there has one too. The Gatekeeper decides what patches to take and what to leave. He decides what programmers ideas he want's to include. Yes you might fork the code to do your idea but it won't make it into the "official" version it will be a different piece of sofware. If you fork apache it's not apache anymore. And people will know it. Conceptual integrity is not missing in OSS, nor does the OSS process make it impossible to implement.
  3. Professionalism:
    Again he shows either a complete lack of knowledge concerning OSS or this is blatant misinformation. Let's look at an example. The Eclipse IDE. IBM sponsored it. A foundation monitors it. And it is quite possibly the most useful, powerful, and quality IDE out there. It also happens to be Open Source. How did an open source App get like this? Simple, IBM got it there. OSS is just another development and licensing process for a company to use. It is not a hippie free love fest with anti corporation sentiment as a required component. Somehow I think the folks that IBM pays to work on Eclipse are professional about it.
  4. Innovation:
    I don't even know where to start on this one. X-Windows is the only windowing system I know of that is network transparent from the ground up. It's been open source since the beginning. Firefox? Again, arguably one of the most innovative browsers out there. What do all these apps have in common? They have commercial backing. This guy writes as if OSS has no, and never will have any commercial backing. OSS is here to stay. The free market demanded it. Microsoft's monopoly incubated it. And now, like all segments of a free market eventually do, software development is evolving. This is not a problem, it's just the natural progression of a free market economy at work..
So what is my point? OSS is here to stay. It's time to stop worrying about it and start thinking about how you can use it, make money at it and succeed in the evolving marketplace of software development. IBM has figured it out, Novell has figured it out, and eventually Mr. Steven Marshall will figure it out or become marginalized for his failure to adapt to the new marketplace.

Tags: