GNO Lab

All about nothing. Don't Panic!

Browsing Posts in Computers

I just bought a Nexus ONE Android device, and thought I should set up the SDK on my Windows 7, Swedish locale. Starting the emulator unscaled gave me a screen way too large, so I tried to start the emulator using the scaled display option. When started, I saw a number of black windows flying by, but no emulator was seen. When investigated what was started, using Process Explorer, I saw the emulator was started using -scale 0,5 (note the comma, not a dot as expected). OK, Eclipse constructs a command line, using some fancy ratio calculation, and the output is formatted according your current language. In my case Swedish where the fraction separator happens to be a comma.

Setting up Eclipse to run with an English locale solves the issue.  I added -nl en_US to the shortcut starting my Eclipse. Solved!

Do you have a lot of downloaded material, coming from bittorrent downloads, or from a FTP-session, where the content is encapsulated in big multi-volume archives like RAR and ZIP files (a.k.a. scene releases). Unpacking those archives can take a lot of manual effort before the actual content can be consumed.

This Python script tries to ease the burden of processing this kind of material, by investigating the directory and categorize its files as one of

  • archive, i.e. the files belongs to an archive, for example file.rar and file.001, etc. The archive also has a base file, that is, the first file in the archive, usually the file having the extension .rar in case of RAR-archives.
  • file, the file is an ordinary file, for example any *.nfo , and *.jpg file.
  • ignored, extra files, not needed for consumption, like those hash files (*.diz, etc.) used only to verify the downloaded content, and also sample, i.e a path matching *sample*.

The tool automatically unpacks the archives, and copies the files, to a given destination (or the current directory if you so like). Further, the destination directory can be derived  by removing a incoming base from the folder examined. The part left is appended to the destination given (or the current directory). Using this feature you can mimic  your content structure  within your download structure, without needing to create folders before moving the downloaded content into its final destination – all is taken care of within  btpostprocess.

Examples:

$ btpostprocess --process --incoming-base=/downloads/ready/pictures \
--base-path=/downloads/ready/pictures/cats \
/torrents/cats.torrent MyPictures

Finds archives and files in /downloads/ready/pictures/cats and a sub-folder indicated by the cats.torrent (or directly under /downloads/ready/pictures/cats) and unpack archives and copy files
into a cats sub-folder under MyPictures. The incoming-base is
used to construct a derived sub-folder under the destination folder.

Integration

The script was made with rtorrent in mind. By using  rtorrent’s  on finished capabilities the post processing can be set up using something like (version 0.8.2):

on_finished = process,"execute=btpostprocess,--incoming-base,/srv/incoming,--base-path,$d.get_base_path=,$d.get_tied_to_file=,/srv/depot"

Indicating downloads are to be found under /srv/incoming, and a folder given by the tied torrent file. Any files downloaded are unpacked (in case of archives) and copied into a sub-folder of /srv/depot.

In case you need to run some logic before spawning btpostprocess, for example, deciding if the download path is outside the normal download path, and in that case skip the post processing, all you need is to wrap the btprocess in a more specific on_finished script.

It’s all about automationDOWNLOAD

MS SQL Server

Exportera data

C:> bcp [<databas>].<dbo>.<tabell> out "out.dat" -c -U<anv.namn> -S<server_ip> -P<passord>

Importera data

Först måste tabellen trunkeras (DELETE FROM <tabell>. Sen importerar vi med

C:> bcp [<databas>].<dbo>.<tabell> in "out.dat" -c -U <anv.namn> -S<databas_target> -P<passord>

Jämför (kopiera) data från två olika databaser

Använd Micrsoft Access (funkar faktiskt ;) ) och dess möjligheter att länka tabeller; File -> Get External Data -> Link Tables. Länka in tabellerna i databas A samt de i databas B (innehållande samma tabeller). Ställ dem sida vid sida… Gör ett en Accessapplikation eller det du anser bäst….

Och just ja.. skapa först ODBC-datakällor och från dialogen Link Tables väljer du att öppna ODBC-källor.

(Använde detta för att kolla skillnaderna mellan EPiServer i utveckling och produktion)


cvs log file | sed -n '/^symbolic names:/,/^keyword/ {
/^symbolic names:/d
/^keyword/d
p
}'

A simple script to remove empty directories in a checked out subversion repository:

#!/usr/bin/bash

find . -depth -type d -name .svn | while read d; do
d=$(dirname "$d")
echo >&2 ">>>> $d <<<<"
if [ 1 -eq $(ls -A "$d" | wc -l) ]; then
echo >&2 "Removing..."
svn remove --force "$d"
fi
done
svn status
  • Validate email address:
    ^([\\p{Alnum}_%\\+-]+\\.?)+\\@([\\p{Alnum}-]+\\.)+[\\p{Alpha}]{2,4}$

Had some problems with my DFS setup, not making it possible for my Windows XP machine to utilize the DFS share on my local machine. Som googling and the answer:

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Mup\Parameters]
"EnableDfsLoopbackTargets"=dword:00000001

My old computer had problem decoding HD-material. I could decode 720, but 1080 was not fun. One day I decided to upgrade my existing system, so here it is:

  • GA-MA770-UD3 (rev. 1.0)
    I wanted a simple, relatively new, single PCI-e 16x slot, and supporting optical S/PDIF connection.
  • AMD 9850 Quad Core
    OK performance to decode 1080p material; actually I can without lack of performance deocde at least 7 streams simultaneously.
  • Head sink, NOCTUA NH-U9B.
  • Reuse of my previous ATI 3870 GPU.
  • Power Supply, Corsair PowerSupply (PSU) 550W VX ATX.
  • Resue of my old Antec chassi.

Main operating system is Windows XP. Media Portal as HTPC software. Video output to a Samung A656 LCD panel.  Sound reproduced by H /K 5500.

New GFX Card

1 comment

A HD3780, silent. Heatpipe. Need a new mother board to be able to taka advantage of all its features.

Some year ago I built my own Lirc device, a home brew transceiver, which I attached to my Linux machine in my hall. Using a somewhat long telephone cable I could place the receiver and transmitter in the living room. The cable is somewhat hidden, so I’m kind of pleased with the installation.

With the infrastructure in place it was time to utilize software. I first just used the terminal to easily send IR-codes, via irsend. No automation there! I realized I needed an OK remote to be able to control the whole HTPC environment. By using a remote controller having ordinary navigational operations and also the play and record buttons was enough to control all devices accordingly. This is my setup:

+-------+                   .--------|(
|       |                  /     IR Receiver                   +-------------
|       |RS232            /                                \   |
|       +----------------+                                -- ( | IR Remote
|       |                 \                                /   |
|       |LAN               \     IR Transmitter                +-------------
|       +------.            `--------|)
+-------+       \
Linux Box        \
                  \                                   +---------------------+
                   \                    H/K 5500      | .---------------. o |
                  +--------+          +----------+    | |               | o |
                  |        |TV-out    |  ||||    |    | |               | o |
                  |        +--------->|  - - - O |--->| |               |   |
                  |        |          +----------+    | `---------------´   |
                  +--------+                   |      +---------------------+
                  HTPC Computer                |             Television
                                               |
                                               V
                                           5+1 Audio System
Linux Box

The Linux box is where the LIRC device is attached. This box must be configured to receive and transmit IR signals. With a correct LIRC configuration, see below, this can be accomplished.

HTPC Computer

I usually use Zoom Player for playing media files, because of its nifty full screen file navigator. So my primary target is to control this application

Zoom Player needs to be started when when a certain button on the remote controller is pressed. To achieve this a special agent is used–EventGhost. EventGhost can actually be used to connect to a LIRC server, and controlling Zoom Player, using a downloadable plug-in. Though, I’ve chosen to not use EventGhost as my logic controller. Instead the Linux box will be used as orchestrian, sending commands to desired places, i.e. a push approach, when certain input stimulus (IR signals) is received.

The Television

A Phillips PW3818 acts as video display, recieiving the video signal via S-Video.

H/K 5500

A The AVR Receiver, H/K 5500, on which the volume and surround emulation must be chosen. Sound is delivered to a 5+1 loudspeaker system.

The Remote Controller

A Logitech Harmony 525 is used as my only remote. I added the XBox360 device to the Harmony. This device will act as the HTPC controller. It has functions for playing as well as recording, and also navigation buttons. More than needed. And it won’t interfere with my existing devices, that is, I don’t own a XBox!

LIRC Configuration

The Xbox360 configuration was added to my lircd.conf. The controller was included in the big remotes.tar.gz file. I did have some problom using the the signals sent from the virtual XBox360. It was solved by adding

toggle_bit 22

to lircd.conf and the XBox360 device.

My lirc.conf also includes the configurations for my television and my AVR. With this configuration I should be able to recieive signals as well as react and trigger transmitting of signals.

The solution is quite elegant. A simple bash script is used to send commands to Zoom Player, via its remote interface. This happens via a FIFO and a a netcat process, which is run in the background. In case netcat needs to be started/respawned, it does this automatically. Netcat running as a background process is needed, to let Zoom Player send back responses, on a not closed connection. (If not Zoom Players generates errors.)

Now I only needed to map the XBox commands to call the script with relevant commands, which is done via lircrc, for example:

begin
remote = Microsoft_Xbox360
button = UpArrow
repeat = 2
prog = irexec
config = /usr/local/sbin/zprpc VK_UP
end

(More to come)