October 2013 Archives

Personal hacktivity report (Jul-Sep 2013)

Previous reports: Apr-Jun 2013, Jan-Mar 2013, ...

After a lack of hactivity in the previous quarter, I've slowly resumed development work. Sadly I failed to achieve last quarter's target to setup CPANLists and GudangAPI, and instead have been mostly busy getting my workflow more {d,r}efined, for development of CPAN modules as well as other non-CPAN Perl projects. I blogged about that …

How I manage my Perl distributions

This post describes my current practice. Input/suggestions are most welcome to improve the process.

I am presently maintaining about 300 Perl distributions, 90% of which are CPAN distributions. As mentioned on a previous blog post, I am now developing some non-CPAN Perl software projects à la CPAN, by grouping software components as Perl distribution and releasing them like CPAN distributions, although not necessarily to CPAN. That number is expected to shoot up to at least 350-40…

Distribution-oriented development

Over the past couple of years, my practice of developing and releasing software as Perl/CPAN distributions has spread to my other non-CPAN projects. Software are now being composed as collections of Perl distributions, although they are not released to CPAN (but some components are). I am embracing this practice because:

1) It encourages modularity, a desired property in software. Perl modules are logical groupings of code, and Perl distributions are units of deployment/release.

2) It encourages the "release often" (and release early too?) principle, which feels …

Random ramblings and observations #1

About this posting series: things that should perhaps personal notes, but shamelessly posted. Things that should've been tweets, but are not because they are a tad longer. Things that are useless most of the time.

* Saw a post about mod_mruby for Nginx. Apparently there is also a module to embed Lua, and another one for Perl. After we painfully learned to decouple web application server from webserver (using WSGI, Rack, PSGI), now it's mod_perl time all over again?

Perl module ideas #5

About the Perl Module Ideas posting series. Previous posts: #4, #3, #2, ...

1. App::FTPThis since, well, there is App::HTTPThis. Or perhaps App::DropBoxThis, for the mod…

Download all your blog posts on blogs.perl.org

Perhaps some of you might find it of use: I just wrote (and am running) a script to download-all-blogs.perl.org-posts-of-a-user. It's not as fast as I would like it to be because apparently wget does not accept mixing -k with -nc.

I also noticed that github does not syntax-highlight the script as Perl code. Probably because I use "#!/usr/bin/env perl" instead of "#!/usr/bin/perl".

JSON and alternatives and an extension proposal

The genius of JSON is that it's so simple. It can even be parsed with a single regex, albeit a rather complex Perl-specific one). In a few years, it has practically taken over the world, especially since at the time people yearned for something simpler and saner than XML.

The problem with JSON is that it's too simple. It lacks features. Yesterday while working on an API that is supposed to return PNG images, I was again reminded by the fact that JSON does not handle binary data. Let's see what else JSON does not support: Inf …

My first public, non-CPAN Perl release

I've been contemplating to do something like this for a while, but have only gotten around to it today. Here it is: SHARYANTO-Shortcuts-0.01.tar.gz. So far it's only hosted on github: http://github.com/sharyanto/releases-perl-steven (BTW, I also archive my CPAN releases there: http://github.com/sharyanto/releases-perl-cpan). The release is just a distribution that contains shortcut modules like DD (shortcut for Data::Dump), DDC (Data::Dump::Color), etc. The dist is not…

Most-used modules in one-liners

% perl -ne'next unless /^perl/; 
END { for (sort {$mods{$b}=>$mods{$a}} keys %mods) { 
    print "$mods{$_}\t$_\n";
}}'  ~/.bash_history

Here are mine (top 20 on my laptop):

210     L
70      Bench
67      Progress::Any
44      Data::Dump::Color
43      Carp::Always
39      Progress::Any::Output
37      Mojo::DOM
36      File::Slurp
35      Data::Dump
32      Text::ANSI::Util
30      Perinci::Sub::Util
27      SHARYANTO::Package::Util
22      Text::WideChar::Util
21      Time::HiR…

Scalar::Util::looks_like_number

I had a recent discussion with a Data::Dump::Color user about formatting ints/floats/stringy numbers differently. So here's a short summary of how core module function Scalar::Util's looks_like_number() can be used to detect the different data types:

perl -MScalar::Util=looks_like_number \
-E'printf "%6d # %s\n", $l=looks_like_number($_), $l20?qq("$_"):$_ 
for ("str", 0, 1, "1", "1a", -1, "-1", 0.1, "0.1", -0.1, "-0.1", 1e20, nan, -nan, inf, -inf)'
     0 # "str"
  4352 # 0
  4352 # 1
     1 # "1"
…

Backing up private data securely

My situation: work on PC at the office, on laptop elsewhere. All of data already in git repositories--well almost, photos and videos are currently out, due to their size. I use SSD on both computers, and my partitions are encrypted.

Some of the data are public, like open source Perl projects. Some work-related, where we have our company git repos. And some private, like personal notes, addressbook, agendas/todos, ledger files, etc.

Since I've read that SSDs usually die without any warning, I am quite paranoid and install post-commit hook to …

About Steven Haryanto

user-pic A programmer (mostly Perl 5 nowadays). My CPAN ID: SHARYANTO. I'm sedusedan on perlmonks. My twitter is stevenharyanto (but I don't tweet much). Follow me on github: sharyanto.