Older blog entries for shlomif (starting at number 663)

Freecell Solver 3.12.0

Freecell Solver version 3.12.0 has been released. It is available in the form of a source archive from the download page. Freecell Solver is an open source framework (library and some command line applications), for automatically solving several variants of card Solitaire / Patience games, including Freecell.

The first item to note is that the URL of its site changed from under *.berlios.de to http://fc-solve.shlomifish.org/, and that there is a redirect in place. Moreover, we have switched the version control system from one based on Subversion to a git repository which is currently hosted on GitHub (though we may move it later).

This release adds a new flag - --show-exceeded-limits or -sel for short, that removes some ambiguity in the output, and fixes a problem with starting the solver with --set-pruning r:tf in conjunction with -opt. A new preset - -l three-eighty (or -l te for short) has been added, which provides somewhat better performance.

The experimental dbm_fc_solver is now less experimental and can now store the positions inside binary trees in memory, and its memory consumption has been greatly reduced since earlier versions. We also added another experimental solver called fcc_fc_solver which aims to determine the solvability of a deal by analysing fully-connected-components (“FCCs”).

We also added support for building and testing the distribution in an out-of-tree build, and there are some cleanups to the code.

More information about all these can be found in the distributed documents of Freecell Solver.

Enjoy!

Syndicated 2012-06-13 13:31:00 from shlomif

Tech Tip: GNU tar’s “-a” Flag

On this post to the Mageia development mailing list by Thierry Vignaud, I discovered that GNU tar (at least in recent versions) has an “-a” flag which is useful in conjunction with its “-c” (create new archive) mode. This is because it detects the suitable compression based on the extension and uses the appropriate flag.

So: “tar -cavf myarchive.tar.gz ./mydir/” is equivalent to “tar -czvf myarchive.tar.gz ./mydir/”, “tar -cavf myarchive.tar.bz2 ./mydir/” does the same thing as “tar -cjvf myarchive.tar.bz2 ./mydir/” and so forth. When unpacking archives, you can omit the “-a/-z/-j/-J” flags, because GNU tar will detect the compression of the archive based on the file magic of the compressed formats.

Another useful (and open-source) tool for manipulating tarballs and other archives is patool, but I've been meaning to suggest they do a short-circuiting when converting tarballs from .tar.gz to .tar.xz to .tar.bz2 / etc.

Anyway, enjoy.

Meta

I know I’ve been really negligent with blogging in my blogs lately (which is not good), but don’t worry - I am fine, just busy with a lot of stuff including work work (which gives money but consumes time), doing quite a lot of coding and other development on open-source software, some Freecell-related research, keeping up with my E-mails, posting to mailing lists, playing some computer games, chatting a lot (maybe too much) on the IRC, and naturally - sleeping.

It seems that despite starting the new job in December, and despite the fact that it was now spring time (which is often a time of calamity for me), I did not have any particularly strong periods of stress lately, which is a good think. Thanks, $DEITY!

Today a friend who is an Israeli open-source enthusiast called me and asked me why I disappeared and if everything OK, and I replied, but he later called again and said his mobile phone mixed me with someone else. Anyway, you can always reach me in many ways, but I think I should start blogging more often, so I‘ve picked up this tech tip as the lowest hanging fruit.

Syndicated 2012-05-27 20:38:59 from shlomif

New Vim Plugin: Add to Word Search

I’ve released a new plugin for the Vim text editor, called "add-to-word-search" ( GitHub repository, Vim Scripts page), and I’d like to introduce it here. If you like Vim, please let me know what you think by commenting below.

In order to properly introduce the plugin, one first should introduce the different (and useful) commands of Vim of * and #. What they do is search forward or backward for the complete word under the cursor (or somewhat before it or after it). Bram Moolenaar (the creator of Vim) covers them in his “Seven habits of effective text editing” document (there’s also a video available), and I think I covered them in a previous Vim tip.

Now, here is the use case that often bugged me: sometimes I searched for a certain function, found it in the text and then found a function that called this function (or often in the case of C code, a preprocessor macro that wrapped it), and wanted to look for its occurrences as well as those of the previous term. I wasn't aware of any good way to do it, so I ended up writing the “add-to-word-search” plugin.

After installing it, and after having searched for a word using * or #, one can press \** to search forward for an additional word under the cursor (or \## to search backward), and then use it more times to add additional words.

After publishing this plugin and mentioning it on #vim, “ironcamel” reported an issue that it gives an error if you have set nowrapscan. I fixed it, but was only able to do so by temporarily disabling nowrapscan, and then enabling it if it was previously enabled. (Apparently, vimscript’s exception-handling cannot handle some of the built-in errors.)

I also demonstrated it to my (now former) co-worker, who had been trying to get used to Vim, and he said it looked useful, but asked if there was an easy way to remove terms from the search query (which there is not at the moment), and I noted it may be a good idea.

Anyway, this Vim plugin is open-source and available under the MIT/X11 licence. Enjoy!

Syndicated 2012-04-24 07:51:03 from shlomif

ANNOUNCEMENT: Resumed maintenance of mikmod and libmikmod

To whom it may concern,

libmikmod is a portable and open-source (LGPLed) library for playing various common formats of Module files, including MOD, S3M, XM, and IT. mikmod is a Curses-based front-end for it, freely available under the GPL. Shlomi Fish would like to announce that he resumed maintenance of libmikmod and mikmod, after many years of lack of maintenance, after getting approval from Raphaël Assénat (raphnet), the previous maintainer.

So far, libmikmod-3.2.0-beta3 has been released with some older changes that lingered in the old version control repository, as well as several important fixes for security bugs taken from the downstream Mageia Linux package. The version control repository was converted from CVS to Mercurial, and more development is expected.

Plans for the future include releasing a stable libmikmod-3.2.0 and afterwards converting the build system from GNU Autotools to CMake, and then looking into fixing more bugs as they are encountered and implementing new features.

The old MikMod homepage ( http://mikmod.raphnet.net/ ) now redirects to the new one at http://mikmod.shlomifish.org/ where new development will take place (some parts of it still need to be updated, but it should already be usable).

Any contribution including testing, reporting bug fixes, contributing changes (as patches or as clones of the repository), or suggesting new features, will be appreciated.

For more information about module files see the wikipedia entry for “Module file”, and the FAQ for alt.binaries.sounds.mods (which was last updated in 1999). </a>

Syndicated 2012-04-15 12:05:18 from shlomif

The Stoic Road to Peace of Mind

If you are like most people, you probably feel angry, frustrated, or disappointed, often. That’s also has naturally been the case for me, but I was told a trick that made it much easier for me to handle these situations, and it dates back to antiquity.

Stoicism was an ancient Greek school of thought (that still exercises some influence today), which among other teachings, advocated self-control and avoiding making your emotions and irrational desires influence your behaviour for the worst. What they claimed was that painful feelings were not a direct result of an experience that induced pain, but rather the human mind's irrational interpretation of it.

If we move from this theory to its implications, then once something frustrating happens to you, you can say to yourself “I don’t like this. This situation is not ideal. However, feeling angry and resentful will not be beneficial, and so I should just accept this as is, try to reasonably cope with it, and make the best of it. I might even grow to like it.”

My psychotherapist told me that “Things must always go my way.” has been identified as an irrational cognitive belief by many people. (It is mentioned in this page in the Google Books’ hosted book). The solution to this is simply to say to myself that “I cannot always get what I want.” and that “Things might not go exactly like I want them to and that’s OK because I’ll survive.”.

Back to Stoicism, we can draw inspiration from the Roman Emperor and Stoic philosopher Marcus Aurelius’s quote from his book Meditations:

Say to yourself in the early morning: I shall meet today ungrateful, violent, treacherous, envious, uncharitable men. All of these things have come upon them through ignorance of real good and ill… I can neither be harmed by any of them, for no man will involve me in wrong, nor can I be angry with my kinsman or hate him; for we have come into the world to work together…

I am not an authority to speak a lot further about Stoicism, because I’ve only heard about it from hearsay and read the wikipedia entry and some other online sources, but I think we can all become a little, or even a lot happier, by adopting the mindset that the key to peace of mind is accepting sub-optimal situations, instead of insisting that we will always have our way.

Thanks

Thanks to steerpike, mofino and perlmonkey from Freenode for going over early drafts of this essay and providing some comments.

Licence

This work is licensed under the Creative Commons Attribution 3.0 License (Unported) (CC-by) or at your option any later version. Copyright © 2012, Shlomi Fish. CC-by is a common, permissive, free/libre/open licence for cultural works, which allows for almost unlimited use. See my interpretation and expectations from people who wish to build upon it (which I believe are pretty fair).

Meta

I realise I’ve neglected this blog for a long time, and I’ve been meaning to write and publish this entry for a long time, but didn’t, but I guess “better late than never”, right? Personally, I’ve been mostly fine recently having found a part-time job, which involves a short bus ride to the office in the downtown city, so it’s at a great location for me. I also enjoyed attending the latest Israeli Perl Workshop for 2012 and written a report about it.

In the meanwhile, livejournal.com’s handling of this blog’s DNS domains has deteriorated, and now just redirects it to shlomifish.livejournal.com. This probably made me even less motivated to post on this blog, and my reports about it appears to have been marked as duplicate without a proper resolution, but I'll try to get it handled and fixed. If not, I might have to investigate other hosted blog solutions.

There’s a lot more going on with my life, but I’m not sure how much it will interest other people and how much I should share it, but I’m fine and happy and have plenty of free time for work and leisure and whatever is in between. So good bye until next time.

Syndicated 2012-03-31 08:57:58 from shlomif

Tech Tip: Getting hgsubversion to Work with subversion-1.7.x

Apache Subversion version 1.7.x broke some backwards compatible and some stuff got broken, including hgsubversion, which provides a way to use subversion remotes with Mercurial.

In order to fix it, just install subvertpy, which provides alternative python bindings for subversion, which hgsubversion prefers by default, and with which it works fine under subversion-1.7.x.

I discovered all that after I attempted to fix it the hard way by installing subversion-1.6.x under /opt/svn-1.6.x, which required building an old version of SWIG, and then setting PATH, LD_LIBRARY_PATH, and PYTHONPATH and then having to remove the global python-svn bindings from under /usr/lib (as root!) because hgsubversion did not like them, a process which took me an entire evening and was frustrating and was ridden with a lot of trial and error, so I would not recommend it.

Hope it helps. Also see this hgsubversion bug report.

Syndicated 2012-03-16 09:04:14 from shlomif

Tech Tip: Getting hgsubversion to Work with subversion-1.7.x

Apache Subversion version 1.7.x broke some backwards compatible and some stuff got broken, including hgsubversion, which provides a way to use subversion remotes with Mercurial.

In order to fix it, just install subvertpy, which provides alternative python bindings for subversion, which hgsubversion prefers by default, and with which it works fine under subversion-1.7.x.

I discovered all that after I attempted to fix it the hard way by installing subversion-1.6.x under /opt/svn-1.6.x, which required building an old version of SWIG, and then setting PATH, LD_LIBRARY_PATH, and PYTHONPATH and then having to remove the global python-svn bindings from under /usr/lib (as root!) because hgsubversion did not like them, a process which took me an entire evening and was frustrating and was ridden with a lot of trial and error, so I would not recommend it.

Hope it helps. Also see this hgsubversion bug report.

Syndicated 2012-03-09 19:04:46 from shlomif

Fifth Part of Perl for Perl Newbies and New Humour Items

Here are the recent updates for Shlomi Fish’s Homepage. I know I have not posted an update to this blog in a while, and in part it’s due to the fact that I have not done as much work on the site as I have before the previous update. But there is still some new things to look forward to.

There are some new items on the original aphorisms page:

Sophie: I’m hungry today.
Jack: well, wait until tomorrow - maybe this feeling will pass.

I’m now mirroring the “English is a Crazy Language” bit I found somewhere.

The fifth installment in the Perl for Perl Newbies series of presentations is now available online. This part covers good programming practices such as using a version control system, writing automated tests, and using accessors for objects. As with the previous parts, this talk is licensed under the Public Domain/CC-Zero.

There are new factoids in the factoids collection:

Larry Wall can make shit up, and the computer will understand what he means.

There are also many new UNIX-like fortune cookies:

  • buu: PKRUMINS
  • rindolf: pKrumins
  • pkrumins: BYY
  • rindolf: pkrumins: BUU
  • rindolf: pkrumins: buu is back.
  • pkrumins: rindolf: i know
  • rindolf: pkrumins: he said he was close to disappearing.
  • pkrumins: WHAT
  • pkrumins: buu, is that true
  • rindolf: pkrumins: he was sick.
  • pkrumins: HE WASNT
  • buu: =[
  • buu: I was
  • pkrumins: HOW
  • buu: Genetic defects!
  • pkrumins: OH NO
  • pkrumins: OH NO NO NO
  • mauke: substance abuuse
  • buu: Owch
  • buu: That joke almost qualifies as abuse
  • mauke: now that I've hurt mst and buu, my work for today is done
  • pkrumins: you still havent hurt me
  • rindolf: mauke: hold on! You haven't hurt me yet.
  • buu: haha
  • * rindolf is hurt that mauke didn't hurt him.
  • rindolf: Oh wait.
  • mauke: just as keikaku.
  • rindolf: mauke: OK, now your work for today is done.
  • pkrumins: NO

I have added a review of Kent Beck’s Test Driven Development: By Example to the recommended books page.

The ABC Path game's generator module is now being mentioned in the Games ABC Path page, and the solver and generator were also ported to JavaScript.

More prominent editors and IDEs were added to the editors and IDEs page.

And as usual, there are many additional links on various pages of the site.

Syndicated 2012-02-19 17:49:20 from shlomif

Vim Tips: scp URLs, "set tabpagemax" and fixing C indentation

Here are some Vim tips I ran into recently. First of all, when opening scp:// URLs, one should use two slashes after the hostname instead of 1, like scp://hostname//home/myuser/foo.txt instead of scp://hostname/home/myuser/foo.txt. I don’t know why that is the case, but it does not work properly without it. It also seems that netrw is buggy as it displays an irritating grey line on the cursor, the syntax highlighting tends to be off and saving a file displays several lines at the bottom.

Another tip is that gvim limits the number of tabs it opens when doing gvim -p [file1] [file2] [file3]. As a result, it is possible that not all files will be opened. If you want to change it you can set set tabpagemax in your .vimrc.

Finally, I noticed that Vim c-indentation tends to indent parameters to functions on subsequent lines using 8 spaces instead of 4 by default. I was able to change it to 4, which is my preference by adding set cinoptions+='(0,W4' to my .vimrc. There is plenty of other nifty stuff available in the cinoptions parameter.

Enjoy!

Syndicated 2012-02-18 16:24:14 from shlomif

git tip: adding remotes to .git/config

When working with the git version control system and editing .git/config to add a new remote, some people may be tempted to copy and change the origin remote that reads something like:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:shlomif/perl.git

However, note that origin also appears at the fetch = and needs to be changed there as well, or else all the branches will be placed in remotes/origin. Maybe there's a better way to add a new remote using the git config commands.

Otherwise, I should note that there doesn't seem to be a consensus among git users whether git pull --rebase is better than a simple git pull: the perl people told me to use --rebase and the Amarok people and someone on Freenode's ##programming told me not to use it. Now I'm just confused.

Syndicated 2012-01-22 16:33:04 from shlomif

654 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!