Archives 2005 - 2019    Search

Interrotron - a cool kind of teleprompter

published Jun 13, 2013 11:06   by admin ( last modified Jun 13, 2013 11:06 )

As far as I can tell from the explanation, it works a bit like mirrored sunglasses. On such sunglasses, from the inside you see the world accurately albeit darkly, and from the outside you just see a reflection. If you put a screen with the same properties but with the mirror at the user at say a 45 degree angle from horizontal in front of a camera lens, the subject can look at the camera lens while still seeing what is projected on the screen (say from beneath).

 

 

Errol Morris - Wikipedia, the free encyclopedia
 

Read more: Link - interrotron1.jpg (JPEG Image, 750 × 482 pixels)


Make collective.recipe.supervisor run scripts as if in another directory

published Jun 08, 2013 12:10   by admin ( last modified Jun 09, 2013 12:12 )

Summary, give the directory path without square brackets and without quotes.

At least that's what worked for me. In the documentation on pypi you read the following syntax:

priority process_name [(process_opts)] command [[args] [directory] [[redirect_stderr]] [user]]

It seems like the parameters both before the directory specification and the one behind, should be given in square brackets. Maybe that is why the directory specification should be given without. Maybe it is simply defined as anything between the brackets and hence also even accepts spaces, but have not tried that one. Bracketing it in double quotes did not work. Tested with the recipe pinned to version 0.17.

 

priority process_name [(process_opts)] command [[args] [directory] [[redirect_stderr]] [user]]


Read more: Link - collective.recipe.supervisor 0.19 : Python Package Index


Python debug tools

published Jun 08, 2013 01:57   by admin ( last modified Jun 08, 2013 01:57 )

A note to self.

 

This is an overview of tools I've used for debugging or profiling purposes. Not necessarily complete, if you know better tools, comment below.


Read more: Link - Python debugging tools | ionel's codelog


Ridiculously graphically well designed presentation on backbone.js

published Jun 07, 2013 02:58   by admin ( last modified Jun 07, 2013 02:58 )

The contents is probably good too, it seems to boil down to using marionette and decoupling into small units. I'm not into backbone.js right now so it's all I can say after a cursory look. But I can say that the graphical design and creativity of the slides are stunning.

 

Backbone.js is a popular, super lightweight JavaScript framework which helps you structure your code MVC style. If you're building JavaScript applications of any reasonable size, you might have heard of it and you might have even given it a try.


Read more: Link - Unsuck your backbone // Speaker Deck


Perl one-liners that gulp entire files for pattern matching

published Jun 05, 2013 06:40   by admin ( last modified Jun 05, 2013 06:40 )

Summary: instead of the -pi switch, enter -p0777i, and remember to use the ms modifier  in the regular expression.

 

Today I wanted to keep everything in each file, after a certain pattern, the last time that pattern was seen. One way of doing that is two write a perl one-liner that treats the file as one big long string, search and replace for the pattern and save away what is left.

The pattern for doing this is something like this:

find directory_name -name "*.txt" -print0|xargs -0 perl -p0777i -e  's!search_pat!replace_pat!gms;


...if you want to find all txt files under directory_name and replace search_pattern with replace_pattern, and do that:

  • many times if necessary (g)
  • over multiple lines (m),
  • expanding dot "." to also match newlines (s).
     
Now, the -0 flag in perl specifies (in octal) the input record separator (new lines in a text file). If we rely on the fact that no 0x777 character exists, we can swallow each file in one big gulp, and then do the search and replace over many lines. So:


Read more: Link - Search and replace across many files with a perl one-liner


ImageMagick from python

published Jun 04, 2013 11:24   by admin ( last modified Jun 04, 2013 11:24 )

Just a note to self:

 

Wand is a ctypes-based simple ImageMagick binding for Python.


Read more: Link - Wand — Wand 0.2.4


Switched from Unity to LXDE on Ubuntu 13.04 (Raring Ringtail)

published Jun 04, 2013 11:24   by admin ( last modified Jun 04, 2013 11:24 )

SInce upgrading to Ubuntu 13.04 from 12.04 and continuing running Unity on it, my laptop has become very sluggish. There is disk activity going on all the time, and it takes seconds for the computer to respond to the GUI.

The sluggishness isn't here all the time, but often enough for it to be a problem. A friend recommended me to try Unity 2D, but that does not exist as an option anymore on the newer Ubuntus. I have been trying to use htop to see where the problem is, both as root and as a normal user but I cannot seem to locate it. Firefox and Chrome feature prominently but I do not think both of them got buggy at the same time just because of a newer Ubuntu.

I have been looking at LXDE for some time as the GUI on virtual machines for my pupils and today I decided to switch to it on my own laptop. So far so good!

LXDE is isgnificantly less polished than e.g. Unity: Panels in LXDE overlap in the corners, sometimes the settings dialogs go bonkers, e.g. when picking applications in the Application Launch Bar. But so far disk activity has gone to virtually zero!

The "Lightweight X11 Desktop Environment" is an extremely fast-performing and energy-saving desktop environment.


Read more: Link - LXDE.org | Lightweight X11 Desktop Environment


How to make a temporary RAM disk on Linux

published May 22, 2013 12:40   by admin ( last modified Jun 05, 2013 07:17 )

Can be an interesting way to check if file accesses is killing a script's or application's performance. I have tested it and it can make things go blazingly fast. I have inserted about 8000 new record in an SQLite datbase from python, and the total speedup seems to be around a factor 20x -50x. Yes, of course it would be possible to solve this in another way, batching SQL inserts or having the db in-memory. But with a RAM disk I do not need to think about that.

 

$ mkdir /tmp/ramdisk; chmod 777 /tmp/ramdisk $ mount -t tmpfs -o size=256M tmpfs /tmp/ramdisk/


Read more: Link - axonxorz comments on SQLite Now Faster With Memory Mapped I/O

 


Dillinger - a markdown editor with a preview pane

published May 16, 2013 06:18   by admin ( last modified May 16, 2013 06:18 )

Looks neat.

 

Dillinger is a cloud-enabled HTML5 Markdown editor. Type some Markdown text in the left window See the HTML in the right Magic


Read more: Link - Online Markdown Editor - Dillinger, the Last Markdown Editor ever.


Link - Letting Generic Setup handle content types that may not exist

published May 15, 2013 04:47   by admin ( last modified May 15, 2013 04:47 )

Saw this today and just saving the link for reference if I would run into this problem.

 

Fortunately there is an undocumented feature hidden in GS: You can declare your type declaration as deprecated. This way, GS does not try to initialize the object and does not try to create the type information object if it does not exist.


Read more: Link - How to handle unknown meta_type in GS — Starzel.de


Analyze Apache log files from the command line

published May 14, 2013 03:00   by admin ( last modified May 15, 2013 04:48 )

Sometime you just want to get a quick overview of what's going on. In this case I wanted to know from what regions accesses were made to a specific page. This web article: Analyzing Apache Log Files < System | The Art of Web, showed how to use awk to filter out specific fields in the apache log format.

 

I found some info on how to geolocate from the command line here: Geolocate a given IP address | commandlinefu.com (I installed geoip-bin on my Debian).

 

The resulting one-liner, that

  • checks for a pattern in the log file vhosts_access.log,
  • extracts the ip number for each request
  • and geolocates it:

 

grep 'some_pattern_in_the_log' vhosts_access.log|awk '{print $2}'|sort|uniq| xargs -I xxx geoiplookup xxx|sort|less

 


How to change the default sort order in Kate (KDE) file dialogs

published May 09, 2013 04:40   by admin ( last modified May 09, 2013 04:36 )

On Ubuntu 13.04 (at least), edit the file:

~/.kde/share/config/kdeglobals

It is a configuration file in the Windows INI style format. Locate the section called

[KFileDialog Settings]

Change the settings:

Sort by=Date
Sort reversed=true

into:

Sort by=Name
Sort reversed=false

Furthermore, changing

View Style=Simple

into

View Style=Detail

will make it easy to change the sort order on the fly.

The changes will not be immediately picked up by Kate. I did not need to restart the computer or even logout from my Ubuntu Unity session, but logout is probably the way to go if the changes do not take effect after a while.


Plone training in London July 2-4

published May 07, 2013 07:23   by admin ( last modified May 07, 2013 07:23 )

We will be back with Plone Training, with a three day course July 2 -4 2013 in London.


Using bottle.py as a Facebook authenticating proxy

published May 02, 2013 06:30   by admin ( last modified May 02, 2013 06:29 )

I haven't actually tested this, so far just assembling bits and pieces that ought to work together.

 

How to make bottle.py into a proxy server:

Making a Bottle app that routes to a proxy

How to make bottle.py authenticate via Facebook:

sean-lynch/bottle_fbauth · GitHub

Underlying python library for the Facebook authentication:

facebook-sdk 0.4.0 : Python Package Index


Text editor for LXDE

published Apr 30, 2013 03:15   by admin ( last modified Apr 30, 2013 03:15 )

Now trying Geany, will see how it performs.

 

I recommend geany, which does not depend on Gnome and seems to have almost everything I might want.


Read more: Link - Developer list for the LXDE desktop environment ()


Lubuntu 13.04 not as dependency-happy as it first seems

published Apr 26, 2013 06:05   by admin ( last modified Apr 27, 2013 02:16 )

I installed the LXDE lightweight X11 desktop environment  on a Debian-based virtual machine (Bachata Linux) and I liked the simplicity of it. So I decided to try lubuntu, Ubuntu with LXDE, on a virtual machine. Once installed, I tried to remove one of the games, to clear up the menus a bit. However then it seemed like it wanted to uninstall LXDE proper..

I wonder if it actually meant a meta-package or what it's called, seems strange to have an all-or-nothing install. I investigated further:

 

All is well then, somebody else must have thought the same thing as I, and added the explanation. It is apparently safe to remove lubuntu-desktop without removing the, eh, Lubuntu desktop.


Page output from inside the python shell (REPL)

published Apr 25, 2013 10:16   by admin ( last modified Apr 25, 2013 10:16 )
import pydoc
pydoc.pager('\n'.join('Hello World %d!' % x for x in xrange(200)))



I had no idea about this. It works well with pythn 2.7 on Ubuntu 12.04

 


Read more: Link - mitsuhiko comments on how to print output like "less" in shell?


Hartmann - Pipelines with multiple ins and outs

published Apr 24, 2013 11:14   by admin ( last modified Apr 24, 2013 11:14 )

Sometimes I think it would be useful to have pipelines where you can branch out and handle errors or other conditions, or jump forward in a pipeline. There seems to be one syntax that covers this, the Hartmann pipeline:

 

Hartmann pipeline - Wikipedia, the free encyclopedia


Block computers from seeing each other on a wireless network

published Apr 20, 2013 01:40   by admin ( last modified Apr 20, 2013 01:40 )

It's called "wireless isolation", "AP isolation, "client isolation", "Publicly Secure Packet Forwarding" or "Wireless Client Security Separator" and I reckon and hope that it is implemented in most public and semi public Wi-Fi  networks.

Earlier this week as part of a python programming course, I demoed  service discovery applications for both Daap and Dlna servers. I wondered if I'd pick up any such devices from the massive guest Wi-Fi network I was on. I picked up none and realized that this was probably because the network did not allow devices to communicate between themselves, only out through the gateway to the Internet. That is good.

But what is that feature called? It seems to have different names and no agreed-upon standard terminology, but one term used is "wireless isolation", another is "Wireless Client Security Separator". I suppose that is a really good feature to have switched on, on a public or semi public network. On Netgear devices it's called "Wireless Client Security Separator".

Read more:


Styr en radiomottagare i Holland

published Apr 08, 2013 02:37   by admin ( last modified Apr 08, 2013 02:37 )

Hur kopplar man en radio till en dator? Måste man bestämma vilken kanal man ska lyssna på osv? Nej, digitalisera alltihopa och skicka hela spektrumet över gigabit Ethernet till datorn.

Och så kan datorn avkoda den frekvens man vill lyssna på, och bandbredd, och modulationsteknik (AM, FM), och med AM single side band osv. 
 
Och förresten, varför inte låta flera göra det på samma gång, så att man använder samma dator för att lyssna på olika frekvensband och modulationer samtidigt, typ just nu 100stycken användare på en radio?
 
Och så kan man göra en front end i Java, eller varför inte också i Javascript.
 
Och så gör man det från Holland. Kul för hela familjen:
 
 
(rulla nedåt för att hitta radiokontrollerna)
SDR board (pictured above; see here for background) which samples the entire shortwave spectrum and sends all of this via a gigabit ethernet link to a PC

Read more: Link - Wide-band WebSDR in JO32KF