Archives 2005 - 2019    Search

Handbrake - a tool for compressing video

published May 05, 2011 04:50   by admin ( last modified May 05, 2011 04:50 )

Today I discovered Handbrake, a tool for compressing and transcoding video. It is probably mainly for doing this from DVD, but I have been using it for making smaller video files from my Casio Exilim camera. I had a rather motionless (demoing eyeglass frames) video that had the original size of 182MB. In Handbrake I set the target size to 24MB, two passes and it managed to shrink the file down to under 24MB with pretty darn no discernible degradation of quality! Recommended.


Länk - How to make transparent stuff clickable in old Internet Explorers

published Apr 28, 2011 02:59   by admin ( last modified Apr 28, 2011 02:59 )

 

a.invisiblelink { background-color: #fff; opacity: 0; filter: alpha(opacity=1); }



Läs mer: Workaround: Can Not Click or Hover Transparent Links/Elements in Internet Explorer IE6, IE7, IE8 | Coil Media


Gör lösenord av flera ord, "this is fun" säkrare än "J4fS>2"

published Apr 24, 2011 08:04   by admin ( last modified Apr 24, 2011 08:04 )

Många råd om lösenord är fel. Det blir lätt så att man tror att man måste ha ett lösenord som är otroligt svårt att komma ihåg, för att vara säker.

Det är ju dock så att det inte är människor som sitter och gissar lösenord vid en attack, utan det är ett datorprogram. Och datorprogram har inte så lätt att gissa flera ord efter varandra, även fast det för oss människor är lätt att komma ihåg ett sådant lösenord. Till exempel är lösenordet "this is fun" säkrare än "J4fS>2". Och vilket är lättare att komma ihåg?

Does that mean that the IT-departments and security companies is right? Nope, it just means that a 6 character password isn't going to work. None can remember a password like "J4fS<2", which evidently mean that it will be written on a post-it note.



Läs mer: The Usability of Passwords (by @baekdal) #tips


Useful links for GSE (Google Search Engine)

published Apr 13, 2011 10:28   by admin ( last modified Apr 13, 2011 10:28 )

I am putting in a Google Search Engine into a customer's Plone site right now. Here are some links to the most interesting documentation I have found so far:

Class Reference - Google Web Search API - Google Code

Re: How to use "cursor.estimatedResultCount" and how to display the results? - jgeerdes [AJAX APIs "Guru"] - com.googlegroups.google-ajax-search-api - MarkMail

Display search results on a separate page: Two page search

 

Debugging javascript with Firebug: FireBug's Console For Debugging Javascript Data (Thanks Ray Camden)

 

 


Altec Lansing Expressionists with trousers for transport?

published Apr 11, 2011 12:48   by admin ( last modified Apr 11, 2011 12:48 )

The Expressionist™ Bass– FX3022 computer speakers would benefit from trousers in transport, to protect the bass elements. The trousers could well stay on, as long as they are made of a cloth with little audio interference.

 

I have just come into possession of a couple of Expressionist™ Bass– FX3022 computer speakers. One task for them, besides being computer speakers, will be to be part of a mini dance PA system - just a small Sansa Clip MP3 player and the speakers, that you can bring with you to the improvised dance hall. However I noticed that the demo speakers in the store had bass elements that had been dented. There is nothing to protect them in transport, if you say throw them in a bag with other stuff.

So I have been trying to come up with a way of protecting the bass elements.

However the obvious solutions, a grille or a piece of foam does not seem to fit easily to the bottom of the speakers. So, why not wrap them in cloth?

And here is where the conical shape of the speakers starts to work with the solution: By wrapping the bottom part of the speaker enclosures in cloth, you can easily fixate it with a "waist belt" around the cone shaped body. The cone tapers upwards, so any tightening of the belt would just make the fit of the cloth along the bottom tighter. This should be enough to protect them in transport. And it would look like your speakers were wearing trousers!

So someone needs to make them.

 

Expressionist™ Bass– FX3022



Läs mer: Expressionist™ Bass– FX3022 - Computer Speakers at Altec Lansing


Cuban clave in different music and a BBC report (link)

published Apr 10, 2011 03:26   by admin ( last modified Apr 10, 2011 03:26 )

Playing Daap shares on Ubuntu Linux

published Mar 31, 2011 01:35   by admin ( last modified Mar 31, 2011 01:35 )

For the last month or so, Rhythmbox and Banshee have refused to play the music from my Daap shares (running the Firefly Daap server, a.k.a. mt-daapd), eventhough I can see and browse the shares.

Banshee works some of the time. I have now resorted to install Songbird under Wine, and it works fine. My guess is that something in the shared components between Rhythmbox and Banshee has been upgraded in a way that causes timeouts.

After a couple of hours of testing, here is what I have found so far:

There is a slight hickup in playback of each song, about 1.5 seconds into the song. Songbird locks up occasionally, seems to be related to accessing large Daap shares. Otherwise plain sailing.

Here is how to install Songbird on Ubuntu 10.10.

Install Wine if you haven't already.

Go to getsongbird.com and download Songbird for Windows.

Selection_033.png

Start it with Windows program loader.

Selection_034.png

Selection_036.png

I chose to import nothing since this is on Wine and all my music is on Daap anyay

Selection_037.png

I chose to disable a lot of features that I do not need since there is always a risk that that particular feature will not be Wine compatible. Only the ones checked above were installed.

Selection_035.png

Songbird has a built in web browser where you can search for plugins.

Selection_038.png

Search for daap and download the more recent plugin.

Selection_039.png

Selection_040.png

Restart Songbird and it should find your shares. In my case one of the computers needed a reboot before Songbird found all of the Daap shares on all computers.


Saving high quality video from the LiVES video editor

published Mar 28, 2011 07:52   by admin ( last modified Mar 28, 2011 07:52 )

On Ubuntu 10.10 Linux, the setting I have found that can save (encode) a clip from LiVES 1.3.2 without blatant degradation of the video quality is to select mencoder as the encoder (install it via synaptic, aptitude or apt-get if it is not installed) and then select the "FFV1 (lossless)" option, subsequently displayed in the list as "ffv1".


A Linux virtual machine for Internet Connection sharing

published Mar 23, 2011 03:29   by admin ( last modified Mar 23, 2011 03:29 )

Usage scenario

This setup is targeted to improvised setups where you need to share out a wireless or mobile connection on your laptop, to a number of computers on a wired network. Instead of using any built in ICS (Internet Connection Sharing) in your laptop's OS, with this solution you start a virtual machine ("device") that takes care of it all. In this way the ICS services are insulated from your laptop, and no changes to the routing on your laptop is needed.

I have only made initial tests with the setup, using two laptops, both running Ubuntu Linux 10.10, and pulling down the Internet over Wi-Fi and putting the local computer on a wired connection from the other latop.

How it works

A small (256 MB RAM) pre-configured Ubuntu Linux is running as a virtual machine under Virtualbox on your laptop. The virtual machine takes care of the Internet Connection Sharing, dishing out IP numbers and handling DNS for any number of computers connected via the wired network and routing their traffic on to the Internet.

In Virtualbox you can easily change the interface on your laptop used for the local connection. The Internet connection is handled automatically.

Your laptop is connected to the Internet via a mobile connection or a wireless connection.

Step by step guide:

  • Install Virtualbox
  • Download an iso image for the server version of Ubuntu 10.4LTS
  • In Virtualbox, make a virtual machine ("machine") with two network interfaces, the first one as NAT, the second one as bridged. Make the second interface link to your local interface on your computer where the local computer should be connected (typically your wired network interface, usually eth0). The NAT connection will automatically connect to whatever Internet connection you have on the laptop.
  • Start the machine
  • Choose "Devices->CD/DVD devices->Choose a virtual CD/DVD disk file...", and navigate to your downloaded ISO.
  • Reset the virtual machine. It will now boot from the ISO
  • Run through the Ubuntu installation, install as little as possible, possibly the SSH server (which I needed due to particular circumstances). The minimum size of a Ubuntu server install is in the order of 600MB (see info on this here).
  • Choose "Devices->CD/DVD devices->Remove virtual drive" in the VirtualBox guest window
  • Restart the machine
  • Login, run "dmesg|grep eth0" and "dmesg|grep eth1" to check that the OS hasn't moved them to new names (e.g. eth2 and eth3)
  • Follow the instructions here Ubuntu Internet Gateway Method (iptables), changing eth0 and eth1 if needed.
  • Set up the interfaces in /etc/network/interfaces, in my case using eth2 and eth3, in your case possibly eth0 and eth1:
    auto eth2
    iface eth2 inet dhcp

    auto eth3
    iface eth3 inet static
        address 192.168.0.1
        netmask 255.255.255.0
  • Restart the networking:
    sudo /etc/init.d/networking restart
  • Install dnsmasq, also according to that page: DHCP/DNS server
  • Make sure your host computer has an Internet Connection
  • Plug another computer in to your local interface so it becomes a client
  • Configure the client computer for DHCP

Now it should all work, check that the client computer can connect to the Internet.

You can now install a switch instead of the client computer and then hang as many client computers as you want off that switch (as many as the configured range of dnsmasq allows, 250 according to the example on the instructions page above). 

Trying other operating systems and solutions

I first tried Internet Connection Sharing Appliance | Virtual Appliance Marketplace , but could not get it to run the way I wanted. It is also a bit old, from 2006.

I then tried puppy Linux 2.2.0 from here. I could not figure out how to install a dhcp server and I realised I did not want to learn another package system. However ICS was very straight forward since it is a part of the Puppy firewall wizard.

I then tried Debian, but installations failed due to not being able to partition the disk, due to corrupt packages, not finding the kernel and not being able to install the bootloader respectively. All or some of these may have been due to overconservative parameters for disk size.

I then tried m0n0wall, but realised it was not open source, then tried Zeroshell but that one did not have a wizard for ICS so in the end I went with the for me more familiar Ubuntu instead.


Purging an Openoffice document from ghost styles

published Mar 14, 2011 08:48   by admin ( last modified Mar 14, 2011 08:48 )

 

Summary: Save in .fodt format and search and replace the style name, using your favorite text editor or text processing utility

So, tomorrow it is time to give a course again, and when it was time to print out the 100 page + documentation today, it turns out that the Openoffice installed on my Ubuntu 10.10 cannot properly read the Opeoffice document I have previously edited on a slightly older Ubuntu.

Most text paragraphs simply had the format "Textformatvorlage", which besides sticking out as German in my English environment, is nowhere to be found in the styles palette or in the search and replace dialog. So now I have hundreds of paragraphs I will need to reformat by hand. Preferrably in under ten minutes.

The solution turned out to be to save the document in a pure text format (.odt was binary on my machine) and then search for "Textformatvorlage" and replace it with another style name, "Text_20_body" in my case, throughout the document. The format I saved the document in is ".fodt" .


Using pykeylogger for other things than keylogging

published Feb 25, 2011 12:48   by admin ( last modified Feb 25, 2011 12:48 )

I have recently come up with two ideas that would need the computer to check what is done on the computer and take some action. One use case is to log what I am working on and for how long, without actually logging exactly what I am doing. The other use case is to control the volume of the computer's sound output with the scroll wheel of a mouse. This should be done on Linux.

In both use cases I would need to globally monitor what goes on with the UI on the computer. I have tried out pykeylogger and I am confident that it would work as a work logger, and I wonder if it also in an even more pared down form could be used for monitoring scroll wheel events, and from that data adjust the sound volume.


It is primarily designed for personal backup purposes, rather than stealth keylogging. Thus, it does not make explicit attempts to hide its presence from the operating system or the user. That said, the only way it is visible is that the process name shows up in the task list, so it is not immediately apparent that there is a keylogger on the system.


Läs mer: SourceForge.net: pykeylogger


Länk - Neural networks for extracting useful text from HTML

published Feb 10, 2011 01:04   by admin ( last modified Feb 10, 2011 01:04 )

 

You’ve finally got your hands on the diverse collection of HTML documents you needed. But the content you’re interested in is hidden amidst adverts, layout tables or formatting markup, and other various links. Even worse, there’s visible text in the menus, headers and footers that you want to filter out. If you don’t want to write a complex scraping program for each type of HTML file, there is a solution.



Läs mer: The Easy Way to Extract Useful Text from Arbitrary HTML - AI Depot


Cheaper virtual hosting

published Jan 23, 2011 05:39   by admin ( last modified Jan 23, 2011 05:39 )

For some hobby projects I have been looking for cheaper virual hosting: I have not tested these two, but I just make a note here of them for future reference:


Virpus | Unmanaged VPS, Cheap VPS, VPS Hosting, Cloud Hosting, Cheapest VPS, Virtual Private Server Hosting, VPS Hosts

 

 x10VPS - Features & Information


Länk - Robotshop - när man vill hacka den fysiska världen

published Jan 21, 2011 03:05   by admin ( last modified Jan 21, 2011 03:05 )

Har inte använt dem, men lägger den här som bokmärke. Verkar ha robotar, servos, arduinos och annat.

RobotShop, the World's Leading Robot Store for Personal and Professional Robot Technology. Here you will find personal robots, professional robots, robot toys, robot kits and robot parts for building your own robots. If you are looking for robot pet care, robot floor cleaners, robot vacuums, robot pool cleaners or robot mowers, to do your household chores, this is the site for you. We also bring robots back to life™ via our Robot Repair Center.



Läs mer: RobotShop | Robot Store | Robots | Robot Parts | Robot Kits | Robot Toys


Många vetenskapliga studier inte så vetenskapliga

published Jan 19, 2011 11:51   by admin ( last modified Jan 19, 2011 11:51 )

Ett allt mer uppmärksammat fenomen är att det blir svårare att replikera resultat som utförts i tidigare vetenskapliga studier. Detta gäller bl a inom psykologi och medicin. En rimlig förklaring till detta är att de inte inte var så vetenskapliga till att börja med. Det borde t ex kunna bero på att:

  • Man subjektivt felbedömt uppmätta data
  • Att man bestämt vad som är signifikant (mindre än 5% sannolikhet att det är slumpen) efter studien har börjat, t ex att man letat efter hårlängds korrelation med födelsevikt, men istället "upptäcker" ett samband mellan hårlängd och längd vid födseln, dvs man shoppar runt bland variabler tills man hittar de som slumpmässigt är signifikanta. Signifikanskriteriet kan ju nämligen bara gälla om man satt vad det är man letar efter i förväg (a priori)
  • Att man upprepar med olika experiment tills man når en signifikans


En diskussion om den svinnande signifikansen vid upprepade experiment finns i The New Yorker:

This suggests that the decline effect is actually a decline of illusion. While Karl Popper imagined falsification occurring with a single, definitive experiment—Galileo refuted Aristotelian mechanics in an afternoon—the process turns out to be much messier than that. Many scientific theories continue to be considered true even after failing numerous experimental tests. Verbal overshadowing might exhibit the decline effect, but it remains extensively relied upon within the field. The same holds for any number of phenomena, from the disappearing benefits of second-generation antipsychotics to the weak coupling ratio exhibited by decaying neutrons, which appears to have fallen by more than ten standard deviations between 1969 and 2001.

Läs mer: The decline effect and the scientific method : The New Yorker

Det finns ju också en möjlighet att världen tröttnar på signifikansen och justerar sig, men det är vad man skulle kalla ett "Extraordinary claim"


Getting keyring-less wireless network connection on Ubuntu

published Jan 11, 2011 02:43   by admin ( last modified Jan 11, 2011 02:43 )

Make wireless network available to all users.

This had been a minor annoyance since a re-install of 9.04. I had never noticed that little "available to all users" checkbox before.



Läs mer: Howto: Get Network Manager to stop asking you for your keyring password (pam_keyring) - Page 14 - Ubuntu Forums


Porsche 918 - kan man be om en reklamfinansierad?

published Jan 10, 2011 07:49   by admin ( last modified Jan 10, 2011 07:49 )

Det är märkligt hur vissa bildesigner bara känns "rätt". Porsches nya 918 är en sådan. Det är en s k retrodesign; jag tänker direkt på tävlingsbilar från början av 70-talet såsom Porsche 917. Jag hittade ingen bild med bra licens för kupéversionen RSR så här är en bild på cabben, Spyder:

Porsche 918 Spyder. Källa: BeverlyHillsPorsche

Vad gäller den andra versionen - RSR, så förevisas den med en massa reklamklistermärken, kanske återigen för att frammana tidig 70-talsracing. Så jag har härmed ett förslag till Porsche: Kan man tänka sig att man om man bara har tillräckligt mycket reklamdekaler på bilen, så skulle man kunna få ett exemplar gratis? Jag lovar att köra försiktigt men inte mjäkigt, och inte ta bort några dekaler.

Porsche 917C, vinnare av Le Mans 1970. Bilden är Public domain.

 

Läs mer: Porsche løfter sløret for ny ekstrem sportsvogn - Politiken.dk
Läs mer: Nytt ljus på bilmässan i Detroit - DN.SE

Porsche, som slopade Detroit för fyra år sedan, är nu tillbaka och visade upp en racebil i hybridversion – Porsche 918 RSR hybrid.

Läs mer: Detroit – försiktigt positivt | Näringslivsnyheter | SvD

 

 


Moving specific files with find, perl and xargs

published Jan 09, 2011 02:33   by admin ( last modified Jan 09, 2011 02:33 )

Summary:

find -print0|perl -n0 -e 'print if m/\(\d+\)/'| xargs -0 -I xxx mv xxx copies/

I needed to find all files that had a parenthesized number in them, such as  "filename(3).txt", and move them to a copies folder.

It is a good idea to use -print0 to cater for complex filenames on the find side, and in perl you tell perl to go into null terminated mode with the "-0" switch as seen above.

If you then pipe it further to xargs, you use the "-0" switch to tell xargs that the file names are null terminated. xargs will assume you want the file names as the last part of the command given to xargs, but for mv you do not want this, since the last part of the command should be the destination folder. The -I switch allows you to specify a placeholder identifier for the input to xargs. Above I have chosen "xxx" for this. Hence in "mv xxx copies/", xxx is replaced with the file name.


When typing "d" mimimizes all your windows with a remote desktop

published Dec 31, 2010 05:51   by admin ( last modified Dec 31, 2010 05:51 )

Of all strange things that happens to a user in Linuxland, having all windows mimize whenever you type the letter "d" while in a VNC session, has been one of the strangest.

A surprising number of Linux commands and programs, python code and Swedish and English words contain the letter "d", so the situation quickly gets untenable.

It turns out that on Ubuntu 10.10 the keyboard shortcut for mimimizing all windows is spuriously set to "d" plainly and simply, when accessing the desktop over VNC. A theory is that this happens because a key that normally is used in combination with d (meta) to mimimize the windows, is not found over VNC and the desktop simply sets the shortcut to "d".

The remedy is to rebind the minimize all windows action to another key combination in System->Preferences->Keyboard Shortcuts .

I chose Windows + m.

See: Comment #3 : Bug #655886 : Bugs : “tsclient” package : Ubuntu

 

 


What does (yield) do in python?

published Dec 21, 2010 07:14   by admin ( last modified Dec 21, 2010 07:14 )

I browsed through the documentation for the Python package m4us and found a "simple example". In it, there are yield statements.

@coroutine(lazy=False)
def lines_producer(file_):
"""Emit lines from a file as messages."""
inbox, message = (yield)
for line in file_:
if is_shutdown(inbox, message):
yield 'signal', message
break
inbox, message = (yield 'outbox', line)
(yield 'signal', ProducerFinished())

Ok got that, kind of. Yield is followed by some arguments that it, well yields. But in the code I found this:

inbox, message = (yield)

Uhm, what is that? It yields something into the method we are in. That's like the other way around. But from where?

I've made a test script sheds some light:

def a_generator():
message = yield('return value of first yield')
message2 = yield(message)
message3 = yield(message2)

g = a_generator()
print "first send:", g.send(None)
print "second send:", g.send('Second send')
print "third send:", g.send('third send')

First, a function is defined. It has the name "a_generator", but it could be anything. However the fact that it contains at least one yield statement means that python will treat the function as a generator.

Now, on the first send, the method is executed until it reaches the first yield. That yield then returns to the caller, in this case with the string "return value of first yield". But it is only half the yield that is executed by the first send! For the next send, the execution is resumed in such a way that the first yield is the input point for the argument of the second send. The string "Second send" is assigned to the variable "message" on the second send.

So the first send used the first yield to get something back. But there is more life left in that yield: That yield's ability to inject something into the method has not been used up yet, the second send will do that. The python documentation on yield talks about suspending and resuming execution, I did not at first realize that it suspends and resumes right in the the middle of the yield word, so to speak.

Since the first yield returns, the first call to send or next can feel a bit futile, if you intend to send stuff into generator. Your first send cannnot contain any useful parameters. One way of dealing with this is to wrap the function inside a decorator that takes care of calling next or send the first time. See David Beazley's script here.

Reading further on Beazley's site it turns out he has made an excellent presentation on the topic. It turns out that the usage of yield with send is not used so much with generators but rather with something called coroutines, and my guess is that the code at the top of this blog posting is coroutine-oriented, so my use of the term generator in this post may be a bit out of place.