How to change sar output time format to 24 (solution)

June 6th, 2011 No comments

I always forget how to change this and Google is not giving the right answer anywhere among top results, so here just for my record:
# Put into your .bashrc
export LC_TIME="POSIX"

# Or use just when needed

sar is a command from systat package. It provides output in AM/PM format by default. Setting the locale LC_TIME to POSIX changes the time format to 24.

Categories: Missing Answers Tags:

Show Site IP of the currently loaded web page in Firefox

May 6th, 2011 2 comments

I play quite often with /etc/hosts file (well I’m on window so I use C:\WINDOWS\system32\drivers\etc\hosts), or I even switch DNS to our development server using following Windows command (make sure your network connection is called LAN):
# Switch to development DNS
netsh interface ip set dns "LAN" static primary
ipconfig /flushdns

# Switch back to DHCP
netsh interface ip set dns "LAN" source=dhcp
ipconfig /flushdns

All this is done to work with the real domain names already during development – no worry, we do some things by changing the top level domain to .dev, but I simply need both.

Now I need a tool which tells me quickly whether I’m in prod or dev. I was using ShowIP Firefox Extension , but it somehow behaved incorrectly for me – mainly looked like some caching problems.

So I decided to write my own extension which would be dead simple and would simply show me the current IP address of the domain loaded in the current tab. So I wrote it using Mozilla Add-on Builder. It took me less time than to write this post (ok, I have spent 2 years developing AllPeers and some months as Mozilla contractor on Firefox 3).

After installing the AlertIP Extension customize your toolbar and add the star icon (the default icon for extensions) to your toolbar.

Categories: Tools Tags:

Enabling Integration Features for IE Application Compatibility VPC Images on Windows 7

February 17th, 2011 No comments

We use Microsoft Internet Explorer Application Compatibility VPC Image to test compatibility with IE6, IE7 and IE8. Recently we have moved to Windows 7 and the last update of perpetually expiring images (created last time on January 18, 2011) raised some issues which made enabling of Integration Features quite difficult (BTW, the images have changed filenames, IE User does not have password stated in the IE_VPC_ReadMe.txt).

Missing drivers

When enabling the features, the installation requested usbhub.sys and usbd.sys. The first file was recommended by MS to be taken from the Windows XP SP3. I have downloaded the SP3 and extracted the file using 7zip:

7za x WindowsXP-KB936929-SP3-x86-ENU.exe i386\usb*.*

But the installation requested another file – usbd.sys, which is not part of the XP SP3 – so I have copied the file from my Windows 7 (C:\Windows\System32\drivers\usbd.sys).

Password prompt

With enabled integration features the VPC asks for password. As it turned out, it tries to do remote desktop connection to itself. It suggests Admin user but Password1 does not work – apparently the Admin account is missing completely. IE User does not work either, because this user does not have password and cannot make remote desktop connection to this PC. So the solution is to give IE User a password and to save the credentials during start up (you may need to delete credentials of the Admin user before using properties on the .VMC files.

This way I have solved all the problems I did not have when running the Compatibility images on Windows Vista with earlier images.

Categories: Missing Answers Tags:

Odstranění klávesnice Spojené státy – mezinárodní ve Windows 7

November 29th, 2010 2 comments

Přepínám mezi českou a anglickou klávesnicí, ve Windows 7 je ale super vychytávka při psaní s defaultní anglickou klávesnicí – Spojené státy (mezinárodní), kdy uvozovky a jiné podobné znaky slouží ke psaní znaků s diakritikou. Řešení je změnit klávesnici na Angličtina (Spojené státy). Nicméně to mi pouze přidá další rozložení pro psaní Anglickým jazykem. Mezi těmito rozloženími mě Windows přepínají natolik náhodně, že jsem to dodnes nepochopil.

Zatím jediný způsob jak se toho nadobro zbavit pro mě byl zásah v registrech – smazal jsem rozložení z registrů:

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layouts\00020409]
“Layout Text”=”United States-International”
“Layout Display Name”=”@%SystemRoot%\\system32\\input.dll,-5026”
“Layout File”=”KBDUSX.DLL”
“Layout Id”=”0001”

Categories: Czech, Missing Answers Tags:

Disable user authentication for subdirectory when using RewriteRule on Apache server

August 30th, 2010 No comments

If you protect your private beta release from public with AuthType and you are using RewriteRule from mod_rewrite, you will soon find, that combination of <Location> and  Satisfy does not work for you – it does not allow access to the subdirectory as expected.

<VirtualHost *:80>
 DocumentRoot /var/www/example

 <Location />
 AuthType basic
 AuthName "Top Secret Beta!"
 AuthUserFile /etc/httpd/htpasswd.beta
 Require valid-user

 <Location /upload-callback>
 Allow from all
 Satisfy Any

 <Directory /var/www/example>
 RewriteEngine On
 RewriteCond %{REQUEST_FILENAME} !-f
 RewriteCond %{REQUEST_FILENAME} !-d
 RewriteRule !\.(swf|pdf|php|js|ico|txt|gif|jpg|png|css|rar|zip|tar\.gz)$ /index.php [L]

With this setup, the subdirectory will require valid user – because mod_rewrite is applied before <Location> and changes the URL, which no longer matches. You can change this by adding an alias:

Alias /upload-callback /var/www/example/index.php

Now all URLs will go through your nice url generator index.php, but the specified URL will be checked against <Location> and give access based on the Allow directive (in this case to everyone).

Categories: Missing Answers Tags:

Parameter order matters for cvs update – lesson learned on Bugzilla

August 25th, 2010 No comments

It looked like a straightforward job – upgrade my heavily customized Bugzilla from 3.6.1 to security fix 3.6.2.  I know I just need to run cvs up to get my files updated to the latest Bugzilla_Stable branch and resolve conflicts. But wait we want to get new files and prune empty directories, so I typed cvs up -Dp. No warnings, ok, go ahead run ./checkconfig go to Bugzilla – oops too many changes – version 4.1 is up. Ok, downgrade and next time use cvs up -Pd, if I have typed cvs up -pD I would finished with a warning about missing date. But cvs up -Dp was understood as -D with value p, that got actually ignored.

Downgrading took quite a couple of hours – Bugzilla caches complete database structure in bz_schema, which is not recommended to be touched – but this time the problem was change of type in table fielddefs for some columns like classification and component.

Debugging seemed quite a lot like the movie Inception – on each deeper level you spent more time and you understand less.

Categories: Uncategorized Tags:

Drupal 5 and strange behavior of jQuery

June 28th, 2010 No comments

We have some jQuery code, that we use on all our company sites, however, this code did not work on Drupal sites. jQuery call to position() was returning “static” instead of expected object with top and left properties. We thought we should use newer jQuery (instead of 1.2.6), but this throwed “too much recursion” error in Firebug – which we tried to solve with patch from bug . However, neither upgrade nor that patch really helped. The reason why position() did not work was hidden here: /sites/all/modules/jquery_update/compat.js (I was looking at linked files and this one sounded suspiciously).

And indeed, these helpers caused the problem:

// UPGRADE: The following css helpers should now be used as:
// .css("top") or .css("top","30px")
jQuery.each("top,left,position,float,overflow,color,background".split(","), function(i,n){
  jQuery.fn[ n ] = function(h) {
    return h == undefined ?
      ( this.length ? jQuery.css( this[0], n ) : null ) :
      this.css( n, h );

We have replaced position with xposition and our jQuery works as expected even with version 1.2.6.

Categories: Missing Answers Tags:

GTD: Toodledo iPhone application

October 27th, 2009 No comments

So I switched from Google Tasks to Toodledo to see what is all this Get Things Done about.

Some hints about GTD:

  • Context is just a funny name for tag, that allows GTD to become a business model.
  • Folder is just a funny name for tag, that allows GTD to become a business model.

Now some words about Toodledo web application:

[-] It does not look nice, it is slow to edit.
[-] I have not found any group operations (like renaming a tag, changing a folder).
[+] It can import from simple text file, line by line.

Some words about the Toodledo Firefox Extension

[+] It looks good and is quite fast.
[-] In order to edit a task you need two clicks.
[-] Does not allow Due by, Due on, Due after, Optionally due specification.
[-] The standalone popup form for adding tasks looks as if it were completely different application.
[-] Due Date does not offer Today as default. You have to select date manually.

And finally the paid iPhone application (native one):

[-] You cannot apply context filter when you are filtering by something else.
[-] You cannot associate a phone call or anything with a contact from your contact list.

And hints about general features:

[-] Task with set Due Date and Due Time will be shown as overdue only on Day+1.
[-] The default reminder 1 hours before task is due is a strange limitation of the free version. The paid one allows 15 minutes to 14 days. But I want to be notified just at a time (phone calls for instance).
[-] Tags are not clickable when you want to add them, you have to type them – so the chance, that you mistype is high.
[-] The notes stored with task strip line breaks.

But so far it is still better than primitive Google Tasks.

Categories: Uncategorized Tags:

ViewVC modified rights of the subversion repository

October 25th, 2009 No comments

From various reasons I ended up with some sophisticated rights settings for my subversion repository, the main idea is to grant access based on group. So I need that the files are created with proper group and with write right on the group.

For the command line ans svn+ssh access I created following files (based on some advice, which I found 4 years ago and did not notice a link):


umask 002
/usr/bin/svn.orig "$@"


umask 002
/usr/bin/svnserve.orig “$@”

As big surprise you will find that the web interface modifies files in the subversion repository – it removes write permission on group. I have solved this by adding following line to viewvc.cgi:

--- viewvc.cgi.orig     2009-10-25 09:55:34.738716284 +0100
+++ viewvc.cgi  2009-10-25 09:51:14.914726062 +0100
@@ -58,4 +58,5 @@

 server = sapi.CgiServer()
 cfg = viewvc.load_config(CONF_PATHNAME, server)
 viewvc.main(server, cfg)
Categories: Missing Answers Tags:

Plesk 9 – disable postfix local mail delivery for webhosting

October 25th, 2009 No comments

The scenario is – you provide only webhosting for certain domain – and you want emails to go wherever MX record points to. So you turn off mail services in the Plesk control panel, but keep receiving mails back with This address no longer accepts mail. when you send emails via your server.

You can check that there is no local delivery for this domain:

postmap -s /var/spool/postfix/plesk/virtual_domains

But the trick is that you have to set emails to this address to be rejected instead of bounced (what seems to be the default). My guess is that the bounce check comes before the local delivery check.

Categories: Missing Answers Tags: