Found 15 entries.
After my article last week regarding Dynamic Method Generation in Perl, here's the conclusion.
See Fun Hacking Perl first unless you've already seen it. It took me a week instead of a day to post this follow up... :-)
Overall, dynamically creating methods can seem like a bit of black magic, some hand waving, smoke and mirrors or all three. But in reality it's fairly straight-forward.
Go take a look at the Class::Accessor module (source) and search for ::$accessor_name (there are 4 instances). It's fairly straight forward and really there are only two steps you have to do:
sub$class} namespaceOf course, there is a few more things you have to be weary of and a few more details to look out for but essentially, that's it.
So far, I now have 5 ways of generating 5 different types of methods. It's kinda cool and means I can remove a lot of template code from Zaapt.
Labels: perl, nz-tech, planet-geek
Inserted: 2007-03-28 22:35 (4 years, 10 months ago)
I just used Fuse to mount my home directories on two remote machines - and was pretty painless.
I'm using Ubuntu 6.10 so was fairly easy. I followed the instructions from here - How to mount a remote ssh filesystem using sshfs.
So I did:
# apt-get install sshfs # adduser andy fuse # mkdir /mnt/fowler /mnt/rush # chown andy.andy /mnt/fowler /mnt/rush
Then (after logging out and in again to refresh my groups list):
$ sshfs fowler:/home/andy /mnt/fowler $ sshfs rush:/home/andy /mnt/rush $ ls -l /mnt/fowler ...stuff... $ ls -l /mnt/rush ...stuff...
Note: sshfs fowler:~ /mnt/fowler didn't seem to work. I don't know why, I suspect it should.
Since I use KeyChain for my SSH keys, I usually have those loaded by the time I want to look at a remote machine.
Anyway, it's fairly cool and dead easy.
One funny thing though was:
[metis:~]$ df -h /mnt/fowler
Filesystem Size Used Avail Use% Mounted on sshfs#fowler:/home/andy/
7.5T 0 7.5T 0% /mnt/fowler
[metis:~]$ df -h /mnt/rush
Filesystem Size Used Avail Use% Mounted on sshfs#rush:/home/andy/
7.5T 0 7.5T 0% /mnt/rush
A total of 15 Terabytes of storage :-) especially because fowler only has 40Gb of storage and rush is a 4Gb VPS :-)
Inserted: 2007-03-24 17:29 (4 years, 10 months ago)
Many things have happened this week. Here's a quick run-down.
Following on from yesterday's article about Dynamic Method Generation I didn't get chance to play with it further tonight.
Instead, I had some outside interest (I can't talk about yet) regarding Zaapt and it's blog capabilities. I'd been putting it off, but I just about got it up and running. The example Zaapt sites now have a blog (plus feed).
In other news, I'm in the middle of a big custom content addition for KiwiWriters so hopefully I'll have that out of the way by next week sometime. It's amazing how you're not busy, then three things come along at once.
It's all happening.
Inserted: 2007-03-22 23:50 (4 years, 10 months ago)
I've known Perl a while - a long while. But still, there is more to learn!
Tonight I have been hacking at dynamic method generation. I've never done it before so it has been like a voyage of discovery for me. Of course, I've used many modules which dynamically generate methods but I've never tried doing it myself.
More times than I can count, I've used modules like Class::Accessor and various others. While I know I've browsed over them in Emacs every now and then, I have usually skimmed over the dynamic parts of it.
So learning about it comes down to scratching an itch.
With Zaapt I've been scratching a rather large itch recently so I thought why not go a bit further. Up until now, many of the methods in my database classes have done much the same things - the insert methods look similar, as do the update and delete methods. Mainly the select methods look dissimilar but sometimes they look the same.
Tonight, I started hacking a rather large custom content type for KiwiWriters. I can't giveaway the details at the moment, but suffice to say I was getting bored writing all those methods all the time.
So I searched and stumbled upon this article, Why I Am Not A Java Programmer. As well as being an interesting read, it also has a small section on Dynamic Method Generation. It mentioned Class::Accessor so I took a look at it...
...and It's not quite as scary as I thought it might be.
After reading around and learning a bit more, I'm up to the stage in my own module whereby I've got my initial code for inserts written and ready to test. It doesn't complain with perl -c and I guess it should be okay.
Unfortunately though, I feel fairly unwell at the moment and really will have to go to bed :-(
Overall, it has been a very intriguing evening. I haven't written much of my content model, but I have been learning something new about Perl. That's the first time in a while I have taken that big a jump but damn-it, I have tired and need sleep.
Part Two of this story will be posted tomorrow, when I find out if my code works the way I want it. I'll also post some examples too.
Labels: perl, hacking, dynamic-method
Inserted: 2007-03-21 23:32 (4 years, 10 months ago)
You guys may have noticed that I have been doing a lot recently - due to one thing...having more time.
Living up the coast, a good three hours each day to/from work was good but very time consuming. Now, I live about 5 minutes from work. Some people don't like living that close - I think it's great.
I get so much more time each and every single day that I can get lots and lots more stuff done. I am sleeping more and therefore sleeping well. I have started exercising again. I am helping people do stuff and am also doing more for myself. It's amazing what you can come up with.
I also come home at lunch, which means I can do other chores - like the washing up, washing, tidying and because I have to be back at work, I just do it in little 15 minute stints. A bit strange, but it does mean I don't have to do it in the evening or the weekend - another time saver.
At the moment, I feel so refreshed doing all this stuff. I'm also going to enrol on an evening course of some sort, but not quite sure what it'll be yet. Should be fun!
Inserted: 2007-03-20 23:12 (4 years, 10 months ago)
I just attended a fantastic talk by George Gibbs about his new book, 'Ghosts of Gondwana'.
I became a member of the Karori Wildlife Sanctuary in January after going twice in December and January. As well as being able to get into the sanctuary for a year, I didn't realise that I also get a newsletter and the ability to attend seminars that are on 4 times a year.
Tonight was the first one I was able to attend and it was amazing. The seminar was on The History of Life in New Zealand and it was presented by George Gibbs. His new book, Ghosts of Gondwana, explains a lot but he managed to talk about some of the things that didn't make it into the book.
Learning about the unique fauna of New Zealand is fascinating since we separated from Gondwanaland over 100 million years ago. He told us how some geologists have the theory called "The Drowning of New Zealand" where Zealandier (a geologist term for the larger landmass that originally split off) basically went underwater for a time about 25 MYA - a theory he doesn't subscribe to but interesting to know about.
Of course, this theory would mean that all the animals here would have had to have come here since then. This would also show a major change in the pollen records too but that doesn't look to have been the case. Finally, fossil records here are severely lacking since the country has changed so much over time (and still is) that there isn't that many about apart from a new discovery in Otago. So that doesn't help us either.
(Note: all of this is information in passing, I hold no guarantees any of what I said is right and I also missed out a big chunk of his talk. That's about as much as I understand it anyway.)
My mate came along too and bought himself a copy of the hardback book. He also got it signed by the author, George Gibbs, so that was cool too.
I can't wait for the next seminar. Whatever that is about, I hope it is as interesting as this one was.
Labels: karori-wildlife-sanctuary, george-gibbs, ghosts-of-gondwana
Inserted: 2007-03-20 23:05 (4 years, 10 months ago)
I took my golf clubs down to Christchurch for the weekend and beat my brother-in-law by one shot.
I was lucky to be honest and he was unlucky, but still, I retain the inter-island cup - a small competition we have each time we meet up. Usually we just make rules up at a driving range but this time I took my clubs down and we played a full round.
The course was nice (it was by Darfield, I forget the name) and was mostly forgiving. It was very dry though that didn't really matter and is to be expected on the Canterbury plains at this time of year. The greens though were absolutely lush and were like walking on carpet.
For $15 a round and there being no-one in front of us and no-one behind us, it was a very enjoyable round. A putt on the first hole and a chip onto the green around the 8th or 9th were my best shots.
I think I got 118, which doesn't sound good in itself, but I haven't played for about 9 months so I'm happy with that.
Labels: golf, christchurch
Inserted: 2007-03-19 23:51 (4 years, 10 months ago)
Tonight, I spoke at Wellington Perlmongers. I volunteered to do it last month and guess what, I only started my slides last night!
I did finish them before 3am though, so I got at least a few hours sleep.
All in all, I thought it went well. I meant it to last for maybe half an hour, but I suspect it was more like 45 mins if not a bit more.
My presentation was in two halves: the first was an introduction to Perl/Mason since I don't think the Wellington Perlmongers had had one before, so I had to go over a lot of material. In fact, I hardly touched the surface of Mason at all and I realised that it is a huge subject to tackle.
This was all in preparation of the main part of the talk. It was titled: 'Using Multiple Mason Component Roots: An experiment in CMS Design'.
Basically (ignoring the grand title) it was about writing and using Zaapt using all the technologies and methodologies mentioned in the titles. I told them about KiwiWriters and also about the two demo Zaapt Sites.
All in all, I think my presentation was okay but possibly a bit boring in the middle. It seems that more than just a few people already knew Mason (in fact, probably the majority) but there was certainly a percentage who didn't.
There wasn't many questions about Mason though I learnt a couple of things too. There was, however, quite a number of questions about Zaapt, especially when I started showing them the sites.
One good thing though was that, I now have a copy of Advanced Perl Programming (signed by Simon Cozens) which I was given in return for the presentation. I also have a borrowed copy of Perl 6 Now (Apress) which I shall have a read of and try and write a review for.
I'll throw up a link to the slides once I have them. I reckon they'll appear somewhere on Wellington Perl Mongers Archive page.
Update: 2007-03-14 10:59:54 - The slides are now up. I'll see if I can try to fix the blatent mistakes I made :-)
Labels: mason, zaapt, perl-mongers
Inserted: 2007-03-13 23:13 (4 years, 11 months ago)
After almost, but not quite, 3 months of development, Zaapt now has to move on, grow up and leave home.
This blog has been a lot about Zaapt recently and it's about time it went back to it's varied but still technical days. Zaapt has been lopped off.
But don't worry, it wasn't hurt. Instead, Zaapt has found a new home. In fact, it has found TWO new homes - the other being Zaapt Simple. There might also be a 3rd on the way.
All these sites, along with Kiwi Writers demonstrate the power that Zaapt already has. Even though Zaapt is still in it's infancy there is enough functionality to demonstrate fully working sites - aided by the fact that menus had just been added.
There is some information on the new site already but it only started a few hours ago. Over time the content will grow, just like the Zaapt CMS did. So from now on, Zaapt news and developments will be posted there with an occasional prod from me here if something major is happening.
It seems there are a few big adventures I am currently journeying on! Long may it continue.
Labels: zaapt, kiwi-writers
Inserted: 2007-03-11 23:00 (4 years, 11 months ago)
I have used Google Sitemaps for well over a year, even before they were standardised across search engines. In the spirit of freedom to index, I've claimed the KiwiWriters.org site on Yahoo! Sitemaps too. Let the battle begin.
The problem is, the Yahoo! Sitemaps (or should I say 'Site Explorer') just doesn't have as clear an interface as the Google one does. Neither does it have as many features. It does provide some that Google doesn't but not much.
Maybe I'll go into a discussion one day about the differences, but for now I'll leave it there.
Anyway, at least Kiwi Writers should be indexed properly by Yahoo! now. It's been a few days already so maybe I'll give it a few more.
Labels: google, sitemap, yahoo
Inserted: 2007-03-11 17:07 (4 years, 11 months ago)
After reports in the past saying it would be good for the British Government, finally someone is backing it.
See this article: http://news.bbc.co.uk/1/hi/uk_politics/6430069.stm
I think this quote is great:
"All too often a government IT system is incompatible with other types of software, which stifles competition and hampers innovation"
- George Osborne, Shadow Chancellor
I still think smaller governments, like right here in New Zealand, are ripe for converting over to Open Source and can pave the way forward. The British Government is a lot bigger and I fear would wait until it has been proven elsewhere.
Then again, I remember something about one of the South American countries converting. I'll have a Google round to see what I can find.
Labels: open-source, government, foss
Inserted: 2007-03-10 11:47 (4 years, 11 months ago)
You'd think that menus would be easy. After a good 5 or 6 hours, I've polished them off.
It's funny because some of the things you'd think would be easy take a little longer than you'd expect. Menus for instance.
The one thing menus have is order. Content managed pages don't have order since they're like a hash (yes, this is Perl). News and blogs have an order but that is implicit because of the current_timestamp. Menus have both an implicit order (the order they were put in) and an explicit order (the order the user has re-arranged the items to).
Anyway, in doing the algorithm to figure out which two display fields I had to swap round was a bit of hassle but I got there in the end. Then again, I was (am?) tired, so that didn't help. Moving on...
The menu is a simple list with each item having an integer level. This means I don't have to deal with hierarchical data - in a relational database - so that makes it a little easier. It also means it's really easy to figure out what you want your HTML to do at each level.
As an example, over at KiwiWriters, we only have a 2 level menu. If the level is one, then it is a top-level menu. My implementation writes out each <div> and only puts an extra class on it (to indent it) if the level > 1. As an added trick, if the level == 0, it isn't shown! Nice to hide those Coming Soon pages :-)
Even though the above workings of the menu are simple, it can pretty much accommodate a number of menu systems I have come across in the past. Also, the way Zaapt is designed, means that if someone wants to come along and create AnotherMenu, a HierarchicalMenu or even a SuperWhizzBangMenuWhichGlowsInTheDarkMenu, then that's perfectly fine with me.
Implementations at the ready...!
Labels: zaapt, content-type, kiwi-writers
Inserted: 2007-03-10 01:35 (4 years, 11 months ago)
A short title and that's exactly what it is.
I went swimming yesterday for the first time in a long time. I decided that I really ought to get myself active again since the past few months have been fairly sedative.
I haven't been swimming for a while - about 3 years or so but I found the Wellington Aquatic Centre to be very good. It is also kinda cool since there is shedloads of space for people wanting to do lanes.
When I was a kid, we used to watch the oldies swim up and down and become completely bored, but I guess it's amazing how things change as you grow up (something I'm still working on). But now when I go to the swimming pool, that's exactly what I want to do. Even better than that, there are no kids around since the whole of the middle pool (yes, there are three) is for lanes only.
There is a diving board area and there were also people doing aquajogging, which I found fairly funny. Hopefully as I get older still, I won't be doing that. Overall, the place certainly tries to cater for every audience so full marks to them.
The only downside is that they charge you $4 to get in and then another $1 for a locker! I find this unreasonable since they know there is nowhere else you can put your clothes when you're in the pool. This is like having to buy food from a train buffet car or when you're on a ferry - since you have no other choice they charge the earth.
Very irritating though I now have to come up with a plan to get around it short of turning up in my trunks and goggles.
Inserted: 2007-03-06 23:30 (4 years, 11 months ago)
Every day, something seems to be happening on KiwiWriters.
Members are getting into challenges, the site is improving and there's always something going on.
By the way, this post is a blatent advert for KiwiWriters.org and therefore I have nothing else to say :-)
Except, come and Join Us!
Labels: kiwi-writers
Inserted: 2007-03-06 23:24 (4 years, 11 months ago)
While I haven't done a huge amount to Zaapt recently, it is still getting added to and tweaked.
Each time I add something new to Zaapt, I realise something else about the way in which it all needs to fit together. For example, I just added the ability for a user to edit their signature which will be added to all of their forum posts.
This doesn't sound like a hard thing to do: edit a text field and display it when necessary, but it does throw up a few things to think about.
As I've mentioned before, you learn what a user can or can't do (should or shouldn't?) for each of the content types which have already been added. For the forums so far, the only information that was specific to the user was the total number of posts they had made. This has now changed with the addition of being able to edit their signature (though they are both specific to the user, only one is editable, the other is generated).
Along with the 'Account' type and the 'Profile' type (specific to KiwiWriters, this means there are now more types in which a user can edit information. This could also be used for their site preferences too though that will come at a later date.
All in all, it's been very interesting developing Zaapt so far and though there is a long way to go, I feel it's worthwhile me doing it.
Labels: zaapt, kiwi-writers
Inserted: 2007-03-04 19:06 (4 years, 11 months ago)