About jontas

I like to make things that people find useful.

Turning off VoddlerNet autostart in windows

VoddlerNet is a part of Voddler, it is used to distribute content via peer-to-peer technology in order to offload the company’s servers.
However this means that it takes up bandwidth from the users (and also makes ping drop if you play on-line games).

  1. In run (windows button+r) enter “services.msc” (or you can open Services via the control panel if you like to)
  2. Find VoddlerNet in the list of Services, choose properties and now change startup type to “Manual”

This changes the settings so that VoddlerNet don’t start automatically with windows, instead you have to start it manually (right click the VoddlerNet icon and choose start) before you start using voddler.

Magento: Invalid transactional email code: x

If you start seeing this error (both when trying to order) and as emails to the sales address then the error is most likely that someone has deleted the template with id x but that is still set to be used in the database.

The solution for this is to update “System-Configuration-Sales Emails” in admin and save existing templates instead of the template that is now removed.

Note: Also it might be good to consider why this happened, is there some (real) problem or was the template file(s) updated and some old database template was removed [perhaps there is an educational need].

What program is using port x?

netstat can be used to figure out what program is using a port.

$ netstat -nlp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      1096/sshd
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      1733/apache2
tcp6       0      0 :::22                   :::*                    LISTEN      1096/sshd
Active UNIX domain sockets (only servers)
Proto RefCnt Flags       Type       State         I-Node   PID/Program name    Path
unix  2      [ ACC ]     STREAM     LISTENING     6338     1071/gdm-simple-sla @/tmp/gdm-greeter-LvjLQPzT
unix  2      [ ACC ]     STREAM     LISTENING     5165     1072/X              /tmp/.X11-unix/X0

If you have a lot open then grep can be used to only find what you are looking for

netstat -nlp|grep :22
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      1096/sshd
tcp6       0      0 :::22                   :::*                    LISTEN      1096/sshd

For windows, simply start with

netstat -n

Showing (and/or) Clearing the arp cache

The arp cache should (normally) be cleared within 20 minutes (or less, this depends on what platform is used).

If you don’t know what ARP is and what is is good for, then perhaps you should take a moment and read the man page:

DESCRIPTION
Arp manipulates or displays the kernels IPv4 network neighbor cache. It can add entries to the table, delete one or display the current content.
 
ARP stands for Address Resolution Protocol, which is used to find the media access control address of a network neighbor for a given IPv4 Address.

On a windows platform to show the arp cache

C:\> arp -a
Interface: 192.168.1.49 --- 0xb
  Internet Address      Physical Address      Type
  192.168.1.29          00-1d-92-08-49-25     dynamic
  192.168.1.34          00-24-81-85-ab-b6     dynamic

To clear the cache

C:\>netsh interface ip delete arpcache
Ok.

To show the arp cache on a nix machine:

$  arp -vn; cat /proc/net/arp
Address                  HWtype  HWaddress           Flags Mask            Iface
192.168.1.254            ether   00:08:ae:09:20:a0   C                     eth0
IP address       HW type     Flags       HW address            Mask     Device
192.168.1.254    0x1         0x2         00:08:ae:09:20:a0     *        eth0

To clear the apr cache on a nix machine.

$  ip neigh flush all

apt-get update gives the error “E: Could not get lock /var/lib/apt/lists/lock – open (11: Resource temporarily unavailable)”

If running apt-get (or aptitude) and you get the following error:

$ apt-get update
E: Could not get lock /var/lib/apt/lists/lock - open (11: Resource temporarily unavailable)
E: Unable to lock the list directory

Then (most likely) explenation is that one of the sources have gotten a timeout and that a (cron) sheduled update task have gotten locked.
A simple solution for this is to find the cron process is locked, and kill it.

$ ps -a |grep apt
Warning: bad ps syntax, perhaps a bogus '-'? See http://procps.sf.net/faq.html
 3737 ?        SN     0:00 /bin/sh /etc/cron.daily/apt
 3833 ?        SN     0:00 apt-get -qq -y update -o APT::Update::Auth-Failure::=cp /usr/share/apt/apt-auth-failure.note /var/lib/update-notifier/user.d/
 3835 ?        SN     0:00 /usr/lib/apt/methods/http
 3838 ?        SN     0:00 /usr/lib/apt/methods/http
 3842 ?        SN     0:00 /usr/lib/apt/methods/http
 3869 ?        SN     0:00 /usr/lib/apt/methods/http
 4223 pts/0    R+     0:00 grep apt
$ kill -9 3833

If this happens often, then perhaps you should try to debug the sources and remove (or exchange) the source that is causing the problems.

mysqldump Couldn’t execute references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them (1356)

If you get an error messages like “mysqldump: Couldn’t execute ‘SHOW FIELDS FROM `store_information`’: View ‘database.viewname’ references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them (1356)” then a number of things might be wrong:

  • The view is “corrupted” (this could happen if the table the view is of has been updated in a way so that the view is no longer correct – for instance if the table structure is updated)
  • The user you are using are lacking permissions (to the view/table (that the view is referencing) )

What I usually do when this happens to solve it is to:

  1. Verify if the user running the mysqldump has the permissions (or test as root if you can – as root has more permissions).

    If this is the case: update the permissions on the user running the dump – or change to another user

  2. Try to find out if the table the view is referencing has been updated (think back what have I done/check with the rest of the team)
    Or if you do not wish to/can not do this, check a previous backup up the base table (from when mysqldump worked with the view) and compare the structure with the current structure in the database.
  3. If this is the case: I just drop the view and recreate the view so that it gets corrected in the underlying db structure and re-run the dump.

More info for people using this notebook as a article; here is some manual pages that will help you along if you don’t know how to alter permissions/create views.
More information about user permissions
More information about views

sudo without password

Use visudo to edit /etc/sudoers

user host = NOPASSWD: /bin/kill, /bin/ls, /usr/bin/lprm

user, host and or the list of commands to be run can be swapped with the keyword ALL.
However that is probably not a good idea in most cases.

more info on this is in the manpages sudoers(5)

svnadmin dump vs hotcopy

  • hotcopy makes a direct copy of the repository. It is fast, but it keeps information about the underlying file system etc. The server where the copy is imported needs to be the same version, have the same config etc.
  • dump is version independent. This means that the exported copy can be used by any version of svn.

IMHO: dump is better for backups and long term archiving (outside a repository) [like a tape in a vault].
hotcopy is better suited to make a quick copy to another server when the other server is up and running.

The base information for this post was found in the svn maillist

Ubuntu: Buffer I/O error on device sr0 logical block

Most of the time this error occurs that is a bad disk or a bad drive (or a bad cable).
Ubuntu 8.10 seams (from own experience and google) to be commonly affected by this.

You can try the following (I try them in this order)

  • If you only get buffer errors and no CRC errors, just try and wait (a few minutes) It might still be possible to install
  • Try another installation CD [from the same installation image] – if this works, then the other disk is bad
  • Try to swap out the cable to the drive (if you have a ribbon cable use one with 80 connectors, not one with 40)
  • Try to swap out the drive
  • Try another installation CD [from another installation image, old version, other dist, windows] – if this works then there is an issue with the installation image – there might be an issue worth reporting

If all this fails or you wish to install the version you have, then using a usb stick to install the image might be a good idea.

Magento: Send åäö (and other international characters) to DIBS

If your store uses DIBS to manage payments, then the risk is that you have to worry about characters like åäö.

What we had to do is to make the form post the data as ISO-8859-1.
We did this by adding accept-charset=”iso-8859-1″ to the forms that we send to DIBS.

In “/app/design/frontend/default/blank/template/dibs/standard/redirect_paymentwindow.phtml”

56
<form action="https://payment.architrade.com/paymentweb/start.action" method="post" name="dibs" id="dibs" accept-charset="iso-8859-1">

Once we had done this then the order details were shown correctly on the DIBS page (yes, the Chinese chars are just a test, I have no idea what it might say)
Details on DIBS including åäö