Shlomif's Technical Posts Community [entries|archive|friends|userinfo]
Shlomif's Technical Posts Community

[ userinfo | livejournal userinfo ]
[ archive | journal archive ]

Links
[Links:| Shlomi Fish's Homepage Main Journal Homesite Blog Planet Linux-IL Amir Aharoni in Unicode open dot dot dot ]

Game Recommendation: “Untrusted: a User JavaScript Adventure Game” [Apr. 21st, 2014|12:47 pm]

shlomif
[Tags|]
[Current Location |Home]
[Current Mood |lazylazy]
[Current Music |StrangeZero - Nanofly (from Jamendo.com)]

If you’re a software developer, you should check out the game “Untrusted: a user JavaScript adventure game” which someone on ##programming referred me to and which I became fond of. It is a game that involves writing some JavaScript code in certain designated places in order to make progress.

On a different note, I found the Jamendo album Nanofly by StrangeZero to be very nice and you should also check it out.

LinkLeave a comment

Tech Tip: add a notification (or any other command) after a command-line task has ended [Mar. 30th, 2014|06:33 pm]

shlomif
[Tags|, , , ]
[Current Location |Home]
[Current Mood |productive]
[Current Music |The White Panda - Bearly Legal]

I discovered that one can add a notification after a command you've already started running has ended on a UNIX system by suspending the command using “Ctrl + Z” and then typing something like “fg ; n --msg 'Command finished'” (where “n” is the command I use for notifications). “fg” brings a job to the foreground, and for more information about it see its wikipedia entry and the Unix Background Jobs entry on thegeekstuff.com.

Licence

You can reuse this entry under the Creative Commons Attribution 3.0 Unported licence, or at your option any later version. See the instructions of how to comply with it.

LinkLeave a comment

Tech Tip: Resetting the GLib/Gtk+ Default Apps on Linux (e.g: the Default Browser) [Mar. 8th, 2014|01:31 pm]

shlomif
[Tags|, , , , ]
[Current Location |Home]
[Current Mood |happyhappy]
[Current Music |Herman’s Hermits - There’s a Kind of Hush]

In this tip, I would like to describe how to reset the default apps, and especially the default browser, for GLib and GTK+. These are used by desktops like GNOME and XFCE, and by GTK+ applications such as HexChat or claws-mail. My problem originally was that I accidentally pressed the "Yes" button when Firefox Nightly (installed under a prefix under /opt) asked me whether I should set it as the default browser, which caused HexChat and Claws-Mail to open links using it by default.

Anyway, to resolve this problem do this:

  1. Go to ~/.local/share/applications.

  2. Backup this directory somewhere safe.

  3. The mimeapps.list file contains the reference to use the offending apps under the *.desktop files there which you can search for the reference to the apps.

  4. Remove these line or their portions from mimeapps.list.

Now you may need to restart the desktop apps or the desktop environment (not sure).

Hope it helps.

Here’s how I found it: after some false leads of either trying to recursively search my home directory for occurrences of /opt/firefox and reading the source code of HexChat, GLib and gtk+ to see where this happens (there were too many levels of indirection there), I ended up doing “strace -f -o hexchat.strace hexchat” and inspecting the strace file for hints.

Licence

You can reuse this entry under the Creative Commons Attribution 3.0 Unported licence, or at your option any later version. See the instructions of how to comply with it.

LinkLeave a comment

The Lost Souls of Freenode [Feb. 25th, 2014|04:02 pm]

shlomif
[Tags|]
[Current Location |Home]
[Current Mood |lazylazy]
[Current Music |Grace Valhalla - Apricot Hill (from Jamendo.com)]

I originally wanted to write a more prose-like blog post about the topic of “The Lost Souls of Freenode”, echoing some of my frustrations from trying to help people on Freenode channels, especially #perl and ##programming and I started from keeping a list of bullets and sub-bullets and decided to keep it this way out of being lazy. Maybe it can also be considered the blog equivalent of some wikiHow pages.

After I gave a link to the bullets to someone I met on Freenode, he told me he hasn't found any of what he read here surprising from his experience on IRC and as a tutor and T.A. (= Teacher Assistant) in an American college.

  • “Many Lost Souls” on Freenode's #perl - IM conversation.

  • Quote the conversation about “First rule of #perl channels” (meaning that Freenode’s #perl is our first line of defence).

  • People having problems getting indentation right.

  • People who /msg me after asking.

    • Either they think that's the way to answer.
    • Or they think that I cannot help them because there's another conversation.
    • They're usually not willing or cannot afford to pay.
    • Someone who thought that paying me 50 USD / hour for private help was too high.
  • * People who want us to write their code for them.

  • “Help me with a script I found.”

    • Often badly written.

  • “Help me with using a program / my operating system / etc.”

    • Not even related to coding.

    • “Are you using version control?” “No, what's that?”
    • Automated tests?
    • A debugger?
  • Old versions of perls.
    • Homework/scholastic constraints.

    • “We didn't study it yet”

    • “No external modules / CPAN”

    • “Not allowed to use any built-in language data structures, including not arrays.”

      • Mandatory course.

      • Graded 0 once because was programmed on Python-2.7.x and tested on Python-3.3.x (on Windows).

  • One who didn't know what files are nor did file I/O.

    - Ruby

    - private conversation with someone else who didn't know what files are.

LinkLeave a comment

Tech Tip: Empty tag in XHTML served as text/html [Jan. 14th, 2014|04:25 pm]

shlomif
[Tags|, , , ]
[Current Location |Home]
[Current Mood |productive]
[Current Music |Set Fire to the Rain - Cover by Spencer Borup with Cimorelli]

If you serve XHTML (= HTML written using XML grammar and conventions) as Content-Type: text/html, you may be tempted to write an empty <div> tag as a standalone XML tag with a trailing slash using <div id="my_anchor" />. Don’t do that, because with text/html (a.k.a “tag-soup”) the browser may think you just have an opening tag and will look for a closing tag elsewhere. Instead, write a pair of opening and closing tags, e.g: <div id="my_anchor"></div>.

Using the first form confused both Firefox (24.2.x in my case) and Google Chromium (whatever shipped with Mageia at the time), and made them misrender my page, despite the fact that it validated as valid XHTML. Perhaps I should have considered putting the id=".." inside a meaningful sub-section of the document, but I implemented something for skipping a section navigation menu.

LinkLeave a comment

Tech Tip: Mitigating “git clone”’s inability to be resumed using rsync [Jan. 2nd, 2014|02:43 pm]

shlomif
[Tags|, , ]
[Current Location |Home]
[Current Mood |Productive]
[Current Music |Chumbawamba - Tubthumping]

Happy new civil year, everyone. As you may know Git is a distributed version control system, but its often time-consuming (if the repository’s history is large) “git clone” operation cannot be resumed, which is a problem with bad Internet connections. There was a service that did “git clone” and then allowed people to download using HTTPS Called “Git bundler” but it has been down for sometime now. However, I found a different solution to the problem.

What can be done is use ssh to log in to a remote host, where the “git clone” is performed (preferably, but not absolutely necessarily, when running on top of a session of tmux, GNU Screen or similar). After that, you can use rsync over ssh to download the .git directory to the local workstation (I like to use the invocation rsync -a --progress -v --inplace for that).

Following that all you have to do is run git clone to a different directory to the one where you put the .git and set “git remote” appropriately.

Hope that helps, and the same can be done with other distributed version control systems such as Mercurial, or Bzr.

LinkLeave a comment

Tech Tip: Combining/Merging Bookmarks From a Different Firefox Profile [Dec. 31st, 2013|08:14 pm]

shlomif
[Tags|, , , ]
[Current Location |Home]
[Current Mood |Calm]
[Current Music |Laura Bell Bundy - Giddy on Up]

Happy New Civil Year! Let’s suppose you collected some bookmarks in a different Firefox profile (possibly on a different computer or system, or in a different profile), and wish to place them somewhere under your current or main profile’s bookmark tree - how can it be done? I had a need for that and in this entry, I describe a solution that worked for me.

  1. First of all export your bookmarks from the source profile to a JSON file (“Bookmarks → Show All Bookmarks → Import and Backup → Backup…”)

  2. Create a new Firefox profile in the machine of the target profile. (see this page for more information about Firefox profiles.).

  3. Import the bookmarks from the JSON file to it (while overriding the default bookmarks).

  4. Copy all the folders you want to merge to the system clipboard (Ctrl+C or equivalent).

  5. Paste them into the default profile’s bookmark manager.

Then all you need to do is sort them. Cheers!

LinkLeave a comment

The GNU Project Will Integrate GNU Guile into GNU coreutils [Nov. 13th, 2013|02:41 pm]

shlomif
[Tags|, ]
[Current Location |Home]
[Current Mood |Lazy]
[Current Music |Des’ree - You Gotta Be]

Tel Aviv, Israel: the GNU (= “Guile N' UNIX”) project announced today that following the popular decision to integrate GNU Guile (= an implementation of the Scheme programming language) into GNU Make, it is going to integrate GNU Guile into the various tools inside GNU coreutils. So for example, GNU cat will have a "-g" flag that will allow embedding Scheme expressions, GNU echo will gain a similar flag, and GNU true and GNU false will allow evaluating Scheme expressions for truth or falsehood. It is not yet clear what functionality GNU head and GNU tail will gain by the integration.

O’Reilly Media announced that it will publish a new edition of its series of books, which includes Mastering cat and Mastering echo to cover the additional functionality provided by GNU Guile, and we will give an overview of the additional functionality in the usergroups of the cat mongers, the echo-chamberists, and the (GNU) true believers.

“If it’s not bloat, it’s not us.”, said Richard Stallman, the colourful head of the GNU project, and started to sing the Free Software song. Linus Torvalds was not available for comments about the proposal to integrate GNU Guile into the Linux kernel.

LinkLeave a comment

Tech Tip: How to Copy a Remote File on rsync.net [Oct. 26th, 2013|03:14 pm]

shlomif
[Tags|, , ]
[Current Location |Home]
[Current Mood |Calm]
[Current Music |Rita - Shir Ahovath Hasapan]

rsync.net is a good service (and a not too pricey one) for remote storage of data (for backups/etc.) based on open protocols and open source applications. One thing that bugged me there however, was that I couldn't find a way to copy a remote file to a different name, because the SFTP client does not support a copy operation, and because I could not get to a login shell by sshing my rsync.net account. Apparently, it's doable and not very hard.

What you need to do is type ssh my_account@somewhere.rsync.net cp [source filename] [destination filename] and it will run the remote UNIX "cp" command to copy the file. You can access some other remote UNIX commands like that such as "ls".

Hope it helps.

LinkLeave a comment

Tech Tip: Tmux: Disabling the Time Display in the Status [Sep. 4th, 2013|02:06 pm]

shlomif
[Tags|, , ]

tmux is a usable and open source terminal multiplexer (that allows one to run several programs in the same terminal, detach them, split them into windows and viewports, etc.) which I've been happily using after switching to it from GNU screen. Some weeks ago, I noticed that if I keep tmux open in a konsole tab, then eventually that tab got highlighted as modified, even if there was no activity in the tab. I realised the problem had to do with the fact that tmux displays the current time by default.

In order to fix it, you can use a line like the following in your ~/.tmux.conf file:

set -g status-right '#H'

-g applies the assignment globally, and '#H' displays the hostname (and not the time or whatever else is there by default).

While searching for an answer, I ran into the powerline project which provides much more functionality, seems like an overkill for me, but may work for you.

Shanah Tovah to everyone!

LinkLeave a comment

navigation
[ viewing | most recent entries ]
[ go | earlier ]