Older blog entries for shlomif (starting at number 648)

Yom Kippur 2011 Summary

This Yom Kippur, I again went over my blogs from the last year. I mostly blogged in my technical blog about tips and events and stuff like that. I did not mention some of the significant good and bad things that happened to me on my blogs, but I guess I have a right for privacy and/or they were of no interest to the world at large.

The past year was good for me, but could have been better, and I drew some conclusions from looking back.

Syndicated 2011-10-10 15:39:56 from shlomif

New Computer

First of all, happy new Jewish Year.

My old Pentium 4 2.4 GHz computer (here's the blog entry where I blogged about getting it back in 22-September-2003) has served me mostly well for 8 years, but recently exhibited many signs of dying and had problems booting a lot of the partitions there. As a result, we bought a new computer to replace it: a Core i3 machine with 8 GB of RAM, a 2 TB hard-disk, and an Intel HD Graphics adapter. I've installed Mageia 1 on it and set it up, and it is now working mostly nicely.

I've ran into a few problems with it. From the 1280*1024 screen resolution not working (which required adding a mode line), to packets being dropped by the network interface (which I found a fix for on a Red Hat bug), to the fact that transparency is not working properly when running remote X apps (which is not resolved yet.), but as a general rule - I'm happy.

The new computer is much faster than the old one, which wasn't too slow running Linux either.

Syndicated 2011-09-29 08:23:24 from shlomif

Recommendation and Tip: The QUnit JavaScript Automated Tests Library

I've begun working on a JavaScript port of some algorithmic perl code, to allow it to run inside a browser. As a result, I had to find a good JavaScript automated tests library to allow me to write automated tests for the code. I first looked at Test.More and Test.Harness from JSAN (the JavaScript Archive Network) but as it turned out, JSAN was defunct, and no one had time to mark it as such. Then I asked the “Test.Run” developer (another thing I had found on jsan) to instruct me how to get it up and running, and he gave me a link to its archive, which was 1.5 mb compressed (!), and so was not acceptable.

I looked at the Wikipedia list of unit testing frameworks, but there were too many. at least I understood that jsUnit was no longer actively maintained. I looked at Jasmine, which is a bdd framework for JS, but its syntax seemed too horrid and unnatural.

Eventually, I decided to ask for recommendation on Stack Overflow and, as after I wrote my title, I found a a previous question, where there was a recommendation of QUnit, which I noticed was developed by the jQuery people, and as I'm fond of jQuery, I decided to look deeper into it.

I wasn't disappointed by QUnit - it does what it does well, and I was able to write my test suite using it, so I can recommend it as well. It has primitives that are very similar to perl's Test::More, and it can even assert that the number of assertions ran within a test are right (like Test::More can).

So here's a tip for it: if you're writing your testing code in a different file, and you wish to check that no compile-time or run-time exception was thrown (which will cause qunit to report a success with zero assertions) you should wrap the testing code in a try { .. } catch block and in the catch block, run ok(false...).

Here's an example from my code:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" 
                    "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>ABCPath Test</title>
<script src="jquery-latest.js"></script>
<link rel="stylesheet" href="qunit.css" type="text/css" media="screen" />
<script type="text/javascript" src="qunit.js"></script>
<script type="text/javascript" src="joose.mini.js"></script>
<script type="text/javascript" src="abc-path.js"></script>
<script type="text/javascript" src="abc-path-test.js"></script>

  <script type="text/javascript">
      $(document).ready(function () { 
          try {
              test_abc_path();
          }
          catch (err) {
            module("Meta");
            test("global_failure", function() {
                ok (false, 'test_abc_path() has thrown an exception or is invalid.');
            });
          }
          // Hide passed tests by default.
          $('#qunit-tests').addClass('hidepass');
      });
  </script>
  
</head>
<body>
  <h1 id="qunit-header">QUnit example</h1>
 <h2 id="qunit-banner"></h2>
 <div id="qunit-testrunner-toolbar"></div>
 <h2 id="qunit-userAgent"></h2>
 <ol id="qunit-tests"></ol>
 <div id="qunit-fixture">test markup, will be hidden</div>
</body>
</html>

Enjoy.

Syndicated 2011-09-05 13:57:54 from shlomif

Tel Aviv Perl Mongers Meeting on 31 August, 2011

(The Hebrew text will be followed by an English one).

ב-31 באוגוסט 2011 (יום רביעי) נערוך את מפגש הפרל החודשי שלנו! אנו נפגשים ב-18:30 ומתחילים ב19:00. כתובת: מכללת שנקר, בניין מיטשל, רמת גן, חדר 2106. (שימו לב לשינוי בכתובת מפעמים קודמות.). במפגש זה נשמע הרצאות אודות מערכת ניהול הגרסאות git.

פרטים נוספים ניתן למצוא באתר של שוחרי הפרל של תל אביב

במפגש זה יהיו ההרצאות הבאות:

  • Git - Git הינה מערכת ניהול גרסאות מבוזרת. היא מהווה כלי שימושי למפתחים ומתפשטת כמו אש, בשל טבעה השימושי, והשימוש שנעשה בה בפיתוח הגרעין של לינוקס, ספריות ותוכנות קוד פתוח רבות, ובתוך מספר רב של ארגונים. בכוונתי ללמד אותו. (סוייר - 40 דקות).

  • Gitflow - Gitflow הינו כלי מעטפת שימושי שמאפשר לכם להסדיר תהליך פיתוח יותר מובנה, הלוקח בחשבון תכונות, גרסאות היוצאות לאור, תיקונים חמים ועוד. הוא שימושי מאוד כאשר מספר מפתחים עובדים עובדים על התוכנה בשילוב משלב, צוות בקרת איכות, צוות פיתוח, וכן הלאה. בכוונתי להדגים גם אותו! (סוייר - 40 דקות).

המפגש הוא חינמי וכולם מוזמנים. נתראה שם!

English Version

Please note the change of venue. We're moving to the next adjacent building to where we were. You can use the original entrance or use the listed address.

On 31 August, 2011 (Wednesday), the Tel Aviv Perl Mongers will hold their monthly meetup. We meet at 18:30 and start at 19:00. The address is: Shenkar College, Mitchel building, Yeda Am 8, Ramat Gan, Room 2106. The theme of this meeting will be the git version control system.

One can find more details in the web-site of the Tel Aviv Perl mongers.

This meeting will hold the following talks:

  • Git - Git is a decentralized code revision management system. It's becoming a valuable tool for developers (whether programmers, designers, or other) and is spreading like fire due to its useful nature, being used in the Linux Kernel development, many free software libraries and programs and many organizations alike. I intend to teach it to you. (Sawyer - 40 minutes).

  • Gitflow - Gitflow is a useful wrapper tool to allow you to set a more streamlined development process, taking into account features, releases, hot fixes and more. It's very useful when using multiple developers with an integrator, a QA, a dev team, and so on. I intend to showcase it as well! (Sawyer - 40 minutes.)

The entrance to the meeting is free-of-charge and everyone are welcome to attend. See you there!

Syndicated 2011-08-29 10:18:22 from shlomif

Recommendation and Tip: The QUnit JavaScript Automated Tests Library

I've begun working on a JavaScript port of some algorithmic Perl code, to allow it to run inside a browser. As a result, I had to find a good JavaScript automated tests library to allow me to write automated tests for the code. I first looked at Test.More and Test.Harness from JSAN (the JavaScript Archive Network) but as it turned out, JSAN was defunct, and no one had time to mark it as such. Then I asked the “Test.Run” developer (another thing I had found on JSAN) to instruct me how to get it up and running, and he gave me a link to its archive, which was 1.5 MB compressed (!), and so was not acceptable.

I looked at the wikipedia list of unit testing frameworks, but there were too many. At least I understood that JSUnit was no longer actively maintained. I looked at Jasmine, which is a BDD framework for JS, but its syntax seemed too horrid and unnatural.

Eventually, I decided to ask for recommendation on Stack Overflow and, as after I wrote my title, I found a a previous question, where there was a recommendation of QUnit, which I noticed was developed by the jQuery people, and as I'm fond of jQuery, I decided to look deeper into it.

I wasn't disappointed by QUnit - it does what it does well, and I was able to write my test suite using it, so I can recommend it as well. It has primitives that are very similar to Perl's Test::More, and it can even assert that the number of assertions ran within a test are right (like Test::More can).

So here's a tip for it: if you're writing your testing code in a different file, and you wish to check that no compile-time or run-time exception was thrown (which will cause QUnit to report a success with zero assertions) you should wrap the testing code in a try { .. } catch block and in the catch block, run ok(false...).

Here's an example from my code:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" 
                    "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>ABCPath Test</title>
<script src="jquery-latest.js"></script>
<link rel="stylesheet" href="qunit.css" type="text/css" media="screen" />
<script type="text/javascript" src="qunit.js"></script>
<script type="text/javascript" src="joose.mini.js"></script>
<script type="text/javascript" src="abc-path.js"></script>
<script type="text/javascript" src="abc-path-test.js"></script>

  <script type="text/javascript">
      $(document).ready(function () { 
          try {
              test_abc_path();
          }
          catch (err) {
            module("Meta");
            test("global_failure", function() {
                ok (false, 'test_abc_path() has thrown an exception or is invalid.');
            });
          }
          // Hide passed tests by default.
          $('#qunit-tests').addClass('hidepass');
      });
  </script>
  
</head>
<body>
  <h1 id="qunit-header">QUnit example</h1>
 <h2 id="qunit-banner"></h2>
 <div id="qunit-testrunner-toolbar"></div>
 <h2 id="qunit-userAgent"></h2>
 <ol id="qunit-tests"></ol>
 <div id="qunit-fixture">test markup, will be hidden</div>
</body>
</html>

Enjoy.

Syndicated 2011-08-11 16:33:14 from shlomif

Review of the Book Forrest Gump

I received the book Forrest Gump, as a present of gratitude after I tried to help someone with a problem he encountered with Freecell Solver. I finished reading it a while ago, and would like to review it here, as a token for being given it.

The book is great, and I liked it better than the film (which was based on it). In the film, it is implied that Forrest Gump is a retard, but in the book, he is an idiot-savant, who excels in mathematics, music, and some other mental activities. In the book, Forrest stumbles upon life, one weird happening after another, in a very lovable way, and the story is captivating, funny and entertaining.

I can recommend this book, and I also recommend its sequel, which I had read before reading the first book.

Humble Indie Bundle 3

I suggest you look at the Humble Indie Bundle 3, which allows you to pay how much you want for seven indie games, and split the proceeds between charity and the developers of the games. I've bought the bundle (as I did the previous one) and am now enjoying the game Crayon Physics Deluxe, which is great.

Personal Log

I've felt under the weather a while ago, but hopefully, this is mostly behind me. In the past few days, I've kept myself busy by studying Group theory, watching episodes of The Muppet Show, translating some code from Perl to JavaScript (which has given me a lot of fodder for my JavaScript page), and playing various games.

I've been feeling guilty about not having been following my RSS feeds for a long while. I've started to become not very fond of Akregator (the KDE feeds' aggregator), due to its lack of RSS service support, and I feel that the developers' plan to port it to Akonadi will make it even worse. I've found two other feeds' aggregators (one for Firefox and the other one for GNOME/gtk+) either slow or annoying, and so am left without an aggregator.

Syndicated 2011-08-07 16:35:11 from shlomif

New Translations of Stories

Here are the recent updates for Shlomi Fish’s Homepage. The first highlight is that I’ve gone over the site and converted most ASCII single quotes and double quotes I could find to their Unicode equivalents. In the process, I corrected many typos, XHTML validation problems, and other issues.

There are new fortune cookies:

The worst way to waste your time is to never waste it.

There’s a translation of the of Human Hacking Field Guide to Written Arabic. This was done by Vieq - thanks!

The Hebrew translation of the screenplay Humanity - the Movie is now complete.

Furthermore, the XML-Grammar-Fiction page was enhanced with examples and links.

There’s a new Test.pm to Test::More partial converter, which may be of interest to programmers maintaining legacy Perl code.

Syndicated 2011-07-23 09:48:24 from shlomif

In order to send a signal (such as kill) to all process of a certain UNIX user, one can do: </

In order to send a signal (such as kill) to all process of a certain UNIX user, one can do:

pkill -U "$username"

To kill them forcibly using the 9 signal ("SIGKILL"), you can do:

pkill -9 -U "$username"

To just list their process IDs, you can do:

pgrep -U "$username"

Personal Log

svn.berlios.de has not been available in the past day , which really drives me mad, so I decided to:

  1. Do stuff that don't require it, like blog or work on non-svn.berlios.de code.
  2. Transition most of my code away from svn.berlios.de to bitbucket.org and Mercurial once it is up.

Cheers.

Syndicated 2011-07-22 12:41:30 from shlomif

More Vim Tips

Here are some more Vim tips I collected recently:

  1. One can repeat the last t, f, T or F command which moves to the next specified character in a line, or right before that, using ;, and repeat in the opposite direction using ,. I discovered those after starting to read through the vim usr_* manuals.

  2. One can get the Unicode value of the character under the cursor using the :ascii command-line command or the ga normal mode command.

  3. If you want to find how many lines/words/etc. are in a visual block, you can select it using "v" and friends and then type g-Ctrl+G.

  4. Finally, you can pipe the contents of the buffer or a range to an external program and view its output temporarily. So you can say :w !grep 'FOO' | wc -l to find the number of lines containing 'FOO', or :'a,'bw !grep 'FOO' | wc -l within a range.

I should note that one thing that annoyed me lately, is the fact that after I have a visual selection (v or V), I sometimes press u instead of y (because they are so nearby) and so cause the selection to become lowercase instead of yanking it.

Happy Vimming!

Syndicated 2011-07-18 09:09:11 from shlomif

Causing an Error in code.google.com

One time when trying to do something with code.google.com, I got a server error. I recorded the HTTP session that led to it and converted it to a self-reproducing Perl script, which still gives me this error. I reported this error to Google on the relevant forums twice, but I did not get a reply. So in the name of full disclosure, I'm reporting it here.

The script in question can be found as a text file on my homepage or as a paste.debian.net paste. I don't know what the implications of this error are, but it should still be dealt with and it wasn't.

Syndicated 2011-07-14 10:23:27 from shlomif

639 older entries...

New Advogato Features

New HTML Parser: The long-awaited libxml2 based HTML parser code is live. It needs further work but already handles most markup better than the original parser.

Keep up with the latest Advogato features by reading the Advogato status blog.

If you're a C programmer with some spare time, take a look at the mod_virgule project page and help us with one of the tasks on the ToDo list!