Giter VIP home page Giter VIP logo

perlmaven.com's Introduction

###Status Build Status

Perl Maven

These are the source files of the articles published on http://perlmaven.com/ and its sub-domains.

The source code of the application running on the server can be found in the https://github.com/szabgab/Perl-Maven repository.

Copyright

All the original English articles are copyright Gabor Szabo, except where the =author field has the name of someone else. In those cases the person listed in the =author field owns the copyright. The translated articles are copyright the translator as mentioned in the =translator field and the original author as mentioned in the =author field.

License

All the Perl 5 examples are "free software". You can redistribute them under the same terms as Perl 5.10.

The articles and the translations are licensed as CC BY-NC-ND http://creativecommons.org/licenses/by-nc-nd/3.0/

FORMAT

See https://github.com/szabgab/Perl-Maven/blob/master/docs/FORMAT.md

Add an 128x128 image of you to the static/img/ folder and an entry for yourself in the authors.txt file in the root of the repository.

TRANSLATIONS - LOCALIZATION

Each language has a subdirectory in the sites/ folder.

Initial language codes were a bit random, but we will try to stick to the way Wikipedia describes: https://meta.wikimedia.org/wiki/List_of_Wikipedias

  • English en (the 'original' files)

  • Simplified Chinese cn

  • Traditional Chinese tw

  • Esperanto eo

  • French fr

  • German de

  • Hebrew he

  • Indonesian id

  • Italian it

  • Korean ko

  • Nepali ne

  • Portuguese (Brazilian) br (sorry Bretons)

  • Romanian ro

  • Russian ru

  • Spanish es

  • Telugu te

  • Turkish tr

  • The file names (that become the URLs) should be in LOCAL_LANGUAGE, but use only ASCII characters. Transliterated to English. (I am not sure in this. Maybe a better thing would be to use LOCAL_LANGUAGE in the URLs?) http://support.google.com/webmasters/bin/answer.py?hl=en&answer=182192 .

  • The file names should more-or-less match the title of the page, they can contain words separated with dashes.

  • Please add the header to each file (the meta information) including the planned publication date

  • The links in the page should be working. If there is already a translation for the target page then link there, if it only exists in English, then please use full URLs including the hostname http://perlmaven.com/ .

  • Please update the hidden(!) section of the perl-tutorial.txt to include the links to the entries.

  • The text listing the author and the translator are added by the system and are driven from the header tags =author and =translator.

  • Each author and translator has to have an entry in the authors.txt file listing a nickname (\w characters only), The full name, the name of the image file containing their picture, link to their G+ profiles.

  • Each author and translator needs to provide a picture in jpg or png format approximately 128x128 pixel size (an Avatar) to be shown at the bottom of each article.

  • Each author and translator should set up authorship by linking their Google+ profile to the CC.perlmaven.com site. (e.g. br.perlmaven.com for the Brazilian Portuguese translators) See http://support.google.com/webmasters/bin/answer.py?hl=en&answer=1408986

The translation process:

  • The translator creates a new file in the sites/CC/drafts folder.

  • When s/he has finished the translations s/he adds the link to the translation in the perl-tutorials.txt file in the open part, and moves the translated file to the sites/CC/pages folder. and updates the =timestamp in the translated file to the current date/time, or slightly in the future (maybe 12 hours) to allow Gabor the time to publish it. (This =timestamp is used to generate the front page, the atom feed, and the order in the archives page.

  • in some cases we would want to synchronize the publication of the same article translated to several languages. In this case the translator should move the translated file to the sites/CC/done folder.

  • Push to your repository and send a pull request.

  • Gabor will periodically merge the pull requests and push the source to the live site. (Actually Gabor periodically merges from the public repositories of the translators in any case, but a pull request provides some opportunity to send messages.) He will try to check for html issues, but cannot check the correctness of the translations.

Comments

We use https://disqus.com/ as the commenting system. The English version is moderated by Gabor. If you'd like to enable comments on your language, and if you are willing to moderate it then please create an account on https://disqus.com/ and tell Gabor about it.

Moderation requires that you follow all the comments that arrive to the site and see if they need any attention. Spams are usually filtered by Disqus, but a few can slip through and there can be an occasional false positive, something that is marked as spam but it isn't really. The moderator also has to make sure that the comments stay civil and not hesitate to remove irrelevant or offending comments.

Getting started with the translation

  • Sign up to GitHub, configure Git on your computer (name, email)

  • Fork the https://github.com/szabgab/perlmaven.com repository and clone the fork to your computer

  • If the specific language does not have a CC directory yet and does not have translated pages yet:

  • translate the first page sites/en/pages/installing-perl-and-getting-started.txt as sites/CC/drafts/installing-perl-and-getting-started.txt or as sites/CC/drafts/TRANSLATED-BUT-TRANSLITERATED-TITLE.txt as is acceptable in other sites in your language.

  • Add =original and =translator entries to the translated file

  • Add yourself to the authors.txt file and add a 128x128 picture of yourself to the static/img/ folder.

  • Please read option 2 here: http://support.google.com/webmasters/bin/answer.py?hl=en&answer=1408986 and add the perlmaven.com site to the list of where you contribute.

  • Update sites/CC/pages/perl-tutorial.txt to include the page in the commented-out section.

  • Push your changes to your forked repository and send a pull request

PROMOTION

When articles are published they are posted to Google+, Twitter and sometimes even to Facebook. They are also posted on LinkedIN.

An e-mail is sent out to the people who registered on the Perl Maven site.

Many of the articles are included the Perl Weekly newsletter.

Once in a while I post a link to Reddit ( http://www.reddit.com/ ) but I'd rather see others post there if they find the article worth the mention. The same with Hacker News: https://news.ycombinator.com/

The translators also need to take on themselves a large part of the promotion in the language communities. Both in the Perl community - to get help from others - and to the general public.

This can be by posting on the language sub-Reddit (e.g. on http://www.reddit.com/r/Romania )

Sharing the articles on Google+, Twitter and Facebook should be almost automatic.

Getting the RSS feed of the site to be included in some local 'planets'.

SEO explained in 5 words

"Get links from trusted sources" ~ Jon Morrow

The best promotion is if people find it worth to mention one of the articles in a blog post or in some other form.

Git and Github

There is good and free book about Git called Git Pro http://git-scm.com/book

Install Git on you desktop configure username and password generate ssh key: https://help.github.com/articles/generating-ssh-keys

Create a Github account, let's say your username is USERNAME: Upload the ssh key to your account On Github 'fork' the https://github.com/szabgab/perlmaven.com repository It will create another repository https://github.com/USERNAME/perlmaven.com

clone it to your desktop:

$ git clone [email protected]:USERNAME/perlmaven.com.git

It will create a directory called perlmaven.com inside all the source files. There should be one called sites/CC (where CC is your language code based on this list: https://meta.wikimedia.org/wiki/List_of_Wikipedias more or less). If there is no such directory ask Gabor to create one.

Initially you will need to know about

$ git add  filename
$ git commit -m "message"
$ git push

And on Github there is a button to "Send Pull request" that will notify me to look at what you pushed, but of course I am also available by e-mail and GTalk.

To follow the changes in the central repository and keep your own fork up-to-date, do the following:

In your working copy do this once:

$ git remote add upstream git://github.com/szabgab/perlmaven.com.git

Then every time you'd like to sync:

$ git fetch upstream
$ git merge upstream/main

Github workflow for translator and reviewer

For some of the languages there are more than one translators, and they like to review their translations before pushing it out. This is a recommended workflow for them.

Let's say there are two people involved one has a username 'translator' the other one username 'reviewer' on Github

translator:

fork      https://github.com/szabgab/perlmaven.com
creating  https://github.com/translator/perlmaven.com

reviewer:

fork      https://github.com/szabgab/perlmaven.com
creating  https://github.com/reviewer/perlmaven.com

translator:

do the translation, put the file in the sites/CC/drafts/ folder and push it to Github

reviewer:

$ git remote add joe_the_translator git://github.com/translator/perlmaven.com.git
$ git fetch joe_the_translator
$ git merge joe_the_translator/main

Now the reviewer also has the file in her drafts/ folder locally The reviewer can make changes locally, commit them and push them to Github.

translator:

$ git remote add sally_the_reviewer git://github.com/reviewer/perlmaven.com.git
$ git fetch sally_the_reviewer
$ git merge sally_the_reviewer/main

Now the translator has the changes from the reviewer.

The fetch and merge parts can be repeated, the git remote add part only needs to be done once.

Once the translation is ready. The file can be moved from drafts/ to pages/ by either the translator or the reviewer:

$ git mv sites/CC/drafts/article.txt sites/CC/pages/article.txt

pushed it to Github and a merge request can be sent to Gabor.

perlmaven.com's People

Contributors

aramisf avatar balueee avatar bkbase-robot avatar borgified avatar choroba avatar danimera avatar davidegx avatar fayland avatar giatorta avatar grubert65 avatar gugod avatar gypark avatar kbeyazli avatar keedi avatar khadis avatar lyjbupt avatar midlifexis avatar name2rnd avatar nanis avatar newbcode avatar nselem avatar rozie avatar shatlovsky avatar spidamoo avatar stefansbv avatar swuecho avatar szabgab avatar tjaensch avatar upgradeksh avatar zipf avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

perlmaven.com's Issues

compare-the-speed-of-perl-and-python-regex

https://perlmaven.com/compare-the-speed-of-perl-and-python-regex

Oof. I know this is a pretty old post, but also very misleading. It says 20 times speed difference between Python and Perl, but it just uses regexp in Python in very inefficient way, and what is measures is actually not regexp speed, but other aspects of the language.

First: If you use c = re.compile(r'y') before you even a start of the loop, and then c.search(line), difference shrinks to 2 times. (Perl does it implicitly to some extent because it compiles regular expression at perl source code parsing time, something that JavaScript for example often does, but cannot be done with Python out of the box).

Second: If you actually first do a proper control test, and test just looping with a function does only return false, instead of calling regexp engine at all, you will see that the time difference as well as absolute different is still similar. Which means you are not testing regexp speed, but other things in the interpreter and language.

The article conclusion:

The regex engine in Perl is much faster than the regex engine of Python.

is simply false. It is faster, and easier to use, but not astronomically faster, and highly depends on regexp.

Sure, perl has easier to use and usually faster regexp, but the tests in the article are just done in a very lazy way. It took me more time to write this "comment" on github, than run proper tests.

Mismatched braces in first listing.

https://perlmaven.com/indexing-emails-in-an-mbox

No biggie. Just noticed an extra final closing brace in the first listing in this article.

I would love to learn more. I need to read more of your articles. I'm not sure what is the advantage of using main::cnt instead of just declaring a global "my cnt;" somewhere early on. I'll try to read & learn more from your articles.

Peace -- Marnix

get keys values from array of hashes

hello, I'm not very good at this. I can get the keys and values from a regular hash and write them as a .csv file to disk.
I can get the values from individual keys in an array of hashes, which your excellent web site showed how to make.
$L_vars[0]={
image_file=>"my_images",
start_frame=>30,
end_frame=>50
}
but I'm having problems getting the keys, values from that as can't find the syntax to address the hash.
help appreciated.
regards
mick

Slight doc error

https://perlmaven.com/counter-dancer2-redis-docker

docker-compose up gives me:

% docker-compose up
no configuration file provided: not found

Apparently, I need a docker-compose.yml at this point.

Comment: Integer Overflow

I love it! However this code will end long before the computer system runs out of memory - since the Fibonacci numbers grow exponentially (as φ^n), this will exceed the maximum integer storage very quickly.

If we take the maximum integer value of 2^64, this will be exceeded by the 93rd Fibonacci number. If we're looking for accuracy of resolution (which is lost around 2^53, the value will no longer be accurate after the 80th Fibonacci number.

P.S. This is my first GitHub post; please let me know if I'm doing this wrong.

Multiple Attachments

Deal Perl Maven,

How could I create an email with multiple attachments?

I need my Perl script to email out PDF's and Email files to various distribution lists.

Thanks

Dead Link in https://perlmaven.com/perl-based-open-source-products

file in this repository: sites/en/pages/perl-based-open-source-products.txt

under "Mailing list", the link to Minimalist points to a domain parking site.
On archive.org, the latest "working" version is from June 2014. There seems to exist a fork on github madroach/minimalist with latest commit in November 2014.

Since it is no longer maintained (the page on archive.org explicitly says so), Unless someone resurrects it, I think it should be removed from this list...

is this an unnecessary warning from Perl's undef

https://perlmaven.com/use-of-uninitialized-value

In this use case, $x becomes undef. I doubt it matters why, but as an example, reading an expected numerical value from an external database can cause it if the code return is empty.
Then a choice has to be made : create another database with not-null values, or assign a value of '0' (zero) in Perl, thus :
< if ($x[$k] eq '') {$x[$k] = 0}>
where $k is a variable that sets an index to the array @x.

When the code is run, a warning is returned for each undefined value.
This isn't necessarily a problem, as the warnings can be ignored, but I would prefer to be able to set a flag to temporarily prevent the warning message being thrown.

Comment on Post

The most important use of T::RL::G, in my opinion, is to make perl -d useable.

Simple Typo

some people thing -> some people think
See line 13 of source.

static variables and loops

https://perlmaven.com/static-and-state-variables-in-perl

Something to watch out for is the use of a static variable in a loop construct.

Eg:

{
	my $stated=0;

	sub counter
	{
		for $stated (1..5) {
			print "$stated\n";
			&resetcount if ($stated>3);
		}
	}

	sub resetcount
	{
		$stated=0;
	}
}

counter();

In this example the call to resetcount when $stated>3 does not effect the value of the loop or the $stated in loop. Consequently, the loop iterates 5 times quite happily. This also applies in a while loop, where the while test will not test a change of value executed in a sub that is called outside the scope of the while.

Dumping GitHub Action error logs

Thanks for blog post https://perlmaven.com/install-developer-dependencies-first-test-css

After applying your pull request to https://metacpan.org/dist/Date-ManipX-Almanac I decided to dive into the the file to try to bend it to my own biases. The most significant change so far was to try to run multiple versions of Perl -- the latest available, and the oldest the distro supports (or the oldest available, if they're different). The distro your pull request was against was written to Perl 5.10, which caused no problem. The next one I tried was written to Perl 5.6.2 and produced exactly the error you describe under darwin and ubuntu (Windows uses Strawberry and does not go back before 5.14). Lacking a way to troubleshoot, I simply pretended Perl 5.6.2 was not available on that platform and used 5.8.

Now I have a way to dig under the hood and find out what is really going on. Thanks again.

Serious error: Row and column labeling is opposite

Thanks for your article on reading Excel from perl! But there is a serious error, regarding rows and columns, that is causing much confusion among readers. You wrote: "The next snippet will read the first row of the first sheet (which is usually represented by the letter A)". But spreadsheets do not use letters to represent rows. The COLUMNS are represented as letters, and the rows are represented as NUMBERS. Consequently, the output is incorrectly labeled in the snippet of code that you show for displaying the content of a row. The corrected code should be:

    my @row = Spreadsheet::Read::row($book->[1], 1);
    for my $i (0 .. $#row) {
        say chr(ord('A')+$i) . '1 ' . ($row[$i] // '');
    }

And the output is similarly incorrectly labeled in the snippet of code for fetching all the rows. That corrected code should be:

    my @rows = Spreadsheet::Read::rows($book->[1]);
    foreach my $i (1 .. scalar @rows) {
        foreach my $j (1 .. scalar @{$rows[$i-1]}) {
            say chr(ord('A')+$j-1) . " $i " . ($rows[$i-1][$j-1] // '');
        }

Would you be willing to make these corrections in your article?

Covert a strins a name fuction

https://es.perlmaven.com/ayuda

Please, I need your help. I had been created the string: $averages
$averages="get_averages(%HoH, '2023-01-01','2023-01-02','2023-01-03',)";

#The string above has been created for call a function to calculate averages for the days the user know averages. (get_averages)

The variable $averages is a string variable, BUT it must a call the function get_averages with the parameters that the user had been selected.

Please, will you help guide me how to call the function get_averages.

Regards
Xochitl

500 errors

Maybe it's too obvious to include, but my first response to a 500 error is:

perl -cw app.pl

Most of my scripts use $ENV{DOCUMENT_ROOT} or other environment variables, so this works better:

export DOCUMENT_ROOT=/path/to/website/root
perl -cw app.pl

Strange build/test errors in Github Actions

https://perlmaven.com/setup-github-actions

Hi,

I tried your suggested setup for a Dist::Zilla distribution on my own repo (https://github.com/sbakker/perl-Term-CLI). For some reason I needed to add a cpanm --notest Dist::Zilla because I was getting dzil: command not found errors.

I now get it to run the tests, but I'm getting failures which do not appear when I pull the Docker image on my laptop and run the tests in there myself. The released module on CPAN also does not show errors in the test results.

I'm guessing that, since this module uses builds on Term::ReadLine and Term::ReadLine::Gnu specifically, the Docker image on Github runs the tests in some bizarre (pseudo-)terminal setup (I'm getting errors from deep within Term::ReadKey).

Any hints on how to debug this would be more than welcome.

Cheers,
Steven

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.