Forum

Forum

Robbert Haarman

2014-02-15

Posted by inglorion
at 2014-04-04 00:16:01

Discovery of the day: "less +F". It's something I've been looking for, but hadn't found until recently. Some background: "tail" shows the last couple of lines in a file. "tail -f" does the same, but also "follows" the file, showing new lines as they are added to the file. "less" is a pager, it allows you to view a file screenful by screenful. It also allows you to scroll up, search, and a number of other useful things. One of those is a follow function, which basically does the same as "tail -f", but allows you to go back to less's normal mode of operation, so you can scroll back, etc.

Often, I want to see new lines being added to a file, with the option to scroll back, search, etc. if something interesting happens (e.g. an error message is printed). The way I used to do this is by running "less $filename", then typing an uppercase F, which invokes the follow function. Today, I discovered that you can do this in one go by doing "less +F $filename". This also works for other less commands, e.g. "less +G $filename" will run less on a file, but start at the end of the file, rather than at the beginning. "less +/foo $filename" will open the file and scroll to the first occurrence of "foo".

  • View this thread (0 comments)
Posted by inglorion
at 2014-03-28 09:56:07

Internet.org just announced that they will be using satellites, lasers, and solar-powered planes to give everyone on Earth access to the Internet. You can read about it in the announcement, or watch the video. I'm ridiculously excited about this.

  • View this thread (0 comments)
Posted by inglorion
at 2014-02-02 14:56:41

If you are getting the error message "ValueError: bad marshal data (unknown type code)" while trying to import a Python module, it may be that the compiled version of the module (the .pyc file) is corrupt. There is an easy way to fix that: just delete the .pyc file.

For example, on my Linaro 13.09 system, I got this error whenever I ran any of the package management commands (aptitude et al.):


Traceback (most recent call last):
  File "/usr/bin/py3compile", line 34, in <module>
    from debpython.version import SUPPORTED, debsorted, vrepr, \
  File "/usr/share/python3/debpython/version.py", line 26, in <module>
    from configparser import ConfigParser
  File "<frozen importlib._bootstrap>", line 1564, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1531, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 586, in _check_name_wrapper
  File "<frozen importlib._bootstrap>", line 1023, in load_module
  File "<frozen importlib._bootstrap>", line 1004, in load_module
  File "<frozen importlib._bootstrap>", line 562, in module_for_loader_wrapper
  File "<frozen importlib._bootstrap>", line 854, in _load_module
  File "<frozen importlib._bootstrap>", line 968, in get_code
ValueError: bad marshal data (unknown type code)

I was able to fix this by doing:

sudo rm /usr/lib/python3.3/__pycache__/configparser.cpython-33.pyc

  • View this thread (0 comments)
Posted by inglorion
at 2014-01-22 19:09:23

Good article by Walter Bright about what it takes to create your own programming language and getting it adopted: So You Want To Write Your Own Language?

  • View this thread (0 comments)
Posted by inglorion
at 2014-01-07 05:09:55

Some of you may have noticed that my website has been down for an extended amount of time (over a week). What happened is that, while I was on vacation, the solid-state drive attached to the machine serving the site broke. Not having access to the files on the SSD, the machine was unable to serve the website, and I only got around to fixing the problem after I returned home.

I replaced the broken SSD with a new one, got everything back up and running, and started a backup job. Unfortunately, while running that backup job, the new SSD broke. I'm now serving the site from a different machine while I wait for a new hard disk to attach to the original server. This machine may have slightly older versions of some files, so I will have to do some work to get things up to the latest state, but I will wait until I have the replacement disk.

  • View this thread (0 comments)

View previous 5 threads