Forum

Forum

Robbert Haarman

2020-11-28

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 (1 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)
Posted by inglorion
at 2013-12-01 22:50:52

I just released version 1.1.3 of the Voodoo Compiler. This release comes with the following bug fixes and improvements:

* Compatibility with Ruby 1.8, 1.9 and 2.0, tested with MRI/YARV and Rubinius.

* Labels that start in underscores now work.

* Programs that use symbols and then try to export or import them are now rejected.

The last change deserves some explanation. Previously, the Voodoo language definition imposed no constraints on the ordering of symbol use, import, and export. However, imported and exported symbols are treated differently from locally defined symbols at least on some platforms. In some cases, using a symbol without first importing it, and then later importing the symbol, would result in a program that compiles and links, but crashes or produces wrong results when run on some platforms. To avoid this rather nasty situation, I've updated the language definition to clarify that symbols that are imported or exported must be imported or exported before they are first used, and updated the Voodoo compiler to reject programs that do not obey this constraint.

  • View this thread (0 comments)
Posted by inglorion
at 2013-10-21 05:30:42

I just released version 1.1.2 of the Voodoo Compiler. This release comes with the following bug fixes and improvements:

* Fixed the allocation of space for local variables. Previously, let incantations inside blocks inside if incantations were not considered, which caused incorrect behavior when such let incantations were used.

* Fixed the computation of offsets for local variables on ARM. A bug in the way these offsets were computed caused incorrect behavior due to local variables being stored in the same memory locations as other values.

* Fixed the parser so that numbers after line continuation escapes are parsed as numbers, not symbols.

* Made the handling of undeclared symbols more consistent. voodooc now rejects code that uses symbols that have not been defined or imported with an error message. Previously, the behavior depended on whether or not the assembler accepted the generated code.

* make gem now configures the Voodoo Compiler with default assembler names, rather than using the configuration of the host system.

  • View this thread (0 comments)
Posted by inglorion
at 2013-08-11 04:39:16

I just put up version 1.0.0 of cconstants. cconstants is a library and a set of command line utilities that allow the values of constants defined in C header files to be queried outside the C preprocessor. This allows the values of these constants to be queried from programming languages other than C, on systems without the C preprocessor installed, and on systems where the header files defining these constants are not available.

One way this library can be used is to provide the right magic values when calling C code from Voodoo programs.

  • View this thread (0 comments)
Posted by inglorion
at 2013-07-15 15:49:14

I just released version 1.1.1 of the Voodoo Compiler. This release implements support for the latest version of the Voodoo language. The following features have been added:

* Stack memory allocation (auto-bytes, auto-words).

* Support for non-local control flow (save-frame, restore-frame). This allows the implementation of things like catch/throw and exceptions.

* Object files created by the Voodoo compiler can now be used in shared libraries.

* Substitute tokens, allowing symbolic names to be used for implementation-defined numeric values (e.g. %saved-frame-size).

* set now accepts at-expressions for the location to store the value at.

  • View this thread (0 comments)
Posted by inglorion
at 2013-07-13 00:50:39

It is good to have great ideas, but, in the end, what counts is not what you have thought of, but what you have done.

  • View this thread (0 comments)

View 10 earlier threads

View 10 newer threads

Valid XHTML 1.1! Valid CSS! Viewable with Any Browser