PageRenderTime 41ms CodeModel.GetById 17ms RepoModel.GetById 0ms app.codeStats 0ms

/blogs.perl.org-entries/blogs.perl.org-journal.xhtml

https://bitbucket.org/shlomif/blogs.perl.org-entries
XHTML | 3501 lines | 2984 code | 517 blank | 0 comment | 0 complexity | 3cc8fd43a43df0870749259985675e4a MD5 | raw file
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <!-- vim: set indentexpr=: -->
  3. <!DOCTYPE
  4. html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
  5. "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
  6. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
  7. <head>
  8. <title>blogs.perl.org Blog</title>
  9. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  10. <style type="text/css">
  11. div.entry
  12. {
  13. border: darkgreen solid medium;
  14. padding: 0.5em;
  15. margin: 0.5em;
  16. }
  17. </style>
  18. </head>
  19. <body>
  20. <div class="entry" id="text-table-1">
  21. <ul class="info">
  22. <li><b>Date:</b> 21-04-2011</li>
  23. </ul>
  24. <h1>Introduction to blogs.perl.org + Text::Table</h1>
  25. <p>
  26. Hello, Perl bloggers! I decided to start
  27. blogging about a most of my exclusively Perl-related stuff here on
  28. blogs.perl.org, in hope of getting more comments
  29. from active Perlers. (Until now, I've blogged about it
  30. <a href="http://shlomif-tech.livejournal.com/">on
  31. my technical LiveJournal blog</a> and previously on
  32. <a href="http://use.perl.org/~Shlomi+Fish/journal/">use.perl.org Journal</a>.).
  33. You can learn more about me on <a href="http://www.shlomifish.org/">my home
  34. site - www.shlomifish.org</a> .
  35. </p>
  36. <p>
  37. OK, having put that aside - let's move on to the main topic of this post.
  38. </p>
  39. <hr />
  40. <p>
  41. Many months ago I wanted to use the
  42. <a href="http://search.cpan.org/dist/Text-Table/">Text::Table CPAN module</a>
  43. to present a table related to the meta-scan heuristics construction
  44. scheme of <a href="http://fc-solve.berlios.de/">Freecell Solver</a>. Now,
  45. I wanted to present nicely formatted borders, using the
  46. <a href="http://en.wikipedia.org/wiki/Box-drawing_characters">Unicode
  47. box-drawing characters</a> (which some people would recall from DOS).
  48. However, I found it difficult to specify the separators in the
  49. rulers properly based on their indices - they were assumed to be the
  50. same globally. As a result, I've written
  51. <a href="https://rt.cpan.org/Public/Bug/Display.html?id=61610">a patch</a>,
  52. and placed the modifications in
  53. <a href="http://github.com/shlomif/Text-Table">a github repository</a>.
  54. </p>
  55. <p>
  56. The author of Text-Table (ANNO) told me he was working on a new version
  57. of Text-Table, which will contain many improvements. However, I was still
  58. interested in an enhanced version of the old Text-Table codebase with my
  59. patch, and after talking on <a href="irc://irc.freenode.net/#perl">#perl</a>,
  60. ANNO said I could have co-maint
  61. on Text-Table-1.x and continue to improve it. The new Text-Table will be
  62. released under a separate namespace - <tt>Text::Table2</tt> or so.
  63. </p>
  64. <p>
  65. Many thanks go to ANNO for agreeing that I further develop Text::Table.
  66. </p>
  67. <p>
  68. Using my git repository, I did many cleanups, like add
  69. pod.t and pod-coverage.t, tweak the author information, add more strict and
  70. warnings to the file, etc. ANNO 's original licence is
  71. <a href="http://perlbuzz.com/2009/07/help-end-licensing-under-same-terms-as-perl-itself.html">"Same
  72. terms as Perl"</a>, but since it is an iffy licensing, I decided that all
  73. further changes will be under the terms of the Public-Domain/X11L/etc.. People
  74. who send me pull requests on github may wish to add their names to the credits
  75. (in the changes or even in the core module) but must not claim copyrights to
  76. their changes.
  77. </p>
  78. <p>
  79. OK, now for some output of the Unicode table:
  80. </p>
  81. <pre>
  82. Place 1 2 3 4 5
  83. 1 68 317 15 3 381
  84. 2 171 482 31 14 594
  85. 3 275 867 42 22 1007
  86. 4 458 1442 125 30 1630
  87. 5 640 1715 137 47 1730
  88. </pre>
  89. <p>
  90. Future plans are:
  91. </p>
  92. <ol>
  93. <li>
  94. Convert the remaining test scripts to Test::More.
  95. </li>
  96. <li>
  97. Go over the code and clean it up
  98. </li>
  99. <li>
  100. Add CPAN keywords to the <tt>META.yml</tt>. (Perhaps this will require
  101. defining a Module-Build-based Build.PL file).
  102. </li>
  103. <li>
  104. Add URLs to the <tt>META.ym</tt>l - to the module's homepage, to the github repository,
  105. etc..
  106. </li>
  107. <li>
  108. Possibly implement some future features.
  109. </li>
  110. <li>
  111. Add some more tests.
  112. </li>
  113. </ol>
  114. <p>
  115. Contributions are naturally welcome, just fork the github repository and send
  116. me a pull request. (Or patches are also OK.)
  117. </p>
  118. </div>
  119. <div class="entry" id="entry-to-yapc-europe-2011">
  120. <ul class="info">
  121. <li><b>Date:</b> 20-06-2011</li>
  122. <li class="tags">YAPC</li>
  123. </ul>
  124. <h1>Transferring a Ticket to YAPC::Europe::2011</h1>
  125. <p>
  126. I originally planned to attend
  127. <a href="http://yapceurope.lv/ye2011/">YAPC::Europe::2011</a> in Riga, Latvia
  128. (on 15-17 August, 2011), and so bought an early bird ticket, but will no
  129. longer be able to attend due to personal reasons. As a result, I'm now seaking
  130. to transfer the ticket to someone else, for the right price (which will be
  131. cheaper than what I bought it.).
  132. </p>
  133. <p>
  134. If you are interested, please
  135. <a href="http://www.shlomifish.org/me/contact-me/">contact me</a> and we will
  136. negotiate a price. I hope everybody enjoys the YAPCs.
  137. </p>
  138. </div>
  139. <div class="entry" id="resuming-maintenance-of-xml-libxml">
  140. <ul class="info">
  141. <li><b>Date:</b> 20-06-2011</li>
  142. <li class="tags">XML, libxml, CPAN</li>
  143. </ul>
  144. <h1>Resuming Maintenance of XML-LibXML</h1>
  145. <p>
  146. For a long while, work on the
  147. <a href="http://beta.metacpan.org/release/XML-LibXML">XML-LibXML
  148. CPAN module</a> halted as the existing maintainer was busy.
  149. After <a href="http://code.activestate.com/lists/perl-xml/8885/">a
  150. discussion</a> on the Perl-in-XML mailing list, some people and I were
  151. given co-maintainer status and we resumed its maintenance inside
  152. <a href="https://bitbucket.org/shlomif/perl-xml-libxml">a Bitbucket.org
  153. Mercurial repository</a>.
  154. </p>
  155. <p>
  156. So far what I did, was fix some low-hanging fruit
  157. bugs, apply some patches, as well as start the long process of converting
  158. the test suite, which still uses Test.pm to
  159. <a href="http://beta.metacpan.org/module/Test::More">Test::More</a> . There are
  160. still many bugs lurking there, and some of them are XS bugs that are still
  161. beyond my reach, and I could use some assistance there. But it's a start.
  162. </p>
  163. <p>
  164. If you're interested in helping, the clone the repository, write a patch and
  165. send me a pull request.
  166. </p>
  167. <p>
  168. <b>Text::Table Update:</b> I've written about
  169. <a href="http://blogs.perl.org/users/shlomi_fish/2011/04/introduction-to-blogsperlorg-texttable.html">resuming
  170. the maintenance of Text::Table</a> in April, and it progressed nicely:
  171. the tests were converted to Test::More, a lot of the code was cleaned up,
  172. the build system was converted to Module::Build, and keywords and resource
  173. URLs were defined, and some bugs were solved (along with tests). I'm still
  174. looking into ways to clean up the code, and if anyone has an idea for a cool
  175. feature, then they should drop me a line (or provide a patch).
  176. </p>
  177. </div>
  178. <div class="entry" id="convert-away-from-Test.pm">
  179. <ul class="info">
  180. <li><b>Date:</b> 23-06-2011</li>
  181. <li class="tags">QA, PPI, Perl</li>
  182. </ul>
  183. <h1>PPI-Based Script to Convert Test.pm-based Test Programs to Test::More</h1>
  184. <p>
  185. Some CPAN modules I inherited used the old
  186. <a href="http://search.cpan.org/perldoc?Test">Test.pm</a> for some of their
  187. <tt>t/*.t</tt> scripts instead of the more modern
  188. <a href="http://en.wikipedia.org/wiki/Test::More">Test::More</a>. This
  189. annoys me to no end because Test.pm is very limited. When I worked on
  190. <a href="http://beta.metacpan.org/release/Config-IniFiles">Config-IniFiles</a>,
  191. I did the conversion manually, which was a lot of work. More recently, I
  192. <a href="http://blogs.perl.org/users/shlomi_fish/2011/06/resuming-maintenance-of-xml-libxml.html">started
  193. working on XML-LibXML</a> which has over 40 of those pesky Test.pm scripts, and
  194. I did not have the nerve to do all the manual and menial work.
  195. </p>
  196. <p>
  197. As a result, I ended up spending a few hours studying
  198. <a href="http://beta.metacpan.org/release/PPI">PPI</a> (the Perl Parsing
  199. Interface), and writing
  200. <a href="http://www.shlomifish.org/open-source/projects/Test.pm-Converter/">a
  201. script</a> to automatically convert Test.pm-based scripts to Test::More. The
  202. main issue at hand was that in Test.pm, a single argument <tt>ok()</tt>
  203. tests for the scalar's truth, while a double argument <tt>ok()</tt> tests for
  204. simple equivalence (similarly to Test::More's <tt>is()</tt>). Eventually, I got
  205. the script working, with some limitations (see <a
  206. href="http://www.shlomifish.org/open-source/projects/Test.pm-Converter/">the page</a>).
  207. </p>
  208. <p>
  209. So what was my impression of PPI? It naturally seems more robust than using
  210. regular expressions and hacks to process Perl code, but there were a few quirks.
  211. For example, a PPI
  212. <a href="http://beta.metacpan.org/module/PPI::Structure::List">list</a> contains
  213. an array of its contents, and the commas are part of them, as are the
  214. various other tokens in the sub-expressions. Therefore, divining the count of
  215. the arguments is pretty hard. I would have expected to get a more <a href="http://en.wikipedia.org/wiki/Abstract_syntax_tree">abstract
  216. syntax tree</a> of the arguments, and since I didn't I had to work around
  217. it with an ugly kludge.
  218. </p>
  219. <p>
  220. Furthermore, after stringifying the document object, the contents of the
  221. <a href="http://en.wikipedia.org/wiki/Here_document">here-documents</a> were
  222. not included in the output from some reason. However, I may have done something
  223. wrong. I also wish the PPI PODs contained more meaningful examples.
  224. </p>
  225. <p>
  226. Nevertheless, my script is mostly working now and I can utilise it to
  227. "test-lift" legacy test programs. You might find it useful too, so it's there
  228. in case you need it, and patches to fix its limitations would be welcome.
  229. </p>
  230. </div>
  231. <div class="entry" id="Inline-C">
  232. <ul class="info">
  233. <li><b>Date:</b> 09-11-2011</li>
  234. <li class="tags">Perl, QA, XS, Inline, C, ctypes, gcc</li>
  235. </ul>
  236. <h1>My Experience with Inline::C</h1>
  237. <p>
  238. I know I didn’t write here for a long time, and I apologise for it, but I have
  239. this entry and another one in mind and I hope they can compensate for it.
  240. </p>
  241. <p>
  242. For my work on <a href="http://fc-solve.shlomifish.org/">Freecell Solver</a>,
  243. I’ve written some code for encoding and decoding game positions into a
  244. compact format, by encoding them as a delta from the position of origin. I
  245. first wrote it in Perl, in order to prototype it, and later
  246. translated it to C (which is the language that Freecell Solver is written in).
  247. I have written some rudimentary unit tests for it, but also wanted to test the
  248. code against a large number of positions, by runnign it over the solutions of
  249. many Freecell deals.
  250. </p>
  251. <p>
  252. The encoding rearranges the order of the card columns and the freecells, so
  253. testing that the output test is correct requires calculating that arrangement.
  254. This was also done by the Perl code. I decided to write a small wrapper for
  255. an encoding+decoding round-trip in C, and use it from a Perl program I was
  256. writing. So far so good.
  257. </p>
  258. <p>
  259. I first looked at <a href="https://gitorious.org/perl-ctypes">the
  260. Perl version of Ctypes</a>, but it failed a large number of its assertions
  261. on my system, so I could not really trust it. Then I looked at
  262. <a href="http://search.cpan.org/perldoc?Inline::C">Inline::C</a>. I could
  263. not understand from its main page, how to return an <tt>SV *</tt> containing
  264. a string from it, but this was covered in the extensive
  265. <a href="http://search.cpan.org/perldoc?Inline::C-Cookbook">Inline::C
  266. cookbook</a> and I wrote this Inline::C function:
  267. </p>
  268. <pre>
  269. extern char * fc_solve_user_INTERNAL_delta_states_enc_and_dec(
  270. const char * init_state_str_proto,
  271. const char * derived_state_str_proto
  272. );
  273. SV* enc_and_dec(char * init_state_s, char * derived_state_s) {
  274. SV * ret;
  275. char * s;
  276. s = fc_solve_user_INTERNAL_delta_states_enc_and_dec(init_state_s, derived_state_s);
  277. ret = newSVpv(s, 0);
  278. free(s);
  279. return ret;
  280. }
  281. </pre>
  282. <p>
  283. I don't need to use “sv_2mortal” there because Inline::C does that for us.
  284. Then I tried to test it. It failed with this error:
  285. </p>
  286. <pre>
  287. perl: symbol lookup error: /home/shlomif/progs/freecell/trunk/fc-solve/source/_Inline/lib/auto/Mega_Test_for_C_delta_states_pl_9385/Mega_Test_for_C_delta_states_pl_9385.so: undefined symbol: fc_solve_user_INTERNAL_delta_states_enc_and_dec
  288. </pre>
  289. <p>
  290. I was familiar with errors like that, but it took me over an hour of playing
  291. with the various Inline::C configuration options, and trying to figure out
  292. why it didn’t link against the relevant Freecell Solver library to realise
  293. what the problem was. It was that the library in question did not export the
  294. symbol, and gcc realised it didn't give the XS extension anything and omitted
  295. it.
  296. </p>
  297. <p>
  298. After fixing this line in my C source:
  299. </p>
  300. <pre>
  301. char * DLLEXPORT fc_solve_user_INTERNAL_delta_states_enc_and_dec(
  302. </pre>
  303. <p>
  304. To this line:
  305. </p>
  306. <pre>
  307. DLLEXPORT char * fc_solve_user_INTERNAL_delta_states_enc_and_dec(
  308. </pre>
  309. <p>
  310. Everything worked properly, and I was able to run the so-called “mega-test”.
  311. </p>
  312. <p>
  313. If you’re having similar problems with Inline::C, you should try to add
  314. <tt>CLEAN_AFTER_BUILD =&gt; 0</tt> to its configuration. It ended up clarifying
  315. a lot for me.
  316. </p>
  317. <p>
  318. Cheers!
  319. </p>
  320. </div>
  321. <div class="entry" id="exec-portability">
  322. <ul class="info">
  323. <li><b>Date:</b> 09-11-2011</li>
  324. <li class="tags">exec, perl, portability, whitespace, windows, unix</li>
  325. </ul>
  326. <h1>exec's portability</h1>
  327. <p>
  328. Pop quiz! What does this perl 5 program prints when executed with no
  329. arguments?
  330. </p>
  331. <pre>
  332. #!/usr/bin/perl
  333. use strict;
  334. use warnings;
  335. if (! @ARGV)
  336. {
  337. exec($^X, $0, "hello world");
  338. }
  339. else
  340. {
  341. my $arg = shift(@ARGV);
  342. print "Got &lt;$arg&gt;\n";
  343. if (@ARGV)
  344. {
  345. print "Other args are &lt;@ARGV&gt;\n";
  346. }
  347. }
  348. </pre>
  349. <p>
  350. The answer is “it depends.”. On my Linux system it prints
  351. “Got &lt;hello world&gt;”, while on Windows, using Strawberry Perl, it
  352. prints “Got &lt;hello&gt;” and later on that the other args are “world”.
  353. </p>
  354. <p>
  355. I would expect the Linux behaviour were every argument passed to the list
  356. <a href="http://perldoc.perl.org/functions/exec.html">exec</a> arrives as
  357. one argument to <tt>@ARGV</tt> regardless of whitespace as the correct. It
  358. also the behaviour exhibited on both operating systems using
  359. <a href="http://perldoc.perl.org/functions/system.html">system</a>. Is this
  360. a bug?
  361. </p>
  362. <p>
  363. <a href="http://perldoc.perl.org/perlport.html">perlport</a> only has this
  364. to say about whitespace: <q>Whitespace in filenames is tolerated on most
  365. systems, but not all, and even on systems where it might be tolerated, some
  366. utilities might become confused by such whitespace.</q>.
  367. </p>
  368. <p>
  369. I discovered this strange mis-behaviour when working on a commission for
  370. a client who is Windows-based.
  371. </p>
  372. </div>
  373. <div class="entry" id="telaviv_pm_2011_Nov_report">
  374. <ul class="info">
  375. <li><b>Date:</b> 03-12-2011</li>
  376. <li class="tags">Perl, Mongers, Tel Aviv, Israel, meeting, DBI, DBIx-Class, local-lib, perlbrew, cpanminus, CPAN, Firebird, SQL</li>
  377. </ul>
  378. <h1>Report on the Latest Tel Aviv Perl Mongers Meeting</h1>
  379. <p>
  380. I attended the latest
  381. <a href="http://telaviv.pm.org/">Tel Aviv Perl Mongers (TelAviv.pm)</a>
  382. meeting the other
  383. day, and am writing this report in order to encourage more people
  384. to come. We didn't have meetings in September or October due to the Jewish
  385. holidays and some renovations on the site, so it was good to finally have
  386. a meeting.
  387. </p>
  388. <p>
  389. Before the meeting, I had helped publicise it on various online news channels,
  390. and thankfully quite a few people (about 20-30) came. I had a previous
  391. appointment that day at 12:00, and so returned home where I ate, worked on
  392. the computer, and rested before the TelAviv.pm meeting.
  393. </p>
  394. <p>
  395. After I rode the bus, I arrived there a few minutes earlier. I met a fellow
  396. Perl monger on the way. We found the room with some difficulty, as there were
  397. very few signs outside the doors of the various rooms in the building. Several
  398. people
  399. including <a href="http://szabgab.com/">Gabor</a> were already sitting
  400. in the room.
  401. They were discussing the upcoming Israeli Perl Workshop in February. In any
  402. case, I decided to walk to the nearby
  403. grocery store to buy some refreshments for the meeting, and when I returned
  404. there were more people in the room.
  405. </p>
  406. <p>
  407. Quite a few people arrived relatively late, but the talks started mostly on
  408. schedule. The first talk (by Erez Schatz) was short, and it discussed some
  409. recent tools that
  410. facilitate the Perl programmer’s life: <a href="http://search.cpan.org/dist/local-lib/">local-lib</a>, <a href="http://www.perlbrew.pl/">perlbrew</a>, cpanm
  411. and pm-uninstall. The talk was very fun, and he ended up covering some other
  412. tools in brief in the last slide. I’m still not convinced that I should use
  413. CPAN-Minus instead of my CPANPLUS (especially given
  414. <a href="http://search.cpan.org/dist/CPANPLUS-Dist-Mageia/">CPANPLUS-Dist-Mageia</a>
  415. and friends), but I still like perlbrew and local::lib and pm-uninstall seems
  416. useful.
  417. </p>
  418. <p>
  419. Erez mentioned that on Perl forums there were several very common and hated
  420. questions like “How do I uninstall a perl module?” or “How can I use
  421. CPAN without root?” and that these technologies address these needs precisely.
  422. </p>
  423. <p>
  424. After this talk, Erez gave a longer talk about DBIx-Class, which is an
  425. Object-Relational Mapper (ORM) for Perl. For the demo, he used a company
  426. whose employees are dogs, and the slides featured many pictures of dogs in
  427. suits (some of them pretty scary). There were a few glitches in the
  428. demonstration, but they
  429. were promptly overcome, and the <tt>DBIC_TRACE=1</tt> flag was a big help.
  430. One bug in the code was that instead of updating the employee's department
  431. (by looking it up by name), the department's name was updated (globally). I
  432. any case, it was an enjoyable talk, but the person who sat next to me said
  433. that she didn’t like it because she used to be a DBA, and she was worried about
  434. performance.
  435. </p>
  436. <p>
  437. Erez mentioned that DBIx-Class was the “Elephant in the Room” of Perl ORMs,
  438. which I had concluded was the case as well.
  439. </p>
  440. <p>
  441. After that talk, there was a break, where people got to eat more of the
  442. cookies I bought and to chat. Afterwards, Ido Kanner presented about
  443. <a href="http://www.firebirdsql.org/">Firebird SQL</a>. It was a good talk,
  444. and Ido drew some comparisons between Firebird and SQLite, MySQL and
  445. PostgreSQL. Firebird looks interesting and it also has embedded (like
  446. SQLite) and read-only modes.
  447. </p>
  448. <p>
  449. One problem during the talk was that the projector kept shutting down,
  450. and it took us some trouble to restart it. We hoped this problem would be
  451. resolved in upcoming meetings.
  452. </p>
  453. <p>
  454. After the meeting, some of us (about 10) went to Spaghettim (a pasta/etc.
  455. place) and had dinner. We chatted about Atheism, Cable company tech-support,
  456. GNOME 3 and KDE 4, and lots of other stuff. This time I had a pizza, which
  457. although not too bad, made me realise I will be ordering pasta there from now
  458. on.
  459. </p>
  460. <p>
  461. To sum up, it was a very enjoyable meeting, and I’m looking forward for
  462. more future ones. One thing notable about it is that this time Sawyer did not
  463. deliver a talk, which made him happy because other people volunteered to do
  464. so instead.
  465. </p>
  466. </div>
  467. <div class="entry" id="breaking_the_perl_debugger_for_fun_and_profit">
  468. <ul class="info">
  469. <li><b>Date:</b> 26-12-2011</li>
  470. <li class="tags">perl,debugger,debugging,refactoring,features,sopa,telaviv,mongers</li>
  471. </ul>
  472. <h1>Breaking the Perl Debugger for Fun and Profit</h1>
  473. <p>
  474. Before I cover the main topic of this entry, here are some short news and
  475. action items:
  476. </p>
  477. <ol>
  478. <li>
  479. <p>
  480. If you have not acted against
  481. <a href="https://www.eff.org/deeplinks/2011/12/fight-blacklist-toolkit-anti-sopa-activists">SOPA
  482. - the proposed online blacklist/censorship bill</a>, you should. Follow the
  483. link for information on how to act against it.
  484. </p>
  485. </li>
  486. <li>
  487. <p>
  488. I have announced the
  489. <a href="http://shlomif-tech.livejournal.com/60825.html">next Tel Aviv
  490. Perl Mongers meeting</a> on my technical journal on LiveJournal.com. It will
  491. take place this Wednesday, on 28 December, 2011. More information in the link.
  492. </p>
  493. </li>
  494. <li>
  495. <p>
  496. <a href="http://golf.shinh.org/">Anarchy Golf</a> is a new server for Code Golf,
  497. which are online programming competitions for implementing code as shortly as
  498. possible. It supports Perl 5, Perl 6 and many other languages. There is
  499. <a href="http://golf.shinh.org/p.rb?Starburst">an active challenge</a>, where
  500. the only Perl 5 submission so far is mine, so I could use some competition.
  501. </p>
  502. </li>
  503. </ol>
  504. <p>
  505. Now for the main topic of the post. Recently, three patches were integrated
  506. into the perl-5 core implementing new features in the perl debugger:
  507. </p>
  508. <ol>
  509. <li>
  510. <a href="http://www.nntp.perl.org/group/perl.perl5.porters/2011/04/msg171038.html">Add "b &lt;filename&gt;:&lt;line&gt; &lt;cond&gt;" to perl -d</a> by me.
  511. </li>
  512. <li>
  513. <a href="http://www.nntp.perl.org/group/perl.perl5.porters/2011/08/msg176454.html">Add enable/disable commands for breakpoints in perl -d</a> also by me.
  514. </li>
  515. <li>
  516. <a href="https://rt.perl.org/rt3/Public/Bug/Display.html?id=104168">"Trace to max depth"</a> by Peter Scott.
  517. </li>
  518. </ol>
  519. <p>
  520. When Father Chrysostomos tried to apply the first patch, he noticed its tests
  521. started failing. Apparently, the breakpoint functionality (irrespective of
  522. the patch's added functionality) became broken in bleadperl, due to a change
  523. in the internals, and it wasn't caught by the debugger's existing tests. I
  524. ended up submitting another patch to add a test for some of the existing
  525. breakpoint functionality.
  526. </p>
  527. <p>
  528. The other two patches passed all of their own tests and the existing ones, but
  529. that wasn't the end of the story. A short time afterwards
  530. <a href="https://rt.perl.org/rt3/Public/Bug/Display.html?id=104820">a
  531. regression was reported in the debugger</a>, which was caused by one of the
  532. patches that I introduced. While, I fixed it with a test, it was soon followed
  533. by other reports and fixes. None of these bugs were caught by the test suite
  534. of the perl debugger, which is incredibly incomplete.
  535. </p>
  536. <p>
  537. Another E-mail that caused an active discussion was
  538. <a href="http://www.nntp.perl.org/group/perl.perl5.porters/2011/11/msg179847.html">my
  539. proposal to add strict and warnings to lib/perl5db.pl</a>, in which someone
  540. kept arguing against it, and eventually said he confused it (it being the
  541. defualt command-line debugger front-end) with the debugger's guts, and ended
  542. up also supporting adding "use strict;".
  543. </p>
  544. <p>
  545. I ended up working on adding "strict" to the debugger on a git branch, and
  546. was eventually successful (though I temporarily broken no-strict code on the
  547. debugger evaluated lines, to which I added a test.). RJBS (the current
  548. pumpking) said he'd like to integrate this patch only after perl-5.16.x
  549. is released.
  550. </p>
  551. <p>
  552. The morals of this story is that the perl debugger needs more tests, and
  553. that trying to enhance it can easily break it. I started
  554. <a href="https://github.com/shlomif/perl/tree/perl-d-add-tests-3">a branch
  555. on GitHub</a> where I've been committing more tests to the perl debugger
  556. to enhance its coverage.
  557. </p>
  558. <p>
  559. There's also a Google Code-In task for devising a strategy to do that, and
  560. I've volunteered to mentor it. All this will hopefully result in less breakage
  561. in the future.
  562. </p>
  563. <p>
  564. Happy Holidays, and a Happy New Year.
  565. </p>
  566. </div>
  567. <div class="entry" id="report_on_israeli_perl_workshop_2012">
  568. <ul class="info">
  569. <li><b>Date:</b> 27-03-2012</li>
  570. <li class="tags">perl, workshop, israel, events, 2012</li>
  571. </ul>
  572. <h1>Report on the Israeli Perl Workshop 2012</h1>
  573. <p>
  574. Well, I've got a lot of stuff I’d like to blog about in the various blogs of
  575. mine, and so I’m starting with this report on the
  576. <a href="http://act.perl.org.il/ilpw2012/">Israeli Perl Workshop of 2012</a>,
  577. which had taken place in 28 February, 2012. Moreover, April Fools' Day is
  578. approaching, and I had an idea for a Perl-related April Fools' gag, but after
  579. telling it to RJBS (the current Perl pumpking), he and I agreed that it would
  580. hit too many nerves. (PerlJam on IRC said he liked it, though). Maybe I’ll
  581. publish it on 2 April with a big disclaimer on top, just for kicks.
  582. </p>
  583. <p>
  584. Anyway, here is the report. I had originally posted it to the Perl in Israel
  585. mailing list for review, but did not get any reviews, so it may not be too
  586. letter-perfect, but I guess that’s life.
  587. </p>
  588. <p>This is my report about the
  589. <a href="http://act.perl.org.il/ilpw2012/">Israeli Perl Workshop of 2012</a> . It was
  590. a fun and educational event, and I'm glad I was able to attend it. For better
  591. or for worse, all the talks I attended were in Room 1, but I was still able
  592. to hear the ends of a few talks in Room 2 (because the corresponding talks
  593. in Room 1 ended before them).</p>
  594. <p>I set up an alarm the night before in order to wake up early in time for the
  595. event, and ended up waking up some time before it (and even the alarm time was
  596. much earlier than what I was used to). Then I made some preparations, ate
  597. breakfast, and caught the appropriate bus. After I walked from the bus station
  598. to Shenkar, it took me some time to find the place, because it wasn't the
  599. same entrance as our normal rooms, and the signs were confusing. What I needed
  600. to do was to take the stairs down to the yard, and then go to the organisation
  601. room, but it was hard to find.</p>
  602. <p>There I got my name sticker, the schedule, and some swag from booking.com. I’d
  603. like to thank <a href="http://www.booking.com/">Booking.com</a> for sponsoring the Israeli
  604. Perl Workshop 2012 (as well as having a presence there and giving some swag
  605. and chocolates), and they are looking for software developers with Perl
  606. experience to relocate to Amsterdam, so please consider working for them.</p>
  607. <p>In the yard, I met a few people including
  608. <a href="http://search.cpan.org/~flora/">Florian Ragwitz</a> (a.k.a &quot;FLORA&quot; on CPAN or
  609. &quot;rafl&quot; on IRC - he has many cool modules there, including quite a few XS ones),
  610. who was one of the workshop’s visitors from Germany. Despite being German, his
  611. English accent sounded English to us. Later on we discussed accents in English
  612. and he noted that the accents of some Israelis he met sounded like French to
  613. him (while ours seemed less so). This is strange, because Israelis can
  614. distinguish between a French accent in English and an Israeli Hebrew accent in
  615. English. </p>
  616. <p>Anyway, Florian told me that he is planning on reviewing and pulling my
  617. Test::Aggregate GitHub pull request Real Soon Now™, a fact which has brought
  618. me some relief, because I've tried to contact him on IRC and ask him if he
  619. remembers.</p>
  620. <p>For better or for worse, all the talks that I preferred to hear took place in
  621. room #1 (while sometimes visiting Room #2) to hear the ends of talks. I still
  622. would be happy to hear many of the talks that took place in Room #2 in the
  623. normal Tel Aviv Perl Mongers meetings, or alternatively, those talks in room #1
  624. which lacked enough time to be conveyed satisfactorily.</p>
  625. <p>The first talk in the day was
  626. <a href="http://search.cpan.org/~eilara/">Ran Eilam</a>’s talk about &quot;Syntactic Sugar
  627. causes Cancer of the Semicolon”, which had to be trimmed towards the end,
  628. because
  629. the introduction may have taken too long. The talk was interesting starting
  630. from an example of <code>ptr-&gt;val</code> being sugar in the C programming language
  631. for <code>(*ptr).val</code> and continuing to further examples. Ran raised the issue
  632. of whether syntactic sugar was important or not, which turns out to not be
  633. a straightforward question. He then demonstrated some modules for syntactic
  634. sugar on CPAN.</p>
  635. <p>I hope Ran can give a rerun of it on one of the mongers' meetings with more
  636. time allocated for that.</p>
  637. <p>After that I attended the talk of Stefan Hornburg (“racke”, known as
  638. <a href="http://search.cpan.org/~hornburg/">HORNBURG on CPAN</a>) who was another
  639. visitor from Germany, about
  640. <a href="http://act.perl.org.il/ilpw2012/talk/3955">Template::Flute</a> which is a
  641. designer’s friendly template system. In this template, one uses an HTML file
  642. with standard HTML attributes for designating the fields that needs to be
  643. replaced, and then an XML specification file that specifies how to process
  644. the HTML (and in addition one uses Perl to give it data). As a result the
  645. designers can manipulate the HTML with their own tools, while still
  646. allowing the programmers to populate it with data.</p>
  647. <p>This seems like an interesting and potentially useful tool, but it’s
  648. less expressive than template systems such as Template Toolkit. After the talk,
  649. another attendee whom we talked in private questioned the need for both the
  650. HTML file and the XML specification, but I didn't find a way to avoid it
  651. given the constraints that the HTML will be valid HTML 4/XHTML 1.</p>
  652. <p>The next talk about Time Management in Software Projects was cancelled because
  653. the presenter did not come (due to lack of time management as we joked then).
  654. I was able to catch a glimpse of the end of
  655. <a href="http://corky.net/dotan/">Dotan Dimet</a>’s “Perl and JavaScript:
  656. bioinformatics in a browser window” talk, but I don’t remember a lot of
  657. it except for a small amount of demonstration.</p>
  658. <p>The talk about Zero to CPAN was eventually given by
  659. <a href="http://blogs.perl.org/users/sawyer_x/">Sawyer</a> instead of by
  660. <a href="http://blogs.perl.org/users/erez_schatz/">Erez Schatz</a>. It was a nice one, and I’ve learned about
  661. <a href="http://metacpan.org/release/CPAN-Changes">the CPAN-Changes module</a> there
  662. (after Florian mentioned it, though). Sawyer covered the way to get to a
  663. working CPAN-like distribution from scratch using tools such as
  664. module-starter and explained what every file in the CPAN module hierarchy
  665. does, and demonstrated some test-driven-development. I knew most of it already,
  666. but it was still a fun talk.</p>
  667. <p><a href="http://www.linkedin.com/in/amirfr">Amir Friedman</a>‘s talk about software
  668. configuration management (SCM) came next,
  669. and he discussed some open-source solutions for the various parts of SCM,
  670. which include version control, release management, task management, and
  671. project management. He recommended Gitflow (which we had a talk about
  672. on the Tel Aviv mongers mailing list) for version control and release
  673. management, and a different solution called Jenkins for issue tracking (if
  674. I remember correctly). I then asked what he thought of integrated “all-in-one”
  675. solutions for SCM, and he said that those were pricey and he did not have
  676. any significant experience with them.</p>
  677. <p>The lunch break came next and I overheard a talk between two other people
  678. about teaching English to speakers of non-English languages. One of them
  679. said that he once worked with some Spanish Electrical Engineers and that they
  680. were “completely isolated” from the rest of the world because they didn’t
  681. read the literature in English. Then we discussed whether it was economical
  682. to teach English to hundreds of millions of speakers of Spanish, or whether
  683. we should expect most things to be translated. It was compared to the
  684. “give a man a fish” vs. “teach a man to fish”. We also discussed the fact that
  685. Dutchmen tended to have very good English, and one of the other people
  686. commented that it was true, but that they still tended to prefer using
  687. software with Dutch localisation.</p>
  688. <p>I’ve also talked with Sawyer about his upcoming
  689. <a href="http://act.perl.org.il/ilpw2012/talk/3936">“CGI.pm MUST DIE!” talk</a>. He
  690. said that he needs to become mentally energised for that talk because he
  691. feels strongly about it and wants to convey the energy. He passed an
  692. anecdote from a conference in Europe, in which he had given a talk about
  693. Dancer, and said he was so emotional then that people said “You must
  694. see him” and rushed to see his other talk. Moreover, afterwards, when asked
  695. who were the two best presenters in the conference, they said “[Someone
  696. very famous] and that Dancer guy”.</p>
  697. <p>The anti-CGI.pm presenting was indeed energetic and emotional, but kinda fell
  698. below my expectations due to the yard talk that preceded it. It was still
  699. pretty informative. Dotan Dimet later took the stage for the rebuttal
  700. of “CGI.pm - the only web development framework you’ll ever need” which was
  701. less emotional but still interesting. I was not convinced that CGI.pm’s
  702. HTML generation routines were a good way to do output HTML (I never really
  703. liked them), so I may have been more convinced by Sawyer.</p>
  704. <p><a href="http://www.ynonperek.com/">Ynon Perek</a>’s
  705. <a href="http://act.perl.org.il/ilpw2012/talk/3977">talk</a> about
  706. “Implementing Perl (Moose) Design Patterns” came next, which was interesting,
  707. but again lacked adequate time to cover everything, and I hope will be given
  708. with less time constraints. One anecdote from there was that Ynon said there
  709. where three primary ways for polymorphism in Perl: Inheritance (“is-a”),
  710. Roles/Traits (“does-a”) and Containment/Delegation (“has-a”) and that
  711. he could no longer recommend inheritance (but did not get to explain why not
  712. from what I recall).</p>
  713. <p>In any case, I was surprised at Ynon’s implementation of the Factory
  714. pattern, and don’t remember the implementation given by him.</p>
  715. <p>Next came Tamir Lousky’s
  716. <a href="http://act.perl.org.il/ilpw2012/talk/3953">talk</a> about generating vector
  717. graphics with Perl and SVG. Its slides contained a lot of very nice eye candy.
  718. The introduction
  719. to SVG and generating it was quite rudimentary, and did not cover the full
  720. potential of SVG. The demonstration and explanation of the module for
  721. generating random trees using SVG was interesting.</p>
  722. <p><a href="http://act.perl.org.il/ilpw2012/talk/3959">David Tabachnikov</a>’s next gave an
  723. interesting talk called “Scaling Up”. He
  724. contrasted optimisation (which makes your code run faster with the existing
  725. resources) to vertical scaling (= buying faster computers) to Horizontal
  726. scaling (= buying more hardware). He also noted that there’s some speed
  727. difference between the various SQL databases, but he did not encounter a
  728. situation where it would have made too much difference.</p>
  729. <p>The last feature of the evening were the lightning talks. I recall a talk
  730. by Florian Ragwitz about Google Code-In and Google Summer-of-Code. I also
  731. recall <a href="http://szabgab.com/">Gabor</a>’s talk about surviving in an uncooperative
  732. workplace. He said
  733. that if the workplace does not practise best practices such as using version
  734. control systems or writing automated tests, one can create their own
  735. small island of sanity where they make use of that on their own, and gradually
  736. convince the rest of the organisation that it’s beneficial.</p>
  737. <p>After the lightning talks, some people went to a local restaurant for dinner,
  738. but I decided against it because I was too tired from waking up early. As a
  739. result, I found someone who drove up north to drive me home, and got home.</p>
  740. <p>In the schedule I noticed that one could go to a certain URL at
  741. <a href="http://www.oreilly.com/">O’Reilly</a> and
  742. receive a free E-book of their choice. I used this opportunity to get the book
  743. <a href="http://shop.oreilly.com/product/9780596510046.do">Beautiful Code</a> , which
  744. I have started reading.</p>
  745. <p>The day was exhausting but very fun, and I enjoyed all the talks I attended.
  746. I’d like to thank the organisers of the event and most notably
  747. <a href="http://szabgab.com/">Gabor Szabo</a> and Sawyer X,
  748. <a href="http://www.shenkar.ac.il/">Shenkar college</a> for providing the venue,
  749. <a href="http://www.booking.com/">Booking.com</a> for the sponsorship, O’Reilly for
  750. the free book presents, the foreign guests who came to present and to attend,
  751. and all the other presenters, who volunteered to give talks.</p>
  752. <p>I hope we can repeat this the next year.
  753. </p>
  754. </div>
  755. <div class="entry" id="the_perl_april_fools_that_could_have_been">
  756. <ul class="info">
  757. <li><b>Date:</b> 09-04-2012</li>
  758. <li class="tags">perl, april fools, joke</li>
  759. </ul>
  760. <h1>The Perl April Fools' Gag That Could Have Been</h1>
  761. <p>
  762. On my <a href="http://blogs.perl.org/users/shlomi_fish/2012/03/report-on-the-israeli-perl-workshop-2012.html">last entry</a>,
  763. I told you that I have had an idea for a Perl-related April Fools’ day gag,
  764. and that I would possibly reveal it on 2-April with a big disclaimer
  765. on top, just for kicks. Well, it’s already 9-April, but I guess it is better
  766. late than never, right?
  767. </p>
  768. <p>
  769. OK, here is the big disclaimer: <b>THIS IS A JOKE. IT’S NOT SERIOUS. SO
  770. RELAX - IT IS NOT GOING TO HAPPEN SOON (AND HOPEFULLY WILL NOT EVER
  771. HAPPEN).</b>.
  772. </p>
  773. <p>
  774. OK, now let’s move on to the gag itself:
  775. </p>
  776. <blockquote>
  777. <p>
  778. 1 April 2012, Tel Aviv, Israel: the Perl foundation has announced today
  779. that by inspiration from Mozilla Firefox, the perl-porters (formerly known
  780. as perl5-porters) will adopt a schedule of a quarterly major release.
  781. </p>
  782. <p>
  783. “Since version 6 of Perl has been claimed by a malevolent project that
  784. amounted to very little, we will release Perl version 7 next Summer, followed
  785. by Perl 8 in next Fall, and Perl 9 next Winter.” said the designated Perl
  786. pumpking.The Perl foundation commented that it is sure that users will
  787. appreciate the accelerated release schedule, despite the fact that a lot
  788. of backwards’ compatibility will be broken in each release to further
  789. the language’s improvement.
  790. </p>
  791. <p>
  792. Some prominent Perl porters have added that they are looking into ways
  793. to automatically upgrade the Perl version automatically upon new
  794. releases, similar to the approach followed by the Google Chrome browser.
  795. “We are tired of people using outdated versions of Perl, which results in
  796. a maintenance burden for us, to say nothing of the security risk by bugs in
  797. old Perl versions. So we think the best way to mitigate that would be to
  798. simply force people to upgrade.”
  799. </p>
  800. <p>
  801. The Perl porters are hard at work on perl-7.0.0, which will implement the
  802. upcoming Perl 7 specification with many new and exciting features and
  803. incompatibilities.
  804. </p>
  805. </blockquote>
  806. <p>
  807. Well, like I said, after discussing this idea with
  808. <a href="http://rjbs.manxome.org/">RJBS</a> (the current Perl 5 Pumpking),
  809. he and I agreed that it would be too cruel, given that many people
  810. are sensitive about upgrading their versions of Perl 5. Comparisons of how
  811. old the perl that your workplace/client/etc. has deployed on their systems
  812. is a common source of discussion among perl mongers (and someone told me
  813. one of his clients still used perl 4), and many people would have found
  814. such an announcement alarming instead of funny. But I hope you enjoyed reading
  815. it, and hope you're also looking forward to perl-5.16.0, which should be out
  816. soon.
  817. </p>
  818. </div>
  819. <div class="entry" id="perl_begin_news_9_July_2002">
  820. <ul class="info">
  821. <li><b>Date:</b> 09-07-2012</li>
  822. <li class="tags">perl, begin, beginners, perl-begin, learn</li>
  823. </ul>
  824. <h1>What’s new on the Perl Beginners’s Site</h1>
  825. <p>
  826. The last update on the news feed for
  827. <a href="http://perl-begin.org/">The Perl Beginners’s site</a> was almost a
  828. year ago. While the site continued to improve, I neglected writing a new
  829. entry until now, so I hope this one will compensate for that.
  830. </p>
  831. <p>
  832. So without further ado, here is what is new:
  833. </p>
  834. <ol>
  835. <li>
  836. <p>
  837. We now have a page about <a href="http://perl-begin.org/humour/">Perl
  838. Humour</a>, which was restored from a page in the now offline perl.net.au
  839. wiki.
  840. </p>
  841. </li>
  842. <li>
  843. <p>
  844. Also originally from that wiki is the <a
  845. href="http://perl-begin.org/FAQs/freenode-perl/">Freenode’s #perl channel
  846. Frequently Asked Questions (FAQ) List</a>, which is well worth a read.
  847. </p>
  848. </li>
  849. <li>
  850. <p>
  851. Another restored page is
  852. <a href="http://perl-begin.org/topics/cpan/wrappers-for-distributions/">the
  853. list of CPAN Wrappers for Distributions</a>.
  854. </p>
  855. </li>
  856. <li>
  857. <p>
  858. We added <a href="http://perl-begin.org/uses/web-automation/">a page</a>
  859. about web automation in Perl, and <a
  860. href="http://perl-begin.org/topics/files-and-directories/">one about
  861. manipulating files and directories</a>.
  862. </p>
  863. </li>
  864. <li>
  865. <p>
  866. The
  867. <a href="http://perl-begin.org/platforms/windows/">Perl on Windows page</a>
  868. was enhanced with new links to Strawberry Perl and DWIM Perl.
  869. </p>
  870. </li>
  871. <li>
  872. <p>
  873. We have a new page about
  874. <a href="http://perl-begin.org/training/">Perl Training Providers</a>, which
  875. currently only contains a link to <a href="http://perltraining.org/">the Perl
  876. Training Directory</a>.
  877. </p>
  878. </li>
  879. <li>
  880. <p>
  881. <a href="http://perl-begin.org/tutorials/bad-elements/">The “Perl
  882. Elements to Avoid” page</a> contains many new entries.
  883. </p>
  884. </li>
  885. <li>
  886. <p>
  887. <a href="http://perl-begin.org/tutorials/modern-perl/">Our mirror of
  888. the book <i>Modern Perl</i> by chromatic</a> was updated to its latest
  889. edition.
  890. </p>
  891. </li>
  892. </ol>
  893. <p>
  894. We hope you find these additions useful or enlightening.
  895. </p>
  896. </div>
  897. <div class="entry" id="App_Notifier_cpan_distributions">
  898. <ul class="info">
  899. <li><b>Date:</b> 22-07-2012</li>
  900. <li class="tags">perl, cpan, dancer</li>
  901. </ul>
  902. <h1>Announcement: the App-Notifier CPAN Distributions</h1>
  903. <p>
  904. I would like to announce two new CPAN distributions of mine:
  905. <a href="https://metacpan.org/release/App-Notifier-Service">App-Notifier-Service</a>
  906. and
  907. <a href="https://metacpan.org/release/App-Notifier-Client">App-Notifier-Client</a>.
  908. These are derived from a few simplistic scripts I've written in shell and
  909. Perl, to allow me to notify when a task has finished (e.g:
  910. <tt>make ; finish-client</tt>) or a certain time has elapsed (e.g:
  911. <tt>sleep 240 ; finish-client</tt>), and I decided to create something
  912. more serious as CPAN modules.
  913. </p>
  914. <p>
  915. App-Notifier-Service implements an HTTP service (using Dancer), which
  916. listens for requests, and once one arrives, implements a callback, which
  917. notifies the user on the localhost that the event occured. App-Notifier-Client
  918. complements it by implementing a client that connects to the service
  919. and sends the event.
  920. </p>
  921. <p>
  922. Currently documentation may be lacking, and there are almost no automated
  923. tests in the distributions, but it appears to work nicely. To get started,
  924. read the documentation and you may wish to peruse some of these files
  925. from my home directory. First of all, the <tt>.app_notifier.yml</tt> file:
  926. </p>
  927. <pre>
  928. commands:
  929. default:
  930. - /home/shlomif/bin/desktop-finish-cue
  931. cookie:
  932. - /home/shlomif/bin/desktop-finish-cue
  933. - "--song"
  934. - "/home/music/Music/dosd-mp3s/Cookie.mp3"
  935. client:
  936. targets:
  937. default:
  938. url: "http://localhost:6300/"
  939. lap:
  940. url: "http://lap.shlomifish.org:6300/"
  941. </pre>
  942. <p>
  943. The <tt>desktop-finish-cue</tt> file:
  944. </p>
  945. <pre>
  946. #!/bin/bash
  947. song="/home/music/Music/dosd-mp3s/Theme - Eurovision.mp2"
  948. param="$1"
  949. shift
  950. if test "$param" = "--song"; then
  951. arg="$1"
  952. shift
  953. song="$arg"
  954. fi
  955. xmessage "Your task has been finished! Go check it out." &amp;
  956. mplayer "$song"
  957. </pre>
  958. <p>
  959. And the <tt>finish-server</tt> script:
  960. </p>
  961. <pre>
  962. #!/bin/bash
  963. cd "$HOME"/progs/perl/alert/http-based/hg/App-Notifier-Service &amp;&amp;
  964. perl ./bin/app.pl --port=6300
  965. </pre>
  966. <hr />
  967. <p>
  968. Otherwise, if you're in the Tel Aviv or vicinity, you are invited to
  969. <a href="http://mail.perl.org.il/pipermail/perl/2012-July/012671.html">the
  970. next Tel Aviv Perl Mongers meeting on Wednesday, 25 July 2012</a>. Otherwise,
  971. I wish to note that I have written my first Java golf program as part
  972. of <a href="http://golf.shinh.org/p.rb?Alphabet+texture+">Anarchy golf’s
  973. “Alphabet Texture” challenge</a> (Anarchy golf accepts challenges in many
  974. languages). At 167 bytes, it is over 3 times longer than the shortest Perl
  975. entry which is only 50 bytes (my Perl solution is 52 bytes). But it
  976. was fun to write. For your information,
  977. <a href="http://en.wikipedia.org/wiki/Code_golf">code golf</a> is a challenge
  978. in which, participating programmers are challenged to write the shortest
  979. program that achieves a certain objective. I find it fun and addictive.
  980. </p>
  981. </div>
  982. <div class="entry" id="tech_tip_packaging_cpan_distributions_in_mageia">
  983. <ul class="info">
  984. <li><b>Date:</b> 16-08-2012</li>
  985. <li class="tags">perl, cpan, tip, tech, tech tip, mageia, linux</li>
  986. </ul>
  987. <h1>Tech Tip: How to Package and Maintain CPAN Distributions in Mageia</h1>
  988. <p>
  989. <a href="http://www.mageia.org/">Mageia Linux</a> is an RPM-based
  990. Linux distribution, whose repositories contain
  991. <a href="http://jquelin.blogspot.co.il/2012/07/more-than-3000-perl-packages-in-mageia.html">over
  992. 3,000 CPAN packages</a>, and part of the reason why it has so many is
  993. because Jerome Quelin and the other maintainers have worked on tools to
  994. facilitate creating Mageia packages for CPAN distributions and maintaining
  995. them.
  996. </p>
  997. <p>
  998. However, I was a little confused about using
  999. <a href="https://metacpan.org/release/App-Magpie">magpie</a>, so I'd like
  1000. to share my findings here:
  1001. </p>
  1002. <ol>
  1003. <li>
  1004. <p>
  1005. In order to import, upload and submit a new CPAN package into Mageia,
  1006. along with all of its dependencies, one should not use magpie, but rather
  1007. <a href="https://metacpan.org/release/App-CPAN2Pkg">cpan2pkg</a>. Its use
  1008. is very simple: make <tt>rpm</tt> and <tt>urpmi</tt> sudoable, and type
  1009. <tt>cpan2pkg Package::Name</tt> from the command-line inside an X terminal.
  1010. This will start a Tk window where one can monitor the progress of preparing
  1011. new RPM packages and it has an entry box to create more packages (which
  1012. saves time on re-initialising CPAN.pm or CPANPLUS.pm).
  1013. </p>
  1014. </li>
  1015. <li>
  1016. <p>
  1017. In order to upgrade a package, one can type
  1018. <tt>eval $( magpie co -s perl-[PACKAGE_NAME] )</tt> and then
  1019. <tt>magpie update</tt>. magpie requires <a href="https://metacpan.org/release/CPAN-Mini">minicpan</a> to be installed and updated.
  1020. </p>
  1021. </li>
  1022. <li>
  1023. <p>
  1024. In order to install packages, one can do
  1025. <tt>sudo urpmi 'perl(Package::Name)'</tt>. My
  1026. <a href="https://metacpan.org/release/Module-Format">Module-Format module</a>
  1027. facilitates the translation from other notations for writing modules:
  1028. </p>
  1029. <pre>
  1030. up()
  1031. {
  1032. sudo urpmi --auto $(perlmf as_rpm_colon "$@")
  1033. }
  1034. </pre>
  1035. </li>
  1036. </ol>
  1037. </div>
  1038. <div class="entry" id="tpf_debugger_grant_and_new_cpan_distributions">
  1039. <ul class="info">
  1040. <li><b>Date:</b> 01-09-2012</li>
  1041. <li class="tags">perl, foundation, tpf, grant, debugger, cpan, ruby</li>
  1042. </ul>
  1043. <h1>Grant for Improving the Perl Debugger + New CPAN Distributions</h1>
  1044. <p>
  1045. First of all, I am glad to announce that the Perl Foundation grant
  1046. committee has accepted my
  1047. <a href="http://news.perlfoundation.org/2012/08/2012q3-grant-proposal-adding-t.html">grant
  1048. proposal for adding tests and refactoring the built-in perl debugger</a>.
  1049. Here is <a href="http://news.perlfoundation.org/2012/08/2012q3-grant-proposals---resul.html">the announcement</a> for which grant proposals were
  1050. accepted. My grant manager for this grant is
  1051. <a href="http://alanhieu.ml/">Alan Haggai Alavi</a>, whom I've been
  1052. talking with online and have collaborated on a few projects, so I'm really
  1053. happy to work with him again.
  1054. </p>
  1055. <p>
  1056. I have already made some progress with the grant (and this post is part
  1057. of it), and sent a log for Alan Haggai to post as a grant update.
  1058. </p>
  1059. <p>
  1060. That put aside, I'd now like to publicise some of the new distributions
  1061. I have uploaded to CPAN, as I had some ideas for new ones, and am also
  1062. contemplating making enough uploads to have 100 CPAN distributions or more:
  1063. </p>
  1064. <ol>
  1065. <li>
  1066. <p>
  1067. <a href="https://metacpan.org/release/WWW-LinkChecker-Internal">WWW-LinkChecker-Internal</a>
  1068. is a distribution wrapping a script that checks for internal broken links. I
  1069. released the first three versions of it in a day, and it uses WWW::Mechanize.
  1070. The reason why I wrote it was that the WDG HTML validator reported some broken
  1071. links in one of my sites, but not their origins, so I had to trace them in
  1072. a different way, and ended up writing that.
  1073. </p>
  1074. </li>
  1075. <li>
  1076. <p>
  1077. <a href="https://metacpan.org/release/Inline-Ruby">Inline-Ruby</a> is
  1078. an Inline:: distribution I adopted that allows to embed Ruby code inside
  1079. Perl programs. I applied some fixes for it (some of which were not released
  1080. to CPAN yet and some are ugly workarounds), and am planning to maintain it
  1081. further down the road.
  1082. </p>
  1083. </li>
  1084. <li>
  1085. <p>
  1086. <a href="https://metacpan.org/release/Test-TrailingSpace">Test-TrailingSpace</a>
  1087. is a <tt>Test::</tt> namespace distribution for verifying that your code
  1088. does not contain trailing space. Death to trailing space!
  1089. </p>
  1090. </li>
  1091. </ol>
  1092. <p>
  1093. A final anecdote is that when working on one of my CPAN modules I found the
  1094. <tt>b [filename]:[line_num]</tt> feature that I implemented in the perl
  1095. debugger to be of great help, and can be content that I'm eating my own
  1096. dogfood.
  1097. </p>
  1098. <p>
  1099. Cheers for now.
  1100. </p>
  1101. </div>
  1102. <div class="entry" id="tech_tip_overriding_eumm_compiler">
  1103. <ul class="info">
  1104. <li><b>Date:</b> 09-09-2012</li>
  1105. <li class="tags">tech, tip, tech tip, perl, eumm, compiler, gcc, clang</li>
  1106. </ul>
  1107. <h1>Tech Tip: Overriding the C compiler with ExtUtils::MakeMaker</h1>
  1108. <p>
  1109. In order to override the C compiler with ExtUtils::MakeMaker, one can
  1110. do something like:
  1111. </p>
  1112. <pre>
  1113. perl Makefile.PL CC=/usr/bin/clang
  1114. </pre>
  1115. <p>
  1116. Which will make the "CC" variable in the generated makefile be set to
  1117. <tt>/usr/bin/clang</tt> instead of the default. Apparently, setting the
  1118. <tt>CC</tt> environment variable does not work like it does with CMake.
  1119. </p>
  1120. <p>
  1121. Thanks to <a href="http://www.mail-archive.com/makemaker@perl.org/msg03060.html">Sisyphus for the tip</a>.
  1122. </p>
  1123. </div>
  1124. <div class="entry" id="perl_events_should_be_placed_on_lwn.net">
  1125. <ul class="info">
  1126. <li><b>Date:</b> 18-10-2012</li>
  1127. <li class="tags">lwn, lwn.net, events, perl, conferences, yapc</li>
  1128. </ul>
  1129. <h1>Please Publish Perl Events on the LWN.net Calendar</h1>
  1130. <p>
  1131. As I read last week’s
  1132. <a href="http://lwn.net/Articles/518564/">LWN.net’s Announcement Page</a>
  1133. (LWN.net is a news site for open-source-related news, formerly standing
  1134. for “Linux Weekly News”),
  1135. I noticed that there were few if any Perl events featured in its upcoming
  1136. events calendar. However, these events appear in
  1137. <a href="http://perlweekly.com/">the Perl Weekly</a>, and there are many
  1138. upcoming Python events featured in LWN.net.
  1139. </p>
  1140. <p>
  1141. So, please, if you are organising a Perl-related event (or any other major
  1142. open-source event), make sure you put it on
  1143. <a href="http://lwn.net/Calendar/">the LWN.net calendar</a>.
  1144. </p>
  1145. </div>
  1146. <div class="entry" id="three_command_line_utilities">
  1147. <ul class="info">
  1148. <li><b>Date:</b> 14-11-2012</li>
  1149. <li class="tags">cpan, perl, command, line, cli, bash, gnu, parallel, sleep</li>
  1150. </ul>
  1151. <h1>Three Command-Line Utilities</h1>
  1152. <p>
  1153. So, November is
  1154. <a href="http://en.wikipedia.org/wiki/National_Novel_Writing_Month">NaNoWriMo</a> (“National Novel Writing Month”), and I was hoping to get some serious
  1155. writing done (instead of coding), but I kept being distracted with coding
  1156. and random writing in various Internet forums. Well, hopefully this blog
  1157. post will compensate a little for that.
  1158. </p>
  1159. <p>
  1160. In this post, I’d like to cover three command-line utilities - two of them
  1161. new and were written by me, and one of them somewhat older, but also written
  1162. in Perl.
  1163. </p>
  1164. <p>
  1165. The first utility is
  1166. <a href="http://en.wikipedia.org/wiki/GNU_parallel">GNU Parallel</a>, which
  1167. allows one to run several command-line jobs in parallel, using forking and/or
  1168. ssh remote logins. I used it to speed up some processing I've been doing on
  1169. my computer. For more information and some examples of usage, see
  1170. <a href="http://zgp.org/pipermail/linux-elitists/2012-November/013428.html">my
  1171. post about it to the linux-elitists mailing list</a>, and also read
  1172. <a href="http://zgp.org/pipermail/linux-elitists/2012-November/013429.html">Thomas
  1173. Sattler’s response</a> which provides some further insights.
  1174. </p>
  1175. <p>
  1176. The second utility is
  1177. <a href="http://www.shlomifish.org/open-source/projects/countdown/">countdown</a>, which is
  1178. similar to the UNIX command-line sleep command, but displays the remaining
  1179. time on the console. I wrote a prototype for it in Perl 6, only to discover it
  1180. consumed far too many resources. The second prototype, as a Perl 5 program
  1181. consumed close to zero resources of my computer. Yesterday, I converted it to
  1182. a modulino (a Perl application implemented as a module) and uploaded
  1183. several versions to the CPAN.
  1184. </p>
  1185. <p>
  1186. The third utility is something I have placed in my
  1187. <tt>~/.bashrc</tt> file in order to implement reminders when the shell
  1188. starts. The code for it is:
  1189. </p>
  1190. <pre>
  1191. reminder_file="$HOME/.local/share/shlomif/reminder/reminder.txt"
  1192. if [ -s "$reminder_file" ] ; then
  1193. perl -Mstrict -Mwarnings -MTerm::ANSIColor -E 'my $x = colored("===", "bold red"); say "$x Reminders $x"'
  1194. cat "$reminder_file"
  1195. fi
  1196. Cancel_reminder()
  1197. {
  1198. rm "$reminder_file"
  1199. }
  1200. </pre>
  1201. <p>
  1202. I wrote it because I wasn't prompted in time by Thunderbird+Lightning
  1203. due to a strange bug, and because I had to ditch KOrganizer because it
  1204. consumed too many resources here. This displays the Reminders whenever you
  1205. start a new shell, which happens quite often with me, so it's OK. I use
  1206. cron jobs to append stuff into "$reminder_file", and the Perl code displays
  1207. a header in colour.
  1208. </p>
  1209. <p>
  1210. That’s it for today.
  1211. <a href="https://metacpan.org/release/App-Countdown">App-Countdown</a> is one
  1212. step closer for the count-up (pun intended) towards the coveted 100
  1213. distributions under “SHLOMIF” on CPAN, so that's another plus.
  1214. </p>
  1215. </div>
  1216. <div class="entry" id="countup100_dec2012">
  1217. <ul class="info">
  1218. <li><b>Date:</b> 06-12-2012</li>
  1219. <li class="tags">cpan, perl, xml, 100, hacktivity, hacktivity log, javascript, llvm</li>
  1220. </ul>
  1221. <h1>Count-up to 100 CPAN Distributions: Test-XML-Ordered, SDLx-Betweener, and more</h1>
  1222. <p>
  1223. Well, it's no longer a secret that I’m craving to join the “100 CPAN
  1224. Distributions Club” by releasing some code that is hopefully not too useless.
  1225. Here I would like to blog about the two new additions to
  1226. <a href="http://metacpan.org/author/SHLOMIF">my CPAN page</a> which are
  1227. the 83rd and 84th distributions respectively. The story is a bit more
  1228. complicated than that.
  1229. </p>
  1230. <p>
  1231. The first upload is
  1232. <a href="https://metacpan.org/release/SDLx-Betweener">SDLx-Betweener</a>,
  1233. which allows for creating high-performance and smooth animations in SDL
  1234. by making use of Perl/XS. Almost all of the coding (and a related
  1235. YAPC::Israel talk) was done by
  1236. <a href="http://metacpan.org/author/EILARA">Ran Eilam</a>, who is a very
  1237. cool guy, a good friend and a former boss of mine, and I've just done
  1238. (with his permission) some last-minute cleanups and did the initial upload
  1239. to CPAN. So I kinda feel like the frog that sat on top of the elephant
  1240. who crossed the river and said “We did it!”.
  1241. </p>
  1242. <p>
  1243. However, I needed SDLx::Betweener
  1244. for something I've been intending to work on, and wanted it on CPAN
  1245. and packaged in Mageia Linux, so I did that. If you run into any problems
  1246. with it, drop me a note or file a bug report, and hopefully I can resolve
  1247. these problems (possibly with some help from Ran).
  1248. </p>
  1249. <p>
  1250. The next distribution is original, but its story is more complicated.
  1251. It all started when I decided to resume work on Qantor, which aims
  1252. to eventually be a modern and saner alternative to TeX/LaTeX and Troff
  1253. (although it is still extremely far from that now). I noticed that the parsing
  1254. was still done by Regexp::Grammars, and so decided to convert it into
  1255. <a href="https://metacpan.org/module/Parser::MGC">Parser::MGC</a>.
  1256. Parser::MGC worked eventually and I was impressed from the straightforward
  1257. way to do stuff with it, but it was time consuming to get there (like most
  1258. other parser generators I tried, only a bit better), and involved writing
  1259. some Moose 'around' code to debug the method calls, and also sometimes delving
  1260. into the code. Parser::MGC is still not perfect (and some of the code I read
  1261. there had gems like
  1262. <tt>die $e if $committed or
  1263. not eval { $e-&gt;isa( "Parser::MGC::Failure" ) };</tt> which I found hard
  1264. to parse, and made me want to drown a kitten), but I think it sucks less
  1265. and is more transparent than other parser generators I tried.
  1266. </p>
  1267. <p>
  1268. Anyway, after I got it working, I noticed that the Test::XML::Ordered code
  1269. (then still unreleased), generated a some memory problems and I suspected
  1270. either XML::LibXML or libxml2 to be the culprit. This involved a long
  1271. investigation process with valgrind, gdb, <tt>perl -d</tt> and other tools
  1272. which culminated in a very small change and more lines of test code. This
  1273. was released in XML::LibXML. After that I received a report that the tests
  1274. got stuck, but that turned out to be due to external loading of DTDs and
  1275. was easily fixed. There's another
  1276. <a href="https://rt.cpan.org/Ticket/Display.html?id=81739">report</a> for
  1277. a problem with perl-5.8.8 (ouch!) on Red Hat Enterprise Linux (ouch again!),
  1278. but I'm not too motivated to do a lot about it (see
  1279. <a href="http://www.shlomifish.org/humour/fortunes/show.cgi?id=hamakor-discs-mozilla-1.1-1">this fortune cookie</a>).
  1280. </p>
  1281. <p>
  1282. Well, after I fixed the problem with XML::LibXML, I decided to release
  1283. Test::XML::Ordered. I'm well aware of
  1284. <a href="https://metacpan.org/module/Test::XML">Test::XML</a>, but found
  1285. it hard to rely on it, because it uses
  1286. <a href="https://metacpan.org/module/XML::SemanticDiff">XML::SemanticDiff</a>
  1287. (the latter I adopted) and which attempts to rearrange the order of the
  1288. nodes when it sees fit (so
  1289. <tt>&lt;ul&gt;&lt;li&gt;One&lt;/li&gt;&lt;li&gt;Two&lt;/li&gt;&lt;/ul&gt;</tt>
  1290. and
  1291. <tt>&lt;ul&gt;&lt;li&gt;Two&lt;/li&gt;&lt;li&gt;One&lt;/li&gt;&lt;/ul&gt;</tt>
  1292. may be considered the same), which was not what I want and not what other
  1293. people who contacted me about XML::SemanticDiff wanted.
  1294. </p>
  1295. <p>
  1296. After Test::XML::Ordered, I decided it would be a good idea to finally
  1297. work on the release of <tt>XML::GrammarBase</tt> which aims to provide
  1298. “base classes and roles” for facilitating creating XML validators
  1299. and processors. Work on it was pretty straightforward after I had
  1300. Test::XML::Ordered available, but required some refactoring the classes
  1301. from using <tt>Any::Moose</tt> to using <tt>Moo</tt> per advice of the
  1302. people on <tt>#moose</tt>, and I have yet to convert the XSLT role into
  1303. a parameterised role.
  1304. </p>
  1305. <p>
  1306. I have some other code I'd like to release on CPAN after all that.
  1307. </p>
  1308. <hr />
  1309. <p>
  1310. Another related hacktivity was a set of patches to the core Vim that I've
  1311. written to improve support for DocBook 5. Since I wanted to maintain
  1312. compatibility with DocBook 4 documents (because DocBook 4 is still popular),
  1313. this involved writing a Perl, Bash and Python Amalgam to generate the
  1314. Vim code in question with a list of common, DocBook 4-only and DocBook 5-only
  1315. tags. You can find it in
  1316. <a href="http://bitbucket.org/shlomif/vim-docbook-5-support">its BitBucket
  1317. repository</a>. It is very hacky, but it works. Using the Python code
  1318. gave me an idea for a missing XML::LibXML feature - DTD introspection - which
  1319. I'd like to implement in the future.
  1320. </p>
  1321. <p>
  1322. Well, that's all for now - just wanted to get it out of my system. Enjoy the
  1323. holidays, and Cheers!
  1324. </p>
  1325. <!-- TODO : Python+bash+perl amalgam to generate Vimscript code. -->
  1326. </div>
  1327. <div class="entry" id="countup100_jan2013">
  1328. <ul class="info">
  1329. <li><b>Date:</b> 07-01-2013</li>
  1330. <li class="tags">cpan, perl, sdlx, xml, 100, hacktivity, hacktivity log</li>
  1331. </ul>
  1332. <h1>Count-up to 100 CPAN Distributions: Quality *as well as* Quantity</h1>
  1333. <p>
  1334. Going over the previous count-ups to 100 CPAN distributions in this
  1335. blog, I feel I have been carried away: I tried to release a lot
  1336. of new distributions to the CPAN, while neglecting all the existing
  1337. distributions I have, and not tending to their pending problems and their
  1338. lack of <b>software quality</b> in several aspects (See
  1339. <a href="http://www.shlomifish.org/philosophy/computers/high-quality-software/rev2/">an
  1340. older essay I have written about it</a>).
  1341. </p>
  1342. <p>
  1343. I was reminded of it when
  1344. working on a few new or existing distributions using
  1345. <a href="http://dzil.org/">Dist-Zilla</a>. I ran into a few places where some
  1346. of its plugins or features were underdocumented, and non-exemplified (in
  1347. the SYNOPSIS sections or wherever), which consumed many hours of my time,
  1348. sometimes made me need to read or grep the code, and made me frustrated. While
  1349. I sent the maintainers some pull requests for better documenting this (and
  1350. some of them were applied), I would have prefered for them to be
  1351. properly documented and exemplified in the first place.
  1352. </p>
  1353. <p>
  1354. While I believe most of my CPAN distributions are in better condition, there
  1355. are some aspects that are lacking, and I would like to fix them: more examples
  1356. outside the SYNOPSES, and better SYNOPSES; documenting all methods of the
  1357. super classes as well as the classes themselves for
  1358. <a href="http://metacpan.org/release/XML-LibXML">XML-LibXML</a>; adding
  1359. support for DTD introspection and the oft requested
  1360. <a href="http://code.activestate.com/lists/perl-xml/8953/">DOM elements
  1361. annotations</a> for it; more
  1362. <a href="http://cpants.cpanauthors.org/kwalitee.html">kwalitee</a>; etc. and
  1363. naturally also better publicity and advertising
  1364. (<a href="http://freecode.com/">Freecode.com</a> (formerly known
  1365. as Freshmeat.net), Reddit, blogs.perl.org, video screencasts, etc.) because
  1366. people should see how cool your code is. I’m
  1367. not sure if any of these things would be as blog worthy as new
  1368. CPAN distributions, but it will make CPAN a bit better.
  1369. </p>
  1370. <p>
  1371. (Now that I think of it, perhaps a CPAN janitors initiative, which will
  1372. submit pull requests and patches for existing distributions to improve
  1373. their quality will be a good idea.)
  1374. </p>
  1375. <p>
  1376. Anyway, I am going to split this report into sections:
  1377. </p>
  1378. <h2>XML-GrammarBase</h2>
  1379. <p>
  1380. After some work (and misunderstanding of some of the Moo / MooX
  1381. documentation, which resulted in some pull requests), I released
  1382. <a href="http://www.shlomifish.org/open-source/projects/XML-Grammar/Base/">XML-GrammarBase</a>
  1383. which aims provides roles and base classes for easily writing wrappers around
  1384. XML schema formats and XML translation languages. So far only RELAXNG and
  1385. XSLT are supported. Here is the synopsis from the docs:
  1386. </p>
  1387. <pre>
  1388. package XML::Grammar::MyGrammar::ToOtherStuff;
  1389. use MooX 'late';
  1390. use XML::GrammarBase::Role::RelaxNG;
  1391. use XML::GrammarBase::Role::XSLT;
  1392. with ('XML::GrammarBase::Role::RelaxNG');
  1393. with XSLT(output_format =&gt; 'html');
  1394. with XSLT(output_format =&gt; 'docbook');
  1395. has '+module_base' =&gt; (default =&gt; 'XML-Grammar-MyGrammar');
  1396. has '+rng_schema_basename' =&gt; (default =&gt; 'my-grammar.rng');
  1397. has '+to_html_xslt_transform_basename' =&gt; (default =&gt; 'mygrammar-xml-to-html.xslt');
  1398. has '+to_docbook_xslt_transform_basename' =&gt; (default =&gt; 'mygrammar-xml-to-docbook.xslt');
  1399. package main;
  1400. my $xslt = XML::Grammar::MyGrammar::ToOtherStuff-&gt;new(
  1401. data_dir =&gt; "/path/to/data-dir",
  1402. );
  1403. # Throws an exception on failure.
  1404. my $as_html = $xslt-&gt;perform_xslt_translation(
  1405. {
  1406. output_format =&gt; 'html'
  1407. source =&gt; {file =&gt; $input_filename, },
  1408. output =&gt; "string",
  1409. }
  1410. );
  1411. </pre>
  1412. <p>
  1413. perform_xslt_translation supports myriad options and formats, and you
  1414. get it all for free.
  1415. </p>
  1416. <p>
  1417. I've also been contemplating something like
  1418. <code>App::XML::GrammarBase</code>
  1419. or <code>XML::GrammarBase::App</code> that will allow for easy registry
  1420. of such formats from the command line and for processing them.
  1421. </p>
  1422. <p>
  1423. At first, I believed that Moo was “almost-completely-unlike-Moose”, but
  1424. «use MooX 'late';» makes it much more Moose-like and I enjoy it, and it is
  1425. now recommended over Any::Moose or maybe even plain Mouse. Mouse is very
  1426. fast as well and has a far smaller startup time than Moose, but it does not
  1427. interoperate very well with pure-Moose classes, which Moo does
  1428. well.
  1429. </p>
  1430. <h2>HTML-Widgets-NavMenu-ToJSON</h2>
  1431. <p>
  1432. As I was working on <a href="http://www.shlomifish.org/">my homepage</a>, I
  1433. noticed that after I placed all the sub-navigation menus inside the main
  1434. navigation menu, it increased the size of the navigation menu considerably,
  1435. having it consume over 40,000 bytes. I decided to put only a subset of it
  1436. as HTML, and load and populate the rest using an AJAX call to a common
  1437. and static .json file. So I needed a way to convert the input of
  1438. <a href="https://metacpan.org/release/HTML-Widgets-NavMenu">HTML-Widgets-NavMenu</a>
  1439. </p>
  1440. <p>
  1441. So enter
  1442. <a href="https://metacpan.org/module/HTML::Widgets::NavMenu::ToJSON">HTML::Widgets::NavMenu::ToJSON</a>,
  1443. which serialises a navigation menu structure as JSON. I also implemented a
  1444. persistence layer for it, currently with only one backend - a YAML file,
  1445. so the IDs which jqTree require would be, well, persisted. This is a bit of
  1446. an <a href="http://www.joelonsoftware.com/articles/fog0000000018.html">architecture
  1447. astronautics</a>, but I ended up with something concrete at the end so it's
  1448. under control.
  1449. </p>
  1450. <p>
  1451. Here is the synopsis:
  1452. </p>
  1453. <pre>
  1454. use HTML::Widgets::NavMenu::ToJSON;
  1455. use HTML::Widgets::NavMenu::ToJSON::Data_Persistence::YAML;
  1456. my $persistence =
  1457. HTML::Widgets::NavMenu::ToJSON::Data_Persistence::YAML-&gt;new(
  1458. {
  1459. filename =&gt; &#39;/path/to/persistence_data.yaml&#39;,
  1460. }
  1461. );
  1462. my $obj = HTML::Widgets::NavMenu::ToJSON-&gt;new(
  1463. {
  1464. data_persistence_store =&gt; $persistence,
  1465. # The one given as input to HTML::Widgets::NavMenu
  1466. tree_contents =&gt; $tree_contents,
  1467. }
  1468. );
  1469. use IO::All;
  1470. io-&gt;file(&#39;output.json&#39;)-&gt;println(
  1471. $obj-&gt;output_as_json(
  1472. {
  1473. %args
  1474. }
  1475. )
  1476. );
  1477. </pre>
  1478. <p>
  1479. It could be made a bit simpler using an abstraction, but I feel it's not
  1480. too bad. You can write custom
  1481. <a href="http://metacpan.org/module/HTML::Widgets::NavMenu::ToJSON::Data_Persistence">HTML::Widgets::NavMenu::ToJSON::Data_Persistence</a>
  1482. child classes by implementing the <code>load()</code>
  1483. and <code>save()</code> methods - I did not document the process yet,
  1484. but you can base your efforts on
  1485. <a href="http://metacpan.org/module/HTML::Widgets::NavMenu::ToJSON::Data_Persistence::YAML">HTML::Widgets::NavMenu::ToJSON::Data_Persistence::YAML</a>.
  1486. </p>
  1487. <h2>Dist-Zilla-Plugin-TestRun</h2>
  1488. <p>
  1489. Since I'm used to running <kbd>./Build runtest</kbd> instead of
  1490. <kbd>./Build test</kbd> for my distributions, I sought a way of doing the
  1491. same using Dist-Zilla. It turned out there wasn't an easy way, and
  1492. <a href="http://metacpan.org/release/Dist-Zilla-Plugin-TestRun">Dist-Zilla-Plugin-TestRun</a>
  1493. is the best I could do. I hope to write a patch to make the <kbd>test</kbd>
  1494. command more configurable.
  1495. </p>
  1496. <h2>Test-XML-Ordered</h2>
  1497. <p>
  1498. <a href="http://metacpan.org/module/Test::XML::Ordered">Test::XML::Ordered</a>
  1499. makes a non-“semantic” diff of XML files and tells you if they are
  1500. equivalent (up to differences of whitespace and namespace prefixes). It grew
  1501. out of my frustration with
  1502. <a href="http://metacpan.org/module/XML::SemanticDiff">XML::SemanticDiff</a>,
  1503. upon which Test::XML is based, and which I maintain. A quick CPAN search
  1504. revealed other modules for testing XML in a similar manner, but since I have
  1505. already written my code, I decided to release it.
  1506. </p>
  1507. <p>
  1508. One tip is that with the current API, one should use something like:
  1509. </p>
  1510. <pre>
  1511. my @common = (validation =&gt; 0, load_ext_dtd =&gt; 0, no_network =&gt; 1);
  1512. is_xml_ordered (
  1513. [ string =&gt; normalize_xml($results_buffer), @common, ],
  1514. [ location =&gt; "./t/data/xhtml-results/$fn_base.xhtml", @common, ],
  1515. "Testing for Good XSLTing of '$fn_base'",
  1516. );
  1517. </pre>
  1518. <p>
  1519. In order to test XHTML documents for equivalency.
  1520. </p>
  1521. <h2>Vered-XML</h2>
  1522. <p>
  1523. I thought that Vered-XML (currently only available in the
  1524. <a href="http://bitbucket.org/shlomif/perl-begin">Perl Beginners’ Site’s
  1525. repository</a> was probably the most ad-hoc and tailored to match
  1526. XML grammar I have ever created, and was used to convert the markup of
  1527. <a href="http://perl-begin.org/tutorials/bad-elements/">the “Perl Elements
  1528. to Avoid” page</a> from hacky Website META Language markup to XML, so it
  1529. will be easier to translate to different (human) languages and also somewhat
  1530. easier to maintain and render. Currently it renders to DocBook/XML, which
  1531. allows translation to many other formats.
  1532. </p>
  1533. <p>
  1534. So why did I call it Vered? Since it was so ad-hoc, and I didn't know what
  1535. else it would be useful for, I wanted to give it an artsy name, and considered
  1536. using a random Hebrew feminine name. Then I thought that “a rose by any other
  1537. name would smell as sweer”, and thought of calling it Rose, but translated
  1538. to Hebrew it was “Vered”, which is also a Hebrew feminine name. I still have
  1539. to tie up some loose ends, but expect XML-Grammar-Vered at a CPAN mirror
  1540. near you Real Soon Now™.
  1541. </p>
  1542. <p>
  1543. Vered-XML supports a subset of XHTML, as well as some specialised tags such
  1544. as <code>&lt;pdoc /&gt;</code> (perldoc),
  1545. <code>&lt;pdoc_f /&gt;</code> (perldoc -f),
  1546. <code>&lt;cpan_self_mod /&gt;</code> (CPAN self link to module), etc. and
  1547. contains a RELAX NG schema and an xsltproc/libxslt2-compatible
  1548. XSLT 1.0 stylesheet. Here is an excerpt from
  1549. <a href="http://bitbucket.org/shlomif/perl-begin/src/d183a648b865a223c353b16664e05b6046bd478d/src/tutorials/bad-elements/perl-elements-to-avoid.xml-grammar-vered.xml?at=default">the “Perl Elements to Avoid” source XML</a>:
  1550. </p>
  1551. <pre>
  1552. &lt;item xml:id=&quot;slurp&quot;&gt;
  1553. &lt;info&gt;
  1554. &lt;title&gt;Slurping a file (i.e: Reading it all into memory)&lt;/title&gt;
  1555. &lt;/info&gt;
  1556. &lt;p&gt;
  1557. One can see several bad ways to read a file into memory in Perl. Among them
  1558. are:
  1559. &lt;/p&gt;
  1560. &lt;code_blk syntax=&quot;perl&quot;&gt;
  1561. # Not portable and suffers from possible
  1562. # shell code injection.
  1563. my $contents = `cat $filename`;
  1564. # Wasteful of CPU and memory:
  1565. my $contents = join(&quot;&quot;, &amp;lt;$fh&amp;gt;);
  1566. # Even more so:
  1567. my $contents = &#39;&#39;;
  1568. while (my $line = &amp;lt;$fh&amp;gt;)
  1569. {
  1570. $contents .= $line;
  1571. }
  1572. &lt;/code_blk&gt;
  1573. &lt;p&gt;
  1574. You should avoid them all. Instead the proper way to read an entire file
  1575. into a long string is to either use CPAN distributions for that such as
  1576. &lt;cpan_self_dist d=&quot;File-Slurp&quot; /&gt; or
  1577. &lt;cpan_self_dist d=&quot;IO-All&quot; /&gt;, or alternatively
  1578. write down the following function and use it:
  1579. &lt;/p&gt;
  1580. &lt;code_blk syntax=&quot;perl&quot;&gt;
  1581. sub _slurp
  1582. {
  1583. my $filename = shift;
  1584. open my $in, &#39;&amp;lt;&#39;, $filename
  1585. or die &quot;Cannot open &#39;$filename&#39; for slurping - $!&quot;;
  1586. local $/;
  1587. my $contents = &amp;lt;$in&amp;gt;;
  1588. close($in);
  1589. return $contents;
  1590. }
  1591. &lt;/code_blk&gt;
  1592. &lt;/item&gt;
  1593. </pre>
  1594. <p>
  1595. I'm not sure if Vered-XML will have much utility outside that use case, but
  1596. I think that putting it on CPAN won't hurt much.
  1597. </p>
  1598. <h2>Improving perlresume.org</h2>
  1599. <p>
  1600. I filed a few issues and sent some pull requests for
  1601. <a href="http://perlresume.org/">perlresume.org</a> for some problems
  1602. I ran into, and <a href="http://showmetheco.de/">vti</a> fixed or
  1603. applied them promptly. Thanks!
  1604. </p>
  1605. <h2>Beginners’ Sites</h2>
  1606. <p>
  1607. I invested more work into <a href="http://perl-begin.org/">the Perl Beginners’
  1608. site</a>
  1609. and also, after some encouragement from the good people on
  1610. <a href="irc://irc.freenode.net/#vim">#vim</a> began work on
  1611. <a href="http://vim.begin-site.org/">the Vim Beginners’s site</a>, which
  1612. I publicised on <a href="http://shlomif-tech.livejournal.com/65619.html">my
  1613. tech blog</a>,
  1614. on <a href="http://www.reddit.com/r/vim/comments/15o6v1/announcing_the_vim_beginners_site/">Reddit</a>,
  1615. and on some mailing lists. While in the past I used my own
  1616. <a href="http://web-cpan.shlomifish.org/latemp/">static site
  1617. generator called “Latemp”</a> based on Website Meta Language for sites
  1618. like that,
  1619. I used Jekyll this time, at least for the first prototype. I did so
  1620. in order to evaluate it for use in a different site
  1621. (<a href="http://www.linux.org.il/">The
  1622. Israeli Linux Portal</a> which is currently implemented using an awkward
  1623. custom PHP-based system, that mostly just reads stuff out of XML data
  1624. files and outputs a constant static HTML as XSLT.). While at first I was
  1625. impressed with Jekyll,
  1626. I then realised that it was quite opaque, often required many plugins to
  1627. get some basic functionality and that one plugin I looked at lacked examples
  1628. and was otherwise under documented.
  1629. </p>
  1630. <p>
  1631. There is <a href="http://iwantmyname.com/blog/2011/02/list-static-website-generators.html">a
  1632. list of many more static site generators / offline content-management
  1633. systems</a> around (which does not include my own Latemp), and it may be
  1634. easier to roll up something on my own based on Template Toolkit or its ttree.
  1635. All this just confirms my
  1636. (and <a href="http://blogs.perl.org/users/su-shee/">Su-Shee</a>’s) suspicion
  1637. that every self-respecting web programmer has written at least one.
  1638. </p>
  1639. <h2>Freecell Solver for JavaScript - ☺</h2>
  1640. <p>
  1641. I have been distracted for many hours trying to port Freecell Solver
  1642. to JavaScript using the very cool
  1643. <a href="https://github.com/kripken/emscripten">Emscripten</a> LLVM bitcode
  1644. to JavaScript compiler.
  1645. The <a href="http://fc-solve.shlomifish.org/js-fc-solve/text/">mostly
  1646. final result</a> could still use some work, and is still under optimised (in
  1647. large part due to what appear to be an Emscripten bug) but it's working.
  1648. </p>
  1649. <p>
  1650. The <a href="https://github.com/kripken/emscripten/wiki">Emscripten
  1651. wiki</a> contains links to many, much more impressive, demos including
  1652. <a href="http://kripken.github.com/meandmyshadow.web/mams.html">a
  1653. JavaScript version of the open-source graphical game “Me and My Shadow”</a>.
  1654. </p>
  1655. <h2>Two Anecdotes from ##programming</h2>
  1656. <p>
  1657. I enjoy chatting on
  1658. <a href="irc://irc.freenode.org/##programming">##programming (on Freenode)</a>
  1659. and along with all the rants about how much every popular programming langauge
  1660. in existence sucks, and trying to help various students with their often
  1661. badly indented and badly formatted homework code, there are often some
  1662. insightful discussions by some smart people. I’d like to share two Perl-related
  1663. anecdotes from there.
  1664. </p>
  1665. <p>
  1666. The first one was that someone there who has taken studying programming, before
  1667. starting to study in university, seriously, and also read the Camel book
  1668. and other books and resources about Perl, asked me to look at my code
  1669. to see how readable it is. I referred him to the
  1670. <a href="https://metacpan.org/source/SHLOMIF/HTML-Widgets-NavMenu-1.0701/lib/HTML/Widgets/NavMenu.pm">source
  1671. code</a> of HTML::Widgets::NavMenu, which will being an early code of
  1672. mine (and still not fully modernised), was written in a modular manner, and he
  1673. said he found it to be well-factored and yet very readable . He noted that he
  1674. suspected that Perl would be less believed to “hard to understand” or
  1675. “unreadable”, if it sandardised on using my preferred style -
  1676. <a href="http://en.wikipedia.org/wiki/Indent_style#Allman_style">Allman
  1677. style</a> - instead of its default style with the opening braces on the
  1678. same line as the opening clause (e.g: <tt>if ( COND ) {</tt>).
  1679. </p>
  1680. <p>
  1681. The other anecdote was that someone else there, who is working in Visual
  1682. Basic and Visual Basic for Applications for a living (for lack of good
  1683. alternative for software development job prospects in his homeland), told us
  1684. that he found the CPAN documentation to usually be superior than the MSDN
  1685. (Microsoft Developers Network) one.
  1686. I found it a little strange, because I recall finding the MSDN documentation
  1687. to give detailed examples for almost every subroutine and a page of prose and
  1688. explanation for each one, and reportedly large parts of it were also
  1689. translated into some non-English languages by Microsoft. Then I showed him
  1690. the “SYNOPSIS” sections of some of the .pm files in CPAN and he was
  1691. even more impressed and said it was useful (because you can copy+paste it and
  1692. tweak it), but naturally commented that not all .pm files had those.
  1693. </p>
  1694. <h2>Conclusion</h2>
  1695. <p>
  1696. I currently stand at <a href="http://perlresume.org/SHLOMIF">87 CPAN
  1697. distributions</a>, some of which a bit lacking, and I still have some in the
  1698. pipe. One of them will require quite a lot of cleanup work to do, but it's
  1699. not a high priority. I also have to juggle some other endeavours, and also
  1700. recently started contracting for an Internet friend as a Drupal developer
  1701. (and in the future possibly one for Moodle as well), which may consume even
  1702. more of my time (but on the bright side pay a little money). It’s no secret
  1703. that I am not a big fan of PHP, but Drupal seems impressive so far, and
  1704. hides away a lot of PHP’s ugliness. It took me some time to get acquainted
  1705. with it, so I hope now things will be smoother and easier to do. It seems that
  1706. there's quite a bit of demand for converting sites into Drupal, setting up new
  1707. sites, or maintaining them in Israel (and possibly elsewhere as well) so it
  1708. is probably a useful skill to have under my belt.
  1709. </p>
  1710. <p>
  1711. Hope you enjoyed this hacktivity log, and see you next time. Byeeeee!
  1712. </p>
  1713. </div>
  1714. <div class="entry" id="just_write_the_god_damn_test_motherfucker">
  1715. <ul class="info">
  1716. <li><b>Date:</b> 07-01-2013</li>
  1717. <li class="tags">tdd, tests, philosophy, essay</li>
  1718. </ul>
  1719. <h1>Essay: “Just write the God-damn tests, motherfucker!”</h1>
  1720. <p>
  1721. (I originally wrote this in
  1722. <a href="http://www.nntp.perl.org/group/perl.qa/2013/01/msg13350.html">a post to qa@perl.org</a>, and I apologise for the profanity in the title, but I felt
  1723. it is needed in this case.)
  1724. </p>
  1725. <p>
  1726. So why am I writing this? I used to feel guilty about not being conscious of
  1727. the distinction between the various scopes of tests, like unit tests vs.
  1728. integration tests vs. system tests vs. functional tests etc. when I wrote the
  1729. tests. I just noticed that I need a test here (as a regression test for a bug,
  1730. or to <a href="http://en.wikipedia.org/wiki/Test-driven_development">TDD</a> (=
  1731. test-driven develop a new feature, or after implementing a new feature,
  1732. etc.), and wrote it using Test::More or whatever. However, now I feel that
  1733. trying to philosophise about the distinction between all those is not so
  1734. useful for the people who are actually trying to write the tests.
  1735. </p>
  1736. <p>
  1737. <q>Tests are good, mmkay? Just freaking write them!</q>
  1738. </p>
  1739. <p>
  1740. chromatic has expressed <a href="http://modernperlbooks.com/mt/2012/04/what-testing-dsls-get-wrong.html">some sentiments</a> against the so-called “Behaviour
  1741. Driven Development” (BDD) Domain-specific-languages (DSLs) such as cucumber.
  1742. </p>
  1743. <p>
  1744. One thing that he notes in a comment there is:
  1745. </p>
  1746. <blockquote>
  1747. <p>
  1748. Our clients are the parents, guardians, and teachers of children between the
  1749. ages of eight and twelve inclusive.
  1750. </p>
  1751. <p>
  1752. The intent of Cucumber is to make readable testcases, just as the intent of
  1753. COBOL and AppleScript and visual component programming is to enable
  1754. non-programmers to create software without having to learn how to program.
  1755. </p>
  1756. </blockquote>
  1757. <p>
  1758. It is impossible to have people who are non-programmers write
  1759. structure code without learning how to program, at least until we get
  1760. sufficiently intelligent Sci-Fi-like artificial intelligence (not the current
  1761. crop of artificial ultra-stupidities) that will be able to perform
  1762. programming like humans do, and will be willing to do so, while not having
  1763. free will and still be obedient to us, and that will perform adequately. I
  1764. feel that you need to write <b>some</b> kind of code, however formatted, to
  1765. write tests, just like HTML and CSS and spreadsheet programs, involve writing
  1766. some kind of *code*.
  1767. </p>
  1768. <p>
  1769. If you want to have your clients write tests, my best suggestion is to either
  1770. instruct them in the proper methodology and discipline of coding, or
  1771. alternatively have them show you how to reproduce the problem (using
  1772. screenshots, screencasts, shared remote desktop sessions, etc.) and then
  1773. <b>you</b> should write a test for it.
  1774. </p>
  1775. <p>
  1776. Some people fear that teaching laymen how to code will create
  1777. competition for professional programmers, and dilute the profession. However,
  1778. this is not true, because there's always a difference between a casual dealer
  1779. in a craftsmanship or art, and someone who invested a substantial amount of
  1780. time doing it. E.g: lots of people can cook well, but not everyone is a
  1781. professional Chef, and Chefs still often teach other people cooking, or share
  1782. their recipes, because that does not dilute their profession.
  1783. </p>
  1784. <p>
  1785. So I think the distinction between the various tests may be useful for
  1786. methodologists and software engineering researchers (people who try to guide
  1787. other people how to code) more than the people who are actually coding. To quote
  1788. Picasso: “When art critics get together they talk about Form and Structure and
  1789. Meaning. When artists get together they talk about where you can buy cheap
  1790. turpentine.”
  1791. ( taken from <a href="http://orip.org/">Ori Peleg’s blog</a> ).
  1792. </p>
  1793. <p>
  1794. Similarly, literature critics and researchers have very little to say that is
  1795. of use for most writers and even authors. I hated studying Literature (what
  1796. Americans might call “English” although naturally in Israel, we study Hebrew
  1797. texts) with a passion, and didn't do too well on the tests (in part because
  1798. out of personal honesty, I refused to write a lot of extraneous text, which
  1799. the teacher seemed to have preferred), only to become a writer of
  1800. <a href="http://www.shlomifish.org/humour/">fiction</a> and
  1801. <a href="http://www.shlomifish.org/philosophy/">essays</a> (see
  1802. <a href="http://www.paulgraham.com/essay.html">Paul
  1803. Graham’s “The Age of the Essay”</a> for why they are not only about
  1804. literature) after graduation. Furthermore, most people I
  1805. talked with seem to have liked and appreciate the textual works I have
  1806. written (although I admit they are certainly not letter perfect), and I
  1807. could usually find some value in the criticisms of people who did not, even
  1808. if expressed very destructively, and often was able to improve my works
  1809. accordingly.
  1810. </p>
  1811. <p>
  1812. Similarly, I'm now struggling with <a href="http://www.amazon.com/xUnit-Test-Patterns-Refactoring-Code/dp/0131495054">this tome</a>
  1813. which seems like I cannot see the forest for the trees from it, while I
  1814. really enjoyed reading the much shorter and much more hands-on
  1815. <a href="http://en.wikipedia.org/wiki/Test-Driven_Development_by_Example"><i>Test Driven Development by Example</i> (by Kent Back)</a>.
  1816. </p>
  1817. <p>
  1818. The time we talk about how to write tests is often better spent writing tests
  1819. (or production code, which is, naturally, what tests are aimed to support and
  1820. are meaningless without it), so I think we should just “freaking write them”.
  1821. </p>
  1822. <p>
  1823. <q>Just write the god-damn test, motherfucker!</q>
  1824. </p>
  1825. <p>
  1826. (
  1827. <b>Note:</b> the title of this essay was inspired by
  1828. the <a href="http://programming-motherfucker.com/">“Programming,
  1829. Motherfucker”</a> of Zed Shaw, which is very amusing, even if it seems
  1830. to be written in a somewhat ironic tone, and that contains the useful
  1831. <a href="http://programming-motherfucker.com/become.html">huge list of free
  1832. books for learning programming</a>.
  1833. )
  1834. </p>
  1835. <h3 id="license">Licence</h3>
  1836. <p>
  1837. As opposed to most of my previous essays, this work is Copyright by Shlomi
  1838. Fish, 2013, under the
  1839. <a rel="license" href="http://creativecommons.org/licenses/by-nc/3.0/">Creative
  1840. Commons Attribution-NonCommercial 3.0 Unported licence</a>, with a
  1841. deliberate exemption for using the text on web pages with web commercials.
  1842. For more information, see
  1843. <a href="http://www.shlomifish.org/meta/copyrights/">my interpretation of
  1844. the licence</a>.
  1845. If you wish to use it under any different licence, then
  1846. <a href="http://www.shlomifish.org/me/contact-me/">drop me a line</a>.
  1847. </p>
  1848. </div>
  1849. <div class="entry" id="soft_dev_to_writer">
  1850. <ul class="info">
  1851. <li><b>Date:</b> 07-01-2013</li>
  1852. <li class="tags">cpan, perl, philosophy, humor, humour, hacking</li>
  1853. </ul>
  1854. <h1>ANN: My Transition From Software Developer to Writer/Entertainer/Amateur Philosopher/Internet Celebrity</h1>
  1855. <p>
  1856. I’d like to make an announcement: after some serious thought, I decided that
  1857. from now on, being a software developer (which I am not too bad at) will only
  1858. be the means (but the absolutely necessary ones) to me being a writer /
  1859. entertainer / philosopher / Internet celebrity (a little bit of all those
  1860. and then some) whose main pride and passion is
  1861. <a href="http://www.shlomifish.org/">his personal web site</a>, which is full
  1862. of a lot of material, and various pages and material is constantly added to it.
  1863. </p>
  1864. <p>
  1865. Note: I am not going to “quit” from the Perl world or am going to
  1866. stop programming completely. In fact, programming in HTML, XHTML, CSS, XSLT,
  1867. Website Meta Language, Perl 5, Bash, Vim/gvim, and many other general
  1868. purpose and/or domain-specific languages, is
  1869. absolutely necessary for what I do on a daily basis. Furthermore, I have
  1870. little
  1871. patience for
  1872. laymen who do not wish to learn HTML, and just require more and more of our
  1873. (= my peers and mine's) time to be wasted in a typical
  1874. <a href="http://en.wikipedia.org/wiki/Parable_of_the_broken_window">“Parable
  1875. of the broken window”</a> fashion. I think even most of our sisters,
  1876. mothers (and yes, I'm being facetiously sexist on purpose, because a lot of
  1877. the most clueless people we can think of are male), etc. can learn some basic
  1878. programming skills and even be good at that with the right attitude. When put
  1879. in a corner, they will be forced to learn it. and that programming is becoming
  1880. more and more essential for everyone to know. Furthermore, clients who wish to
  1881. remain ignorant (and often hostile) forever should be avoided, with a clear
  1882. honest and sincere explanation telling them why and how to improve.
  1883. </p>
  1884. <p>
  1885. Anyway, as is evident from
  1886. <a href="http://www.shlomifish.org/humour/TheEnemy/">my first story</a>,
  1887. I have already made a gradual transition from being a mathematician and
  1888. a mathematical logician, to being a software developer and web developer,
  1889. so now it's another transition. It took me a lot of time to hone my skills
  1890. as a writer of stories, screenplays, aphorisms, Chuck Norris/etc. factoids,
  1891. etc. etc. so it’s now much easier for me. It took me over a year to write
  1892. my first story, but now I can whip up text fairly quickly, and find it
  1893. enjoyable. Moreover, I now also have not one - but two ideas for new
  1894. stories - both of which I have not started writing.
  1895. </p>
  1896. <p>
  1897. One implication is that I decided to <b>transfer the maintenance</b> of
  1898. <a href="https://metacpan.org/release/XML-LibXML">XML::LibXML</a> to someone
  1899. else, because while I believe I proved myself of utility in maintaing
  1900. it, I find it hard to keep with its ongoing maintenance. One can easily
  1901. fork
  1902. <a href="https://bitbucket.org/shlomif/perl-xml-libxml">its bitbucket
  1903. repository</a>, or given enough motivation, one can set up a similar one
  1904. on GitHub or wherever (I recall receiving several patches with “--git” there)
  1905. so if you have the skills, time, and motivation - just do it, and I’ll just
  1906. upload the archives on your behalf (and eventually ask for giving you COMAINT).
  1907. I have mentioned some ideas about what I have in mind for XML-LibXML elsewhere
  1908. and you can always ask me on IM or IRC.
  1909. </p>
  1910. <h2>“Putting all the cards on the table - 2013”</h2>
  1911. <p>
  1912. I have started to write <a href="http://unarmed.shlomifish.org/2109.html">an
  1913. essay</a> on my “Unarmed but still Dangerous” blog titled “Putting all the
  1914. Cards on the Table” - I start from the Technion, M.I.T., the film
  1915. <a href="http://en.wikipedia.org/wiki/Silver_Linings_Playbook"><i>Silver
  1916. Linings Playbook</i></a>
  1917. and <a href="http://en.wikipedia.org/wiki/Jennifer_Lawrence">its lead
  1918. actress - Ms. Jennifer Lawrence</a> (♥!) and goes on to discuss lots of other
  1919. stuff including David vs. Goliath, computer networking, the second major
  1920. battle that Chuck Norris lost, and to why we should initiate action (any
  1921. action) instead of letting things go from bad to worse on their own, and
  1922. there is much more to come. Hopefully, it will be amateur philosophy (
  1923. where amateur is someone who: 1) Loves what he does. 2) Is not professional.
  1924. 3) Does not play by the same rules as professionals. - i.e: what we often
  1925. call today as “hackers”) at the best I can do.
  1926. </p>
  1927. <p>
  1928. My main issue is that I felt the truly amateuristic intellectuals like me
  1929. have been speaking too much in riddles, and that even I have been lying
  1930. to myself and hiding many things from other people, and I want to offload
  1931. everything I know as of March, 2013 (and it may be very different 10 years
  1932. from now or even a year from now). And I want to do it in a truly honest,
  1933. sincere, and putting all the cards I have now on the table fashion. There is
  1934. a lot of humour in the essay, and a lot of personal analogies and references,
  1935. some sex talk, (even sexism) and personal reflections (and my typical
  1936. self-promotion), but it's still serious, honest, and sincere, and
  1937. hopefully enjoyable.
  1938. </p>
  1939. <p>
  1940. Please comment on it on the blog, where you should be able to register using
  1941. any OpenID provider, but anonymous comments, that are not spam, and where you
  1942. give a link to identify yourself can also be done (just <b>please</b> preview
  1943. the comment before sending it). I am planning on working on further publicity.
  1944. </p>
  1945. <h2>How to Achieve World Domination</h2>
  1946. <p>
  1947. A lot of people think that the proper way to achieve world domination is
  1948. to create an
  1949. <a href="http://www.joelonsoftware.com/articles/fog0000000018.html">architecture
  1950. that will solve the whole world’s problems and then some</a>. We’ve been seeing
  1951. quite a few of them since <i>Joel on Software</i> wrote this article: Ruby,
  1952. Google Go, Node.js, Mozilla’s Rust, Clojure, Scala, Perl 6, etc. Some of them
  1953. have or will mature to something truly nice, or have inspired a lot of
  1954. features in other languages, but it’s hard for
  1955. plain-old-single-you to compete with them, and here is something interesting:
  1956. not too many people want them.
  1957. </p>
  1958. <p>
  1959. What do people want? Chuck Norris/etc. factoids, lolcats and other captioned
  1960. images, funny cat videos, parodies of
  1961. <i>My Little Pony: Friendship is Magic</i> (♥), photos of attractive (or even
  1962. not too attractive) men and women, screencasts of games or other programs
  1963. (including many open source programs), photos of scenery, new and improved
  1964. recipes for preparing food (and of course - tasty food itself), new, old or
  1965. renovated jokes, and some interesting tales and anecdotes from your life. And
  1966. naturally - programs that can will scratch an itch - however small.
  1967. </p>
  1968. <p>
  1969. Some people told me that my solver for Freecell and other solitaire games,
  1970. simply called
  1971. <a href="http://fc-solve.shlomifish.org/">Freecell Solver</a> is useless, but
  1972. it's not - it's just a niche program. And I received hundreds of E-mails
  1973. about it. Furthermore, given that Freecell is (or used to be) a big phenomenon
  1974. in Israel, where many boys and girls starting from 18 found themselves
  1975. playing it
  1976. on the <a href="http://en.wikipedia.org/wiki/Israel_Defense_Forces">Israeli
  1977. military</a> computers out of boredom, then the fact that I have written a
  1978. solver for it,
  1979. has impressed many people I talked with or met, including some attractive
  1980. (both physically and intellectually) young ladies (or what people may
  1981. refer to as “hot chicks”), and they ended up asking me about how it was
  1982. written, and which algorithms it employed.
  1983. </p>
  1984. <p>
  1985. So Freecell Solver was one of my most successful programs, not despite being
  1986. a niche program, but because of it. Niche programs own. Not only that,
  1987. but niche everything is great. Many people whom I referred to
  1988. <a href="http://www.shlomifish.org/humour/stories/">my stories</a> helped
  1989. themselves to the screenplay
  1990. <a href="http://www.shlomifish.org/humour/Star-Trek/We-the-Living-Dead/">Star Trek:
  1991. “We, the Living Dead”</a> <b>because</b> it contained Star Trek in the name,
  1992. and because there are quite a few fans of the <i>Star Trek</i> franchise and
  1993. worlds.
  1994. </p>
  1995. <p>
  1996. The more of a niche artwork you write, the more a large subset of those
  1997. who like it, are likely to pay attention to it, try it out, and enjoy it.
  1998. For more information, see
  1999. Eric Sink’s excellent and inspiring essay
  2000. <a href="http://www.ericsink.com/articles/Buzz.html">“How to get
  2001. people talking about your product”</a>.
  2002. For example,
  2003. <a href="http://en.wikipedia.org/wiki/DuckDuckGo">DuckDuckGo</a> was originally
  2004. marketed as a search engine by Perl geeks, and for Perl geeks, and it was
  2005. a good marketing decision because the Perl community is small, cohesive and
  2006. is at a good strategical position to influence other communities. Now, many
  2007. people who are not Perl programmers, are using it, as well as, or even in
  2008. preference to Google, but choosing Perl was a good strategical decision.
  2009. We can expect that with the future growth of DuckDuckGo, that it will
  2010. use more performant technologies than Perl more and more, but it will still
  2011. owe some of its initial success to be a Perl product.
  2012. </p>
  2013. </div>
  2014. <div class="entry" id="recent_hacktivity_log_13_april_2013">
  2015. <ul class="info">
  2016. <li><b>Date:</b> 13-04-2013</li>
  2017. <li class="tags">perl, philosophy, humor, hacktivity log, xml, films, fiction</li>
  2018. </ul>
  2019. <h1>Recent Hacktivity Log</h1>
  2020. <p>
  2021. This is another recent hacktivity log of what I have been up to recently, as
  2022. far as software development and writing is concerned.
  2023. </p>
  2024. <h2>“Every Publicity is Good Publicity…”</h2>
  2025. <p>
  2026. True to my belief that “The Gods help them that help themselves”, I have been
  2027. working much more on publicity recently, utilising
  2028. <a href="http://twitter.com/shlomif">my Twitter account</a>,
  2029. <a href="http://www.reddit.com/user/shlomif">my Reddit account</a>,
  2030. <a href="http://www.facebook.com/shlomi.fish">my Facebook account</a>
  2031. and other online resources. I am not exclusively promoting only my own works,
  2032. and also share/retweet/etc. the posts of my friends. I had great success
  2033. with <a href="http://www.reddit.com/r/xkcd/comments/1bignr/xkcdinspired_screenplay_starring_summer_glau_as/">this
  2034. /r/xkcd subreddit post</a> which so far received 150 upvotes (and 36 down
  2035. votes) about my
  2036. new screenplay
  2037. <a href="http://www.shlomifish.org/humour/Summerschool-at-the-NSA/"><i>Summerschool
  2038. at the NSA</i></a> which has a strong
  2039. <a href="http://en.wikipedia.org/wiki/Xkcd">xkcd (= the web comics)</a> theme,
  2040. and also had some lesser success with posts to other subreddits. As usual,
  2041. I also upvote and comment on other people's posts and comments.
  2042. </p>
  2043. <p>
  2044. It seems that the main problem with my site up to now has not been
  2045. that it lacked good content, but
  2046. that most people were not aware of the site.
  2047. </p>
  2048. <p>
  2049. I’ve also been experimenting with buying
  2050. <a href="http://www.projectwonderful.com/">Project Wonderful</a> web
  2051. advertisements, but so far they did not yield too many clicks.
  2052. </p>
  2053. <h2>The Olamot Sci-Fi/Fantasy Conference</h2>
  2054. <p>
  2055. As I <a href="http://hamakor.org.il/pipermail/discussions/2013-March/004518.html">reported
  2056. on the Hamakor mailing list</a>, I attended the Olamot
  2057. Science-Fiction/Fantasy/etc. conference that took place during Passover in
  2058. Tel Aviv, Israel, and had a great time. I didn't bring a camera to the first
  2059. day, so people on IRC did not believe me that I saw many highly attractive
  2060. geeks there, which I remedied by bringing a camera
  2061. and taking many
  2062. <a href="http://www.flickr.com/photos/shlomif/sets/72157633111982891/">photos</a>
  2063. during the second day.
  2064. </p>
  2065. <p>
  2066. The conference was colourful, zany, and inspiring and most of the people I saw
  2067. agreed to be photographed. I spent most of the time there
  2068. helping with the booth of the
  2069. <a href="http://en.wikipedia.org/wiki/Open_source">open source community</a>
  2070. and we were better organised and more prepared than a similar
  2071. conference several years ago, where we only had a very huge and heavy
  2072. Sun CRT screen that did not yield to our attempts to get it to display
  2073. something on the computer.
  2074. </p>
  2075. <h2>Work on Selina Mandrake - The Slayer (a Buffy Parody)</h2>
  2076. <p>
  2077. I was able to mostly complete my work on the screenplay
  2078. <a href="http://www.shlomifish.org/humour/Selina-Mandrake/"><i>Selina Mandrake -
  2079. The Slayer</i></a>, which is marketed as a parody of
  2080. <a href="http://en.wikipedia.org/wiki/Buffy_the_Vampire_Slayer_%28TV_series%29"><i>Buffy the Vampire Slayer</i></a>, but which also
  2081. crosses over many other elements, including from
  2082. <a href="http://en.wikipedia.org/wiki/Star_Trek:_Deep_Space_Nine"><i>Star
  2083. Trek: Deep Space Nine</i></a>,
  2084. Judaism, history of the Near East and Europe, and computer geekdom. It is
  2085. in a usable condition now, but there are still some missing scenes, and the
  2086. screenplay may also need some polishing.
  2087. </p>
  2088. <h2>Buffy and Clarissa Facts</h2>
  2089. <p>
  2090. In the name of <a href="http://en.wikipedia.org/wiki/Girl_power">girl
  2091. power</a>, and
  2092. <a href="http://tvtropes.org/pmwiki/pmwiki.php/Main/ForGreatJustice">FOR
  2093. GREAT JUSTICE</a>,
  2094. I have continued to collect factoids about females:
  2095. <a href="http://www.shlomifish.org/humour/bits/facts/Buffy/">Buffy Summers</a>
  2096. from the show
  2097. <i>Buffy the Vampire Slayer</i>, and
  2098. and <a href="http://www.shlomifish.org/humour/bits/facts/Clarissa/">Clarissa
  2099. Darling</a> from
  2100. <a href="http://en.wikipedia.org/wiki/Clarissa_Explains_It_All"><i>Clarissa
  2101. Explains It All</i></a> (which I fear no one is familiar with or remember
  2102. now, but still makes for some awesome factoids). Additions are welcome.
  2103. </p>
  2104. <h2>Summerschool at the NSA</h2>
  2105. <p>
  2106. I got the idea for the screenplay
  2107. <a href="http://www.shlomifish.org/humour/Summerschool-at-the-NSA/"><i>Summerschool
  2108. at the NSA</i></a> during the Olamot conference mentioned above, and I
  2109. am thankful for such great conference for providing a lot of inspiration.
  2110. I was able to complete the screenplay in less than two weeks and
  2111. it is in a usable condition now (but likely still has many rough spots).
  2112. Quoting from the abstract:
  2113. </p>
  2114. <blockquote>
  2115. <p>
  2116. The Hollywood actresses
  2117. <a href="https://en.wikipedia.org/wiki/Sarah_Michelle_Gellar">Sarah
  2118. Michelle Gellar</a> (of
  2119. <a href="http://en.wikipedia.org/wiki/Buffy_the_Vampire_Slayer">Buffy</a>
  2120. fame) and
  2121. <a href="https://en.wikipedia.org/wiki/Summer_Glau">Summer Glau</a> (of
  2122. <a href="http://en.wikipedia.org/wiki/Xkcd">xkcd</a> notability)
  2123. conspire to kick the ass of the
  2124. <a href="https://en.wikipedia.org/wiki/National_Security_Agency">NSA</a>
  2125. (= the United States government’s National Security Agency), while using
  2126. special warfare that is completely non-violent.
  2127. </p>
  2128. </blockquote>
  2129. <p>
  2130. This screenplay crosses Judaism, the Mother Goose nursary rhymes,
  2131. <a href="http://en.wikipedia.org/wiki/My_Little_Pony:_Friendship_Is_Magic">My
  2132. Little Pony</a>, substance/etc. addiction, xkcd, Buffy, the song
  2133. <a href="http://en.wikipedia.org/wiki/99_Problems">“99
  2134. Problems” by Jay-Z</a>, and some personal insights and memes, and despite
  2135. all that is actually mostly realism for a change.
  2136. </p>
  2137. <h3>“All Truth is God’s Truth”</h3>
  2138. <p>
  2139. Some people, with whom I talked on <a href="http://freenode.net/">the Freenode
  2140. chat network</a>, complained that I didn’t stay loyal to my Jewish roots,
  2141. and instead crossed Judaism with other idea system, and some newer sources of
  2142. influence. However I’d like to quote Larry Wall from his
  2143. <a href="http://cos.polyamory.org/text/T/lwall-keynote.txt">“Perl Culture”
  2144. keynote</a>:
  2145. </p>
  2146. <blockquote>
  2147. <p>
  2148. I have a book on my bookshelf that I’ve never read, but that has a great title.
  2149. It says, <a href="http://en.wikipedia.org/wiki/All_truth_is_god%27s_truth">“All
  2150. Truth is God’s Truth.”</a> And I believe that. The most viable belief
  2151. systems are those that can reach out and incorporate new ideas, new memes, new
  2152. metaphors, new interfaces, new extensions, new ways of doing things. My goal
  2153. this year is to try to get Perl to reach out and cooperate with Java. I know it
  2154. may be difficult for some of you to swallow, but Java is not the enemy. Nor is
  2155. Lisp, or Python, or Tcl. That is not to say that these languages don't have
  2156. good and bad points. I am not a cultural relativist. Nor am I a linguistic
  2157. relativist. In case you hadn't noticed. :-)
  2158. </p>
  2159. </blockquote>
  2160. <p>
  2161. Furthermore, like Ayn Rand
  2162. <a href="http://books.google.co.il/books?id=5_NDTA9x-qMC&amp;pg=PA279&amp;lpg=PA279&amp;dq=ayn+rand+philosophy+writer+diary+%22absolutely+necessary+means%22&amp;source=bl&amp;ots=str9ABfMXk&amp;sig=z0TChWLzDHhcEWcBg17X7MW_Srk&amp;hl=en&amp;sa=X&amp;ei=VydpUbGdLemI4ASKvYDIDQ&amp;redir_esc=y#v=onepage&amp;q=ayn%20rand%20philosophy%20writer%20diary%20%22absolutely%20necessary%20means%22&amp;f=false">noted in her journal</a>,
  2163. a good work of fiction requires a solid philosophy, and so one can learn
  2164. a lot from works of fiction. Furthermore,
  2165. <a href="http://en.wikiquote.org/wiki/Peter_Ustinov">Peter Ustinov</a>
  2166. noted that “Comedy is simply a funny way of being serious.”, so even
  2167. humorous works of art convey a good philosophy.
  2168. </p>
  2169. <p>
  2170. I think the main difference between
  2171. contemporary or old works of fiction, such as the Greek mythology, Aesop’s
  2172. fables, the works of Alexandre Dumas Pere,
  2173. <a href="http://en.wikipedia.org/wiki/Star_Trek">Star Trek</a>, Buffy, etc.
  2174. and “holy” works such as
  2175. <a href="http://en.wikipedia.org/wiki/Bible">the Holy Bible</a>
  2176. or <a href="http://en.wikipedia.org/wiki/Quran">the Qur’an</a> is that some
  2177. people still take the latter too seriously, and consider them the final
  2178. word on how to lead your life, rather than just another step in the road
  2179. to enlightenment.
  2180. </p>
  2181. <p>
  2182. So I’m not going to let my personal philosophy stagnate by sticking only
  2183. to traditional Judaism, which itself was never pure, and always
  2184. incorporated many useful ideas from elsewhere, and still should.
  2185. </p>
  2186. <h2>XML-Grammar-Screenplay / XML-Grammar-Fiction</h2>
  2187. <p>
  2188. When working on the screenplays, I noticed that some of the error messages
  2189. were quite unhelpful, so I implemented more informative error messages
  2190. in
  2191. <a href="http://www.shlomifish.org/open-source/projects/XML-Grammar/Fiction/">XML-Grammar-Fiction
  2192. / XML-Grammar-Screenplay</a>. I noticed that the code was getting quite
  2193. complicated, so I refactored it a little, but there is still a long way
  2194. to go.
  2195. </p>
  2196. <h2>Freecell Solver</h2>
  2197. <p>
  2198. Someone reported problems understanding the solutions of the online (JS-based)
  2199. port of <a href="http://fc-solve.shlomifish.org/">Freecell Solver</a>, and
  2200. I decided to convert the card suit identifiers to their Unicode equivalents.
  2201. So from:
  2202. </p>
  2203. <pre>
  2204. Foundations: H-0 C-0 D-0 S-0
  2205. Freecells:
  2206. : 4C 2C 9C 8C QS 4S 2H
  2207. : 5H QH 3C AC 3H 4H QD
  2208. : QC 9S 6H 9H 3S KS 3D
  2209. : 5D 2S JC 5C JH 6D AS
  2210. : 2D KD TH TC TD 8D
  2211. : 7H JS KH TS KC 7C
  2212. : AH 5S 6S AD 8H JD
  2213. : 7S 6C 7D 4D 8S 9D
  2214. </pre>
  2215. <p>
  2216. We get:
  2217. </p>
  2218. <pre>
  2219. Foundations: ♥-0 ♣-0 ♦-0 ♠-0
  2220. Freecells:
  2221. : 4♣ 2♣ 9♣ 8♣ Q♠ 4♠ 2♥
  2222. : 5♥ Q♥ 3♣ A♣ 3♥ 4♥ Q♦
  2223. : Q♣ 9♠ 6♥ 9♥ 3♠ K♠ 3♦
  2224. : 5♦ 2♠ J♣ 5♣ J♥ 6♦ A♠
  2225. : 2♦ K♦ T♥ T♣ T♦ 8♦
  2226. : 7♥ J♠ K♥ T♠ K♣ 7♣
  2227. : A♥ 5♠ 6♠ A♦ 8♥ J♦
  2228. : 7♠ 6♣ 7♦ 4♦ 8♠ 9♦
  2229. </pre>
  2230. <p>
  2231. Moreover, Shirl Hart informed me that he/she have uploaded
  2232. <a href="https://github.com/shirha/freecell-solver">a Java port of
  2233. their Freecell Solver</a> to GitHub, which runs much faster (70x reportedly)
  2234. than the Perl version (but might still consume more RAM than an equivalent
  2235. C port). All the power to Shirl!
  2236. </p>
  2237. <h2>DocBook EPUB generation</h2>
  2238. <p>
  2239. I ran into some problems with getting the EPUB (an Electronic book format)
  2240. generation of the
  2241. <a href="http://en.wikipedia.org/wiki/DocBook">DocBook</a>/5 XSLT stylesheet
  2242. to work properly, but it was fixed in
  2243. <a href="https://github.com/shlomif/Human-Hacking-Field-Guide/commit/337ad3365e6b375ecb34492954a7b37da960e7b6">this
  2244. commit</a> thanks in part to help I got on the docbook-apps mailing list.
  2245. </p>
  2246. <h2>Wiki-ing</h2>
  2247. <p>
  2248. I have been desperately
  2249. <a href="http://thread.gmane.org/gmane.science.linguistics.wikipedia.english/111411">trying
  2250. to find</a> a usable photo (under a Creative
  2251. Commons licence/etc.) of
  2252. <a href="http://en.wikipedia.org/wiki/Christina_Grimmie">Christina Grimmie</a>
  2253. (= the singer and musician known for <a href="http://www.youtube.com/user/zeldaxlove64">her YouTube videos</a>)
  2254. for her Wikipedia pages, without luck so far.
  2255. </p>
  2256. <p>
  2257. I also have been trying to protect
  2258. <a href="http://en.wikipedia.org/wiki/Tiffany_Alvord">the
  2259. English Wikipedia page of Tiffany Alvord</a> (another superb artist) from
  2260. deletionism, and it’s ironic that the
  2261. <a href="http://es.wikipedia.org/wiki/Tiffany_Alvord">Spanish
  2262. Wikipedia page</a> about her is longer and more comprehensive, even though
  2263. Alvord is American and almost always sings in English.
  2264. </p>
  2265. <p>
  2266. Furthermore, I have been using
  2267. <a href="http://buffyfanfiction.wikia.com/wiki/Category:Selina_Mandrake_-_The_Slayer">several
  2268. pages in the Buffy Fan Fiction Wikia</a> to organise my thoughts for
  2269. <a href="http://www.shlomifish.org/humour/Selina-Mandrake/">the
  2270. Selina Mandrake screenplay</a>.
  2271. </p>
  2272. <h2>Thanks</h2>
  2273. <p>
  2274. Thanks to protist (Jonathan Avery) for reviewing this post and commenting
  2275. on it.
  2276. </p>
  2277. </div>
  2278. <div class="entry" id="heroic_people_make_any_job_awesome">
  2279. <ul class="info">
  2280. <li><b>Date:</b> 13-04-2013</li>
  2281. <li class="tags">jobs, work, employment, hacktivity log</li>
  2282. </ul>
  2283. <h1>Copied from Slashdot.org: “Heroic people make any job they take awesome.”</h1>
  2284. <p>
  2285. First of all, I have written my
  2286. <a href="http://shlomif.dreamwidth.org/464.html">recent hacktivity log</a>
  2287. over on my new dreamwidth.org blog, and I am not posting it here, because
  2288. it involves a lot of non-code hacktivity, which I expect to do quite a lot
  2289. more of from now.
  2290. </p>
  2291. <p>
  2292. That put aside, I am copying here something that I wrote
  2293. <a href="http://news.slashdot.org/comments.pl?sid=3619331&amp;cid=43371075">in
  2294. a Slashdot comment</a> about why I am looking for a job not in IT. Especially
  2295. of note there are my frustrations with employers being too domineering and
  2296. control-freaks, and not letting the good developers do things the way they
  2297. most prefer to do it. Here goes:
  2298. </p>
  2299. <p>
  2300. I'll put it on the table: I have a Bachelor of Science (B.Sc. - 4 year degree)
  2301. in Electrical Engineering (more like a mixed CE/EE/CS degree) from <a
  2302. href="http://en.wikipedia.org/wiki/Technion_%E2%80%93_Israel_Institute_of_Technology"
  2303. title="wikipedia.org" rel="nofollow">The Technion in their Haifa, Israel
  2304. Campus</a> [wikipedia.org], and graduated cum laude, and I have a qualified
  2305. engineer certificate which theoretically allows me to write software for
  2306. guiding missiles (or other flaw-free software) and give my signature that it is
  2307. flaw-free. Nevertheless, right now I'm looking for part-time jobs as a
  2308. seller/vendor in icecream parlours, candy/snack stores,
  2309. caf&#233;s/restaurants/bars/etc. or even as a street sweeper. Lots of places in
  2310. Tel Aviv, Israel are now advertising for this, and this seems like a good way
  2311. to earn some money, as well as interact with other people and get inspired
  2312. which will really help me with my <a href="http://www.shlomifish.org/humour/"
  2313. title="shlomifish.org" rel="nofollow">creative writing</a> [shlomifish.org] and
  2314. my <a href="http://www.shlomifishorg/philosophy/" title="www.shlomifishorg"
  2315. rel="nofollow">essays</a> [www.shlomifishorg]. And I can buy an Android
  2316. smartphone (nothing really better now and some people have successfully
  2317. installed GNU/Linux chroots there) so I can type stuff for later incoporation
  2318. into my desktop and laptop devices.
  2319. </p>
  2320. <p>
  2321. So why not work as a software developer? I don't mind getting a job as a
  2322. software developer or a hardware developer or whatever, but lately employers in
  2323. Tel Aviv and vicinity have become extremely picky: you go to an interview,
  2324. answer most technical questions nicely, and don't get hired. Furthermore, even
  2325. if they like you they are often very domineering: don't work from home, work
  2326. 10-12 hours a day, only full time, don't play computer games at all (I only
  2327. played some card Patience/Solitaire and Sokoban and not for long and still got
  2328. flack), don't go to Facebook/Twitter/Google-Plus, we don't want you accessing
  2329. imgur.com (too muchu traffic to there so let's firewall it) etc. etc. Thing is
  2330. - <a
  2331. href="http://www.avc.com/a_vc/2012/02/the-management-team-guest-post-from-joel-spolsky.html"
  2332. title="avc.com" rel="nofollow">the junior developers are kings</a> [avc.com]
  2333. (see the link for the Joel article), and you should leave them alone to their
  2334. elements to get shit done at their own pace, and using their own resources
  2335. instead of being a control freak. If, as a boss, my developer watched porn for
  2336. 6 hours a day, while still being available on the forums for questions, and
  2337. spent 2 hours creating great code that is functional and beautiful, I would be
  2338. happy, and give him a full salary. But finding such enlightened employers is a
  2339. big problem.
  2340. </p>
  2341. <p>
  2342. Software was the first field where workers were in constant demand, but now it
  2343. seems that other fields are headed the same way here in Tel Aviv and other
  2344. major centres of commerce worldwide: the food outlets, the music industry,
  2345. photography, and soon - writing, acting/drama/film and then hopefully also
  2346. modelling, and then if we can get past the normal and silly legal barriers -
  2347. also more brick-and-mortar industries. Right now I've decided to make a <a
  2348. href="http://blogs.perl.org/users/shlomi_fish/2013/03/ann-my-transition-from-software-developer-to-writerentertaineramateur-philosopherinternet-celebrity.html"
  2349. title="perl.org" rel="nofollow">transition</a> [perl.org]
  2350. from a software developer to a writer/Internet-entertainer/amateur-philosopher
  2351. - a field where I feel I produce better results and also something that people
  2352. will find cooler and sexier (although like I note in the article, the fact that
  2353. I wrote a Freecell solver has impressed some really cute and intelligent
  2354. chicks), and will have a larger influence. I still see knowing programming and
  2355. other software development as an absolutely necessary means for that, just like
  2356. I can no longer survive without knowing how to read and write English. Everyone
  2357. should know at least HTML/XHTML/etc.
  2358. </p>
  2359. <p>
  2360. What I'm trying to say is that one should avoid Fatalism. People can improve
  2361. for the better. I spent six and a half year doing my Elec. Eng. degree in the
  2362. Technion and it cost me a lot of frustrations, but I'm still alive and have
  2363. constantly become a better person - more competent, more able, smarter, wiser,
  2364. and with a greater capacity for love and friendship. As long as you're not dead
  2365. and still have some health in you, you will do fine. My suggestion to someone
  2366. who got a Ph.D. in literature is to realise that that may make them a really
  2367. awesome programmer , or a bartender, or a candy store vendor, or a secretary,
  2368. or a sys admin, or anything else that they will find a job at. Don't think "I'm
  2369. too good for that" because like they say in Hollywood "There are no small roles
  2370. - only small (= small-minded) actors." You can be an awesome superheroic person
  2371. even if you're just a factory worker.
  2372. </p>
  2373. </div>
  2374. <div class="entry" id="hacktivity_02_06_2013">
  2375. <ul class="info">
  2376. <li><b>Date:</b> 07-01-2013</li>
  2377. <li class="tags">cpan, perl, hacking, hacktivity, rsync, uploading</li>
  2378. </ul>
  2379. <h1>The “sky” command-line application and other Recent hacktivity</h1>
  2380. <p>
  2381. If you have a good web hosting, you may have run into a pattern, where you
  2382. are uploading files to it for other people to download and need to find the
  2383. URL where they were uploaded to. Thing is - recalling the exact
  2384. <a href="http://en.wikipedia.org/wiki/Rsync">Rsync</a> (= a file
  2385. uploader) command and then going to the web browser to access the URL
  2386. is time-consuming, and repetitive.
  2387. <a href="http://www.shlomifish.org/open-source/projects/sky/">sky</a>,
  2388. written in Perl using Moo and available on CPAN, aims to fix all that.
  2389. </p>
  2390. <p>
  2391. Here is a sample invocation from the web-site:
  2392. </p>
  2393. <pre>
  2394. shlomif@telaviv1:~$ sky up /home/music/Music/mp3s/Thierry\ de\ Massia/Elements\ essentiels/01\ -\ Le\ vent.ogg
  2395. X11 forwarding request failed on channel 0
  2396. sending incremental file list
  2397. 01 - Le vent.ogg
  2398. 5271287 100% 147.24kB/s 0:00:34 (xfer#1, to-check=0/1)
  2399. sent 5272011 bytes received 31 bytes 87141.19 bytes/sec
  2400. total size is 5271287 speedup is 1.00
  2401. Got URL:
  2402. http://www.shlomifish.org/Files/files/music/mp3-ogg/01%20-%20Le%20vent.ogg
  2403. shlomif@telaviv1:~$
  2404. </pre>
  2405. <p>
  2406. As you can see, we just specified the file, and it divined the rsync
  2407. command and gave us the resultant URL. Convenient.
  2408. </p>
  2409. <p>
  2410. sky requires a configuration file in <code>~/.config/Perl/App-Sky/app_sky_conf.yml</code> such as this one:
  2411. </p>
  2412. <pre>
  2413. ---
  2414. default_site: homepage
  2415. sites:
  2416. homepage:
  2417. base_upload_cmd:
  2418. - 'rsync'
  2419. - '-a'
  2420. - '-v'
  2421. - '--progress'
  2422. - '--inplace'
  2423. dest_upload_prefix: 'hostgator:public_html/'
  2424. dest_upload_url_prefix: 'http://www.shlomifish.org/'
  2425. sections:
  2426. code:
  2427. basename_re: '\.(?:pl|pm|c|py)\z'
  2428. target_dir: 'Files/files/code/'
  2429. music:
  2430. basename_re: '\.(?:mp3|ogg|wav|aac|m4a)\z'
  2431. target_dir: 'Files/files/music/mp3-ogg/'
  2432. video:
  2433. basename_re: '\.(?:webm|flv|avi|mpeg|mpg|mp4|ogv)\z'
  2434. target_dir: 'Files/files/video/'
  2435. </pre>
  2436. <p>
  2437. And it uses the <code>basename_re</code> to figure out where to upload it
  2438. later. The next features I would like to see added are an ability to specify
  2439. the target directory or alternatively override the target section, and naturally
  2440. - better documentation. But I'm happy with what I have so far.
  2441. </p>
  2442. <h2>CPAN Cleanups</h2>
  2443. <p>
  2444. I have been going over many of <a href="https://metacpan.org/author/SHLOMIF">my
  2445. CPAN distributions</a>
  2446. and doing various cleanups such as removing trailing whitespace (with tests
  2447. based on
  2448. <a href="https://metacpan.org/release/Test-TrailingSpace">Test-TrailingSpace</a>),
  2449. or converting the <code>Changes</code> file to be compliant with
  2450. <a href="https://metacpan.org/release/CPAN-Changes">CPAN-Changes</a>. It was
  2451. kinda fun, though time consuming.
  2452. </p>
  2453. <h2>New Version of Freecell Solver</h2>
  2454. <p>
  2455. There’s a
  2456. <a href="http://fc-solve.blogspot.co.il/2013/05/freecell-solver-3180-was-released.html">new
  2457. stable version of Freecell Solver</a>, 3.18.0 released with some improvements
  2458. including a port to JavaScript.
  2459. </p>
  2460. <h2>Black Hole Solitaire Solver</h2>
  2461. <p>
  2462. I have done a lot of work on
  2463. <a href="http://www.shlomifish.org/open-source/projects/black-hole-solitaire-solver/">Black
  2464. Hole Solitaire Solver</a>, and it can now also solve All-in-a-Row-Solitaire,
  2465. and has some other improvements.
  2466. </p>
  2467. <h2>Binary Puzzle Solver</h2>
  2468. <p>
  2469. The
  2470. <a href="http://www.shlomifish.org/open-source/projects/japanese-puzzle-games/binary-puzzle/">Binary
  2471. Puzzle Solver</a> (written in Ruby) is now at version 0.0.3, with some bug
  2472. fixes, several new moves and a convenient command line application.
  2473. </p>
  2474. </div>
  2475. <div class="entry" id="some_perl_related_bugs__june_2013">
  2476. <ul class="info">
  2477. <li><b>Date:</b> 25-06-2013</li>
  2478. <li class="tags">perl, Module-Build-Tiny, valgrind, windows, open, source</li>
  2479. </ul>
  2480. <h1>Some Perl-Related Bugs and How They Were Fixed.</h1>
  2481. <p>
  2482. In this entry, I’d like to tell about several Perl-related bugs I have run
  2483. into, and how they were fixed. I know I have not been blogging a lot lately,
  2484. but, on the bright side, I was busy coding.
  2485. </p>
  2486. <h2>XML-Grammar-Fortune-Synd Test Failures on Some Windows-based Testers</h2>
  2487. <p>
  2488. For a long time, I've been getting test failures such as
  2489. <a href="http://www.cpantesters.org/cpan/report/28051c7c-71ca-1014-9ba1-70af6b2677eb">this
  2490. one</a> for my
  2491. <a href="https://metacpan.org/release/XML-Grammar-Fortune-Synd">XML-Grammar-Fortune-Synd</a>
  2492. module, from some Windows-based systems, which I was unable to reproduce on
  2493. my local Linux system. Per
  2494. <a href="http://www.nntp.perl.org/group/perl.cpan.testers.discuss/2013/05/msg3151.html">Michael G. Schwern’s advice</a>,
  2495. I tried to convert all the path handling to use File::Spec for paths
  2496. portability, but it did not fix the problem. Then I tried it on a Windows XP
  2497. VM, but the tests passed there fine. Eventually, I had to install a Windows 7
  2498. VM, and run the tests there, and they failed. I originally suspected the
  2499. problem was with
  2500. <a href="https://metacpan.org/release/File-Temp">File::Temp</a>’s
  2501. <code>tempdir()</code> function,
  2502. but it turned out to be an inconsistency in the behaviour of
  2503. <a href="https://metacpan.org/module/File::Copy">File::Copy</a> across
  2504. the systems. On some systems, it copied a read only file to the temporary
  2505. directory, preserving its read-only status, which made
  2506. <code>open()</code> throw an error when writing to it.
  2507. </p>
  2508. <p>
  2509. This was fixed by these two subroutines:
  2510. </p>
  2511. <pre>
  2512. sub _my_copy
  2513. {
  2514. my ($src, $dest) = @_;
  2515. open my $out_fh, '&gt;', $dest;
  2516. print {$out_fh} _slurp($src);
  2517. close($out_fh);
  2518. return;
  2519. }
  2520. sub _slurp
  2521. {
  2522. my $filename = shift;
  2523. open my $in, "&lt;", $filename
  2524. or die "Cannot open '$filename' for slurping - $!";
  2525. local $/;
  2526. my $contents = &lt;$in&gt;;
  2527. close($in);
  2528. return $contents;
  2529. }
  2530. </pre>
  2531. <p>
  2532. Where I used <code>_my_copy()</code> to copy from one file location to another.
  2533. </p>
  2534. <p>
  2535. Since this was fixed, I didn't get any test failures for the module
  2536. from Microsoft Windows machines or otherwise. Silence is golden.
  2537. </p>
  2538. <h2>Module-Build-Tiny Test Failures on Mageia Linux</h2>
  2539. <p>
  2540. I noticed that some of the tests of Module-Build-Tiny (which some CPAN
  2541. distributions started using)
  2542. <a href="https://bugs.mageia.org/show_bug.cgi?id=10449">failed to run</a>
  2543. on Mageia Linux, while they ran fine in a perl installed from perlbrew. The
  2544. problem was that the file was partly writable while Module-Build-Tiny
  2545. wanted it to be completely read-only. At first, we suspected a combination of
  2546. the perl build-time flags caused it, but a perl I built from source with all
  2547. the Mageia flags, passed all the tests. So it was likely caused by a Mageia
  2548. patch.
  2549. </p>
  2550. <p>
  2551. By using the perl debugger, I realised that a downstream patch changed the
  2552. permissions in the Perl ExtUtils::Install to 0644 instead of 0444, and after
  2553. testing the package without this patch, the Module-Build-Tiny tests passed.
  2554. </p>
  2555. <p>
  2556. We ended up removing the patch permanently from the Mageia perl package.
  2557. </p>
  2558. <h2>Second Problem with Module-Build-Tiny: Double-Dash</h2>
  2559. <p>
  2560. Another problem I had with Module-Build-Tiny, after the previous
  2561. one was that <a href="https://rt.cpan.org/Public/Bug/Display.html?id=86240">it
  2562. appeared to have ignored</a> the “destdir” and “installdirs” command line
  2563. arguments , but it turned out that we
  2564. needed to spell them <code>--destdir=$FOO</code> instead of
  2565. <code>destdir=$FOO</code>, and as <code>--installdirs=vendor</code> instead
  2566. of <code>installdirs=vendor</code> (with double-dash prefixes). This
  2567. was noted in the <a href="https://wiki.mageia.org/en/Perl_policy">Mageia
  2568. Perl Policy</a>, and I also sent
  2569. <a href="https://github.com/jquelin/cpanplus-dist-mageia/pull/3"> a pull
  2570. request</a> for fixing it to CPANPLUS-Dist-Mageia.
  2571. </p>
  2572. <h2>Parallelising Time-Consuming Automated Tests Using prove -j</h2>
  2573. <p>
  2574. As I did
  2575. <a href="http://tech.groups.yahoo.com/group/fc-solve-discuss/message/1351">some
  2576. work</a> on
  2577. <a href="http://fc-solve.shlomifish.org/">Freecell Solver</a>, I was annoyed
  2578. by the fact that the valgrind.t test script, which ran several tests for
  2579. checking the programs for
  2580. <a href="https://en.wikipedia.org/wiki/Valgrind">valgrind</a>
  2581. sanity, was too time consuming, despite the fact that I ran it first and ran
  2582. the other test scripts in parallel to it using prove’s “-j” flag.
  2583. </p>
  2584. <p>
  2585. Then it occurred to me that I can parallelise these tests inidividually. I
  2586. decided to split them into an array of tests, each one with an ID, and then
  2587. have a program write several tests scripts, with each one running an individual
  2588. ID, and then run all the files generated by the generation program.
  2589. </p>
  2590. <p>
  2591. This seems to have improved performance, and I can now run the parallelised
  2592. tests in 21 seconds.
  2593. </p>
  2594. <p>
  2595. I've been thinking that this could be a useful CPAN distribution, and am
  2596. contemplating writing something like that for CPAN.
  2597. </p>
  2598. <h2>Thanks</h2>
  2599. <p>
  2600. Thanks to Altreus for reviewing this entry.
  2601. </p>
  2602. </div>
  2603. <div class="entry" id="I_have_over_a_100_distributions_on_CPAN">
  2604. <ul class="info">
  2605. <li><b>Date:</b> 25-10-2013</li>
  2606. <li class="tags">cpan, perl, hacking, hacktivity, download manager, 100</li>
  2607. </ul>
  2608. <h2>I now have over a 100 Distributions on CPAN!</h2>
  2609. <p>
  2610. Some days ago I discovered that my CPAN distributions count had already gone
  2611. above 100, only that my <a href="https://metacpan.org/author/SHLOMIF">MetaCPAN
  2612. page</a> has misled me due to
  2613. <a href="https://github.com/CPAN-API/metacpan-web/issues/973">a bug</a> (
  2614. which I reported since). I now have 103 distributions on CPAN and you can
  2615. find <a href="http://perl.org.il/israeli-projects.html">a list
  2616. of them</a> on the Israeli Perl Mongers site, with whatever is missing from
  2617. the MetaCPAN page.
  2618. </p>
  2619. <p>
  2620. So now I'm in the CPAN 100 club, and now will also better focus on improving
  2621. the quality of my existing distributions. According to GumbyPAN, the
  2622. top ten authors are
  2623. <code>SHARYANTO [265] RJBS [258] TOBYINK [239] ADAMK [236] ZOFFIX [222]
  2624. MIYAGAWA [216] BINGOS [197] INGY [177] TOKUHIROM [170] SMUELLER [156]</code>,
  2625. so no one has gone up to 300 distributions yet (also see
  2626. <a href="http://stats.cpantesters.org/leadercpan.html#top20current">the
  2627. top 20 current in the leadercpan page.</a>).
  2628. </p>
  2629. <h2>Maniac Downloader</h2>
  2630. <p>
  2631. One of the distributions on my road to the 100 distributions was
  2632. <a href="http://www.shlomifish.org/open-source/projects/maniac-downloader/">Maniac
  2633. Downloader</a>, which is a download accelerator written in Perl using
  2634. <a href="https://metacpan.org/release/AnyEvent">AnyEvent</a> and other
  2635. CPAN distributions. It was written as a way for me to scratch an itch where
  2636. I noticed that I could get better download throughput from many
  2637. sites by opening more than one connection. I tried several download managers,
  2638. but most of them were GUI only and the only terminal one I found -
  2639. <a href="https://sourceforge.net/projects/prozilla/">prozilla</a>, could not
  2640. handle <code>https://</code> URLs and, furthermore, didn’t implement the
  2641. “secret sauce” of Maniac downloader of splitting slow segments into multiple
  2642. parts to speed up the acceleration, and finally - was very noisy. Since
  2643. prozilla is written in C, it was not easy to hack on it, so I decided to
  2644. write something myself using Perl.
  2645. </p>
  2646. <p>
  2647. I wrote the first prototype of Maniac Downloader using POE, but didn’t get
  2648. very far, and I also think performance left some things to be desired. Then,
  2649. some weeks ago, I started working on the second version as a Dist-Zilla
  2650. distribution and using AnyEvent, and made more progress. AnyEvent is easy
  2651. to use, and works nicely and quickly, and I like it more than POE.
  2652. </p>
  2653. <p>
  2654. I released App-ManiacDownloader-v0.0.3 to the CPAN today, and it now resumes
  2655. interrupted downloads, so it's getting more usable for me. There are still
  2656. some tasks left to be done there, but you can try using it already.
  2657. </p>
  2658. </div>
  2659. <div class="entry" id="tech_tip_loop_labels_in_Perl_6">
  2660. <ul class="info">
  2661. <li><b>Date:</b> 13-01-2014</li>
  2662. <li class="tags">perl, perl 6, tech, tip, tech tip, loops, labels</li>
  2663. </ul>
  2664. <h1>Tech Tip: Loop Labels in Perl 6</h1>
  2665. <h2>The Tip</h2>
  2666. <p>
  2667. It is known that one can label loops (or arbitrary blocks) in Perl 5, using
  2668. the syntax of <code>MYLABEL: while (COND()) { BLOCK }</code>
  2669. or <code>MYLABEL: for my $x (@array) { BLOCK }</code> and then one can
  2670. do <code>last MYLABEL;</code>, <code>next MYLABEL;</code>, or
  2671. <code>redo MYLABEL;</code> (for more information see
  2672. <a href="http://perldoc.perl.org/perlsyn.html">perldoc perlsyn</a>).
  2673. However, I was unable to find how to do something
  2674. like that in Perl 6, despite some amount of searching. Luckily, the people
  2675. on the Perl 6 helped me.
  2676. </p>
  2677. <p>
  2678. The answer is that in Perl 6, it’s essentially not different:
  2679. </p>
  2680. <pre>
  2681. MYLABEL: for (1 .. 100) -&gt; $x
  2682. {
  2683. .
  2684. .
  2685. last MYLABEL;
  2686. .
  2687. .
  2688. }
  2689. WHILE_LABEL: while $x &lt; 24
  2690. {
  2691. .
  2692. .
  2693. next WHILE_LABEL;
  2694. .
  2695. .
  2696. }
  2697. </pre>
  2698. <p>
  2699. In Perl 6, one can also write <code>MYLABEL.last;</code> instead, but
  2700. <code>last MYLABEL;</code> will still work. <b>Note</b> however that
  2701. “last/redo/next” + label are not currently implemented in
  2702. <a href="http://rakudo.org/">Rakudo Perl 6</a> (though you can still safely
  2703. add labels to the loops).
  2704. </p>
  2705. <p>
  2706. Cheers!
  2707. </p>
  2708. <h2>Meta</h2>
  2709. <p>
  2710. I haven’t blogged for a while in my blogs.perl.org blog, even though
  2711. I’ve been meaning to. Anyway, I’m mostly fine, and have been working on some
  2712. Project Euler challenges, some pull requests and patches to projects, and
  2713. some activity on my own projects. Hopefully, I'll find the time to write
  2714. something more substantial. Recently, I’ve contributed some extra examples to
  2715. the Project Euler section of
  2716. <a href="https://github.com/perl6/perl6-examples">the perl6-examples
  2717. repository</a>. As a result, I was recently granted a perl6-GitHub-project-wide
  2718. commit bit (by none other than
  2719. <a href="https://en.wikipedia.org/wiki/Larry_Wall">TimToady</a>), so
  2720. now I can do all the MAYHEM and DESTRUCTION I want there (Muahahahahahahah!).
  2721. Just kidding about that: all I’m planning to do for now is add more Perl 6
  2722. examples.
  2723. </p>
  2724. </div>
  2725. <div class="entry" id="tech_tip_open_fh_for_rw_wo_clobbering">
  2726. <ul class="info">
  2727. <li><b>Date:</b> 19-01-2014</li>
  2728. <li class="tags">perl, perl 5, tech, tip, tech tip, open, files, I/O</li>
  2729. </ul>
  2730. <h1>Tech Tip: Opening a file for read/write without clobbering it.</h1>
  2731. <h2>The Tip</h2>
  2732. <p>
  2733. <a href="http://perldoc.perl.org/perlopentut.html">perlopentut</a>
  2734. gives <a href="http://perldoc.perl.org/perlopentut.html#Mixing-Reads-and-Writes">several
  2735. options</a> for opening a file for read and write, and I opted to use
  2736. <code>'+&gt;'</code> for
  2737. <a href="http://www.shlomifish.org/open-source/projects/maniac-downloader/">Maniac
  2738. Downloader</a>, but as it turned out, it caused the existing file to be
  2739. clobbered (= its length to be set to zero and all of its contents deleted).
  2740. </p>
  2741. <p>
  2742. After asking on Freenode’s #perl channel, we reached this solution for
  2743. opening a filehandle so that: <b>1)</b> it will be opened for read/write.
  2744. <b>2)</b> it can open both an existing file or create a new file that does
  2745. not exist. <b>3)</b> If the file exists, its contents will be retained,
  2746. and it won't be clobbered. and <b>4)</b> it will overwrite existing contents,
  2747. and not append everything at the end of the file.
  2748. </p>
  2749. <p>
  2750. The code is as follows:
  2751. </p>
  2752. <pre>
  2753. sub _open_fh_for_read_write_without_clobbering
  2754. {
  2755. my ($path, $url_basename) = @_;
  2756. # open with '+&gt;:raw' will clobber the file.
  2757. # On the other hand, open with '+&lt;:raw' won't create a new file if it
  2758. # does not exist.
  2759. # So we have to restort to this.
  2760. #
  2761. # For more information, see: http://perldoc.perl.org/perlopentut.html
  2762. {
  2763. open my $fh_temp, '+&gt;&gt;:raw', $path
  2764. or die "Cannot open '$path' for temp-creation. $!";
  2765. close($fh_temp);
  2766. }
  2767. open my $fh, "+&lt;:raw", $path
  2768. or die "${url_basename}: $!";
  2769. return $fh;
  2770. }
  2771. </pre>
  2772. <p>
  2773. ( You can freely reuse this code under your choice of
  2774. <a href="https://en.wikipedia.org/wiki/MIT_License">the MIT/X11 License</a>
  2775. or <a href="https://creativecommons.org/choose/zero/">the
  2776. Public Domain/CC0</a>. )
  2777. </p>
  2778. <p>
  2779. The <code>$url_basename</code> is a relic of the roots of Maniac Downloader.
  2780. Using that file-handle I used
  2781. <a href="http://perldoc.perl.org/functions/sysseek.html">sysseek</a>
  2782. and <a href="http://perldoc.perl.org/functions/syswrite.html">syswrite</a>,
  2783. and it worked nicely.
  2784. </p>
  2785. <p>
  2786. I should note that <a href="https://metacpan.org/author/MAUKE">mauke</a>
  2787. suggested using this instead:
  2788. </p>
  2789. <pre>
  2790. use File::Open qw(fsysopen);
  2791. my $fh = fsysopen($path, 'rw');
  2792. binmode $fh;
  2793. </pre>
  2794. <h2>More about Maniac Downloader</h2>
  2795. <p>
  2796. I investigated why Maniac Downloader misdownloaded several “.iso” files
  2797. after being interrupted and resumed, and it turned out to have been caused
  2798. by the fact that it clobbered the temporary buffer files, due to the
  2799. reason I mentioned above. This was fixed in version 0.0.5.
  2800. </p>
  2801. <p>
  2802. Next I tried to benchmark it against
  2803. <a href="http://aria2.sourceforge.net/">aria2</a> and GNU wget in trying
  2804. to download a file from a local mirror. Using ten connections for both aria2
  2805. and Maniac Downloader, I saw that aria2 and wget took about 30 minutes
  2806. to download the file, while Maniac Downloader downloaded it in less than 13
  2807. minutes. However, at one point the ManDown downloading completely stopped
  2808. (displaying 0 KB/s), and I had to Ctrl+C it and run it again. I guess
  2809. now I’ll need to investigate how to cancel the HTTP/HTTPS downloads and
  2810. start them again if they stalled.
  2811. </p>
  2812. </div>
  2813. <div class="entry" id="recent_hacktivity_log_01_may_2014">
  2814. <ul class="info">
  2815. <li><b>Date:</b> 29-03-2014</li>
  2816. <li class="tags">perl, du, analyze, downloader, download, manager, disk usage, command line, khronos group, opengl</li>
  2817. </ul>
  2818. <h1>Recent Hacktivity Log</h1>
  2819. <p>
  2820. This is another “recent hacktivity log” of some of the open source
  2821. work I’ve been up to lately.
  2822. </p>
  2823. <h2>New Command-Line App: App-Du-Analyze</h2>
  2824. <p>
  2825. <a href="https://metacpan.org/release/App-Du-Analyze">App-Du-Analyze</a>
  2826. (with its command-line script of "analyze-du") is now available on CPAN. What
  2827. it does is allow you to analyse the output of the UNIX
  2828. <a href="https://en.wikipedia.org/wiki/Du_%28Unix%29">“du” command</a>,
  2829. get results based on a prefix and a depth, and sort them. It is my preference
  2830. for a disk usage analyser, with the benefit of being able to run several
  2831. queries on the same data, by keeping the same <code>du.txt</code> file - a
  2832. feature which I found is often lacking in GUI disk usage analysers.
  2833. </p>
  2834. <p>
  2835. Here's an example of using it:
  2836. </p>
  2837. <pre>
  2838. $ export ANALYZE_DU_INPUT_FN="$(pwd)/t/data/fc-solve-git-du-output.txt"
  2839. $ analyze-du -p "fc-solve" -d 1
  2840. 16 fc-solve/tests
  2841. 120 fc-solve/docs
  2842. 172 fc-solve/scripts
  2843. 232 fc-solve/arch_doc
  2844. 276 fc-solve/rejects
  2845. 392 fc-solve/benchmarks
  2846. 2920 fc-solve/site
  2847. 4192 fc-solve/source
  2848. 44208 fc-solve/presets
  2849. </pre>
  2850. <p>
  2851. You can find <a href="http://shlomif-tech.livejournal.com/40841.html">a
  2852. report</a> about using an earlier incarnation of the same program to find
  2853. the hotspots in a Windows XP disk.
  2854. </p>
  2855. <h2>New Versions of Maniac Downloader</h2>
  2856. <p>
  2857. I uploaded new versions of
  2858. <a href="http://www.shlomifish.org/open-source/projects/maniac-downloader/">Maniac
  2859. Downloader</a>, which is a CPAN module that implements a download accelerator.
  2860. What they do is convert the file open to sysopen (per
  2861. <a href="http://blogs.perl.org/users/shlomi_fish/2014/01/tech-tip-opening-a-file-for-readwrite-without-clobbering-it.html">Steven
  2862. Haryanto’s tip</a> (thanks Steven!), and
  2863. attempt to refresh stale connections after a timeout, which is a problem
  2864. that bit me several times.
  2865. </p>
  2866. <h2>Working on my CPANTS Kwalitee Score</h2>
  2867. <p>
  2868. I worked on my <a href="http://cpants.cpanauthors.org/">CPANTS</a>
  2869. (= a CPAN Testing Service) Kwalitee score. My
  2870. <a href="http://cpants.cpanauthors.org/author/SHLOMIF">CPANTS page</a>
  2871. currently says I have an Average Kwalitee of 134.88, a CPANTS Game
  2872. Kwalitee of 99.79 and a Rank of 68 in the league of “5 or more”.
  2873. </p>
  2874. <p>
  2875. I was looking for something to do and decided to revamp my CPAN distributions’
  2876. Kwalitee as much as I could. This involved quite a lot of actions:
  2877. </p>
  2878. <ol>
  2879. <li>
  2880. <p>
  2881. Converting distributions from “Makefile.PL” to “Build.PL” or to <a href="http://dzil.org/">Dist-Zilla</a>.
  2882. </p>
  2883. </li>
  2884. <li>
  2885. <p>
  2886. Adding various test scripts for POD coverage, POD validity,
  2887. <a href="https://metacpan.org/release/CPAN-Changes">CPAN changes</a>
  2888. validity, and trailing whitespace (the latter are not required by CPANTS
  2889. but they are something I like to have for good measure).
  2890. </p>
  2891. </li>
  2892. <li>
  2893. <p>
  2894. Resurrecting or tracing the version control history of various modules, either
  2895. using
  2896. <a href="https://metacpan.org/release/App-cpangitify">App-cpangitify</a>,
  2897. using the old repositories over at bitbucket.org, or the even older ones
  2898. on my Subversion repository on <code>svn.berlios.de</code>.
  2899. </p>
  2900. </li>
  2901. <li>
  2902. <p>
  2903. Adding "use strict;" and "use warnings;".
  2904. </p>
  2905. </li>
  2906. <li>
  2907. <p>
  2908. Having a $VERSION in all the modules (“.pm” files).
  2909. </p>
  2910. </li>
  2911. </ol>
  2912. <p>
  2913. Anyway, it was a good excuse to do a lot of clean ups, and doing all this work
  2914. made me appreciate the utility of Dist-Zilla even more, but it kinda sucks
  2915. that sometimes existing <code>dist.ini</code> checkouts break after an upgrade
  2916. (like this
  2917. <a href="https://github.com/jquelin/app-cpan2pkg/pull/3">App-CPAN2pkg
  2918. pull request</a> indicates).
  2919. </p>
  2920. <p>
  2921. Anyway, CPANTS still complains about some stuff in my modules, but a lot
  2922. of them are false positives.
  2923. </p>
  2924. <h2>Khronos Group Kickoff Meetup</h2>
  2925. <p>
  2926. I went to the kickoff meetup of
  2927. <a href="http://www.meetup.com/Khronos-Tel-Aviv-Chapter/">the Tel Aviv chapter</a>
  2928. of the <a href="https://en.wikipedia.org/wiki/Khronos_Group">Khronos Group</a>.
  2929. In case you do not know, the Khronos group is an industry consortium for
  2930. maintaining some standards for hardware-assisted computing like OpenGL
  2931. and OpenCL (whose specifications are open, but do not always have open
  2932. source implementations). I got some free food and drinks there, and it was
  2933. easy to travel to, and I caught a ride back home. The talks - one about
  2934. OpenVX and the other about OpenCL 2.0 were enjoyable, but I think I would
  2935. have liked more code and focus on “hands-on” development.
  2936. </p>
  2937. <p>
  2938. The Khronos Group’s local chapters aim to reach out to the community
  2939. of developers who use their APIs.
  2940. </p>
  2941. <p>
  2942. Anyway, I met there a few people from some companies like Intel and
  2943. AMD. I talked with the AMD representative and he was a bit shocked that
  2944. I was using <a href="http://www.x.org/wiki/radeon/">the open source
  2945. drivers</a> for Linux on my ATI Mobility HD laptop, saying that the proprietary
  2946. drivers were more performant and featureful, and that the open source
  2947. drivers were primarily provided for servers. I remember trying the
  2948. proprietary drivers, but recall having had some problems with them, and
  2949. I also <a href="http://www.shlomifish.org/philosophy/computers/open-source/trust-non-FOSS/">hesitate
  2950. to use proprietary software</a>, especially as kernel drivers.
  2951. </p>
  2952. <p>
  2953. On my way back, someone gave me a ride, and I talked with him about OpenCL and
  2954. he gave me some ideas for a possible methods to still accelerate
  2955. <a href="http://fc-solve.shlomifish.org/">Freecell Solver</a> using it. I'm
  2956. not sure if they are practical, but they were still good food for thought.
  2957. </p>
  2958. <p>
  2959. Anyway, I’d like to attend more of their meetups.
  2960. </p>
  2961. <h2>perl-begin.org Update and Revamp</h2>
  2962. <p>
  2963. I dedicated some time to go over the contents of
  2964. <a href="http://perl-begin.org/">the Perl Beginners’ Site (perl-begin.org)</a> and update
  2965. it to reflect the new knowledge and best practices. Now the site is in
  2966. much better shape than it was before. I still want to write an item for it
  2967. in <a href="http://perl-begin.org/news/">its news page</a>.
  2968. </p>
  2969. <!-- To Add:
  2970. * http://perl-begin.org/ update/revamp.
  2971. * Tel Aviv.pm meetup.
  2972. * Emscripten - fastcomp/etc.
  2973. * Freecell Solver AI-Pathfinding-OptimizeMultiple - convert away from MyInput.
  2974. -->
  2975. </div>
  2976. </body>
  2977. </html>