|
Recent Entries...
Re: Catching up through week 7
Re: Porting a non-Moose object to Moose
Wow, look what I found,
greedy genius ...
Re: Porting a non-Moose object to Moose
Kevin,
You're right, that does seem a little confusing. ...
Re: Porting a non-Moose object to Moose
Wait. I'm confused. Moose isn't the tool to reach for. So...
Re: Porting a non-Moose object to Moose
You should switch to MooseX::Types to declare your Typed and...
Porting a non-Moose object to Moose
I'm currently working with a lot of legacy code in an envi...
Testing strategy for mocking code
I keep finding myself using the following idiom for writing ...
Re: Library Woes on OSX
Have you considered changing your hosts file so it connects ...
Re: Library Woes on OSX
Right now the tests for Device::USB are failing. I've turne...
Re: Library Woes on OSX
What's the USB device you are trying to connect?...
|
|
weblog | `web·lôg -läg |
noun
Another term for BLOG
ORIGIN 1990s: from web in the sense [World Wide Web] and log in the sense [regular record of incidents.]
blog | bläg |
noun
A web site on which an individual or group of users produces an ongoing narrative.
ORIGIN a shortening of WEBLOG.
Bad at blogging
 Posted by
on Thursday, March 06 2008, 1:44am
So, I'm really bad at blogging.
But it seems I'm OK at microblogging.
Starting tonight, I'll be posting my daily tweets from twitter.
With any luck, I'll be embarrassed by having my only blog postings be from my daily microblogging.
Yeah, right.
Related Photos:
None
New term coined
 Posted by
on Wednesday, October 17 2007, 2:29pm
Someone on #perl on irc.perl.org complained of someone else "blogging on IRC".
Well, blogging (as you can see above) is the short form of weblog.
On IRC, there is no web.
So, IRC logging (of events happening in one's life) is now known as "clogging". Instead of weblog, it's irclog, shortened to clog.
Enjoy.
Related Photos:
None
Slow no more
 Posted by
on Sunday, September 16 2007, 5:16pm
Hooray!
Shortly after complaining about how long my main page was taking to load, I started thinking up ways to make it go faster. As far as I could see, one option would be to try to parse the perl with perl - but just borrow all the ideas and regexes from the perl.vim vim syntax file. Easy enough - just figure out what the metacharacters in vim map to in perl, etc etc and so forth.
About a third of the way through my translation, I realized it was going to be harder than I was expecting/hoping, because there are some conventions in vim's syntax files that makes that sort of thing somewhat easy.
Plus, I wasn't even sure how good the translations were, or whether or not they'd even do anything useful:
my( $I, $i )
= ( qr/[A-Za-z_]/, qr/[0-9A-Za-z_]/ );
my $packageRef = qr/(?:$I$i*)?(::|')$i/;
my $varPlain
= qr/\\?(?:[@%\$]|\$#)\$*(?:
$I$i)?(?:(?:::|')$I$i*)*\b/x;
my $functionName
= qr/\\?&\$*(?:$I$i*)?(?:
(?:::|')$I$i*)*\b/x;
Yuck.
I toyed with the idea of doing something with PPI, but quickly dismissed that.
I then thought I might've remembered reading something about creating some kind of "vim server" with Text::VimColor - so a quick read of that yielded nothing. But I noticed the link in SEE ALSO to Apache::VimColor, which thank goodness mentions Cache::Cache (and sibling Cache::FileCache).
What was I thinking?
So the solution was exceedingly simple:
use Cache::FileCache;
use Digest::MD5;
sub vimformat {
my( $self, $text ) = @_;
my $key = Digest::MD5::md5_hex( $text );
my $cache = new Cache::FileCache;
my $return = $cache->get( $key );
if( ! defined $return ){
$cache->set( $key, $return );
}
return $return;
And just like that, the page is back to being under 2 tenths of a second to create. Even with (as of this post) more than 10 hunks of syntax colored code.
Yay!
Related Photos:
None
Claiming my blog
 Posted by
on Tuesday, August 28 2007, 10:32pm
Just a quick post claiming my blog by posting a link to my Technorati Profile.
Please drive through.
Related Photos:
None
Testing with vim
 Posted by
on Sunday, April 15 2007, 5:37pm
Wrote a quick little perl wrapper around vim to automate posting entries to my blog.
Really threw it together pretty quickly, but wanted to save myself the trouble of opening a web browser, typing in the site name, scrolling down, clicking on "login", logging in, etc. Just a whole lot of work. Quite honestly, no one should have to put up with that.
Maybe I should see about writing a plugin for vim, since the perl wrapper is a little hackish.
Tags, topics, categories... Photos!
 Posted by
on Thursday, March 29 2007, 6:15pm
I've already revamped my photo gallery to use the same look and feel as everything else on my site now.
But there's a small problem - now I want to add tags (topics) to my photos, and have pretty much the same functionality as I now have with my blog.
While the primary CGI that drives the main display was completely re-written, the interface I use to add captions to the photos is pretty much still the same old code, and might be a little harder to work with.
But I think I'll give it a go anyhow.
More updates
 Posted by
on Sunday, March 25 2007, 10:00pm
So, it's nothing particularly earth shattering, but I've made a few updates.
- I've added an "archives" section, so it's a lot easier to jump to older posts if you're looking for something I wrote in a given month and year. Granted, there's not a lot to choose from at this point, and it's pretty obvious where I took a few breaks from posting (the first break was pretty long, and in fact was due to some of my misunderstandings).
- I decided that making the links for newer/older posts to be like
/start/blah/ instead of like ?start=blah really wouldn't be that tough, so I just went ahead and did it. I'm wondering if this is a good way to go about it though, since the "start" links are fairly ephemeral - for each and every post, those numbers shift.
- I also broke some of the uglier code out to separate subroutines. The following seemed to clutter things up in index:Local:
map {
my $hashref = $_;
my $entry = $hashref->{blog_entry};
$entry = $c->textile->process( $entry );
if( $entry =~ m/(<pre.*<\/pre>)/s ){
$entry =~ s/(<pre.*?<\/pre>)/
blog::View::Code->vimformat($1)/xseg;
}
$hashref->{blog_entry} = $entry;
$hashref;
}
blog::Model::BlogDB->get_roots( $startrow );
Also of note is that most of the temporary variables above are leftover from when I was using Kate for code syntax highlighting - the "format" method clobbered (didn't localize) $_, so I had to assign $_ to something else. I could probably take that part out and condense it a bit, but I'm not yet sure if that would interfere with readability.
Related Photos:
None
Text::VimColor works!
 Posted by
on Tuesday, March 20 2007, 12:28pm
Turns out I was able to get Text::VimColor to work after all - seems I wasn't quite reading the documentation properly. See, vim needed a little help to figure out what's what - in this case, what kind of terminal it's attached to (which it isn't in this case, which is running as a CGI under apache).
According to the documentation for vim:
-T {terminal}
Tells Vim the name of the terminal
you are using. Only required when the
automatic way doesn't work. Should be
a terminal known to Vim (builtin) or
defined in the termcap or terminfo file.
So all I really needed to do was give it a hint so it wouldn't complain about not being attached to a terminal. Therefore, the solution is:
my $vim = Text::VimColor->new(
string => $code,
filetype => $filetype,
vim_options => [qw(-RXZ -i NONE -u NONE -N -T xterm) ],
);
Unfortunately, it's slow.
It's a known issue - this is why Apache::VimColor uses caching to speed up the HTML generation. In fact, with five code snippets on the main page (just prior to this current time of writing) case the page generation speed to go from about 0.07 seconds to nearly 1.1 seconds. That's quite an order of magnitude increase. And that's not counting adding these two snippets in a single post, nor the posts in the future that will undoubtedly have more code and other syntax colored snippets.
Related Photos:
None
Trying to display pre tags inside a pre block
 Posted by
on Saturday, March 17 2007, 11:00pm
I think I know why I can't show HTML pre tags inside a pre block, and it's not Kate's fault, and it's not Textile's fault.
It's my fault.
if( $text =~ m/<pre class="([^"]+)"/s ){
$lang = $1;
$text =~ s/<pre[^>]+>(.*)<\/pre>/$1/s;
}
See the problem?
I'll probably have a few more posts about this until I figure it out.
But it's not like you were doing anything better than reading this :)
What days do I post?
 Posted by
on Friday, March 16 2007, 4:00pm
As a follow-on to my last statistical post, I thought I'd also create a graph that tracks what days I generally post on.

The SQL is amazingly the same, but only slightly different. In fact, nearly everything is exactly the same -- I should just generalize the code.
Related Photos:
None
When do I post?
 Posted by
on Wednesday, March 14 2007, 10:00am
I ran across some guys' blog recently where he decided that for every 100 posts to his blog, he should figure out some of his blogging statistics. Or something like that.
One of which was to see what time of day he generally posted. He explained some procedure for doing a database query from the shell, piping the output through some command line utilities, and then running some commands or somesuch to feed into some graphing program (gnuplot) to produce a chart.
Seemed like a terribly manual process.
Inspired by that, I created the following:

Which is pretty much what I stated, but it updates automatically. As in every time it gets displayed. What you see above is current, even now. However long ago this was actually written.
For the morbidly curious, the SQL to create the data looks like this:
select count(*) as posts,
substring(blog_date,12,2) as hour
from blog
group by hour;
Related Photos:
None
|
|