Say Perl

Worldwide Perl Blogging

Totally
311 feeds,
9627 posts.

Install Finance:: Bank:: ID:: Self to Self transaction download

19 October, 07:08, by Steven Haryanto, machine translated from Indonesian

At the request of the user, the following guidelines on how to use the Perl module Finance:: Bank:: ID:: Self to download your Mandiri bank account transactions. This guide assumes you are using Linux (Debian or Ubuntu) with Perl 5.10 and above. If you use Windows, or Linux with Perl below 5.10 (eg: CentOS 5.x) please adjust itself (or, if one is willing to make a tutorial, please contact me).

Module similar to BCA Finance:: Bank:: ID:: BCA is also available, how to use it similar.

Prerequisites:




  1. Computer with Internet connection Linux operating system (Debian / Ubuntu) and Perl 5.10 upwards
  2. Program curl (to download cpanminus)
  3. Root access (application may also be installed without root privileges, but that simply are taking root)
  4. Mandiri bank account with internet banking access is active (there is a username and password).


Steps:





  1. Install the Perl modules are needed. For convenience, we use cpanminus to install Perl modules. If you have not installed cpanminus, please install it first as follows:

    Open the console, then type:

     $ Curl-L http://cpanmin.us | perl - - sudo App:: cpanminus 
    


    After that, we install the module with cpanminus Independent:

     $ Sudo cpanm-n Finance:: Bank:: ID:: Independent 
    


  2. Configuring the program. Once completed, you will get a download-independent command. Configuring this command to create the configuration file:

     $ Mkdir ~ /. App 
    $ (Create / edit the file download-mandiri.conf)


    The contents of the configuration file is as follows:

     [ALL] 
    username = (your username Mandiri account)
    password = (your account password Independent)


    After that download-lived run independently of the console. By default the program will download transactions in YAML format during the last month. Can also dioutput JSON format and customization date. Add the option - debug if you want to see debugging messages. You also can run this script via cron to run automatically periodically (eg once a week or once a day).



If you're having problems, please reply this blog post.

Yet another issue stringification regexp.

26 July, 09:17, by tokuhirom, machine translated from Indonesian

https://github.com/tokuhirom/p5-lingua-ja-kana/commit/43fe5a964c933b3a64373a60593450a4a231df8e

Lingua:: JA:: Kana does not work on perl + 5:14. Since it depended on regexp stringification.

This code is ugly.

        substr ($ str, 0, 8,''); # remove '(?-xism:'
        substr ($ str, -1, 1,''); # and ')';

Perl 5.9.5 + provides re:: regexp_pattern method for this purpose. I think this code is better to fix issue.

        if ($]> = 5.009005) {
            my ($ pattern, $ mod) = re:: regexp_pattern ($ str);
            $ Str = $ pattern;
        } Else {
            substr ($ str, 0, 8,''); # remove '(?-xism:'
            substr ($ str, -1, 1,''); # and ')';
        }

I think, We need a module named re:: compat or something. But I Will not write That module since this issue is not a popular issue.

Backup data with Perl, rsync, and git

15 February, 07:27, by Steven Haryanto, machine translated from Indonesian

Currently, I store personal data on 2 main directory: ~ / repos and ~ / media. All text files (including source code, websites, notes / writing, configuration, agenda. Org Emacs) placed under ~ / repos in the repo-repo git, per project (Example: there is ~ / repos / settings, ~ / repos / Writings, ~ / repos / perl-Git-Bunch, etc.). All other files in the form of large media files placed in ~ / media.

To backup data in ~ / media, I use File:: RsyBak , which provides command-line scripts rsybak. The script is basically just a wrapper for the rsync command and create a snapshot-based backup snapshot desired historical period (default: 7 daily + 4 weekly + 3 monthly). The script is run every day via cron and backup stored on a separate hard drive / backup.

To backup data in ~ / repos, I use Git:: Bunch , which provides command-line scripts gitbunch. Basically, gitbunch backup using rsync too, but without the history (because git already storing historical change.) In addition, the backup is also just a subdirectory. Git / from each repo. This saves disk space, because ~ / repos still often my coffee into the flash that capacity was limited. To restore from backup, we just do "git checkout" from the backup. Git / each repo this.

Gitbunch Scripts can also synchronize from one directory ~ / repos to the directory ~ / repos other. In essence, "gitbunch sync" is just wrapper to "git pull". In this way, I can synchronize your PC to work netbook or vice versa with ease.

A more detailed article, written for the magazine ever InfoLINUX: personal data management with git .

How is your backup strategy?

Perl IDE: Eclipse + Epic

29 January, 10:24, by koorchik, machine translated from Indonesian

Waiting interesting statistics from the census of 2010

2 June, 16:12, by Steven Haryanto, machine translated from Indonesian

PR newspaper several weeks ago wrote, Population Census in 2010 than the soul purpose of chopping, also wanted to "look for unique facts." One (and only) example: search for the oldest people. And true indeed, for a few weeks there have been several articles which cover about somebody's grandmother in the village who was 115th, and his record was broken by the 120th, then 125th, and so on. Last if not mistaken there are more than 140th (despite all claims of this age based on speech alone, not even a birth certificate or other written evidence).

Of course, besides just looking for the oldest, still there are so many interesting things that can be extracted from this census data. For example, I expect, BPS may publish a list of your first name and last name of the most prevalent, such as that conducted by the American census agencies.

When preparing an early version of the Perl module Locale:: ID:: GuessGender:: FromFirstName , I was having trouble finding a database that can be used, so I took the 1000 name of the customer database terlazim front office. Of course, suppose there is a more representative data, such as the census, and of course much better.

If given the chance, I am willing to process the raw data ;-)

Guessing the gender of people of Indonesia based on a first name

13 May, 09:57, by Steven Haryanto, machine translated from Indonesian

In accordance promise in a blog post several months ago , today I am releasing Locale-ID-GuessGender-FromFirstName . Module name so long huh? :-P

For the future, along with complementary modules are planned, Locale-ID-ParseName-Person, we are also able to guess the gender of the attributes of someone other names, such as the salutation (Mr / Mrs / Bung / Sister), from religious degree (H / Hj ), the pattern name of regionalism (eg, I Ketut / Ni Ayu), etc..

This first release of the accuracy and completeness can not be relied upon, but it can be exercised. I have added around 1000 common names from the database client's office (because the difficulty to find a better database, unlike in U.S. that can retrieve data from the census bureau there). Heuristic algorithm (very) simple also been added, along with algorithms to search from Google.

Anyone have spare time to make a simple CGI scripts, or applications of Facebook, the web interface module for this? Gentlemen gather more data and corrections. I still want aja, just lazy: p

Yada Yada, Why?

18 April, 16:08, by zak, machine translated from Indonesian

Perl 5.12.0 just came out and the new one is Yada Yada operator .

I'm just confused about when or what kind of situation that makes Yada Yada operators can (and good) to use?,
I briefly thought of as pending his RSpec.

Tip sprintf ()

16 April, 02:28, by Steven Haryanto, machine translated from Indonesian

One feature sprintf () (and printf ()) is quite rarely known / used one is that the sprintf () supports the specification of position in the string argument in the format, use the prefix NUMBER + "$":

% Perl-e 'say sprintf (q [% d% d% d], 1, 2, 3)'
1 2 3

% Perl-e 'say sprintf (q [% 2 $ d% 3 $ d% 1 $ d], 1, 2, 3)'
2 3 1

Unfortunately, sprintf () does not support binding by name, as in Python:

print 'This (food) is (adjective)..' format (adjective = 'absolutely horrible', food = 'spam')
This spam is absolutely horrible.

Sometimes the bindings based on a more comfortable, because if the addition / reduction argument, we must not sliding back position. Some specific applications such as translation can sometimes be made more comfortable if the interface uses a name-based bindings.

So, how the solution in Perl? Can with modules such as String:: Formatter , or create your own :-) (as I did recently in Data:: Schema ):

# $ Extra = (mverb => "must"); # mverb also be 'better'
# $ Args = [1, 10];
stringf print ("Data% (mverb) s of% (0) d to% (1) d ', $ args, $ extra);
Data should be smaller at between 1 to 10.

Stringf function () tries to find the value binding in the second argument and so on. The argument can be a hashref or arrayref, so I can use bindings based on the position or name. Comfortable :-)

Language of bad vs. bad programmer

1 April, 19:01, by Steven Haryanto, machine translated from Indonesian

Are we supposed to mourn the fact that Perl is no longer the belle of the language for the Web? It was hard to catch the popularity of PHP, or Ruby and Python programming currently on the Web domain. Once the mid-1990s Perl was chosen because not many other languages available by default on Unix servers. The alternative then is C, shell, or Tcl. Now the competition is very tight / lot. Perl is one of the more difficult / longer than it has learned and images "old" (despite its age with rekan2nya not much different, only about 1-2 years with annual Python and only 5 more to Ruby; all this bahasa2x already nearly or more older than 20 years).

On one side of the lost prestige / momentum / position of champion / whatever would not wear. But on the other hand, there are benefits. The "programmers" of the web tend to generate more bad code so leave Perl. I remember the first time the popular Perl, Perl how communities are considered elitist, eksklusivist, boastful, arrogant, unfriendly to the beginners. And other languages are beginning to get a place in the hearts of the general public because it offers the community a more beginner friendly. (Later, the Perl community began to soften and initiate more embracing effort2x for beginners, such as creating mailing list Beginners @, etc.. But maybe it's too late).

One reason why Perl community "hate" beginner is: because so many are so niubi karbitan/jadi2xan berbondong2x programmers learn Perl, sometimes setengah2x (or seperempat2x!), And always mix the concept of Perl and CGI. Always write Perl with PERL. Always mengenkode own CGI parameters, but in any existing Perl4 cgi-lib.pl (remember Matt's Script Archive?) Always ask for trivial problems that should have been there in the FAQ. Always copy and paste the code and write a program that was so bad hancur2xan.

Now it seems the majority of them have moved to PHP. As a Linux hosting server administrator, I have often had to check PHP application hosting of clients' problems. And every time I peek the source code, I'll sometimes bitter smile, sometimes stroking his chest, sometimes geleng2x head. Program2x ugly and messy it is never extinct. First in Perl, now in PHP. If the MSA had a prickly holes, now there is phpBB, WordPress, Joomla as his successor.

Is Rails or Django will be immune from bad programmers? Do not underestimate the power of stupid people:)

Sorry, I do not intend here berarogan ria. There are various reasons why someone could be called bad programmers, often it is not because he is stupid. Deadlines are too short cause must be the coffee paste the code. Knowledge is minimal due to lack of experience lead to a naive design. The role of language to do the "nudging" and the management incentive to improve the wrong habits are influential, but there is always room for beginner's Mistakes. And always there should be a refactoring. Bad programmer who has never done refactoring.

So, thanks again for the next 10 years a new generation of programmers are no longer as much condemned Perl CGI should maintain the old code that has been rotting. But condemned the PHP code because it inherited a mountain of rotting spaghetti mixed with HTML. Or condemn Ruby because the legacy codes rotten Rails OOP design with an upside-down-behind-pattern and the pattern wrong.

Bad programmers always existed throughout the ages. The language is widely used when it will be a scapegoat. :-)

Competition, competition

31 March, 17:47, by Steven Haryanto, machine translated from Indonesian

(Because again there kerjaan2x not ants and others, too deh post Iron Man week. According to the rules, so the paper should have the status of ane again :-()

Had just read the posting Sawyer X on post Adam Kennedy who plans to complain Dancer and Mojolicious . Very exciting!

IMO, the first Perl community should hold a competition like this inisiatif2x.

Usually that happens frequently in CPAN is the birth of a new module by module, which is experimental or private project owned by orang2x different. Less happy with a module? Make it equal, alternatively, your own version. See how many dozen web framework in Perl since the Catalyst, how many twenty-modules for data validation (ane also donate a nih hehe), and possibly hundreds of configuration modules.

But that makes users confused, how to choose the best modules? Most popular? Fastest? Etc. There is less perbandingan2x or benchmark2x or contests. Perl as a community do not like the competition. Even the counter can download from the first not so dibuat2x.

We need to remember that competition encourages innovation. Lack of innovation is dead.

Let's compete, let us argue with each other positively.

- Sh (What is brewing version Data:: Schema-DFV next to a killer :-)

Autovivication

27 March, 03:12, by zacko, machine translated from Indonesian

Based on the questions of several people who somewhat confused by the term autovivication, maybe I will briefly give a direct example of what it called autovivication.
This he autovivication:

my $ hash;
$ hash-> (aaa) (bbb) (ccc) = 'a value';

When declared, $hash key and has no value, but then we give a value at key 'undefined'.

Yes that's the definition of the shortest autovivication.

After 7 years ...

11 February, 01:49, by Steven Haryanto, machine translated from Indonesian

In 2003 I wrote this article: 8 Things Make Perl Relative Unreadable. Well, 1 year was 8 years old again deh, is that as soon as time passed?

Eniwei, after the past 7 years, of course there are a few things / points in the article that are no longer valid. Evidence that Perl still alive because it remains changed and evolved.

1. Moose and the Perl6 OO systems. Now users do not need insecure Perl, because Perl is now a modern object system and the "not terrible", and even dared to clash deh superior to Ruby, Python, Javascript, etc..

2. Several improvements can we meet readability in Perl 6, among others, the use of variable prefixes more consistent, to access the array and hash elements is now using the @ array [n] and% array (s), not $ array [n] and $ array ( s), you can even actually "alive" only by knowing only one prefix, $, because the array and hash and complex structures can all be accommodated by the $.

There is also a grammar to allow us memodularkan complex regex pattern that becomes much more readable.

But ... Perl is not his name if not let us briefly summarize, the program uses many symbols. No less than dozens of new operators, not to mention metaoperator, and also many new idiom, present in Perl 6. Even all Unicode characters can be used!

Is this a fixed Perl / increasingly unreadable? Repeating the words in my 2003 article, readability something subjective. Does full mathematical symbols are also unreadable? Of course yes, for those who are blind / ordinary mathematics, but certainly not for mathematicians.

Advent calendar Perl 6, RSS in the HP

21 December, 05:27, by Steven Haryanto, machine translated from Indonesian

Blog what is most interesting read in this 2009? No doubt, Perl 6 Advent Calendar, http://perl6advent.wordpress.com/. For a month before Christmas, you'll be presented with interesting articles relaxed style of language which examines each new feature / cool from Perl 6. There is now an 20-article published. There are still a few more days left, do not miss out!

Betewe, since this epidemic bandwagon hape buy kuerti can internetan, though not joining in fesbukan, I find that exciting activities: reading RSS in hape with Google Reader. Was once, the company's most gets it, the most watched mobile browsing usability none other than the Google. And Facebook also possible (but I rarely use). Therefore it can not wait wait for the phone and Google besutan netbuk next year.

The meaning of a name

16 December, 11:31, by Steven Haryanto, machine translated from Indonesian

"What's in a name?" What's in a name, so wrote Shakespeare. "That which we call a rose. By any other name would smell as sweet. "Or translated, shrimp paste remained practically smell the roses.

Of course, in reality, a name usually contains a lot of sense, because we do not give a name at random but with the association, the purpose, expression, or a certain expectation. I remember when a Japanese drama series of the popular 1980 in Indonesia, from kids to dogs neighborhood acquaintance named Oshin. The soul of every age and culture terjejak in the names given to the era / culture is. Period of revolution and the struggle of China had a lot of baby boy named Jian Guo (awake state) or Guo Qing (independence day). On the Internet, sites appear strange name like digg, reddit, twitter, all because he wanted a short name in the domain of scarcity. Com.

Recently I wrote a small module 2 fruit in the Perl programming language, which one to guess gender based on a person's first name (according to the statistics and some heuristic rules), and the other to resolve a name into its components. At the time you read this, the second module is already perched on the Perl CPAN repository site.

In contrast to several similar modules already written for other languages like English are only deals with questions of gender penebakan, Indonesia module name pengurai I completed with a routine to extract all sorts of aspects that are indicated in the name. Including religion (from the existence of titles such as Hajj / Hj, first name like Mohammed / Muh, or abbreviated as FX baptismal name), tribal / ethnic (of a particular naming pattern such as in Bali with names like I Gusti Agung or Ni Made, in Java with Raden, or the first name / surname is very characteristic like Liem for ethnic China, Siregar for Batak, etc.), to professional / educational level (from the academic title). It was very "SARA" is not it? But what is really meant by the issue of racial intolerance?

Gender guesser module is usually used to give a word of greeting to match (can you or Mom) when writing letters / emails, because there are studies that say that the word "wrong address can reduce the effectiveness / response rate / etc (other than to offend of course!). But my name pengurai module, including tools such as race-detection software in facial images, can help

State variables in Perl 5:10

8 December, 05:10, by Steven Haryanto, machine translated from Indonesian

language Perl provides many options including variable scope for programmers. First, there is a global variable (rather variable package, because in fact there is no global variables in Perl; tut tut tut at the beginning of the article is lying? :-)

Second, perhaps the most often we use, alias lexical variables private variables are declared with my () which can only be viewed / accessed by the block or file, or eval where the variable declared.

Third, the local variables for dynamic scoping, using local keywords (), we generally use to store / backup of a variable, then change it in a block, and we'll automatically when the block out of the variable value will be recovered back. We can localize the package variables, filehandle, glob, etc.. In fact we can do something like this:

$config = { foo=>'ujan', bar=>'kemarau' };
...
{
local $config->{foo} = 'blah';
sini();
sana();
}
print $config->{foo}; # 'ujan' lagi


In the example above, we localize a pair of hash alone. We came in here () and there (), the local value $ config-> (foo) will continue to be maintained. This is what dynamic scoping, so it is not based on source code but on the flow of running the program. After the block is complete, then the old value of $ config-> (foo) returned. Fun is not it?

Fourth, there is more to our name (), was introduced since Perl 5.6. This is essentially a substitute for "use vars qw ($ foo)". our () to make lexical alias to a global variable, uh, package variables. Of course, these variables can later be accessed from another package.

Fifth, who became the topic of this blog post, the state variables. This variable is introduced since Perl 5.9.sekian and officially became part of the new features of 5.10. To use it, at the beginning of the script we have to do:

use feature 'state';

or:

use feature ':5.10'; # jangan lupa kutipnya ya...

Uses state variable is to create a persistent lexical variables. Earlier this can indeed be done using the closures, but frankly I'm lazy to memorize. After a state (), then became more motivated to use the lexical persistent.

Lately, I often make a method that returns a constant value / static, for example:

sub config_vars