<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-3722286367705184557</id><updated>2011-12-21T01:04:57.953+04:00</updated><category term='BASH'/><category term='linux'/><category term='knowledge'/><category term='songs'/><category term='howto'/><category term='red hat'/><category term='locale'/><category term='experience'/><category term='Sabayon'/><category term='Windows'/><category term='GNU'/><category term='Google'/><category term='investigation'/><category term='Web'/><category term='Within Temptation'/><category term='MTG'/><category term='HTTP'/><category term='regex'/><category term='PHP'/><category term='VBA'/><category term='make'/><category term='socket'/><category term='Vim'/><category term='css'/><category term='sql'/><category term='shell'/><category term='unix'/><category term='e-mail'/><category term='HTML'/><category term='favourite'/><category term='debian'/><category term='bat'/><category term='Qt'/><category term='samba'/><category term='video'/><category term='regular expressions'/><category term='network'/><category term='fun'/><category term='cmd'/><category term='JavaScript'/><category term='SVN'/><category term='GMail'/><category term='Magic'/><title type='text'>cat /dev/head &gt; blogger.com</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://darkmind2007.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3722286367705184557/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://darkmind2007.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>D@rkmind</name><uri>http://www.blogger.com/profile/07798238268250031219</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>63</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-3722286367705184557.post-3369378077268374611</id><published>2011-09-30T18:54:00.002+04:00</published><updated>2011-09-30T19:00:06.054+04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='howto'/><category scheme='http://www.blogger.com/atom/ns#' term='BASH'/><title type='text'>BASH: check new line at end of file</title><content type='html'>Sometimes it's useful to check if a file had newline at the end. For example, if there're lots of C source code (compiler shows warning if no newline found) or file is going to be processed by "cat filename | while read;" construction. The last one will not read the bottom line of the file.&lt;br /&gt;&lt;br /&gt;I found several answers in Google, they used "sed" or "tail -n 1", but didn't work me.&lt;br /&gt;&lt;br /&gt;I used the following construction:&lt;br /&gt;&lt;code&gt;if [ -s filename -a "$(tail -c 1 filename)" = "" ]; then&lt;br /&gt;    echo "Has newline";&lt;br /&gt;else&lt;br /&gt;    echo "No newline";&lt;br /&gt;fi&lt;/code&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3722286367705184557-3369378077268374611?l=darkmind2007.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://darkmind2007.blogspot.com/feeds/3369378077268374611/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://darkmind2007.blogspot.com/2011/09/bash-check-new-line-at-end-of-file.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3722286367705184557/posts/default/3369378077268374611'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3722286367705184557/posts/default/3369378077268374611'/><link rel='alternate' type='text/html' href='http://darkmind2007.blogspot.com/2011/09/bash-check-new-line-at-end-of-file.html' title='BASH: check new line at end of file'/><author><name>D@rkmind</name><uri>http://www.blogger.com/profile/07798238268250031219</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3722286367705184557.post-3451740791095962750</id><published>2011-08-19T15:24:00.004+04:00</published><updated>2011-08-19T16:23:56.022+04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><category scheme='http://www.blogger.com/atom/ns#' term='howto'/><category scheme='http://www.blogger.com/atom/ns#' term='samba'/><title type='text'>Samba: no password access</title><content type='html'>Probably I'm a newbie to SMB protocol and Samba server, but it turns to be a problem to organize a comfortable access to Samba server.&lt;br /&gt;&lt;br /&gt;What I mean comfortable? Ok, to me it's, for example, several directories which can be accessed without prompting for username or password (irritating one as soon as you want to organize media share free for all) and several directories which require authentication.&lt;br /&gt;&lt;br /&gt;In &lt;a href="http://darkmind2007.blogspot.com/2008/07/guest-access-to-samba-server.html"&gt;this post&lt;/a&gt; it seemed that I resolved my problems by setting "security = share" in Samba server access, but then I found several things about this:&lt;br /&gt;&lt;br /&gt;&lt;b&gt;positive&lt;/b&gt;:&lt;br /&gt;+ yes, it allows one to browse server directories and access public ones without password&lt;br /&gt;&lt;br /&gt;&lt;b&gt;negative&lt;/b&gt;:&lt;br /&gt;- it doesn't provide True authentication. According to Samba's documentation for secured shares, it just receives password from client (ignoring username) and then tries to compare this password against users which are allowed to access that share. From my perspective, it's not fully secure&lt;br /&gt;&lt;br /&gt;- strange, but I only succeeded in authentication from Windows. If only I tried to use Dolphin, Konqueror or even smbclient, I always got "NT_STATUS_WRONG_PASSWORD". I haven't succeeded in googling and troubleshooting this issue.&lt;br /&gt;&lt;br /&gt;So, "security = share" doesn't seem to be a solution. On the other hand, if I apply "security = user", Windows clients always ask for password even if I try to access public shares (which would allow even without providing one).&lt;br /&gt;&lt;br /&gt;I was able to find a "magic spell" &lt;a href="http://www.linux.org.ru/forum/admin/3790409"&gt;here&lt;/a&gt;:&lt;br /&gt;&lt;code&gt;security = user&lt;br /&gt;map to guest = Bad Password&lt;br /&gt;guest account = guest&lt;/code&gt;&lt;br /&gt;After that, both Linux and Windows clients (even consoles like IconBit) were able to authenticate correctly.&lt;br /&gt;&lt;br /&gt;&lt;font class="highlight"&gt;So, finally steps which were done (I assume here that system users "guest", "user1" and "user2" are available in the server system):&lt;/font&gt;&lt;br /&gt;&lt;br /&gt;1) Add Samba users and set the same passwords as system ones:&lt;br /&gt;&lt;code&gt;# smbpasswd -a user1&lt;br /&gt;# smbpasswd -a user2&lt;br /&gt;# smbpasswd -a guest&lt;/code&gt;&lt;br /&gt;Leave blank password for "guest" account. If any account already exists, just remove it with "smbpasswd -x &lt;account&gt;". Just to be sure.&lt;br /&gt;&lt;br /&gt;2) Create several test shares and assign full access to them (or at least for those users, which are supposed to access these shares):&lt;br /&gt;&lt;code&gt;# mkdir -p /shares/public&lt;br /&gt;# mkdir -p /shares/share1&lt;br /&gt;# mkdir -p /shares/share2&lt;br /&gt;# chmod 777 /shares/public&lt;br /&gt;# chmod 777 /shares/share1&lt;br /&gt;# chmod 777 /shares/share2&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;3) Put the following configuration into your &lt;b&gt;[global]&lt;/b&gt; section of &lt;b&gt;smb.conf&lt;/b&gt;:&lt;br /&gt;&lt;code&gt;[global]&lt;br /&gt;workgroup = workgroup&lt;br /&gt;server string = %h server&lt;br /&gt;dns proxy = no&lt;br /&gt;log file = /var/log/samba/log.%m&lt;br /&gt;max log size = 1000&lt;br /&gt;syslog = 0&lt;br /&gt;&lt;br /&gt;####&lt;br /&gt;security = user&lt;br /&gt;map to guest = Bad Password&lt;br /&gt;guest account = guest&lt;br /&gt;####&lt;br /&gt;&lt;br /&gt;encrypt password = true&lt;br /&gt;passbd backend = tdbsam&lt;br /&gt;obey pam restrictions = no&lt;br /&gt;invalid users = root&lt;br /&gt;unix password sync = yes&lt;br /&gt;domain logons = no&lt;/code&gt;&lt;br /&gt;Fields decorated with "####" are the most important ones. Other fields can be changed depending on system's security and other requirements.&lt;br /&gt;&lt;br /&gt;4) Configure you shares the following way:&lt;br /&gt;&lt;code&gt;[public]&lt;br /&gt;  comment = Public Staff&lt;br /&gt;  path = /shares/public&lt;br /&gt;  guest ok = yes&lt;br /&gt;  writable = yes&lt;br /&gt;  browseable = yes&lt;br /&gt;  valid users =&lt;br /&gt;&lt;br /&gt;[share1]&lt;br /&gt;  comment = Share for user1&lt;br /&gt;  path = /shares/share1&lt;br /&gt;  guest ok = no&lt;br /&gt;  writable = yes&lt;br /&gt;  browseable = yes&lt;br /&gt;  valid users = user1&lt;br /&gt;&lt;br /&gt;[share2]&lt;br /&gt;  comment = Share for user2&lt;br /&gt;  path = /shares/share2&lt;br /&gt;  guest ok = no&lt;br /&gt;  writable = yes&lt;br /&gt;  browseable = yes&lt;br /&gt;  valid users = user2&lt;/code&gt;&lt;br /&gt;5) Finally, restart your Samba server. In my Debian it's "/etc/init.d/samba restart"&lt;br /&gt;&lt;br /&gt;Now all clients should be able to list shares on this server and access "public" directory without prompting password. At the same time, in order to access share1, user must be authenticated with "user1" and his password (similar way for share2).&lt;br /&gt;&lt;br /&gt;The only problem I had is accessing from Windows XP. Originally it authenticated as "guest" and was able to access public, but when I tried to access "share1", it didn't prompt for password, but instead showed me a message saying that access is denied.&lt;br /&gt;&lt;br /&gt;In log files of Samba server I could see that Windows XP still tries to authenticate with "guest". So, it seems to be a problem of Windows XP which doesn't close session and doesn't prompt for password within one session. It seems to me that reboot could fix this problem.&lt;br /&gt;&lt;br /&gt;Anyway, this also look like a bug in SMB protocol. It says that upon establishing connection, server just tell the client its security level ('share', 'user', etc.) and then it's up to client - how and when to ask for password. Windows XP as usually does it wrong :)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3722286367705184557-3451740791095962750?l=darkmind2007.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://darkmind2007.blogspot.com/feeds/3451740791095962750/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://darkmind2007.blogspot.com/2011/08/samba-no-password-access.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3722286367705184557/posts/default/3451740791095962750'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3722286367705184557/posts/default/3451740791095962750'/><link rel='alternate' type='text/html' href='http://darkmind2007.blogspot.com/2011/08/samba-no-password-access.html' title='Samba: no password access'/><author><name>D@rkmind</name><uri>http://www.blogger.com/profile/07798238268250031219</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3722286367705184557.post-71573473749968017</id><published>2011-05-01T00:19:00.002+04:00</published><updated>2011-05-01T00:21:44.648+04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='video'/><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><category scheme='http://www.blogger.com/atom/ns#' term='howto'/><title type='text'>mencoder: convert DVD to mp4</title><content type='html'>Found a command to convert movie to mp4 &lt;a href="http://www.axllent.org/docs/video/mencoder_for_iphone_android"&gt;here&lt;/a&gt; and slightly modified it in order to capture DVD from hard drive:&lt;br /&gt;&lt;code&gt;mencoder dvd://2 -dvd-device /home/username/Secret/VIDEO_TS -o secret.mp4 -vf dsize=480:352:2,scale=-8:-8,harddup -oac faac -faacopts mpeg=4:object=2:raw:br=128 -of lavf -lavfopts format=mp4 -ovc x264 -sws 9 -x264encopts nocabac:level_idc=30:bframes=0:bitrate=512:threads=auto:turbo=1:global_header:threads=auto:subq=5:frameref=6:partitions=all:trellis=1:chroma_me:me=umh&lt;/code&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3722286367705184557-71573473749968017?l=darkmind2007.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://darkmind2007.blogspot.com/feeds/71573473749968017/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://darkmind2007.blogspot.com/2011/05/mencoder-convert-dvd-to-mp4.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3722286367705184557/posts/default/71573473749968017'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3722286367705184557/posts/default/71573473749968017'/><link rel='alternate' type='text/html' href='http://darkmind2007.blogspot.com/2011/05/mencoder-convert-dvd-to-mp4.html' title='mencoder: convert DVD to mp4'/><author><name>D@rkmind</name><uri>http://www.blogger.com/profile/07798238268250031219</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3722286367705184557.post-8530672778305481364</id><published>2011-04-30T02:31:00.003+04:00</published><updated>2011-04-30T02:36:13.967+04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='video'/><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><category scheme='http://www.blogger.com/atom/ns#' term='experience'/><title type='text'>Mencoder: 1 duplicate frame(s)</title><content type='html'>Trying to convert DVD Video from hard drive to .avi file by means of mencoder I received a lot of messages like "1 duplicate frame(s)". As result, my there was problem with sound sync in the produced avi file. I used this command:&lt;br /&gt;&lt;code&gt;mencoder dvd://2 -dvd-device /home/Secret/VIDEO_TS -o secret.avi -oac copy -ovc copy&lt;/code&gt;&lt;br /&gt;One of the solution proposed by post author &lt;a href="http://ubuntuforums.org/showthread.php?t=350857"&gt;here&lt;/a&gt; worked for me. I changed audio codec and everything went ok:&lt;br /&gt;&lt;code&gt;mencoder dvd://2 -dvd-device /home/Secret/VIDEO_TS -o secret.avi -oac mp3lame -ovc copy&lt;/code&gt;&lt;br /&gt;May be not a universal solution, but definitely something to try working on the problem&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3722286367705184557-8530672778305481364?l=darkmind2007.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://darkmind2007.blogspot.com/feeds/8530672778305481364/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://darkmind2007.blogspot.com/2011/04/mencoder-1-duplicate-frames.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3722286367705184557/posts/default/8530672778305481364'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3722286367705184557/posts/default/8530672778305481364'/><link rel='alternate' type='text/html' href='http://darkmind2007.blogspot.com/2011/04/mencoder-1-duplicate-frames.html' title='Mencoder: 1 duplicate frame(s)'/><author><name>D@rkmind</name><uri>http://www.blogger.com/profile/07798238268250031219</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3722286367705184557.post-5703735742353340712</id><published>2011-02-06T14:45:00.002+03:00</published><updated>2011-02-06T14:55:14.175+03:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><category scheme='http://www.blogger.com/atom/ns#' term='howto'/><category scheme='http://www.blogger.com/atom/ns#' term='locale'/><title type='text'>Russian layout in Wine applications</title><content type='html'>I've tried to solve this problem for a long time. The problem is that in applications executed be means of Wine I can't type in russian layout. Existing text is shown correctly, but as soon as I switch to russian symbols don't appear while I type.&lt;br /&gt;&lt;br /&gt;I googled a lot, and saw a lot of different tips about solutions of this problem. Some people say that creating a symlink (ln -s /usr/share/X11/locale/en_US.UTF-8 /usr/share/X11/locale/ru_RU.UTF-8) worked in their case. Other said that copying of TTF fonts from Windows solved the problem. Even export LC_ALL=ru_RU.UTF-8 insted of LC_ALL=ru_RU.utf8 worked in one particular case.&lt;br /&gt;&lt;br /&gt;But all of these solutions didn't work for me and I think that there is no universal solution for this problem.&lt;br /&gt;&lt;br /&gt;I finally solved it on my computer and the reason was that my LC_ALL variable wasn't set and even when I tried to set it, I always used forms of LC_ALL=ru_RU{...}. Accidentally I tried (just for fun) &lt;font class="highlight"&gt;export LC_ALL=en_US.UTF-8&lt;/font&gt; and somehow it did the trick.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3722286367705184557-5703735742353340712?l=darkmind2007.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://darkmind2007.blogspot.com/feeds/5703735742353340712/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://darkmind2007.blogspot.com/2011/02/russian-layout-in-wine-applications.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3722286367705184557/posts/default/5703735742353340712'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3722286367705184557/posts/default/5703735742353340712'/><link rel='alternate' type='text/html' href='http://darkmind2007.blogspot.com/2011/02/russian-layout-in-wine-applications.html' title='Russian layout in Wine applications'/><author><name>D@rkmind</name><uri>http://www.blogger.com/profile/07798238268250031219</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3722286367705184557.post-1015030276636179243</id><published>2010-12-09T12:13:00.006+03:00</published><updated>2010-12-12T15:30:18.577+03:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='howto'/><category scheme='http://www.blogger.com/atom/ns#' term='Windows'/><title type='text'>Windows 7: Arrows on shortcuts</title><content type='html'>There are 2 problems in one:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Big ugly arrows on shortcuts in Windows 7&lt;/li&gt;&lt;li&gt;Appending of "Link for" to all newly created shortcuts&lt;/li&gt;&lt;/ul&gt;Both of them are solved by simply correcting 2 values in Windows registry and adding a new file to a system.&lt;br /&gt;&lt;br /&gt;New file is a blank icon (which probably can be created manualy, but I've downloaded it from &lt;a href="http://tools.oszone.net/Blast/reg/icon_arrow.zip"&gt;here&lt;/a&gt;). This file, called for example blank.ico, should be put into &lt;font class="highlight"&gt;%systemroot%&lt;/font&gt;. Now let's tweak the registry.&lt;br /&gt;&lt;br /&gt;To disable arrows, create a key &lt;font class="highlight"&gt;[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\explorer\Shell Icons]&lt;/font&gt; and add parameter with RG_EXPAND_SZ type:&lt;br /&gt;&lt;code&gt;[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\explorer\Shell Icons]&lt;br /&gt;"29"="C:\\Windows\\Blank.ico,0"&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;To disable "link for", set:&lt;br /&gt;&lt;code&gt;[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer]&lt;br /&gt;"link"=hex:00,00,00,00&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;I tested it on my Windows 7. I'm not sure, but probably this solution also applies for other versions of Windows.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3722286367705184557-1015030276636179243?l=darkmind2007.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://darkmind2007.blogspot.com/feeds/1015030276636179243/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://darkmind2007.blogspot.com/2010/12/windows-7-arrows-on-shortcuts.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3722286367705184557/posts/default/1015030276636179243'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3722286367705184557/posts/default/1015030276636179243'/><link rel='alternate' type='text/html' href='http://darkmind2007.blogspot.com/2010/12/windows-7-arrows-on-shortcuts.html' title='Windows 7: Arrows on shortcuts'/><author><name>D@rkmind</name><uri>http://www.blogger.com/profile/07798238268250031219</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3722286367705184557.post-4537572999705671392</id><published>2010-09-03T14:05:00.003+04:00</published><updated>2010-09-03T14:09:40.503+04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><category scheme='http://www.blogger.com/atom/ns#' term='knowledge'/><category scheme='http://www.blogger.com/atom/ns#' term='howto'/><title type='text'>Man: specify the page to browse</title><content type='html'>It's just a small notice which can be found in &lt;font class="highlight"&gt;man&lt;/font&gt; help. The reason I wrote this post is that it was not evident for me and I spent some time to pick this information from &lt;b&gt;man man&lt;/b&gt;.&lt;br /&gt;&lt;br /&gt;So, the task is to open a particular man page instead of default one. It can be found in &lt;b&gt;man man&lt;/b&gt;:&lt;br /&gt;&lt;code&gt; -S  section_list&lt;br /&gt;              List is a colon separated list of manual sections to search.  This option overrides the MANSECT environment variable.&lt;/code&gt;&lt;br /&gt;I used to say "man page" speaking about page numbers, but they call it sections. So, to open the 3rd page for syslog:&lt;br /&gt;&lt;code&gt;man -S syslog&lt;/code&gt;&lt;br /&gt;By default, it usually opens syslog(2)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3722286367705184557-4537572999705671392?l=darkmind2007.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://darkmind2007.blogspot.com/feeds/4537572999705671392/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://darkmind2007.blogspot.com/2010/09/man-specify-page-to-browse.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3722286367705184557/posts/default/4537572999705671392'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3722286367705184557/posts/default/4537572999705671392'/><link rel='alternate' type='text/html' href='http://darkmind2007.blogspot.com/2010/09/man-specify-page-to-browse.html' title='Man: specify the page to browse'/><author><name>D@rkmind</name><uri>http://www.blogger.com/profile/07798238268250031219</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3722286367705184557.post-7549773771526233558</id><published>2010-06-02T13:46:00.003+04:00</published><updated>2010-06-02T14:27:20.473+04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><category scheme='http://www.blogger.com/atom/ns#' term='howto'/><category scheme='http://www.blogger.com/atom/ns#' term='red hat'/><title type='text'>Linux: add custom script to chkconfig</title><content type='html'>One of my servers runs Red Hat EL5 and thus there's &lt;font class="highlight"&gt;chkconfig&lt;/font&gt; available to configure services for different run levels. I developed a script for my application (runs as daemon) which I put into &lt;font class="highlight"&gt;/etc/init.d/my_app&lt;/font&gt;. This script has the same CLI as all other scripts which control services. I mean it accepts one argument that can be "start", "stop", "restart" and "status" (I know, there could be other options, but this set was enough for me).&lt;br /&gt;&lt;br /&gt;Then I decided not to create symbolic links in &lt;font class="highlight"&gt;/etc/rc*&lt;/font&gt; manually, but to use chkconfig instead and received the following:&lt;br /&gt;&lt;code&gt;# chkconfig --add my_app&lt;br /&gt;service file does not support chkconfig&lt;/code&gt;&lt;br /&gt;The reason is that &lt;font class="highlight"&gt;chkconfig&lt;/font&gt; has some requirements for comments in the begining of the script. They should be something like this:&lt;br /&gt;&lt;code&gt;#!/bin/bash&lt;br /&gt;# chkconfig: 2345 95 20&lt;br /&gt;# description: This application was developed by me and is tested on this server&lt;br /&gt;# processname: my_app&lt;/code&gt;&lt;br /&gt;&lt;font class="highlight"&gt;chkconfig&lt;/font&gt; line tells chkconfig that application should run on 2, 3, 4 and 5 run levels and activation and deactivation priorities. The greater the number, the less priority has your application (see numbers in &lt;font class="highlight"&gt;/etc/rc*.d/&lt;/font&gt; links names)&lt;br /&gt;&lt;br /&gt;After these lines are inserted into your script, service should be added to chkconfig without any problems.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3722286367705184557-7549773771526233558?l=darkmind2007.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://darkmind2007.blogspot.com/feeds/7549773771526233558/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://darkmind2007.blogspot.com/2010/06/linux-add-custom-script-to-chkconfig.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3722286367705184557/posts/default/7549773771526233558'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3722286367705184557/posts/default/7549773771526233558'/><link rel='alternate' type='text/html' href='http://darkmind2007.blogspot.com/2010/06/linux-add-custom-script-to-chkconfig.html' title='Linux: add custom script to chkconfig'/><author><name>D@rkmind</name><uri>http://www.blogger.com/profile/07798238268250031219</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3722286367705184557.post-3156693832799493799</id><published>2010-03-28T12:43:00.002+04:00</published><updated>2010-03-28T12:56:32.622+04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='howto'/><category scheme='http://www.blogger.com/atom/ns#' term='Windows'/><title type='text'>Windows: Welcome screen default keyboard layout</title><content type='html'>I use Windows 7 as primary OS, but I faced the same problem in previous versions of Windows too. The problem is that I use russian version of this system and it doesn't allow to select default keyboard layout and toggle keys during system installation. So, each time I boot my system I have to change language with Alt-Shift keys (I used to press Ctrl-Shift). It's very inconvinient!&lt;br /&gt;&lt;br /&gt;The solution is &lt;a href="http://forum.oszone.net/thread-8004.html"&gt;here&lt;/a&gt;. One should change the following registry keys, which control default keyboard layout and toggle keys:&lt;br /&gt;&lt;code&gt;HKEY_USERS\.DEFAULT\Keyboard Layout\Preload\1;&lt;br /&gt;HKEY_USERS\.DEFAULT\Keyboard Layout\Preload\2;&lt;/code&gt;&lt;br /&gt;These 2 parameters control the primary (key 1), default language and other languages (keys 2, 3, etc.). The values of these keys contain language id. English layout is '00000409'. Russian is '00000419'. ID's for other languages could be found in &lt;font class='highlight'&gt;HKEY_CURRENT_USER/Keyboard layout/Preload&lt;/font&gt; if the required language is configured for current user.&lt;br /&gt;&lt;br /&gt;So, in my case parameter set was:&lt;br /&gt;&lt;code&gt;HKEY_USERS\.DEFAULT\Keyboard Layout\Preload\1 REG_SZ 00000409&lt;br /&gt;HKEY_USERS\.DEFAULT\Keyboard Layout\Preload\2 REG_SZ 00000419&lt;/code&gt;&lt;br /&gt;Layout switching keys are controlled by &lt;font class='highlight'&gt;HKEY_USERS\.DEFAULT\Keyboard Layout\Toggle\Hotkey&lt;/font&gt; key. Value '1' means Alt-Shift, value '2' means Ctrl-Shift.&lt;br /&gt;&lt;br /&gt;The following script changes default login layout to English and toggle keys to Ctrl-Shift:&lt;br /&gt;&lt;code&gt;reg add "HKU\.DEFAULT\Keyboard Layout\Preload" /v 1 /t REG_SZ /d 00000409 /f&lt;br /&gt;reg add "HKU\.DEFAULT\Keyboard Layout\Preload" /v 2 /t REG_SZ /d 00000419 /f&lt;br /&gt;reg add "HKU\.DEFAULT\Keyboard Layout\Toggle" /v Hotkey /t REG_SZ /d 2 /f&lt;/code&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3722286367705184557-3156693832799493799?l=darkmind2007.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://darkmind2007.blogspot.com/feeds/3156693832799493799/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://darkmind2007.blogspot.com/2010/03/windows-welcome-screen-default-keyboard.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3722286367705184557/posts/default/3156693832799493799'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3722286367705184557/posts/default/3156693832799493799'/><link rel='alternate' type='text/html' href='http://darkmind2007.blogspot.com/2010/03/windows-welcome-screen-default-keyboard.html' title='Windows: Welcome screen default keyboard layout'/><author><name>D@rkmind</name><uri>http://www.blogger.com/profile/07798238268250031219</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3722286367705184557.post-7811200589238741815</id><published>2010-01-27T15:22:00.003+03:00</published><updated>2010-01-27T15:33:18.663+03:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Vim'/><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><category scheme='http://www.blogger.com/atom/ns#' term='howto'/><title type='text'>VIM: Numpad doesn't work in PuTTY</title><content type='html'>If I work on Windows I usually use PuTTY to connect to remote UNIX servers and VIM to edit some files. On just another server I've faced the following issue:&lt;br /&gt;&lt;br /&gt;When I used numpad in BASH it worked well, but as soon as I opened VIM my numpad stopped working. All keys caused VIM to insert another symbol on the new line in text. As I saw &lt;a href="http://cialug.org/pipermail/cialug/2005-June/003060.html"&gt;here&lt;/a&gt;, it's a problem of PuTTY configuration. All I needed is just to open terminal settings and select &lt;font class="highlight"&gt;Terminal-&gt;Features-&gt;Disable application keypad mode&lt;/font&gt;. That solved my problem.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3722286367705184557-7811200589238741815?l=darkmind2007.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://darkmind2007.blogspot.com/feeds/7811200589238741815/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://darkmind2007.blogspot.com/2010/01/vim-numpad-doesnt-work-in-putty.html#comment-form' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3722286367705184557/posts/default/7811200589238741815'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3722286367705184557/posts/default/7811200589238741815'/><link rel='alternate' type='text/html' href='http://darkmind2007.blogspot.com/2010/01/vim-numpad-doesnt-work-in-putty.html' title='VIM: Numpad doesn&apos;t work in PuTTY'/><author><name>D@rkmind</name><uri>http://www.blogger.com/profile/07798238268250031219</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3722286367705184557.post-6711910230536416499</id><published>2010-01-27T12:41:00.003+03:00</published><updated>2010-01-27T12:47:33.190+03:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='howto'/><category scheme='http://www.blogger.com/atom/ns#' term='BASH'/><category scheme='http://www.blogger.com/atom/ns#' term='experience'/><title type='text'>Bash: Alt+Alt blocked cursor keys</title><content type='html'>&lt;font class="highlight"&gt;Alt+.&lt;/font&gt; which appends the last argument of the previous command to the current command line is very useful. From the other hand while using this combination it's easy to press &lt;font class="highlight"&gt;Left Alt + Right Alt&lt;/font&gt;. In my case it blocked cursor keys. I don't know why, probably I switched some state of the terminal.&lt;br /&gt;Anyway, pressing &lt;font class="highlight"&gt;Left Ctrl + Right Alt&lt;/font&gt; returned my terminal to the normal state (found by bruteforcing my keyboard :)).&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3722286367705184557-6711910230536416499?l=darkmind2007.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://darkmind2007.blogspot.com/feeds/6711910230536416499/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://darkmind2007.blogspot.com/2010/01/bash-altalt-blocked-cursor-keys.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3722286367705184557/posts/default/6711910230536416499'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3722286367705184557/posts/default/6711910230536416499'/><link rel='alternate' type='text/html' href='http://darkmind2007.blogspot.com/2010/01/bash-altalt-blocked-cursor-keys.html' title='Bash: Alt+Alt blocked cursor keys'/><author><name>D@rkmind</name><uri>http://www.blogger.com/profile/07798238268250031219</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3722286367705184557.post-3396848637981517910</id><published>2010-01-17T16:01:00.003+03:00</published><updated>2010-01-17T16:18:15.876+03:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Vim'/><category scheme='http://www.blogger.com/atom/ns#' term='knowledge'/><category scheme='http://www.blogger.com/atom/ns#' term='howto'/><title type='text'>VIM: remove highlighting after search</title><content type='html'>Just found the right way of removing highlighting in VIM after search. Before this I usually just entered another senseless search criteria (which is for sure doesn't exist in the text). What I really liked in &lt;a href="http://www.linuxquestions.org/questions/linux-newbie-8/remove-color-after-word-search-in-vi-editor-264760/"&gt;the found solution&lt;/a&gt; is additional keymapping for such a frequent action.&lt;br /&gt;&lt;br /&gt;The command which removes highlighting of the last search is &lt;font class="highlight"&gt;:nohlsearch&lt;/font&gt; or it's abbreviation &lt;font class="highlight"&gt;:noh&lt;/font&gt;&lt;br /&gt;&lt;br /&gt;It can be mapped, for example, to Ctrl-N combination by adding the following line to the &lt;font class="highlight"&gt;.vimrc&lt;/font&gt;:&lt;br /&gt;&lt;code&gt;nmap &amp;lt;silent&amp;gt; &amp;lt;C-N&amp;gt; :silent noh&amp;lt;CR&amp;gt;&lt;/code&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3722286367705184557-3396848637981517910?l=darkmind2007.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://darkmind2007.blogspot.com/feeds/3396848637981517910/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://darkmind2007.blogspot.com/2010/01/vim-remove-highlighting-after-search.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3722286367705184557/posts/default/3396848637981517910'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3722286367705184557/posts/default/3396848637981517910'/><link rel='alternate' type='text/html' href='http://darkmind2007.blogspot.com/2010/01/vim-remove-highlighting-after-search.html' title='VIM: remove highlighting after search'/><author><name>D@rkmind</name><uri>http://www.blogger.com/profile/07798238268250031219</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3722286367705184557.post-2478106127322434833</id><published>2010-01-17T15:46:00.004+03:00</published><updated>2010-01-17T15:59:37.765+03:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><category scheme='http://www.blogger.com/atom/ns#' term='knowledge'/><category scheme='http://www.blogger.com/atom/ns#' term='howto'/><title type='text'>su: incorrect password</title><content type='html'>After a long time of stable work of a Linux server (RHEL 5) it suddenly started to refuse logins under regular users. Only root logins were allowed. I guess, it's because of password expiration of my user (the only interactive non-root user in the system) or after some system update which has been done by another adminstrator.&lt;br /&gt;&lt;br /&gt;First of all I tried to reset password of my user under root "&lt;font class="highlight"&gt;passwd &amp;lt;user&amp;gt;&lt;/font&gt;", but it didn't do the trick. What was strange is that &lt;font class="highlight"&gt;su&lt;/font&gt; didn't prompt for password and just returned &lt;font class="highlight"&gt;"su: incorrect password"&lt;/font&gt;&lt;br /&gt;&lt;br /&gt;There were a lot of reasons of such a problem which were described on a lot of forums. The only solution that helped me has been shown by &lt;font class="highlight"&gt;dballagh&lt;/font&gt; in &lt;a href="http://www.linuxquestions.org/questions/linux-security-4/su-incorrect-password-451653/page2.html"&gt;this thread&lt;/a&gt;:&lt;br /&gt;&lt;code&gt;pam_tally --user &amp;lt;user&amp;gt; --reset&lt;/code&gt;&lt;br /&gt;My user has been blocked by pam_tally module after password expiration or a lot of failed logins.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3722286367705184557-2478106127322434833?l=darkmind2007.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://darkmind2007.blogspot.com/feeds/2478106127322434833/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://darkmind2007.blogspot.com/2010/01/su-incorrect-passord.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3722286367705184557/posts/default/2478106127322434833'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3722286367705184557/posts/default/2478106127322434833'/><link rel='alternate' type='text/html' href='http://darkmind2007.blogspot.com/2010/01/su-incorrect-passord.html' title='su: incorrect password'/><author><name>D@rkmind</name><uri>http://www.blogger.com/profile/07798238268250031219</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3722286367705184557.post-6302275549222220984</id><published>2010-01-15T00:42:00.005+03:00</published><updated>2010-01-15T01:06:28.233+03:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><category scheme='http://www.blogger.com/atom/ns#' term='howto'/><category scheme='http://www.blogger.com/atom/ns#' term='BASH'/><category scheme='http://www.blogger.com/atom/ns#' term='unix'/><title type='text'>Segmentation fault has blocked terminal</title><content type='html'>Yesterday I worked with one of Linux servers and run an application which continually updated my terminal. So it was quite interactive one. Suddenly the application failed (because of internal bug, I'm sure) and blocked my terminal. I mean, I could see output of all programs and Bash prompt, I could type my commands, but I couldn't see "what I type".&lt;br /&gt;&lt;br /&gt;I found on &lt;a href="http://how-to.ru/linux/faq/Text-Terminal-HOWTO-14.html"&gt;one of Russian sites&lt;/a&gt; detailed description of the reason of such behavior. In fact, interactive applications which process keyboard input themselves usually modify terminal settings and instruct system to pass keyboard events directly to the application. When they correctly exit, they restore all terminal settings. While in case of "segmentation fault" they do not have time to restore the settings.&lt;br /&gt;&lt;br /&gt;Fortunately, there is a simple command that allows to restore terminal state manually:&lt;br /&gt;&lt;code&gt;$ stty sane&lt;/code&gt;&lt;br /&gt;This command should be entered blindly, because we can't see our input at the moment. After execution of the command our terminal should return to normal functionality.&lt;br /&gt;&lt;br /&gt;There could be another reason of broken terminal: output of binary file. There could be special binary commands which affect behavior of terminal. In this case, one of the following command should help:&lt;br /&gt;&lt;code&gt;$ reset&lt;br /&gt;or&lt;br /&gt;$ setterm -reset&lt;/code&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3722286367705184557-6302275549222220984?l=darkmind2007.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://darkmind2007.blogspot.com/feeds/6302275549222220984/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://darkmind2007.blogspot.com/2010/01/segmentation-fault-blocked-terminal.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3722286367705184557/posts/default/6302275549222220984'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3722286367705184557/posts/default/6302275549222220984'/><link rel='alternate' type='text/html' href='http://darkmind2007.blogspot.com/2010/01/segmentation-fault-blocked-terminal.html' title='Segmentation fault has blocked terminal'/><author><name>D@rkmind</name><uri>http://www.blogger.com/profile/07798238268250031219</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3722286367705184557.post-3592079760904032699</id><published>2009-11-22T12:51:00.004+03:00</published><updated>2009-11-22T13:12:04.959+03:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='sql'/><title type='text'>MS SQL: Drop all views</title><content type='html'>When updating database it's sometimes hard to track all minor changes in lots of tables, views and other database elements. In case of tables, imho, we don't have lots of options and we are to track all changes carefully (not to damage data). On the other hand views, functions and stored procedures don't contain any data and we have more freedom.&lt;br /&gt;&lt;br /&gt;That's why I used to drop and create all views when updating them. It's not too slow and scripts are not very large. Also, MS SQL Server can generate one script for creation of all views automatically and as result we have just a complete snapshot of them.&lt;br /&gt;&lt;br /&gt;The problem is that before applying script on another server, we have to delete all previous views. There is no a built-in procedure to do this and I found a script and modified it a little bit:&lt;br /&gt;&lt;code&gt;declare @name  &lt;font color="#00ff00"&gt;varchar&lt;/font&gt;(&lt;font color="#ff6060"&gt;100&lt;/font&gt;)&lt;br /&gt;declare @sqlstring nvarchar(&lt;font color="#ff6060"&gt;1000&lt;/font&gt;)&lt;br /&gt;&lt;br /&gt;declare SPViews_cursor &lt;font color="#ff40ff"&gt;cursor&lt;/font&gt; &lt;font color="#ff40ff"&gt;for&lt;/font&gt;&lt;br /&gt;&lt;font color="#ffff00"&gt;SELECT&lt;/font&gt; sysobjects.name&lt;br /&gt;&lt;font color="#ff40ff"&gt;FROM&lt;/font&gt; sysobjects&lt;br /&gt;&lt;font color="#ff40ff"&gt;where&lt;/font&gt; OBJECTPROPERTY(sysobjects.id, N&lt;font color="#ff6060"&gt;'IsView'&lt;/font&gt;) = &lt;font color="#ff6060"&gt;1&lt;/font&gt;&lt;br /&gt;&lt;br /&gt;open SPViews_cursor&lt;br /&gt;&lt;br /&gt;fetch next &lt;font color="#ff40ff"&gt;from&lt;/font&gt; SPViews_cursor &lt;font color="#ff40ff"&gt;into&lt;/font&gt; @name&lt;br /&gt;&lt;br /&gt;while @@fetch_status = &lt;font color="#ff6060"&gt;0&lt;/font&gt;&lt;br /&gt;  &lt;font color="#ff40ff"&gt;begin&lt;/font&gt;&lt;br /&gt;    &lt;font color="#ffff00"&gt;set&lt;/font&gt; @sqlstring = &lt;font color="#ff6060"&gt;'drop view '&lt;/font&gt; + @name&lt;br /&gt;    exec sp_executesql @sqlstring&lt;br /&gt;    &lt;font color="#ffff00"&gt;set&lt;/font&gt; @sqlstring = &lt;font color="#ff6060"&gt;' '&lt;/font&gt;&lt;br /&gt;    fetch next &lt;font color="#ff40ff"&gt;from&lt;/font&gt; SPViews_cursor &lt;font color="#ff40ff"&gt;into&lt;/font&gt; @name&lt;br /&gt;  &lt;font color="#ff40ff"&gt;end&lt;/font&gt;&lt;br /&gt;&lt;br /&gt;close SPViews_cursor&lt;br /&gt;deallocate SPViews_cursor&lt;/code&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3722286367705184557-3592079760904032699?l=darkmind2007.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://darkmind2007.blogspot.com/feeds/3592079760904032699/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://darkmind2007.blogspot.com/2009/11/ms-sql-drop-all-views.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3722286367705184557/posts/default/3592079760904032699'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3722286367705184557/posts/default/3592079760904032699'/><link rel='alternate' type='text/html' href='http://darkmind2007.blogspot.com/2009/11/ms-sql-drop-all-views.html' title='MS SQL: Drop all views'/><author><name>D@rkmind</name><uri>http://www.blogger.com/profile/07798238268250031219</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3722286367705184557.post-5503460363411941195</id><published>2009-10-22T22:51:00.007+04:00</published><updated>2009-10-22T22:59:21.212+04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='howto'/><category scheme='http://www.blogger.com/atom/ns#' term='Qt'/><title type='text'>QT: Window in the center of screen</title><content type='html'>The problem is how to position Qt windows in the center of screen. Found the solution &lt;a href="http://www.wiki.crossplatform.ru/index.php/%D0%9A%D0%B0%D0%BA_%D1%80%D0%B0%D1%81%D0%BF%D0%BE%D0%BB%D0%BE%D0%B6%D0%B8%D1%82%D1%8C_%D0%BE%D0%BA%D0%BD%D0%BE_%D0%BF%D0%BE_%D1%86%D0%B5%D0%BD%D1%82%D1%80%D1%83_%D1%8D%D0%BA%D1%80%D0%B0%D0%BD%D0%B0%3F"&gt;here&lt;/a&gt;. It's a Russian site, but I hope the code is visible. There are just two similar codes for positioning. I liked the second one :) It's shorter and clearer.&lt;br /&gt;&lt;code&gt;QRect frect = frameGeometry();&lt;br /&gt;frect.moveCenter(QDesktopWidget().availableGeometry().center());&lt;br /&gt;move(frect.topLeft())&lt;/code&gt;&lt;br /&gt;I assume that this code is placed inside a constructor of the window which is positioned.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3722286367705184557-5503460363411941195?l=darkmind2007.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://darkmind2007.blogspot.com/feeds/5503460363411941195/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://darkmind2007.blogspot.com/2009/10/qt-window-in-center-of-screen.html#comment-form' title='6 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3722286367705184557/posts/default/5503460363411941195'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3722286367705184557/posts/default/5503460363411941195'/><link rel='alternate' type='text/html' href='http://darkmind2007.blogspot.com/2009/10/qt-window-in-center-of-screen.html' title='QT: Window in the center of screen'/><author><name>D@rkmind</name><uri>http://www.blogger.com/profile/07798238268250031219</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>6</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3722286367705184557.post-7606629733231109279</id><published>2009-10-22T11:23:00.003+04:00</published><updated>2009-10-22T11:31:57.793+04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><category scheme='http://www.blogger.com/atom/ns#' term='howto'/><title type='text'>Linux: start remote detached screen</title><content type='html'>Screen is very useful tool in case when it's necessary to start remote command without wait for its completeness. But by default it doesn't allow to detach screen without an actual terminal:&lt;br /&gt;&lt;code&gt;$ ssh Server "screen -m -d echo test"&lt;br /&gt;Must be connected to a terminal.&lt;/code&gt;&lt;br /&gt;The solution is to use ssh's &lt;font class="highlight"&gt;-t&lt;/font&gt; flag:&lt;br /&gt;&lt;code&gt;$ ssh -t Server "screen -m -d echo test"&lt;/code&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3722286367705184557-7606629733231109279?l=darkmind2007.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://darkmind2007.blogspot.com/feeds/7606629733231109279/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://darkmind2007.blogspot.com/2009/10/linux-start-remote-detached-screen.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3722286367705184557/posts/default/7606629733231109279'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3722286367705184557/posts/default/7606629733231109279'/><link rel='alternate' type='text/html' href='http://darkmind2007.blogspot.com/2009/10/linux-start-remote-detached-screen.html' title='Linux: start remote detached screen'/><author><name>D@rkmind</name><uri>http://www.blogger.com/profile/07798238268250031219</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3722286367705184557.post-1471800155652892208</id><published>2009-10-20T16:30:00.002+04:00</published><updated>2009-10-20T16:37:33.183+04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><category scheme='http://www.blogger.com/atom/ns#' term='howto'/><category scheme='http://www.blogger.com/atom/ns#' term='BASH'/><category scheme='http://www.blogger.com/atom/ns#' term='experience'/><title type='text'>Linux: ps output fomat</title><content type='html'>It took for me some time to find the solution, because &lt;font class="highlight"&gt;"ps --help"&lt;/font&gt; doesn't print the full information especially about output format. I often need to obtain some process ID from script, based on command name and its arguments.&lt;br /&gt;&lt;br /&gt;The first solution is to parse &lt;font class="highlight"&gt;"ps -aux"&lt;/font&gt;. But it's not convenient because pid is not the first column. I found command in the man page:&lt;br /&gt;&lt;code&gt;$ ps -eo pid,comm,args&lt;/code&gt;&lt;br /&gt;It allows one to define certain columns. Possible keys are:&lt;br /&gt;pcpu; group; ppid; user; args; comm; rgroup; nice; pid; pgid; etime; ruser; time; tty; vsz&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3722286367705184557-1471800155652892208?l=darkmind2007.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://darkmind2007.blogspot.com/feeds/1471800155652892208/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://darkmind2007.blogspot.com/2009/10/linux-ps-output-fomat.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3722286367705184557/posts/default/1471800155652892208'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3722286367705184557/posts/default/1471800155652892208'/><link rel='alternate' type='text/html' href='http://darkmind2007.blogspot.com/2009/10/linux-ps-output-fomat.html' title='Linux: ps output fomat'/><author><name>D@rkmind</name><uri>http://www.blogger.com/profile/07798238268250031219</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3722286367705184557.post-5481256933852895692</id><published>2009-10-15T22:22:00.004+04:00</published><updated>2009-10-15T22:31:05.733+04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='sql'/><category scheme='http://www.blogger.com/atom/ns#' term='knowledge'/><title type='text'>MS SQL: Drop view if it exists</title><content type='html'>Microsoft recommends the following way of dropping database view without an error message if the view doesn't exist (&lt;a href="http://msdn.microsoft.com/en-us/library/aa258835%28SQL.80%29.aspx"&gt;http://msdn.microsoft.com/en-us/library/aa258835%28SQL.80%29.aspx&lt;/a&gt;):&lt;br /&gt;&lt;code&gt;&lt;font color="#ff40ff"&gt;IF&lt;/font&gt; &lt;font color="#ffff00"&gt;EXISTS&lt;/font&gt; (&lt;font color="#ffff00"&gt;SELECT&lt;/font&gt; TABLE_NAME &lt;font color="#ff40ff"&gt;FROM&lt;/font&gt; INFORMATION_SCHEMA.VIEWS&lt;br /&gt;         &lt;font color="#ff40ff"&gt;WHERE&lt;/font&gt; TABLE_NAME = &lt;font color="#ff6060"&gt;'View_myview'&lt;/font&gt;)&lt;br /&gt;         &lt;font color="#ffff00"&gt;DROP&lt;/font&gt; &lt;font color="#ff40ff"&gt;VIEW&lt;/font&gt; dbo.View_myview&lt;br /&gt;GO&lt;/code&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3722286367705184557-5481256933852895692?l=darkmind2007.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://darkmind2007.blogspot.com/feeds/5481256933852895692/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://darkmind2007.blogspot.com/2009/10/ms-sql-drop-view-if-it-exists.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3722286367705184557/posts/default/5481256933852895692'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3722286367705184557/posts/default/5481256933852895692'/><link rel='alternate' type='text/html' href='http://darkmind2007.blogspot.com/2009/10/ms-sql-drop-view-if-it-exists.html' title='MS SQL: Drop view if it exists'/><author><name>D@rkmind</name><uri>http://www.blogger.com/profile/07798238268250031219</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3722286367705184557.post-7584309475773049625</id><published>2009-08-27T12:38:00.003+04:00</published><updated>2009-08-27T13:00:33.293+04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><category scheme='http://www.blogger.com/atom/ns#' term='howto'/><title type='text'>Broadcom Wi-Fi adapter on Linux</title><content type='html'>Some laptops have integrated Wi-Fi adapter which Linux doesn't recognize by default. Probably because the drivers are proprietary. Ubuntu suggests automatic installation of the driver but does it optionally. Lots of other distributives don't do this at all.&lt;br /&gt;&lt;br /&gt;I'll describe the process of driver installation for my Wi-Fi adapter in PCLinux. As I could understand on forums, this type of adapter is widely spread and installation process is almost the same for all distributives.&lt;br /&gt;&lt;br /&gt;First of all, let's check that system has found our adapter:&lt;br /&gt;&lt;code&gt;$ lspci | grep Wireless&lt;br /&gt;05:02.0 Network controller: Broadcom Corporation BCM4318 [AirForce One 54g] 802.11g Wireless LAN Controller (rev 02)&lt;/code&gt;&lt;br /&gt;Now lets install &lt;font class="highlight"&gt;fwcutter&lt;/font&gt;:&lt;br /&gt;&lt;code&gt;$ sudo apt-get install bcm43xx-fwcutter&lt;/code&gt;&lt;br /&gt;Then download driver from &lt;a href="http://mirror2.openwrt.org/sources/broadcom-wl-4.150.10.5.tar.bz2"&gt;here&lt;/a&gt;, extract the archive and install the firmware:&lt;br /&gt;&lt;code&gt;$ tar -xjf broadcom-wl-4.150.10.5.tar.bz2&lt;br /&gt;$ cd broadcom-wl-4.150.10.5/driver&lt;br /&gt;$ sudo b43-fwcutter -w /lib/firmware wl_apsta_mimo.o&lt;/code&gt;&lt;br /&gt;After all these steps Wi-Fi should start working. At worst, you can try to reboot your laptop.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3722286367705184557-7584309475773049625?l=darkmind2007.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://darkmind2007.blogspot.com/feeds/7584309475773049625/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://darkmind2007.blogspot.com/2009/08/broadcom-wi-fi-adapter-on-linux.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3722286367705184557/posts/default/7584309475773049625'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3722286367705184557/posts/default/7584309475773049625'/><link rel='alternate' type='text/html' href='http://darkmind2007.blogspot.com/2009/08/broadcom-wi-fi-adapter-on-linux.html' title='Broadcom Wi-Fi adapter on Linux'/><author><name>D@rkmind</name><uri>http://www.blogger.com/profile/07798238268250031219</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3722286367705184557.post-101277184909783455</id><published>2009-08-26T22:24:00.005+04:00</published><updated>2009-08-26T22:36:50.975+04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><category scheme='http://www.blogger.com/atom/ns#' term='howto'/><category scheme='http://www.blogger.com/atom/ns#' term='BASH'/><title type='text'>BASH: autocompletion after the first &lt;TAB&gt;</title><content type='html'>Lots of modern Linux distributives prefer this variant of autocompletion. You type a letter, push 'Tab' and receive the list of options. But I don't like this. I like when options appear after the second push of 'Tab'.&lt;br /&gt;&lt;br /&gt;It is controlled by &lt;font class="highlight"&gt;show-all-if-ambiguous&lt;/font&gt; parameter of &lt;font class="highlight"&gt;inputrc&lt;/font&gt;. For double-Tab style (which I prefer) the command will look like:&lt;br /&gt;&lt;code&gt;&lt;font color="#ffff00"&gt;set&lt;/font&gt; &lt;font color="#00ff00"&gt;show-all-if-ambiguous&lt;/font&gt; &lt;font color="#ff6060"&gt;off&lt;/font&gt;&lt;/code&gt;&lt;br /&gt;This should be placed into &lt;font class="highlight"&gt;/etc/inputrc&lt;/font&gt; (if you have privileges and want system wide setting) or in your local &lt;font class="highlight"&gt;~/.inputrc&lt;/font&gt;. But in the second case you should also add&lt;br /&gt;&lt;code&gt;&lt;font color="#ffff00"&gt;unset&lt;/font&gt; &lt;font color="#00ffff"&gt;INPUTRC&lt;/font&gt;&lt;font color="#ffff00"&gt;;&lt;/font&gt;&lt;/code&gt;&lt;br /&gt;to you &lt;font class="highlight"&gt;~/.bashrc&lt;/font&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3722286367705184557-101277184909783455?l=darkmind2007.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://darkmind2007.blogspot.com/feeds/101277184909783455/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://darkmind2007.blogspot.com/2009/08/bash-autocompletion-after-first.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3722286367705184557/posts/default/101277184909783455'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3722286367705184557/posts/default/101277184909783455'/><link rel='alternate' type='text/html' href='http://darkmind2007.blogspot.com/2009/08/bash-autocompletion-after-first.html' title='BASH: autocompletion after the first &amp;lt;TAB&amp;gt;'/><author><name>D@rkmind</name><uri>http://www.blogger.com/profile/07798238268250031219</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3722286367705184557.post-7719469160225311633</id><published>2009-08-25T22:20:00.002+04:00</published><updated>2009-08-25T22:50:27.380+04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Vim'/><category scheme='http://www.blogger.com/atom/ns#' term='howto'/><title type='text'>Aliases in VIM</title><content type='html'>I usually have a problem with VIM commands ":w" and ":q". I type them very quickly and don't have time to release Shift key. As result I get error messages which inform me that commands ":W" and ":Q" don't exist.&lt;br /&gt;&lt;br /&gt;That's why I decided to create an alias for them. They are created by the following command:&lt;br /&gt;&lt;code&gt;command &amp;lt;new_alias&amp;gt; &amp;lt;source_command&amp;gt;&lt;/code&gt;&lt;br /&gt;For example, my &lt;font class="highlight"&gt;~/.vimrc&lt;/font&gt; looks like this:&lt;br /&gt;&lt;code&gt;set nobackup&lt;br /&gt;command W w&lt;br /&gt;command Q q&lt;/code&gt;&lt;br /&gt;So I obtain correct result regardless state of Shift key.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3722286367705184557-7719469160225311633?l=darkmind2007.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://darkmind2007.blogspot.com/feeds/7719469160225311633/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://darkmind2007.blogspot.com/2009/08/aliases-in-vim.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3722286367705184557/posts/default/7719469160225311633'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3722286367705184557/posts/default/7719469160225311633'/><link rel='alternate' type='text/html' href='http://darkmind2007.blogspot.com/2009/08/aliases-in-vim.html' title='Aliases in VIM'/><author><name>D@rkmind</name><uri>http://www.blogger.com/profile/07798238268250031219</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3722286367705184557.post-216768353005041403</id><published>2009-08-10T18:35:00.002+04:00</published><updated>2009-08-10T18:40:08.943+04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Web'/><category scheme='http://www.blogger.com/atom/ns#' term='knowledge'/><category scheme='http://www.blogger.com/atom/ns#' term='howto'/><title type='text'>Firefox: redirection to "jar:file//"</title><content type='html'>Recently my favorite browser Firefox get used to redirect me to &lt;font class="highlight"&gt;"jar:file//..."&lt;/font&gt; with local address of some files. "Backward" button didn't work in this case and it really annoyed me.&lt;br /&gt;&lt;br /&gt;The reason of this problem was additional plug-in called &lt;font class="highlight"&gt;Ask.com&lt;/font&gt;. When I uninstalled it, the useless redirection disappeared.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3722286367705184557-216768353005041403?l=darkmind2007.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://darkmind2007.blogspot.com/feeds/216768353005041403/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://darkmind2007.blogspot.com/2009/08/firefox-redirection-to-jarfile.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3722286367705184557/posts/default/216768353005041403'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3722286367705184557/posts/default/216768353005041403'/><link rel='alternate' type='text/html' href='http://darkmind2007.blogspot.com/2009/08/firefox-redirection-to-jarfile.html' title='Firefox: redirection to &quot;jar:file//&quot;'/><author><name>D@rkmind</name><uri>http://www.blogger.com/profile/07798238268250031219</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3722286367705184557.post-8312726399018102245</id><published>2009-08-04T13:38:00.004+04:00</published><updated>2009-08-04T13:42:28.820+04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='network'/><category scheme='http://www.blogger.com/atom/ns#' term='howto'/><category scheme='http://www.blogger.com/atom/ns#' term='Windows'/><title type='text'>Windows: List of network shares</title><content type='html'>In order to see the list of all current network shares on the local computer and where they point to, imho, the following command is the most useful:&lt;br /&gt;&lt;code&gt;&lt;b&gt;&amp;gt;net share&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;Share name   Resource         Remark&lt;br /&gt;&lt;br /&gt;-------------------------------------------------&lt;br /&gt;ADMIN$       C:\Windows       Remote Admin&lt;br /&gt;C$           C:\              Default share&lt;br /&gt;D$           D:\              Default share&lt;br /&gt;IPC$                          Remote IPC&lt;/code&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3722286367705184557-8312726399018102245?l=darkmind2007.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://darkmind2007.blogspot.com/feeds/8312726399018102245/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://darkmind2007.blogspot.com/2009/08/windwos-list-of-network-shares.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3722286367705184557/posts/default/8312726399018102245'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3722286367705184557/posts/default/8312726399018102245'/><link rel='alternate' type='text/html' href='http://darkmind2007.blogspot.com/2009/08/windwos-list-of-network-shares.html' title='Windows: List of network shares'/><author><name>D@rkmind</name><uri>http://www.blogger.com/profile/07798238268250031219</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3722286367705184557.post-8749970313643288321</id><published>2009-07-31T23:25:00.009+04:00</published><updated>2009-08-02T13:59:30.625+04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='knowledge'/><category scheme='http://www.blogger.com/atom/ns#' term='debian'/><category scheme='http://www.blogger.com/atom/ns#' term='howto'/><title type='text'>Debian: "Waiting for root file system..."</title><content type='html'>After installation of Debian RC4 on my server I noticed that sometimes in hangs on boot with message like &lt;font class="highlight"&gt;"Waiting for root file system..."&lt;/font&gt;. I didn't know how to deal with this problem and as long as it appeared not often I didn't pay attention to this.&lt;br /&gt;&lt;br /&gt;But then I decided to upgrade my kernel to the latest version (2.6.30.3 at that moment) and the new version hanged each time. I spend some time in Google and finally found the solution here &lt;a href="http://www.debianhelp.org/node/11653"&gt;http://www.debianhelp.org/node/11653&lt;/a&gt;. Big thanks to this guy for full description.&lt;br /&gt;&lt;br /&gt;The problem hides in conflicts of kernel's devices naming convention and udev's one. For example, in my &lt;font class="highlight"&gt;grub/menu.lst&lt;/font&gt; the root partition is &lt;span style="font-style:italic;"&gt;/dev/hda1&lt;/span&gt; while kernel considers it as &lt;span style="font-style:italic;"&gt;/dev/sda1&lt;/span&gt;. I've solved this problem by using UUID's of devices.&lt;br /&gt;&lt;code&gt;$ blkid /dev/hda1&lt;br /&gt;/dev/hda1: UUID="38ed6c23-3908-49f6-81eb-9945a173a60a" TYPE="ext3"&lt;/code&gt;&lt;br /&gt;And then just typed this identifier into &lt;font class="highlight"&gt;/etc/fstab&lt;/font&gt; and &lt;font class="highlight"&gt;/boot/grub/menu.lst&lt;/font&gt;:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;fstab:&lt;/span&gt;&lt;br /&gt;&lt;code&gt;{...}&lt;br /&gt;&lt;font color="#ffff00"&gt;UUID=38ed6c23-3908-49f6-81eb-9945a173a60a&lt;/font&gt; / ext3 defaults,errors=remount-ro 0 1&lt;br /&gt;{...}&lt;/code&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;/boot/grub/menu.lst:&lt;/span&gt;&lt;br /&gt;&lt;code&gt;{...}&lt;br /&gt;title   Debian GNU/Linux, kernel 2.6.30.3&lt;br /&gt;root    (hd0,0)&lt;br /&gt;kernel  /boot/vmlinuz-2.6.30.3 &lt;font color="#ffff00"&gt;root=UUID=38ed6c23-3908-49f6-81eb-9945a173a60a&lt;/font&gt; ro&lt;br /&gt;initrd  /boot/initrd.img-2.6.30.3&lt;br /&gt;savedefault&lt;br /&gt;{...}&lt;/code&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3722286367705184557-8749970313643288321?l=darkmind2007.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://darkmind2007.blogspot.com/feeds/8749970313643288321/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://darkmind2007.blogspot.com/2009/07/debian-waiting-for-root-file-system.html#comment-form' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3722286367705184557/posts/default/8749970313643288321'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3722286367705184557/posts/default/8749970313643288321'/><link rel='alternate' type='text/html' href='http://darkmind2007.blogspot.com/2009/07/debian-waiting-for-root-file-system.html' title='Debian: &quot;Waiting for root file system...&quot;'/><author><name>D@rkmind</name><uri>http://www.blogger.com/profile/07798238268250031219</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3722286367705184557.post-7802970289874115533</id><published>2009-07-28T19:26:00.009+04:00</published><updated>2009-07-28T20:05:20.735+04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='network'/><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><category scheme='http://www.blogger.com/atom/ns#' term='howto'/><category scheme='http://www.blogger.com/atom/ns#' term='experience'/><title type='text'>NAT configuration in Debian</title><content type='html'>Currently my home network consists of several computers and each of them needs access to the Internet. My provider requires VPN connection, so one computer should be a router and control traffic by means of &lt;a href="http://en.wikipedia.org/wiki/Network_address_translation"&gt;NAT&lt;/a&gt;. The easiest way is to buy a special router which has convenient web interface, but I hadn't enough money, so I decided to configure my Linux server for this purpose.&lt;br /&gt;&lt;br /&gt;That's what I had: local home network with subnet number 192.168.1.0/24 &lt;span style="font-style:italic;"&gt;(the first server's Ethernet controller is connected to it)&lt;/span&gt;; DHCP in provider's network &lt;span style="font-style:italic;"&gt;(the second server's controller)&lt;/span&gt; and VPN connection. I won't describe creation of VPN connection in this post, may be later.&lt;br /&gt;&lt;br /&gt;Let's say that my &lt;font class="highlight"&gt;eth0&lt;/font&gt; interface has IP 192.168.1.1 (home network); &lt;font class="highlight"&gt;eth1&lt;/font&gt; interface obtains network setting through DHCP; and &lt;font class="highlight"&gt;ppp0&lt;/font&gt; is the interface which is created on VPN connection.&lt;br /&gt;&lt;br /&gt;My routing table is simple and just describes my connections and default route:&lt;br /&gt;&lt;code&gt;$ sudo route -n&lt;br /&gt;Kernel IP routing table&lt;br /&gt;Destination     Gateway Genmask         Flags Metric Ref Use Iface&lt;br /&gt;213.219.200.230 0.0.0.0 255.255.255.255 UH    0      0   0 ppp0&lt;br /&gt;10.251.50.0     0.0.0.0 255.255.255.0   U     0      0   0 eth1&lt;br /&gt;192.168.1.0     0.0.0.0 255.255.255.0   U     0      0   0 eth0&lt;br /&gt;0.0.0.0         0.0.0.0 0.0.0.0         U     0      0   0 ppp0&lt;/code&gt;&lt;br /&gt;Now I have to configure my firewall, which will replace IP address for outgoing packets. The POSTROUTING chain of NAT is responsible for this. So I do this by simple command:&lt;br /&gt;&lt;code&gt;# /sbin/iptables -v -t nat -A POSTROUTING -o eth1 -j MASQUERADE&lt;/code&gt;&lt;br /&gt;This activates NAT for eth1 interface. Each packet which is routed on this interface will be processed by firewall in order to replace source IP address of the packet with server's one (that's how NAT works).&lt;br /&gt;&lt;br /&gt;I also duplicated this command for ppp0, and later wrote a script which is executed on system startup. This script fully configures iptables according to my requirements:&lt;br /&gt;&lt;code&gt;&lt;font color="#8080ff"&gt;#!/bin/bash&lt;/font&gt;&lt;br /&gt;&lt;br /&gt;&lt;font color="#ffff00"&gt;echo&lt;/font&gt;&lt;font color="#ff6060"&gt; &lt;/font&gt;&lt;font color="#ffff00"&gt;&amp;quot;&lt;/font&gt;&lt;font color="#ff6060"&gt;IpTables Loading&lt;/font&gt;&lt;font color="#ffff00"&gt;&amp;quot;;&lt;/font&gt;&lt;br /&gt;&lt;br /&gt;&lt;font color="#00ffff"&gt;int_if&lt;/font&gt;=&lt;font color="#ffff00"&gt;&amp;quot;&lt;/font&gt;&lt;font color="#ff6060"&gt;eth0&lt;/font&gt;&lt;font color="#ffff00"&gt;&amp;quot;;&lt;/font&gt;&lt;br /&gt;&lt;font color="#00ffff"&gt;ext_if&lt;/font&gt;=&lt;font color="#ffff00"&gt;&amp;quot;&lt;/font&gt;&lt;font color="#ff6060"&gt;eth1&lt;/font&gt;&lt;font color="#ffff00"&gt;&amp;quot;;&lt;/font&gt;&lt;br /&gt;&lt;font color="#00ffff"&gt;ppp_if&lt;/font&gt;=&lt;font color="#ffff00"&gt;&amp;quot;&lt;/font&gt;&lt;font color="#ff6060"&gt;ppp0&lt;/font&gt;&lt;font color="#ffff00"&gt;&amp;quot;;&lt;/font&gt;&lt;br /&gt;&lt;br /&gt;&lt;font color="#00ffff"&gt;lo_if&lt;/font&gt;=&lt;font color="#ffff00"&gt;&amp;quot;&lt;/font&gt;&lt;font color="#ff6060"&gt;lo&lt;/font&gt;&lt;font color="#ffff00"&gt;&amp;quot;;&lt;/font&gt;&lt;br /&gt;&lt;br /&gt;&lt;font color="#00ffff"&gt;cmd&lt;/font&gt;=&lt;font color="#ffff00"&gt;&amp;quot;&lt;/font&gt;&lt;font color="#ff6060"&gt;/sbin/iptables -v&lt;/font&gt;&lt;font color="#ffff00"&gt;&amp;quot;;&lt;/font&gt;&lt;br /&gt;&lt;br /&gt;&lt;font color="#ff40ff"&gt;$cmd&lt;/font&gt; &lt;font color="#ff40ff"&gt;-F&lt;/font&gt;&lt;font color="#ffff00"&gt;;&lt;/font&gt;&lt;br /&gt;&lt;font color="#ff40ff"&gt;$cmd&lt;/font&gt; &lt;font color="#ff40ff"&gt;-t&lt;/font&gt; nat &lt;font color="#ff40ff"&gt;-F&lt;/font&gt;&lt;font color="#ffff00"&gt;;&lt;/font&gt;&lt;br /&gt;&lt;font color="#ff40ff"&gt;$cmd&lt;/font&gt; &lt;font color="#ff40ff"&gt;-t&lt;/font&gt; mangle &lt;font color="#ff40ff"&gt;-F&lt;/font&gt;&lt;font color="#ffff00"&gt;;&lt;/font&gt;&lt;br /&gt;&lt;font color="#ff40ff"&gt;$cmd&lt;/font&gt; &lt;font color="#ff40ff"&gt;-X&lt;/font&gt;&lt;font color="#ffff00"&gt;;&lt;/font&gt;&lt;br /&gt;&lt;br /&gt;&lt;font color="#ff40ff"&gt;$cmd&lt;/font&gt; &lt;font color="#ff40ff"&gt;-A&lt;/font&gt; INPUT &lt;font color="#ff40ff"&gt;-i&lt;/font&gt; &lt;font color="#ff40ff"&gt;$lo_if&lt;/font&gt; &lt;font color="#ff40ff"&gt;-j&lt;/font&gt; ACCEPT&lt;font color="#ffff00"&gt;;&lt;/font&gt;&lt;br /&gt;&lt;br /&gt;&lt;font color="#ff40ff"&gt;$cmd&lt;/font&gt; &lt;font color="#ff40ff"&gt;-A&lt;/font&gt; INPUT &lt;font color="#ff40ff"&gt;-j&lt;/font&gt; ACCEPT&lt;font color="#ffff00"&gt;;&lt;/font&gt;&lt;br /&gt;&lt;font color="#ff40ff"&gt;$cmd&lt;/font&gt; &lt;font color="#ff40ff"&gt;-A&lt;/font&gt; OUTPUT &lt;font color="#ff40ff"&gt;-j&lt;/font&gt; ACCEPT&lt;font color="#ffff00"&gt;;&lt;/font&gt;&lt;br /&gt;&lt;font color="#ff40ff"&gt;$cmd&lt;/font&gt; &lt;font color="#ff40ff"&gt;-A&lt;/font&gt; FORWARD &lt;font color="#ff40ff"&gt;-j&lt;/font&gt; ACCEPT&lt;font color="#ffff00"&gt;;&lt;/font&gt;&lt;br /&gt;&lt;br /&gt;&lt;font color="#ff40ff"&gt;$cmd&lt;/font&gt; &lt;font color="#ff40ff"&gt;-t&lt;/font&gt; nat &lt;font color="#ff40ff"&gt;-A&lt;/font&gt; POSTROUTING &lt;font color="#ff40ff"&gt;-o&lt;/font&gt; &lt;font color="#ff40ff"&gt;$ext_if&lt;/font&gt; &lt;font color="#ff40ff"&gt;-j&lt;/font&gt; MASQUERADE&lt;font color="#ffff00"&gt;;&lt;/font&gt;&lt;br /&gt;&lt;font color="#ff40ff"&gt;$cmd&lt;/font&gt; &lt;font color="#ff40ff"&gt;-t&lt;/font&gt; nat &lt;font color="#ff40ff"&gt;-A&lt;/font&gt; POSTROUTING &lt;font color="#ff40ff"&gt;-o&lt;/font&gt; &lt;font color="#ff40ff"&gt;$ppp_if&lt;/font&gt; &lt;font color="#ff40ff"&gt;-j&lt;/font&gt; MASQUERADE&lt;font color="#ffff00"&gt;;&lt;/font&gt;&lt;br /&gt;&lt;br /&gt;&lt;font color="#ffff00"&gt;echo&lt;/font&gt;&lt;font color="#ff6060"&gt; 1 &lt;/font&gt;&lt;font color="#ffff00"&gt;&amp;gt;&lt;/font&gt; /proc/sys/net/ipv4/ip_forward&lt;font color="#ffff00"&gt;;&lt;/font&gt;&lt;br /&gt;&lt;font color="#ffff00"&gt;echo&lt;/font&gt;&lt;font color="#ff6060"&gt; 1 &lt;/font&gt;&lt;font color="#ffff00"&gt;&amp;gt;&lt;/font&gt; /proc/sys/net/ipv4/ip_dynaddr&lt;font color="#ffff00"&gt;;&lt;/font&gt;&lt;/code&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3722286367705184557-7802970289874115533?l=darkmind2007.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://darkmind2007.blogspot.com/feeds/7802970289874115533/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://darkmind2007.blogspot.com/2009/07/nat-configuration-in-debian.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3722286367705184557/posts/default/7802970289874115533'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3722286367705184557/posts/default/7802970289874115533'/><link rel='alternate' type='text/html' href='http://darkmind2007.blogspot.com/2009/07/nat-configuration-in-debian.html' title='NAT configuration in Debian'/><author><name>D@rkmind</name><uri>http://www.blogger.com/profile/07798238268250031219</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3722286367705184557.post-3546332588472458401</id><published>2009-06-25T17:05:00.003+04:00</published><updated>2009-06-25T17:12:14.376+04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Vim'/><category scheme='http://www.blogger.com/atom/ns#' term='knowledge'/><category scheme='http://www.blogger.com/atom/ns#' term='HTML'/><title type='text'>Syntax highlight for HTML</title><content type='html'>VIM can create an HTML file with highlighted syntax for browsers.&lt;br /&gt;&lt;br /&gt;To do this:&lt;br /&gt;- open you file in Vim&lt;br /&gt;- ensure that syntax is highlighted&lt;br /&gt;- type command &lt;font class="highlight"&gt;":runtime! syntax/2html.vim"&lt;/font&gt;&lt;br /&gt;&lt;br /&gt;You'll obtain file with the same name, but with ".html" extension with highlighted syntax.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3722286367705184557-3546332588472458401?l=darkmind2007.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://darkmind2007.blogspot.com/feeds/3546332588472458401/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://darkmind2007.blogspot.com/2009/06/syntax-highlight-for-html.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3722286367705184557/posts/default/3546332588472458401'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3722286367705184557/posts/default/3546332588472458401'/><link rel='alternate' type='text/html' href='http://darkmind2007.blogspot.com/2009/06/syntax-highlight-for-html.html' title='Syntax highlight for HTML'/><author><name>D@rkmind</name><uri>http://www.blogger.com/profile/07798238268250031219</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3722286367705184557.post-2182479198055767644</id><published>2009-06-04T17:27:00.004+04:00</published><updated>2009-06-04T17:39:00.712+04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='howto'/><category scheme='http://www.blogger.com/atom/ns#' term='experience'/><category scheme='http://www.blogger.com/atom/ns#' term='HTML'/><title type='text'>HTML: 1-pixel table border without CSS</title><content type='html'>I had to create a table with 1-pixel black border without CSS because I generated markup for an e-mail and most of Mail clients break all CSS when you push "Reply".&lt;br /&gt;&lt;br /&gt;I tried &lt;font class="highlight"&gt;border="1"&lt;/font&gt;, but it didn't work because the border was in relief. Then I tried &lt;font class="highlight"&gt;style&lt;/font&gt; but it didn't work too, because it left only outer border without any lines between cells. Making a border for each cell also didn't work because border between 2 cells was 2-pixel length.&lt;br /&gt;&lt;br /&gt;Finally, I found a solution:&lt;br /&gt;&lt;code&gt;&amp;lt;TABLE cellSpacing="1" cellPadding="0" border="0" bgcolor="#000000"&amp;gt;&lt;br /&gt;&amp;lt;TR bgcolor="FFFFFF"&amp;gt;&lt;br /&gt;...&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;The idea is 1-pixel spacing between white cells and black background of the table that looks like border. You just set &lt;font class="highlight"&gt;bgcolor&lt;/font&gt; of the table to color of your border you want to see and then set &lt;font class="highlight"&gt;bgcolor&lt;/font&gt; of all rows to the color of outer background (so they seem to be transparent).&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3722286367705184557-2182479198055767644?l=darkmind2007.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://darkmind2007.blogspot.com/feeds/2182479198055767644/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://darkmind2007.blogspot.com/2009/06/html-1-pixel-table-border-without-css.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3722286367705184557/posts/default/2182479198055767644'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3722286367705184557/posts/default/2182479198055767644'/><link rel='alternate' type='text/html' href='http://darkmind2007.blogspot.com/2009/06/html-1-pixel-table-border-without-css.html' title='HTML: 1-pixel table border without CSS'/><author><name>D@rkmind</name><uri>http://www.blogger.com/profile/07798238268250031219</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3722286367705184557.post-8887178277759584277</id><published>2009-04-23T20:06:00.008+04:00</published><updated>2009-04-23T20:25:08.567+04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Web'/><category scheme='http://www.blogger.com/atom/ns#' term='experience'/><category scheme='http://www.blogger.com/atom/ns#' term='HTML'/><title type='text'>HTML: 1-pixel horizontal line</title><content type='html'>&lt;font class="highlight"&gt;&amp;lt;div&amp;gt;&lt;/font&gt; element is quite useful for creating 1-pixel width horizontal lines on Web page. For example, we can use empty DIV container and than write the following CSS style:&lt;br /&gt;&lt;code&gt;.separator {&lt;br /&gt; height: 1px;&lt;br /&gt; width: 90%;&lt;br /&gt; display: block;&lt;br /&gt; background-color: #555555;&lt;br /&gt; margin-left: auto;&lt;br /&gt; margin-right: auto;&lt;br /&gt;}&lt;/code&gt;&lt;br /&gt;This works fine everywhere except IE6. It creates a horizontal line with minimum width equal to the current font size:&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_7XbafVoYfZQ/SfCU-YBiQjI/AAAAAAAAACw/FgDsMNH8I24/s1600-h/forsite.png"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 243px; height: 30px;" src="http://2.bp.blogspot.com/_7XbafVoYfZQ/SfCU-YBiQjI/AAAAAAAAACw/FgDsMNH8I24/s320/forsite.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5327922158500987442" /&gt;&lt;/a&gt;&lt;br /&gt;The hack for IE6 is adding empty comment to the div:&lt;br /&gt;&lt;code&gt;&amp;lt;div class="separator"&amp;gt;&amp;lt!----&amp;gt;&amp;lt/div&amp;gt;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;The result is the same in all browsers:&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_7XbafVoYfZQ/SfCVk8aflPI/AAAAAAAAAC4/0uroh0QgFW4/s1600-h/forsite1.png"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 238px; height: 17px;" src="http://1.bp.blogspot.com/_7XbafVoYfZQ/SfCVk8aflPI/AAAAAAAAAC4/0uroh0QgFW4/s320/forsite1.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5327922821104375026" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;P.S. "font-size: 1px" doesn't do the trick because, all the same, the resulting line is 2px or something&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3722286367705184557-8887178277759584277?l=darkmind2007.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://darkmind2007.blogspot.com/feeds/8887178277759584277/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://darkmind2007.blogspot.com/2009/04/html-1-pixel-horizaontal-line.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3722286367705184557/posts/default/8887178277759584277'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3722286367705184557/posts/default/8887178277759584277'/><link rel='alternate' type='text/html' href='http://darkmind2007.blogspot.com/2009/04/html-1-pixel-horizaontal-line.html' title='HTML: 1-pixel horizontal line'/><author><name>D@rkmind</name><uri>http://www.blogger.com/profile/07798238268250031219</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_7XbafVoYfZQ/SfCU-YBiQjI/AAAAAAAAACw/FgDsMNH8I24/s72-c/forsite.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3722286367705184557.post-6401298504902558403</id><published>2009-04-09T18:07:00.002+04:00</published><updated>2009-04-09T18:12:55.537+04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='knowledge'/><category scheme='http://www.blogger.com/atom/ns#' term='howto'/><category scheme='http://www.blogger.com/atom/ns#' term='HTML'/><category scheme='http://www.blogger.com/atom/ns#' term='css'/><title type='text'>HTML: align="center" through CSS</title><content type='html'>If you need to center one element inside another block element (for example TABLE inside a DIV element) you can use &lt;font class="highlight"&gt;align="center"&lt;/font&gt;. For example:&lt;br /&gt;&lt;code&gt;&amp;lt;div&amp;gt;&lt;br /&gt;&amp;lt;TABLE width="50" align="center"&amp;gt;&lt;br /&gt;...&lt;br /&gt;&amp;lt;/TABLE&amp;gt;&lt;br /&gt;&amp;lt;/div&amp;gt;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;But if you need to use CSS you can do this:&lt;br /&gt;&lt;code&gt;table {&lt;br /&gt;  margin-left: auto;&lt;br /&gt;  margin-right: auto;&lt;br /&gt;  # or just margin: 0 auto 0 auto;&lt;br /&gt;}&lt;br /&gt;&lt;/code&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3722286367705184557-6401298504902558403?l=darkmind2007.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://darkmind2007.blogspot.com/feeds/6401298504902558403/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://darkmind2007.blogspot.com/2009/04/html-aligncenter-through-css.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3722286367705184557/posts/default/6401298504902558403'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3722286367705184557/posts/default/6401298504902558403'/><link rel='alternate' type='text/html' href='http://darkmind2007.blogspot.com/2009/04/html-aligncenter-through-css.html' title='HTML: align=&quot;center&quot; through CSS'/><author><name>D@rkmind</name><uri>http://www.blogger.com/profile/07798238268250031219</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3722286367705184557.post-4175854285208388024</id><published>2009-03-26T11:18:00.004+03:00</published><updated>2009-03-26T11:31:54.392+03:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><category scheme='http://www.blogger.com/atom/ns#' term='howto'/><category scheme='http://www.blogger.com/atom/ns#' term='BASH'/><category scheme='http://www.blogger.com/atom/ns#' term='experience'/><category scheme='http://www.blogger.com/atom/ns#' term='shell'/><title type='text'>Shell: Reading a file line-by-line as is</title><content type='html'>I faced this problem when I had to copy one file to another, but change or skip some lines. It's mandatory that all spaces of the copied lines were left unchanged. First of all I've tried this script:&lt;br /&gt;&lt;code class="SH"&gt;&lt;res&gt;cat "&lt;/res&gt;&lt;varuse&gt;$original_file&lt;/varuse&gt;&lt;res&gt;" | while read str; do&lt;/res&gt;&lt;br /&gt;   {some analysis of str variable}&lt;br /&gt;   &lt;res&gt;echo "&lt;/res&gt;&lt;varuse&gt;$str&lt;/varuse&gt;&lt;res&gt;" &gt;&gt; "&lt;/res&gt;&lt;varuse&gt;$new_file&lt;/varuse&gt;&lt;res&gt;";&lt;/res&gt;&lt;br /&gt;&lt;res&gt;done&lt;/res&gt;&lt;/code&gt;&lt;br /&gt;But it cut all leading and trailing spaces in the new line (it's a feature of &lt;font class="highlight"&gt;"read"&lt;/font&gt; tool). Fortunately, it provides &lt;font class="highlight"&gt;$REPLY&lt;/font&gt; variable if run without arguments. In this case $REPLY contains the line as is, with all spaces. So the working code was:&lt;br /&gt;&lt;code class="SH"&gt;&lt;res&gt;cat "&lt;/res&gt;&lt;varuse&gt;$original_file&lt;/varuse&gt;&lt;res&gt;" | while read; do&lt;/res&gt;&lt;br /&gt;   &lt;vardef&gt;str&lt;/vardef&gt;=&lt;res&gt;"&lt;/res&gt;&lt;varuse&gt;$REPLY&lt;/varuse&gt;&lt;res&gt;";&lt;/res&gt;&lt;br /&gt;   {some analysis of str variable}&lt;br /&gt;   &lt;res&gt;echo "&lt;/res&gt;&lt;varuse&gt;$str&lt;/varuse&gt;&lt;res&gt;" &gt;&gt; "&lt;/res&gt;&lt;varuse&gt;$new_file&lt;/varuse&gt;&lt;res&gt;";&lt;/res&gt;&lt;br /&gt;&lt;res&gt;done&lt;/res&gt;&lt;/code&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3722286367705184557-4175854285208388024?l=darkmind2007.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://darkmind2007.blogspot.com/feeds/4175854285208388024/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://darkmind2007.blogspot.com/2009/03/shell-reading-file-line-by-line-as-is.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3722286367705184557/posts/default/4175854285208388024'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3722286367705184557/posts/default/4175854285208388024'/><link rel='alternate' type='text/html' href='http://darkmind2007.blogspot.com/2009/03/shell-reading-file-line-by-line-as-is.html' title='Shell: Reading a file line-by-line as is'/><author><name>D@rkmind</name><uri>http://www.blogger.com/profile/07798238268250031219</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3722286367705184557.post-319722579883236354</id><published>2009-03-18T22:05:00.005+03:00</published><updated>2009-03-19T00:43:04.149+03:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><category scheme='http://www.blogger.com/atom/ns#' term='knowledge'/><category scheme='http://www.blogger.com/atom/ns#' term='debian'/><category scheme='http://www.blogger.com/atom/ns#' term='howto'/><title type='text'>apt-get MergeList problem</title><content type='html'>If you have the following error while calling &lt;font class="hightlight"&gt;apt-get update&lt;/font&gt;:&lt;br /&gt;&lt;code&gt;# apt-get update&lt;br /&gt;{...}&lt;br /&gt;E: Dynamic MMap ran out of room                                                                                                                                     &lt;br /&gt;E: Error occurred while processing util-linux (NewVersion1)                                                                                                         &lt;br /&gt;E: Problem with MergeList /var/lib/apt/lists/ftp.debian.org_debian_dists_etch_main_binary-i386_Packages                                                             &lt;br /&gt;E: The package lists or status file could not be parsed or opened.&lt;/code&gt;&lt;br /&gt;The first solution is to try removing all downloaded lists:&lt;br /&gt;&lt;code&gt;# rm -vf /var/lib/apt/lists/*&lt;/code&gt;&lt;br /&gt;Or move to some backup directory and remove from there later if there're no other problems.&lt;br /&gt;&lt;br /&gt;If it doesn't help, try to find same of very similar repositories in the &lt;font class="highlight"&gt;/etc/apt/sources.list&lt;/font&gt; and remove one of them. They can conflict with each other. Don't forget to repeat the first solution in order to clear cache&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3722286367705184557-319722579883236354?l=darkmind2007.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://darkmind2007.blogspot.com/feeds/319722579883236354/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://darkmind2007.blogspot.com/2009/03/apt-get-mergelist-problem.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3722286367705184557/posts/default/319722579883236354'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3722286367705184557/posts/default/319722579883236354'/><link rel='alternate' type='text/html' href='http://darkmind2007.blogspot.com/2009/03/apt-get-mergelist-problem.html' title='apt-get MergeList problem'/><author><name>D@rkmind</name><uri>http://www.blogger.com/profile/07798238268250031219</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3722286367705184557.post-627445850989340904</id><published>2009-03-10T08:36:00.006+03:00</published><updated>2009-03-10T11:45:46.588+03:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><category scheme='http://www.blogger.com/atom/ns#' term='Sabayon'/><category scheme='http://www.blogger.com/atom/ns#' term='experience'/><title type='text'>Experience with Sabayon 4 (Linux)</title><content type='html'>Yesterday I tried to install Sabayon 4 on my desktop. The reason for this was double-side DVD with 2 Linux distributives which goes with Linux Format magazine. I realized that if I have several different Linux'es why don't I just install them for several weeks and try.&lt;br /&gt;&lt;br /&gt;After that I decided to rearrange my primary HDD. Before this I had 3 partitions on my 80Gb HDD: the first for Windows (40Gb) because I used to play some gluttonous games, the second (~30Gb) for Linux and the rest for Linux swap. I made the following changes: left Win partition unchanged, left swap unchanged, reduced Linux partition to about 14Gb. On the freed space I created 8Gb partition for the temporary Linux system and 4Gb partition for home directories. So, everything was ready for the new installation.&lt;br /&gt;&lt;br /&gt;Insert Boot DVD and see the initial screen which offers boot from LiveCD (with ability to install OS, like in Ubuntu), try a 3D game (I don't remember it's name), start text-mode installation and start graphical installation.&lt;br /&gt;&lt;br /&gt;A few words about LiveCD. It boots quite long (comparing with Ubuntu 8.10 from the previous &lt;acronym title="Linux Format"&gt;LXF&lt;/acronym&gt;), but in the end you have quite stylish desktop, with running compiz, Firefox, several 3D games and lots of tools. I could easily surf the Internet a bit, communicate with friends using Pidgin and enjoy the 3D-desktop. A few disadvantages were - resolution of my screen, which was something like 1024x768 or 800x600 (native monitor's resolution is 1680x1050) and keymap switching. Languages were installed, but I couldn't switch them by means of keyboard (ctrl-shift, alt-shift, shift-shift, nothing...) even after some settings. The only way, I could deal with this problem was to click on the language icon by mouse. Hope it won't appear in permanent installation.&lt;br /&gt;&lt;br /&gt;After that I tried to reboot and install it through graphical installer. When I was in LiveCD version, I read article about Sabayon and Gentoo (base of Sabayon) in Wikipedia and my expectations were OS like Slackware ot smth. else. Simple, fast and stable. I was wrong.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_7XbafVoYfZQ/SbYNAJnZUII/AAAAAAAAACk/CV9lPcFHzWY/s1600-h/p1030131.jpg"&gt;&lt;img style="float:right; margin:0 0 10px 10px;cursor:pointer; cursor:hand;width: 320px; height: 240px;" src="http://2.bp.blogspot.com/_7XbafVoYfZQ/SbYNAJnZUII/AAAAAAAAACk/CV9lPcFHzWY/s320/p1030131.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5311447106762395778" /&gt;&lt;/a&gt;The first thing that I didn't like was packages selection. I was provided by several general options like "Install KDE", "Install Gnome", "Install 3D games" and so on. 8 points if I'm not mistaken. Of course, I could look through it's contents, but I couldn't select. Ok, I will install or remove required or unnecessary soft after the installation.&lt;br /&gt;&lt;br /&gt;The next screen asked me about default services (Samba, NFS, CUPS...), and then I should choose the partitions. Without any doubt I pointed on 8Gb partition as root and the 4Gb as "/home". Click on "Forward"... What's this??.. I see a small window, which says that I'm trying to install the system on 8Gb partition, which is much smaller than 12Gb. I was shocked. It's Linux, which is famous for the ability of installation on diskette, telling me this. It's not Mandriva or other fat desktop distributive, with big amount of the latest software. It's a Gentoo based "true" Linux. And it said "pish!" on my 8Gb partition and asked for 12Gb. Why not 20Gb? Or may be 60Gb? What's the problem I can pull my HDD and it will enlarge! Easily. Seems like Windows Vista requires less...&lt;br /&gt;&lt;br /&gt;But nevertheless, it's just a notification. I proceeded with installation, was asked about root passwords, new users, about GRUB loader and installation started offering me to "relax in my chair", just like Win98. When it was ~55% of installation I got an unhandled exception with some useless details and Installer exited. A bug in the Graphical installer. No matter, sometimes it happens. Reboot and select text installer.&lt;br /&gt;&lt;br /&gt;Menu structure is the same, phrases are the same, but... Where is the Package selection window? I was asked about desktop environment and nothing more. I'm puzzled, why I'm limited in the text installer options. But hope, it's default selection is Ok. Answer on the rest known questions and, again, start the installation.&lt;br /&gt;&lt;br /&gt;Don't remember how much it installed, but "No space left on device" reported one of the tools, which struggled through installer's interface directly on my console. Finish. So, it really requires so much space, and text-installer can't deselect packages. Graphical installer drops during installation (I tried several times). What should I do with this distributive?&lt;br /&gt;&lt;br /&gt;It was midnight by the moment and I decided to think about this next day. Today I had another idea - I noticed "Update installer" button in the graphical installation yesterday. May be this exception will disappear in the new version. But... Somehow I damaged my DVD a little bit :( It's double-side and it's hard to use such a disk. I should have copied it on two DVD's before. It will be a lesson for future for me.&lt;br /&gt;&lt;br /&gt;My resume about this distributive is the following. Probably it's quite useful and good-looking distributive, with integrated compiz and lots of useful soft. But the installer is quite buggy and useless. I didn't like that I can't select packages and even categories in the text mode. I think I'll try to install it again if have and an opportunity to get another DVD with this or next version.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3722286367705184557-627445850989340904?l=darkmind2007.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://darkmind2007.blogspot.com/feeds/627445850989340904/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://darkmind2007.blogspot.com/2009/03/experience-with-sabayon-4-linux.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3722286367705184557/posts/default/627445850989340904'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3722286367705184557/posts/default/627445850989340904'/><link rel='alternate' type='text/html' href='http://darkmind2007.blogspot.com/2009/03/experience-with-sabayon-4-linux.html' title='Experience with Sabayon 4 (Linux)'/><author><name>D@rkmind</name><uri>http://www.blogger.com/profile/07798238268250031219</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_7XbafVoYfZQ/SbYNAJnZUII/AAAAAAAAACk/CV9lPcFHzWY/s72-c/p1030131.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3722286367705184557.post-5740869151547198252</id><published>2009-03-04T14:25:00.004+03:00</published><updated>2009-03-04T14:38:06.737+03:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='unix'/><category scheme='http://www.blogger.com/atom/ns#' term='experience'/><title type='text'>.tgz vs .tar.gz</title><content type='html'>Comparing the result, there is no difference between "old-style" archival of directories (by means of pipe: &lt;font class="highlight"&gt;tar -c dir1 | gzip &amp;gt; arch1.tar.gz&lt;/font&gt;) and "new-style" (by means of integrated ability of tar: &lt;font class="highlight"&gt;tar -czf arch1.tgz dir1&lt;/font&gt;).&lt;br /&gt;&lt;br /&gt;But there is a huge difference in speed. I tried to archive a large directory these 2 ways and obtained completely the same archives. I used "time" Linux tool to measure execution time. The first method (with pipe) took about &lt;font class="highlight"&gt;40&lt;/font&gt; minutes to complete. The second method - &lt;font class="highlight"&gt;12&lt;/font&gt;.&lt;br /&gt;&lt;br /&gt;The reason of the difference, I guess, in usage of pipe in the first method. Shell creates a temporary file for each pipe and all stdout of one application is stored into this file. Another application gets this file as stdin. We obtain the next sequence: reading of source directory, writing pipe temporary file, reading the temporary file and writing the archive file. In the second method we have only two of these actions: reading of source directory and writing to the target archive file.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3722286367705184557-5740869151547198252?l=darkmind2007.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://darkmind2007.blogspot.com/feeds/5740869151547198252/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://darkmind2007.blogspot.com/2009/03/tgz-vs-targz.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3722286367705184557/posts/default/5740869151547198252'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3722286367705184557/posts/default/5740869151547198252'/><link rel='alternate' type='text/html' href='http://darkmind2007.blogspot.com/2009/03/tgz-vs-targz.html' title='.tgz vs .tar.gz'/><author><name>D@rkmind</name><uri>http://www.blogger.com/profile/07798238268250031219</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3722286367705184557.post-8569471510172848847</id><published>2009-02-25T19:04:00.010+03:00</published><updated>2009-02-25T20:02:43.114+03:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Web'/><category scheme='http://www.blogger.com/atom/ns#' term='JavaScript'/><category scheme='http://www.blogger.com/atom/ns#' term='howto'/><category scheme='http://www.blogger.com/atom/ns#' term='experience'/><category scheme='http://www.blogger.com/atom/ns#' term='HTML'/><title type='text'>Web: Stretch all elements to the width of the longest one</title><content type='html'>I had such a problem with IE (as usual). I had a column with dropdown lists and all these lists had different width. My layout required that all of these elements had the same width.&lt;br /&gt;&lt;br /&gt;First of all I tried to create a table with one column and place all my elements into cells. After that I set &lt;font class="highlight"&gt;style="width: 100%"&lt;/font&gt; for all content of the table. It worked ideally in all browsers. Except one... &lt;font class="highlight"&gt;Internet Explorer compressed my table to several pixels&lt;/font&gt;. As I understood he realized that width of my table depends on elements and width of elements depends on table. This recursion made him crazy.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_7XbafVoYfZQ/SaV4tKNXksI/AAAAAAAAACM/nHNleKEBcto/s1600-h/dropdown_compressed.bmp"&gt;&lt;img style="float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;width: 150px; height: 150px;" src="http://3.bp.blogspot.com/_7XbafVoYfZQ/SaV4tKNXksI/AAAAAAAAACM/nHNleKEBcto/s200/dropdown_compressed.bmp" border="0" alt=""id="BLOGGER_PHOTO_ID_5306780453155869378" /&gt;&lt;/a&gt;I thought that if it knew actual width of table, he would scale right. So I removed "width" from tags attributes and added JavaScript in the end of the page &lt;i&gt;(after load and automatic scaling)&lt;/i&gt; and added "width=100%" through this script &lt;i&gt;(when table width is known for a browser)&lt;/i&gt;. The same result...&lt;br /&gt;&lt;br /&gt;My solution was to add two lines to the script before setting elements width. &lt;font class="highlight"&gt;I got the first cell as element by ID and then changed it's width from "auto" to it's actual current width&lt;/font&gt;. It worked in IE, Firefox, Opera, Chrome and Safari.&lt;br /&gt;&lt;br /&gt;Here is the example and solution:&lt;br /&gt;&lt;code class="HTML"&gt;&amp;lt;form name="myform"&amp;gt;&lt;br /&gt;  &amp;lt;Table cellspacing="5" cellpadding="0"&amp;gt;&lt;br /&gt;  &lt;comment&gt;&amp;lt;!-- set id for the frist cell --&amp;gt;&lt;/comment&gt;&lt;br /&gt;  &amp;lt;TR&amp;gt;&amp;lt;TD id="firstcell"&amp;gt;&lt;br /&gt;    &amp;lt;select name="list1"&amp;gt;&lt;br /&gt;      &amp;lt;option&amp;gt;opt1&amp;lt;/option&amp;gt;&lt;br /&gt;      &amp;lt;option&amp;gt;opt2&amp;lt;/option&amp;gt;&lt;br /&gt;    &amp;lt;/select&amp;gt;&lt;br /&gt;  &amp;lt;/TD&amp;gt;&amp;lt;/TR&amp;gt;&lt;br /&gt;  &amp;lt;TR&amp;gt;&amp;lt;TD&amp;gt;&lt;br /&gt;    &amp;lt;select name="list2"&amp;gt;&lt;br /&gt;      &lt;comment&gt;&amp;lt;!-- lengths of the elements will be different by default --&amp;gt;&lt;/comment&gt;&lt;br /&gt;      &amp;lt;option&amp;gt;my_opt1&amp;lt;/option&amp;gt;&lt;br /&gt;      &amp;lt;option&amp;gt;my_opt2&amp;lt;/option&amp;gt;&lt;br /&gt;    &amp;lt;/select&amp;gt;&lt;br /&gt;  &amp;lt;/TD&amp;gt;&amp;lt;/TR&amp;gt;&lt;br /&gt;  &amp;lt;/Table&amp;gt;&lt;br /&gt;&amp;lt;/form&amp;gt;&lt;br /&gt;&lt;comment&gt;&amp;lt;!-- some other HTML here... --&amp;gt;&lt;/comment&gt;&lt;br /&gt;&amp;lt;Script language="JavaScript"&amp;gt;&lt;br /&gt;  &lt;comment&gt;// get the first cell object and fix it's width&lt;/comment&gt;&lt;br /&gt;  var firstcell = document.getElementById('firstcell');&lt;br /&gt;  firstcell.style.width = firstcell.offsetWidth;&lt;br /&gt;&lt;br /&gt;  document.myform.list1.style.width = '100%';&lt;br /&gt;  document.myform.list2.style.width = '100%';&lt;br /&gt;&amp;lt;/Script&amp;gt;&lt;/code&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_7XbafVoYfZQ/SaV41YGg3pI/AAAAAAAAACU/ZK_epdyzk44/s1600-h/dropdown_normal.bmp"&gt;&lt;img style="float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;width: 150px; height: 150px;" src="http://1.bp.blogspot.com/_7XbafVoYfZQ/SaV41YGg3pI/AAAAAAAAACU/ZK_epdyzk44/s200/dropdown_normal.bmp" border="0" alt=""id="BLOGGER_PHOTO_ID_5306780594324168338" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3722286367705184557-8569471510172848847?l=darkmind2007.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://darkmind2007.blogspot.com/feeds/8569471510172848847/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://darkmind2007.blogspot.com/2009/02/web-stretch-all-elements-to-width-of.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3722286367705184557/posts/default/8569471510172848847'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3722286367705184557/posts/default/8569471510172848847'/><link rel='alternate' type='text/html' href='http://darkmind2007.blogspot.com/2009/02/web-stretch-all-elements-to-width-of.html' title='Web: Stretch all elements to the width of the longest one'/><author><name>D@rkmind</name><uri>http://www.blogger.com/profile/07798238268250031219</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_7XbafVoYfZQ/SaV4tKNXksI/AAAAAAAAACM/nHNleKEBcto/s72-c/dropdown_compressed.bmp' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3722286367705184557.post-4798419591797548137</id><published>2009-02-24T20:25:00.005+03:00</published><updated>2009-02-24T20:31:40.477+03:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Vim'/><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><category scheme='http://www.blogger.com/atom/ns#' term='knowledge'/><title type='text'>Disable backup in VIM</title><content type='html'>Most modern Linux distributives set creation of backup files in vim by default. Probably it's useful in some particular cases (imho, it's better to make a backup for very important files yourself), but I lose my mind when I see the files like "textfile.txt~" everywhere I've edited a file.&lt;br /&gt;&lt;br /&gt;To turn off the default backup add &lt;font class="highlight"&gt;set nobackup&lt;/font&gt; to &lt;font class="highlight"&gt;/etc/vim/vimrc&lt;/font&gt; or to your own vim config (in your home directory).&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3722286367705184557-4798419591797548137?l=darkmind2007.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://darkmind2007.blogspot.com/feeds/4798419591797548137/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://darkmind2007.blogspot.com/2009/02/disable-backup-in-vim.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3722286367705184557/posts/default/4798419591797548137'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3722286367705184557/posts/default/4798419591797548137'/><link rel='alternate' type='text/html' href='http://darkmind2007.blogspot.com/2009/02/disable-backup-in-vim.html' title='Disable backup in VIM'/><author><name>D@rkmind</name><uri>http://www.blogger.com/profile/07798238268250031219</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3722286367705184557.post-8933230496633784151</id><published>2009-02-24T14:53:00.006+03:00</published><updated>2009-02-24T15:43:05.394+03:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Web'/><category scheme='http://www.blogger.com/atom/ns#' term='JavaScript'/><category scheme='http://www.blogger.com/atom/ns#' term='knowledge'/><category scheme='http://www.blogger.com/atom/ns#' term='howto'/><title type='text'>Web: Dynamic dropdown lists</title><content type='html'>In order to change dropdown lists dynamically (depending on values of other elements) the current options of the list should be deleted and new options should be created. This code probably will be located in a handler function of another element (for example, another list or radio button).&lt;br /&gt;&lt;br /&gt;For instance, if have 2 options - the first is type of numbers (1,2,3... or I, II, III...) and the second - actual number (it's just a model, I don't say that it's a very useful example :)). So the HTML code will be:&lt;br /&gt;&lt;code class="HTML"&gt;&amp;lt;form name="numbers"&amp;gt;&lt;br /&gt;  &amp;lt;select name="num_type" onchange="num_type_change();"&amp;gt;&lt;br /&gt;    &amp;lt;option value="1"&amp;gt;1,2,3...&amp;lt;/option&amp;gt;&lt;br /&gt;    &amp;lt;option value="I"&amp;gt;I,II,III...&amp;lt;/option&amp;gt;&lt;br /&gt;    &lt;comment&gt;&amp;lt;!-- remember option values from the previous post --&amp;gt;&lt;/comment&gt;&lt;br /&gt;  &amp;lt;/select&amp;gt;&lt;br /&gt;  &amp;lt;select name="num_value"&amp;gt;&lt;br /&gt;    &amp;lt;option value="1"&amp;gt;1&amp;lt;/option&amp;gt; &lt;br /&gt;    &amp;lt;option value="2"&amp;gt;2&amp;lt;/option&amp;gt;&lt;br /&gt;    &amp;lt;option value="3"&amp;gt;3&amp;lt;/option&amp;gt;&lt;br /&gt;    &amp;lt;option value="4"&amp;gt;4&amp;lt;/option&amp;gt;&lt;br /&gt;  &amp;lt;/select&amp;gt;&lt;br /&gt;&amp;lt;/form&amp;gt;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;Now let's write a JavaScript function &lt;font class="highlight"&gt;num_type_change()&lt;/font&gt; which will change the second list according to the selected type of numbers:&lt;br /&gt;&lt;code class="JavaScript"&gt;&amp;lt;Script language="JavaScript"&amp;gt;&lt;br /&gt;&lt;res&gt;function&lt;/res&gt; num_type_change() {&lt;br /&gt;  &lt;res&gt;var&lt;/res&gt; type = document.numbers.num_type.value;&lt;br /&gt;  &lt;res&gt;var&lt;/res&gt; numbers_list = document.numbers.num_value;&lt;br /&gt;&lt;br /&gt;  &lt;comment&gt;// Reset options list&lt;/comment&gt;&lt;br /&gt;  numbers_list.options.length = 0;&lt;br /&gt;&lt;br /&gt;  &lt;comment&gt;// Add required options&lt;/comment&gt;&lt;br /&gt;  &lt;res&gt;if&lt;/res&gt; (type == '1') {&lt;br /&gt;    numbers_list.options[0] = &lt;res&gt;new&lt;/res&gt; Option('1','1');&lt;br /&gt;    numbers_list.options[1] = &lt;res&gt;new&lt;/res&gt; Option('2','2');&lt;br /&gt;    numbers_list.options[2] = &lt;res&gt;new&lt;/res&gt; Option('3','3');&lt;br /&gt;    numbers_list.options[3] = &lt;res&gt;new&lt;/res&gt; Option('4','4');&lt;br /&gt;  }&lt;br /&gt;  &lt;res&gt;else&lt;/res&gt; {&lt;br /&gt;    numbers_list.options[0] = &lt;res&gt;new&lt;/res&gt; Option('I','I');&lt;br /&gt;    numbers_list.options[1] = &lt;res&gt;new&lt;/res&gt; Option('II','II');&lt;br /&gt;    numbers_list.options[2] = &lt;res&gt;new&lt;/res&gt; Option('III','III');&lt;br /&gt;    numbers_list.options[3] = &lt;res&gt;new&lt;/res&gt; Option('IV','IV');&lt;br /&gt;  }&lt;br /&gt;}&lt;br /&gt;&amp;lt;/Script&amp;gt;&lt;br /&gt;&lt;/code&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3722286367705184557-8933230496633784151?l=darkmind2007.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://darkmind2007.blogspot.com/feeds/8933230496633784151/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://darkmind2007.blogspot.com/2009/02/web-dynamic-dropdown-lists.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3722286367705184557/posts/default/8933230496633784151'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3722286367705184557/posts/default/8933230496633784151'/><link rel='alternate' type='text/html' href='http://darkmind2007.blogspot.com/2009/02/web-dynamic-dropdown-lists.html' title='Web: Dynamic dropdown lists'/><author><name>D@rkmind</name><uri>http://www.blogger.com/profile/07798238268250031219</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3722286367705184557.post-5300780210378221350</id><published>2009-02-24T14:22:00.007+03:00</published><updated>2009-02-24T14:50:13.629+03:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='JavaScript'/><category scheme='http://www.blogger.com/atom/ns#' term='knowledge'/><title type='text'>Value of a dropdown list through JavaScript</title><content type='html'>A dropdown list is a usual element of a from on WebPages. And very often it's checked by some JaveScript before sending the data to the host (or for whatever other reasons). The following list:&lt;br /&gt;&lt;code&gt;&amp;lt;form name="myform"&amp;gt;&lt;br /&gt;    &amp;lt;select name="mylist"&amp;gt;&lt;br /&gt;        &amp;lt;option&amp;gt;A&amp;lt;/option&amp;gt;&lt;br /&gt;        &amp;lt;option&amp;gt;B&amp;lt;/option&amp;gt;&lt;br /&gt;        &amp;lt;option&amp;gt;C&amp;lt;/option&amp;gt;&lt;br /&gt;    &amp;lt;/select&amp;gt;&lt;br /&gt;&amp;lt;/form&amp;gt;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;could be accessed by means of JavaScript the following way: "document.myform.mylist.value". It will work in most of the browsers except Internet Explorer. Especially for this one, HTML code should be little bit different:&lt;br /&gt;&lt;code&gt;&amp;lt;form name="myform"&amp;gt;&lt;br /&gt;    &amp;lt;select name="mylist"&amp;gt;&lt;br /&gt;        &amp;lt;option &lt;font color="red"&gt;value="A"&lt;/font&gt;&amp;gt;A&amp;lt;/option&amp;gt;&lt;br /&gt;        &amp;lt;option &lt;font color="red"&gt;value="B"&lt;/font&gt;&amp;gt;B&amp;lt;/option&amp;gt;&lt;br /&gt;        &amp;lt;option &lt;font color="red"&gt;value="C"&lt;/font&gt;&amp;gt;C&amp;lt;/option&amp;gt;&lt;br /&gt;    &amp;lt;/select&amp;gt;&lt;br /&gt;&amp;lt;/form&amp;gt;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;Now the same JavaScript code can be used in IE, too.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3722286367705184557-5300780210378221350?l=darkmind2007.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://darkmind2007.blogspot.com/feeds/5300780210378221350/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://darkmind2007.blogspot.com/2009/02/value-of-dropdown-list-through.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3722286367705184557/posts/default/5300780210378221350'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3722286367705184557/posts/default/5300780210378221350'/><link rel='alternate' type='text/html' href='http://darkmind2007.blogspot.com/2009/02/value-of-dropdown-list-through.html' title='Value of a dropdown list through JavaScript'/><author><name>D@rkmind</name><uri>http://www.blogger.com/profile/07798238268250031219</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3722286367705184557.post-398623636874514865</id><published>2009-01-23T19:56:00.003+03:00</published><updated>2009-01-23T20:04:20.210+03:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Vim'/><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><category scheme='http://www.blogger.com/atom/ns#' term='debian'/><category scheme='http://www.blogger.com/atom/ns#' term='howto'/><title type='text'>Colorless VIM in Debian</title><content type='html'>After installation of Debian 4.0 I had no colors when using Vim. Command like &lt;i&gt;":syntax on"&lt;/i&gt; gave no results, instead it reported: &lt;i&gt;"E319: Sorry, the command is not available in this version"&lt;/i&gt;. The solution was found there &lt;a href="http://www.cyberciti.biz/faq/howto-install-full-vim-under-ubuntu-linux/"&gt;http://www.cyberciti.biz/faq/howto-install-full-vim-under-ubuntu-linux/&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Debian distributives (my and also Ubuntu, as I could see in the source above) install &lt;font class="highlight"&gt;vim-tiny by default&lt;/font&gt;. Just "apt-get" a normal version of Vim:&lt;br /&gt;&lt;code&gt;# apt-get install vim&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;And also uncomment line "syntax on" in &lt;font class="highlight"&gt;/etc/vim/vimrc&lt;/font&gt; if it's still commented.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3722286367705184557-398623636874514865?l=darkmind2007.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://darkmind2007.blogspot.com/feeds/398623636874514865/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://darkmind2007.blogspot.com/2009/01/colorless-vim-in-debian.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3722286367705184557/posts/default/398623636874514865'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3722286367705184557/posts/default/398623636874514865'/><link rel='alternate' type='text/html' href='http://darkmind2007.blogspot.com/2009/01/colorless-vim-in-debian.html' title='Colorless VIM in Debian'/><author><name>D@rkmind</name><uri>http://www.blogger.com/profile/07798238268250031219</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3722286367705184557.post-9184054929331921027</id><published>2009-01-19T23:25:00.003+03:00</published><updated>2009-01-19T23:31:54.904+03:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><category scheme='http://www.blogger.com/atom/ns#' term='knowledge'/><category scheme='http://www.blogger.com/atom/ns#' term='debian'/><category scheme='http://www.blogger.com/atom/ns#' term='howto'/><title type='text'>Searching for a package in Debian</title><content type='html'>There are useful tool in Debian which manage packages within your system - &lt;font class="highlight"&gt;apt-get&lt;/font&gt; and &lt;font class="highlight"&gt;aptitude&lt;/font&gt;. However, both of them have one disadvantage - they can't tell which packages contain a file your're looking for. In such a situation one can use a special script called &lt;font class="highlight"&gt;apt-file&lt;/font&gt;.&lt;br /&gt;&lt;br /&gt;To install:&lt;br /&gt;&lt;code&gt;# apt-get install apt-file&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;Before the first usage it should create indices:&lt;br /&gt;&lt;code&gt;# apt-file update&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;And now we can use it:&lt;br /&gt;&lt;code&gt;# apt-file search stdio.h&lt;br /&gt;&lt;/code&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3722286367705184557-9184054929331921027?l=darkmind2007.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://darkmind2007.blogspot.com/feeds/9184054929331921027/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://darkmind2007.blogspot.com/2009/01/searching-for-package-in-debian.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3722286367705184557/posts/default/9184054929331921027'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3722286367705184557/posts/default/9184054929331921027'/><link rel='alternate' type='text/html' href='http://darkmind2007.blogspot.com/2009/01/searching-for-package-in-debian.html' title='Searching for a package in Debian'/><author><name>D@rkmind</name><uri>http://www.blogger.com/profile/07798238268250031219</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3722286367705184557.post-357485887684847035</id><published>2008-08-27T22:56:00.013+04:00</published><updated>2009-01-21T20:38:29.180+03:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><category scheme='http://www.blogger.com/atom/ns#' term='howto'/><category scheme='http://www.blogger.com/atom/ns#' term='SVN'/><title type='text'>Adding SubVersion to the Init (Linux)</title><content type='html'>First of all, I tried this solution on &lt;font class="highlight"&gt;Debian 4.0r1&lt;/font&gt;. But in fact I don't think there will a huge difference between distributives.&lt;br /&gt;&lt;br /&gt;As I could realize from packages came with two my distributives (ASP Linux v10 and Debian 4.0r1) - SubVersion provides &lt;font class="highlight"&gt;svnserve&lt;/font&gt; which can be started in the current terminal or loaded as a daemon (also there is a possibility to run in inetd mode, but I used daemon mode). But installer doesn't add &lt;font class="highlight"&gt;svnserve&lt;/font&gt; to &lt;font class="highlight"&gt;init&lt;/font&gt; among with other daemons. So I had to do this myself.&lt;br /&gt;&lt;br /&gt;We have several directories:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;font class="highlight"&gt;/etc/init.d&lt;/font&gt; - storage for all scripts which are called during change of runlevel. These scripts must accept one argument that can be &lt;i&gt;start&lt;/i&gt;, &lt;i&gt;stop&lt;/i&gt;, &lt;i&gt;reload&lt;/i&gt;, &lt;i&gt;restart&lt;/i&gt; and &lt;i&gt;force-reload&lt;/i&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;&lt;font class="highlight"&gt;/etc/rc*.d&lt;/font&gt; - symbolic links to the corresponding scripts in init.d directory. All of them a called when entering corresponding runlevel.&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;I've added the next script called "&lt;font class="highlight"&gt;svn&lt;/font&gt;" into &lt;font class="highlight"&gt;init.d&lt;/font&gt;:&lt;br /&gt;&lt;code class="SH"&gt;&lt;comment&gt;#!/bin/sh&lt;/comment&gt;&lt;br /&gt;&lt;br /&gt;&lt;comment&gt;#standard logging functions&lt;/comment&gt;&lt;br /&gt;. /lib/lsb/init-functions&lt;br /&gt;&lt;br /&gt;&lt;res&gt;case "&lt;/res&gt;&lt;varuse&gt;$1&lt;/varuse&gt;&lt;res&gt;" in&lt;/res&gt;&lt;br /&gt;        start&lt;res&gt;)&lt;/res&gt;&lt;br /&gt;                log_begin_msg &lt;res&gt;"&lt;/res&gt;&lt;val&gt;Starting SubVersion...&lt;/val&gt;&lt;res&gt;"&lt;/res&gt;;&lt;br /&gt;                &lt;res&gt;if !&lt;/res&gt; svnserve -d -r "/repositories"&lt;res&gt;; then&lt;/res&gt;&lt;br /&gt;                        log_end_msg &lt;val&gt;1&lt;/val&gt;&lt;br /&gt;                        &lt;res&gt;exit&lt;/res&gt; &lt;val&gt;1&lt;/val&gt;&lt;br /&gt;                &lt;res&gt;else&lt;/res&gt;&lt;br /&gt;                        log_end_msg &lt;val&gt;0&lt;/val&gt;&lt;br /&gt;                &lt;res&gt;fi&lt;/res&gt;&lt;br /&gt;        ;;&lt;br /&gt;        stop&lt;res&gt;)&lt;/res&gt;&lt;br /&gt;                log_begin_msg &lt;res&gt;"&lt;/res&gt;&lt;val&gt;Stopping SubVersion...&lt;/val&gt;&lt;res&gt;"&lt;/res&gt;;&lt;br /&gt;                &lt;res&gt;if !&lt;/res&gt; pkill svnserve&lt;res&gt;; then&lt;/res&gt;&lt;br /&gt;                        log_end_msg &lt;val&gt;1&lt;/val&gt;&lt;br /&gt;                        &lt;res&gt;exit&lt;/res&gt; &lt;val&gt;1&lt;/val&gt;&lt;br /&gt;                &lt;res&gt;else&lt;/res&gt;&lt;br /&gt;                        log_end_msg &lt;val&gt;0&lt;/val&gt;&lt;br /&gt;                &lt;res&gt;fi&lt;/res&gt;&lt;br /&gt;        ;;&lt;br /&gt;        reload&lt;res&gt;|&lt;/res&gt;restart&lt;res&gt;|&lt;/res&gt;force-reload&lt;res&gt;)&lt;/res&gt;&lt;br /&gt;                log_begin_msg &lt;res&gt;"&lt;/res&gt;&lt;val&gt;Stopping SubVersion...&lt;/val&gt;&lt;res&gt;"&lt;/res&gt;;&lt;br /&gt;                &lt;res&gt;if !&lt;/res&gt; pkill svnserve&lt;res&gt;; then&lt;/res&gt;&lt;br /&gt;                        log_end_msg &lt;val&gt;1&lt;/val&gt;&lt;br /&gt;                &lt;res&gt;else&lt;/res&gt;&lt;br /&gt;                        log_end_msg &lt;val&gt;0&lt;/val&gt;&lt;br /&gt;                &lt;res&gt;fi&lt;/res&gt;&lt;br /&gt;&lt;br /&gt;                log_begin_msg &lt;res&gt;"&lt;/res&gt;&lt;val&gt;Starting SubVersion...&lt;/val&gt;&lt;res&gt;"&lt;/res&gt;;&lt;br /&gt;                &lt;res&gt;if !&lt;/res&gt; svnserve -d -r "/repositories"&lt;res&gt;; then&lt;/res&gt;&lt;br /&gt;                        log_end_msg &lt;val&gt;1&lt;/val&gt;&lt;br /&gt;                        &lt;res&gt;exit&lt;/res&gt; &lt;val&gt;1&lt;/val&gt;&lt;br /&gt;                &lt;res&gt;else&lt;/res&gt;&lt;br /&gt;                        log_end_msg &lt;val&gt;0&lt;/val&gt;&lt;br /&gt;                &lt;res&gt;fi&lt;/res&gt;&lt;br /&gt;        ;;&lt;br /&gt;        *)&lt;br /&gt;                echo &lt;res&gt;"&lt;/res&gt;&lt;val&gt;Usage: /etc/init.d/svn {start|stop|reload|restart|force-reload}&lt;/val&gt;&lt;res&gt;"&lt;/res&gt;&lt;br /&gt;                &lt;res&gt;exit&lt;/res&gt; &lt;val&gt;1&lt;/val&gt;&lt;br /&gt;                ;;&lt;br /&gt;&lt;res&gt;esac&lt;/res&gt;&lt;br /&gt;&lt;br /&gt;&lt;res&gt;exit&lt;/res&gt; &lt;val&gt;0&lt;/val&gt;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;Then I've just created link in &lt;font class="highlight"&gt;/etc/rc2.d&lt;/font&gt; directory:&lt;br /&gt;&lt;code&gt;  # ln -s /etc/init.d/svn /etc/rc2.d/S22svn&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;And that's all. Subversion is automatically started on runlevel 2 and is stopped during shutdown or going down to runlevel 1.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3722286367705184557-357485887684847035?l=darkmind2007.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://darkmind2007.blogspot.com/feeds/357485887684847035/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://darkmind2007.blogspot.com/2008/08/adding-subversion-to-init-linux.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3722286367705184557/posts/default/357485887684847035'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3722286367705184557/posts/default/357485887684847035'/><link rel='alternate' type='text/html' href='http://darkmind2007.blogspot.com/2008/08/adding-subversion-to-init-linux.html' title='Adding SubVersion to the Init (Linux)'/><author><name>D@rkmind</name><uri>http://www.blogger.com/profile/07798238268250031219</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3722286367705184557.post-4718204569667982020</id><published>2008-08-18T20:49:00.016+04:00</published><updated>2009-01-21T20:39:54.372+03:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><category scheme='http://www.blogger.com/atom/ns#' term='knowledge'/><category scheme='http://www.blogger.com/atom/ns#' term='howto'/><category scheme='http://www.blogger.com/atom/ns#' term='unix'/><category scheme='http://www.blogger.com/atom/ns#' term='experience'/><category scheme='http://www.blogger.com/atom/ns#' term='shell'/><title type='text'>Colored output to a vt100 (e.g. Linux console)</title><content type='html'>Lots of Linux programs use colors to paint their output (ls, for example). But there're no special commands to do the same thing yourself. Solution was found here: &lt;a href="http://www.freeos.com/guides/lsst/misc.htm"&gt;http://www.freeos.com/guides/lsst/misc.htm&lt;/a&gt; (BTW, quite good tutorial). These are control characters of Linux console. For instance, if you print &lt;font class="highlight"&gt;\033[31m&lt;/font&gt;, all your next output will be red. The list of codes of all supported colors can be easily obtained by experiment or found in Google, but just to save time here it is:&lt;br /&gt;&lt;code&gt;   \033[22;30m - &lt;b&gt;black&lt;/b&gt;&lt;br /&gt;   \033[22;31m - &lt;span style="color:#c00000;"&gt;&lt;b&gt;red&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;   \033[22;32m - &lt;span style="color:#00c000;"&gt;&lt;b&gt;green&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;   \033[22;33m - &lt;span style="color:#804000;"&gt;&lt;b&gt;brown&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;   \033[22;34m - &lt;span style="color:#0000c0;"&gt;&lt;b&gt;blue&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;   \033[22;35m - &lt;span style="color:#c000c0;"&gt;&lt;b&gt;magenta&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;   \033[22;36m - &lt;span style="color:#00c0c0;"&gt;&lt;b&gt;cyan&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;   \033[22;37m - &lt;span style="color:#c0c0c0;"&gt;&lt;b&gt;gray&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;   \033[01;30m - &lt;span style="color:#808080;"&gt;&lt;b&gt;dark gray&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;   \033[01;31m - &lt;span style="color:#ff0000;"&gt;&lt;b&gt;light red&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;   \033[01;32m - &lt;span style="color:#00ff00;"&gt;&lt;b&gt;light green&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;   \033[01;33m - &lt;span style="color:#ffff00;"&gt;&lt;b&gt;yellow&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;   \033[01;34m - &lt;span style="color:#0000ff;"&gt;&lt;b&gt;light blue&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;   \033[01;35m - &lt;span style="color:#ff00ff;"&gt;&lt;b&gt;light magenta&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;   \033[01;36m - &lt;span style="color:#00ffff;"&gt;&lt;b&gt;light cyan&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;   \033[01;37m - &lt;span style="color:#ffffff;"&gt;&lt;b&gt;white&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;   \033[01;0m - default scheme&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Also, there're a lot of other control characters (some of them can controls leds on a keyboard).&lt;br /&gt;&lt;br /&gt;All these knowledge was needed for me to write a script that prints Linux-style log (it was just for fun :)). Two functions - first shows a log message with required number of separating symbols (dots, for example), and the second prints colored result of operation. Here is my product:&lt;br /&gt;&lt;code class="SH"&gt;&lt;comment&gt;# function does color output of the result. OK if $1 equal 1, and FAILED otherwise&lt;/comment&gt;&lt;br /&gt;&lt;res&gt;function&lt;/res&gt; echo_result&lt;res&gt;()&lt;/res&gt;&lt;br /&gt;{&lt;br /&gt;  &lt;res&gt;if [&lt;/res&gt; &lt;varuse&gt;$1&lt;/varuse&gt; &lt;res&gt;-eq&lt;/res&gt; &lt;val&gt;0&lt;/val&gt; &lt;res&gt;]; then&lt;/res&gt;&lt;br /&gt;     echo -e &lt;res&gt;"&lt;/res&gt;&lt;val&gt;[\033[31mFAILED\033[0m]&lt;/val&gt;&lt;res&gt;"&lt;/res&gt;;&lt;br /&gt;  &lt;res&gt;else&lt;/res&gt;&lt;br /&gt;     echo -e &lt;res&gt;"&lt;/res&gt;&lt;val&gt;[\033[32m  OK  \033[0m]&lt;/val&gt;&lt;res&gt;"&lt;/res&gt;;&lt;br /&gt;  &lt;res&gt;fi&lt;/res&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;comment&gt;# function outputs the string given in the first parameter and adds required number of dots&lt;/comment&gt;&lt;br /&gt;&lt;res&gt;function&lt;/res&gt; echo_log&lt;res&gt;()&lt;/res&gt;&lt;br /&gt;{&lt;br /&gt;  &lt;vardef&gt;str&lt;/vardef&gt;=&lt;res&gt;"&lt;/res&gt;&lt;varuse&gt;$1&lt;/varuse&gt;&lt;res&gt;"&lt;/res&gt;;&lt;br /&gt;  &lt;vardef&gt;len&lt;/vardef&gt;=&lt;varuse&gt;`expr length "$str"`&lt;/varuse&gt;; &lt;comment&gt;# obtain length of the given string and correct this value by 1 for the next loop&lt;/comment&gt;&lt;br /&gt;  &lt;vardef&gt;len&lt;/vardef&gt;=&lt;varuse&gt;$((len+1))&lt;/varuse&gt;;&lt;br /&gt;  &lt;res&gt;for&lt;/res&gt; i &lt;res&gt;in&lt;/res&gt; &lt;varuse&gt;`seq $len 34`&lt;/varuse&gt;&lt;res&gt;; do&lt;/res&gt;&lt;br /&gt;     &lt;vardef&gt;str&lt;/vardef&gt;=&lt;res&gt;"&lt;/res&gt;&lt;varuse&gt;${str}&lt;/varuse&gt;&lt;val&gt;.&lt;/val&gt;&lt;res&gt;"&lt;/res&gt;;&lt;br /&gt;  &lt;res&gt;done&lt;/res&gt;&lt;br /&gt;  echo -n &lt;res&gt;"&lt;/res&gt;&lt;varuse&gt;$str&lt;/varuse&gt;&lt;res&gt;"&lt;/res&gt;;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;comment&gt;# Usage&lt;/comment&gt;&lt;br /&gt;&lt;vardef&gt;RES&lt;/vardef&gt;=&lt;val&gt;1&lt;/val&gt;;&lt;br /&gt;echo_log &lt;res&gt;"&lt;/res&gt;&lt;val&gt;Log message 1&lt;/val&gt;&lt;res&gt;"&lt;/res&gt;;&lt;br /&gt; cmd1 &lt;res&gt;&amp;&amp; \&lt;/res&gt;&lt;br /&gt; cmd2 &lt;res&gt;&amp;&amp; \&lt;/res&gt;&lt;br /&gt; cmd3 &lt;res&gt;||&lt;/res&gt; &lt;vardef&gt;RES&lt;/vardef&gt;=&lt;/val&gt;0&lt;/val&gt;;&lt;br /&gt;echo_result &lt;varuse&gt;$RES&lt;/varuse&gt;;&lt;br /&gt;&lt;br /&gt;&lt;vardef&gt;RES&lt;/vardef&gt;=&lt;val&gt;1&lt;/val&gt;;&lt;br /&gt;echo_log &lt;res&gt;"&lt;/res&gt;&lt;val&gt;Log message 2&lt;/val&gt;&lt;res&gt;"&lt;/res&gt;;&lt;br /&gt; cmd1 &lt;res&gt;&amp;&amp; \&lt;/res&gt;&lt;br /&gt; cmd2 &lt;res&gt;&amp;&amp; \&lt;/res&gt;&lt;br /&gt; cmd3 &lt;res&gt;||&lt;/res&gt; &lt;vardef&gt;RES&lt;/vardef&gt;=&lt;/val&gt;0&lt;/val&gt;;&lt;br /&gt;echo_result &lt;varuse&gt;$RES&lt;/varuse&gt;;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;As the result we could see:&lt;br /&gt;&lt;code&gt;Log message 1.....................[  &lt;font color="#00C000"&gt;&lt;b&gt;OK&lt;/b&gt;&lt;/font&gt;  ]&lt;br /&gt;Log message 2.....................[&lt;font color="#C00000"&gt;&lt;b&gt;FAILED&lt;/b&gt;&lt;/font&gt;]&lt;br /&gt;&lt;/code&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3722286367705184557-4718204569667982020?l=darkmind2007.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://darkmind2007.blogspot.com/feeds/4718204569667982020/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://darkmind2007.blogspot.com/2008/08/colored-output-to-vt100-eg-linux.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3722286367705184557/posts/default/4718204569667982020'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3722286367705184557/posts/default/4718204569667982020'/><link rel='alternate' type='text/html' href='http://darkmind2007.blogspot.com/2008/08/colored-output-to-vt100-eg-linux.html' title='Colored output to a vt100 (e.g. Linux console)'/><author><name>D@rkmind</name><uri>http://www.blogger.com/profile/07798238268250031219</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3722286367705184557.post-4515814302142536914</id><published>2008-07-19T16:16:00.009+04:00</published><updated>2008-07-19T16:25:16.502+04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='network'/><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><category scheme='http://www.blogger.com/atom/ns#' term='knowledge'/><category scheme='http://www.blogger.com/atom/ns#' term='samba'/><title type='text'>Guest access to a Samba server</title><content type='html'>Just a little note: I had a problem with guest access to samba server (he always asked username and password, while there were public folders with all permissions). The root of the problem was in the following line in &lt;font class="highlight"&gt;/etc/samba/smb.conf&lt;/font&gt;:&lt;br /&gt;&lt;br /&gt;&lt;i&gt;security = &lt;b&gt;user&lt;/b&gt;&lt;/i&gt;&lt;br /&gt;&lt;br /&gt;To have a guest account enabled change this line to:&lt;br /&gt;&lt;br /&gt;&lt;i&gt;security = &lt;b&gt;share&lt;/b&gt;&lt;/i&gt;&lt;br /&gt;&lt;br /&gt;P.S. Stolen from &lt;a href="http://www.opennet.ru/openforum/vsluhforumID1/40838.html"&gt;opennet.ru&lt;/a&gt; :)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3722286367705184557-4515814302142536914?l=darkmind2007.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://darkmind2007.blogspot.com/feeds/4515814302142536914/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://darkmind2007.blogspot.com/2008/07/guest-access-to-samba-server.html#comment-form' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3722286367705184557/posts/default/4515814302142536914'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3722286367705184557/posts/default/4515814302142536914'/><link rel='alternate' type='text/html' href='http://darkmind2007.blogspot.com/2008/07/guest-access-to-samba-server.html' title='Guest access to a Samba server'/><author><name>D@rkmind</name><uri>http://www.blogger.com/profile/07798238268250031219</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3722286367705184557.post-7480453460404130848</id><published>2008-07-19T15:28:00.002+04:00</published><updated>2008-07-19T15:42:11.600+04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='bat'/><category scheme='http://www.blogger.com/atom/ns#' term='cmd'/><category scheme='http://www.blogger.com/atom/ns#' term='experience'/><title type='text'>Win cmd: copy only required extension</title><content type='html'>Let's imagine we have a directory structure with photos (jpg) and videos. Now we have to extract only photos, but save directory structure (photo albums). The following cmd command could be useful:&lt;br /&gt;&lt;br /&gt;&gt; xcopy /E /I /Y Albums\*.jpg OnlyPhotos&lt;br /&gt;&lt;br /&gt;This will create directory OnlyPhotos which is copy of Albums, but contains only *.jpg files.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3722286367705184557-7480453460404130848?l=darkmind2007.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://darkmind2007.blogspot.com/feeds/7480453460404130848/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://darkmind2007.blogspot.com/2008/07/win-cmd-copy-only-required-extension.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3722286367705184557/posts/default/7480453460404130848'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3722286367705184557/posts/default/7480453460404130848'/><link rel='alternate' type='text/html' href='http://darkmind2007.blogspot.com/2008/07/win-cmd-copy-only-required-extension.html' title='Win cmd: copy only required extension'/><author><name>D@rkmind</name><uri>http://www.blogger.com/profile/07798238268250031219</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3722286367705184557.post-1033672401607618542</id><published>2008-07-19T14:20:00.007+04:00</published><updated>2008-09-14T23:08:02.410+04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='regex'/><category scheme='http://www.blogger.com/atom/ns#' term='experience'/><category scheme='http://www.blogger.com/atom/ns#' term='regular expressions'/><title type='text'>RegEx: Alternative lazy operator</title><content type='html'>If we, for example, want to get the first directory name by means of regular expressions, we probably will use lazy operator "&lt;font class="highlight"&gt;*?&lt;/font&gt;" to find all symbols before the first entry of '/':&lt;br /&gt;&lt;code&gt;&lt;font color="#FF0000"&gt;&lt;b&gt;t2/&lt;/b&gt;&lt;/font&gt;dir1/file1.txt&lt;br /&gt;&lt;font color="#FF0000"&gt;&lt;b&gt;t2/&lt;/b&gt;&lt;/font&gt;dir1/file2.txt&lt;br /&gt;&lt;font color="#FF0000"&gt;&lt;b&gt;t2/&lt;/b&gt;&lt;/font&gt;test.txt&lt;br /&gt;&lt;font color="#FF0000"&gt;&lt;b&gt;t2/&lt;/b&gt;&lt;/font&gt;new.txt&lt;br /&gt;&lt;br /&gt;^.*?/&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;But for unknown reasons, &lt;font class="highlight"&gt;sed&lt;/font&gt; doesn't know what is lazy operator and cuts all symbols until the last '/'. So, in this case we can use the following alternative:&lt;br /&gt;&lt;code&gt;$ find t2 -type f | sed -r "&lt;font class="highlight"&gt;s#^[^/]*##&lt;/font&gt;"&lt;br /&gt;/dir1/file1.txt&lt;br /&gt;/dir1/file2.txt&lt;br /&gt;/test.txt&lt;br /&gt;/new.txt&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;This expression will search for any number of symbols before the first '/' (this might be any other symbol. So, instead of:&lt;br /&gt;&lt;br /&gt;.*?&lt;font class="highlight"&gt;&amp;lt;MY_SUMBOL&amp;gt;&lt;/font&gt;&lt;br /&gt;&lt;br /&gt;we can use&lt;br /&gt;&lt;br /&gt;[^&lt;font class="highlight"&gt;&amp;lt;MY_SUMBOL&amp;gt;&lt;/font&gt;]*&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3722286367705184557-1033672401607618542?l=darkmind2007.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://darkmind2007.blogspot.com/feeds/1033672401607618542/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://darkmind2007.blogspot.com/2008/07/regex-alternative-lazy-operator.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3722286367705184557/posts/default/1033672401607618542'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3722286367705184557/posts/default/1033672401607618542'/><link rel='alternate' type='text/html' href='http://darkmind2007.blogspot.com/2008/07/regex-alternative-lazy-operator.html' title='RegEx: Alternative lazy operator'/><author><name>D@rkmind</name><uri>http://www.blogger.com/profile/07798238268250031219</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3722286367705184557.post-391719215570899623</id><published>2008-07-08T14:29:00.013+04:00</published><updated>2008-07-08T16:31:55.087+04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='VBA'/><category scheme='http://www.blogger.com/atom/ns#' term='knowledge'/><category scheme='http://www.blogger.com/atom/ns#' term='howto'/><category scheme='http://www.blogger.com/atom/ns#' term='experience'/><title type='text'>VBA: How to extract unique values from cells range</title><content type='html'>Sometimes it's very useful to obtain all unique values from column, for example, into array. The first way is to look through all the cells in range and copy their values to an array, checking existence. Another way is to add each value to a special VBA object called Collection. As I understood from an example, this object will raise exception if next value already exists in the collection (and the script will handle this exception and continue). This method leaves existence checking to VBA.&lt;br /&gt;But there's the third way - leave all of the work to Excel's filter. The algorithm is:&lt;br /&gt;&lt;ol&gt;&lt;li&gt;Find enough empty place in the worksheet&lt;/li&gt;&lt;br /&gt;&lt;li&gt;Apply advanced filter (which will copy unique value to the given range)&lt;/li&gt;&lt;br /&gt;&lt;li&gt;Copy all values to an array&lt;/li&gt;&lt;br /&gt;&lt;li&gt;Clear copied values and cells formatting&lt;/li&gt;&lt;/ol&gt;&lt;br /&gt;So, let's assume we have the following table&lt;br /&gt;&lt;TABLE border="1"&gt;&lt;TR&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&lt;b&gt;A&lt;/b&gt;&lt;/TD&gt;&lt;TD&gt;&lt;b&gt;B&lt;/b&gt;&lt;/TD&gt;&lt;TD&gt;&lt;b&gt;C&lt;/b&gt;&lt;/TD&gt;&lt;TD&gt;&lt;b&gt;D&lt;/b&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;b&gt;1&lt;/b&gt;&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;a&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;b&gt;2&lt;/b&gt;&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;b&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;b&gt;3&lt;/b&gt;&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;c&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;b&gt;4&lt;/b&gt;&lt;/TD&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;TD&gt;c&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;b&gt;5&lt;/b&gt;&lt;/TD&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;TD&gt;d&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;/TABLE&gt;&lt;br /&gt;And we want to find all unique values for column A. Also, we have empty place next to the table. In this case we can use the follwing VBA code:&lt;br /&gt;&lt;br /&gt;&lt;code class="VBA"&gt;&lt;res&gt;Dim&lt;/res&gt; ColA_Values() &lt;res&gt;As Integer&lt;/res&gt;&lt;br /&gt;&lt;comment&gt;' select the required range and apply filter&lt;/comment&gt;&lt;br /&gt;Range("A1:A5").Select&lt;br /&gt;Selection.AdvancedFilter Action:=xlFilterCopy, CopyToRange:=[D1], Unique:=&lt;res&gt;True&lt;/res&gt;&lt;br /&gt;&lt;br /&gt;&lt;comment&gt;' obtain number of unique values (number of rows in column D)&lt;/comment&gt;&lt;br /&gt;&lt;res&gt;Dim&lt;/res&gt; LastRow &lt;res&gt;As Long&lt;/res&gt;&lt;br /&gt;LastRow = ActiveSheet.Cells(ActiveSheet.Rows.Count, "D").End(xlUp).Row&lt;br /&gt;&lt;br /&gt;&lt;comment&gt;' copy values to the array&lt;/comment&gt;&lt;br /&gt;&lt;res&gt;ReDim&lt;/res&gt; ColA_Values(LastRow)&lt;br /&gt;&lt;res&gt;Dim&lt;/res&gt; i &lt;res&gt;As Integer&lt;/res&gt;&lt;br /&gt;&lt;res&gt;For&lt;/res&gt; i = 1 &lt;res&gt;To&lt;/res&gt; LastRow&lt;br /&gt;   ColA_Values(i) = ActiveSheet.Cells(i, "D").Value&lt;br /&gt;&lt;res&gt;Next&lt;/res&gt;&lt;br /&gt;&lt;br /&gt;&lt;comment&gt;' clear temporary values and formatting&lt;/comment&gt;&lt;br /&gt;Range("D1:D" + &lt;res&gt;CStr&lt;/res&gt;(LastRow)).Select&lt;br /&gt;Selection.Clear&lt;br /&gt;&lt;/code&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3722286367705184557-391719215570899623?l=darkmind2007.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://darkmind2007.blogspot.com/feeds/391719215570899623/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://darkmind2007.blogspot.com/2008/07/vba-how-to-extract-unique-values-from.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3722286367705184557/posts/default/391719215570899623'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3722286367705184557/posts/default/391719215570899623'/><link rel='alternate' type='text/html' href='http://darkmind2007.blogspot.com/2008/07/vba-how-to-extract-unique-values-from.html' title='VBA: How to extract unique values from cells range'/><author><name>D@rkmind</name><uri>http://www.blogger.com/profile/07798238268250031219</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3722286367705184557.post-6852764884367923215</id><published>2008-07-07T18:56:00.003+04:00</published><updated>2008-08-29T00:00:58.549+04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='VBA'/><category scheme='http://www.blogger.com/atom/ns#' term='knowledge'/><title type='text'>VBA: Number of rows in a column and vice versa</title><content type='html'>Found this trick &lt;a href="http://www.rondebruin.nl/last.htm"&gt;here&lt;/a&gt; and modified a bit. These two functions can be used to determine number of cells in a particular column or a row of an Excel data sheet.&lt;br /&gt;&lt;br /&gt;&lt;code class="VBA"&gt;&lt;res&gt;Function&lt;/res&gt; ColsInRow(Row) &lt;res&gt;As Long&lt;/res&gt;&lt;br /&gt;   ColsInRow = ActiveSheet.Cells(Row, ActiveSheet.Columns.Count).End(xlToLeft).Column&lt;br /&gt;&lt;res&gt;End Function&lt;/res&gt;&lt;br /&gt;&lt;br /&gt;&lt;res&gt;Function&lt;/res&gt; RowsInCol(Col) &lt;res&gt;As Long&lt;/res&gt;&lt;br /&gt;   RowsInCol = ActiveSheet.Cells(ActiveSheet.Rows.Count, Col).End(xlUp).Row&lt;br /&gt;&lt;res&gt;End Function&lt;/res&gt;&lt;/code&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3722286367705184557-6852764884367923215?l=darkmind2007.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://darkmind2007.blogspot.com/feeds/6852764884367923215/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://darkmind2007.blogspot.com/2008/07/vba-number-of-rows-in-column-and-vice.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3722286367705184557/posts/default/6852764884367923215'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3722286367705184557/posts/default/6852764884367923215'/><link rel='alternate' type='text/html' href='http://darkmind2007.blogspot.com/2008/07/vba-number-of-rows-in-column-and-vice.html' title='VBA: Number of rows in a column and vice versa'/><author><name>D@rkmind</name><uri>http://www.blogger.com/profile/07798238268250031219</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3722286367705184557.post-890409774755123383</id><published>2008-05-12T15:15:00.006+04:00</published><updated>2008-09-14T23:08:36.932+04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='knowledge'/><category scheme='http://www.blogger.com/atom/ns#' term='GNU'/><category scheme='http://www.blogger.com/atom/ns#' term='howto'/><category scheme='http://www.blogger.com/atom/ns#' term='make'/><title type='text'>lastword function in GNU Make</title><content type='html'>If you saw the previous post, you would notice that for &lt;font class="highlight"&gt;MAKEFILE_LIST&lt;/font&gt; variable it's better to use &lt;font class="highlight"&gt;lastword&lt;/font&gt; function (because this variable could contain more then one file name, but we need the last one). The problem is that some versions of GNU Make don't support this function. Another way to obtain the same result can be found &lt;a href="http://www.gnu.org/software/automake/manual/make/Text-Functions.html#Text-Functions"&gt;here&lt;/a&gt;.&lt;br /&gt;&lt;code class="MAKE"&gt;&lt;var&gt;$(&lt;/var&gt;&lt;func&gt;word&lt;/func&gt; &lt;var&gt;$(&lt;/var&gt;&lt;func&gt;words&lt;/func&gt; text&lt;var&gt;),&lt;/var&gt;text&lt;var&gt;)&lt;/var&gt;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;instead of&lt;br /&gt;&lt;code class="MAKE"&gt;&lt;var&gt;$(&lt;/var&gt;&lt;func&gt;lastword&lt;/func&gt; text&lt;var&gt;)&lt;/var&gt;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;Longer, but it works.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3722286367705184557-890409774755123383?l=darkmind2007.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://darkmind2007.blogspot.com/feeds/890409774755123383/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://darkmind2007.blogspot.com/2008/05/lastword-function-in-gnu-make.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3722286367705184557/posts/default/890409774755123383'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3722286367705184557/posts/default/890409774755123383'/><link rel='alternate' type='text/html' href='http://darkmind2007.blogspot.com/2008/05/lastword-function-in-gnu-make.html' title='lastword function in GNU Make'/><author><name>D@rkmind</name><uri>http://www.blogger.com/profile/07798238268250031219</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3722286367705184557.post-8556855588424564719</id><published>2008-04-29T17:07:00.011+04:00</published><updated>2008-09-14T23:09:07.547+04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='knowledge'/><category scheme='http://www.blogger.com/atom/ns#' term='GNU'/><category scheme='http://www.blogger.com/atom/ns#' term='experience'/><category scheme='http://www.blogger.com/atom/ns#' term='make'/><title type='text'>How to know makefile name and targets</title><content type='html'>In lots of cases I had to know the name of the current makefile and targets, Make was called with. I expected that solution of these problems should be in special variables, however I couldn't find such variables even in GNU Make reference.&lt;br /&gt;&lt;br /&gt;Why do I need to know such information on runtime? So, lets start with name of the current makefile. &lt;br /&gt;&lt;br /&gt;&lt;font class="SubHeader"&gt;MAKEFILE_LIST - list of the currently used makefiles&lt;/font&gt;&lt;br /&gt;&lt;br /&gt;Imagine that we have to do recursive call of &lt;font class="highlight"&gt;Make&lt;/font&gt; to call different targets, with different variables. For example, I have a number of targets with the same actions, but with different paths. And I want to have one target that do these actions and another targets which call the first one with different &lt;i&gt;MY_PATH&lt;/i&gt; values. In common case, the code will be:&lt;br /&gt;&lt;code class="MAKE"&gt;&lt;var&gt;all:&lt;/var&gt; t1 t2&lt;br /&gt;&lt;br /&gt;&lt;var&gt;t1:&lt;/var&gt;&lt;br /&gt;        &lt;var&gt;$(MAKE)&lt;/var&gt; MY_PATH=~/component1 build&lt;br /&gt;&lt;var&gt;t2:&lt;/var&gt;&lt;br /&gt;        &lt;var&gt;$(MAKE)&lt;/var&gt; MY_PATH=~/component2 build&lt;br /&gt;&lt;var&gt;build:&lt;/var&gt;&lt;br /&gt;        &lt;var&gt;$(CC)&lt;/var&gt; -o &lt;var&gt;$(MY_PATH)&lt;/var&gt;/binary source.c&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;It's working. But our makefile could be called other than &lt;i&gt;"makefile"&lt;/i&gt;. My solution is predefined variable &lt;font class="highlight"&gt;MAKEFILE_LIST&lt;/font&gt;. It contains the list of makefiles used for build.&lt;br /&gt;&lt;code class="MAKE"&gt;&lt;var&gt;all:&lt;/var&gt; t1 t2&lt;br /&gt;&lt;br /&gt;&lt;var&gt;t1:&lt;/var&gt;&lt;br /&gt;        &lt;var&gt;$(MAKE)&lt;/var&gt; -f &lt;var&gt;$(MAKEFILE_LIST)&lt;/var&gt; MY_PATH=~/component1 build&lt;br /&gt;&lt;var&gt;t2:&lt;/var&gt;&lt;br /&gt;        &lt;var&gt;$(MAKE)&lt;/var&gt; -f &lt;var&gt;$(MAKEFILE_LIST)&lt;/var&gt; MY_PATH=~/component2 build&lt;br /&gt;&lt;var&gt;build:&lt;/var&gt;&lt;br /&gt;        &lt;var&gt;$(CC)&lt;/var&gt; -o &lt;var&gt;$(MY_PATH)&lt;/var&gt;/binary source.c&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;I've tested this code in different versions of Linux, MacOS and even under Cygwin. May be I'll find another, simpler way for recursive call, but at this moment I have only this one. &lt;br /&gt;&lt;br /&gt;&lt;font class="SubHeader"&gt;MAKECMDGOALS - list of the specified targets&lt;/font&gt;&lt;br /&gt;&lt;br /&gt;Sometimes it happens, that different targets require different set of variables, defined by user. For instance, &lt;font class="highlight"&gt;make src&lt;/font&gt; should export a repository tree to the current directory (prepare sources to build) and thus require a repository address and a revision. Also, &lt;font class="highlight"&gt;make build&lt;/font&gt; should build these sources. May it require ARCH variable, which means target architecture. So, it's normal to check variables existence, but it's nonsense to make a user define architecture while exporting repository tree ;) That's why we should check only those variable, which are required by the selected target.&lt;br /&gt;I found predefined variable &lt;font class="highlight"&gt;MAKECMDGOALS&lt;/font&gt; investigating output of command &lt;font class="highlight"&gt;$(warning $(.VARIABLES))&lt;/font&gt; (see the GNU Make reference). In the end, let's try to write a little make, illustrating usage of this variable:&lt;br /&gt;&lt;code class="MAKE"&gt;&lt;var&gt;ALL&lt;/var&gt;=src build&lt;br /&gt;&lt;br /&gt;&lt;var&gt;ifeq&lt;/var&gt; (&lt;var&gt;$(MAKECMDGOALS)&lt;/var&gt;,)&lt;br /&gt;   &lt;var&gt;MAKECMDGOALS&lt;/var&gt;=&lt;var&gt;$(ALL)&lt;/var&gt;&lt;br /&gt;&lt;var&gt;endif&lt;/var&gt;&lt;br /&gt;&lt;br /&gt;&lt;var&gt;ifneq&lt;/var&gt; (&lt;var&gt;$(&lt;/var&gt;&lt;func&gt;filter&lt;/func&gt; &lt;var&gt;$(MAKECMDGOALS), src)&lt;/var&gt;,)&lt;br /&gt;   &lt;var&gt;ifeq&lt;/var&gt; (&lt;var&gt;$(REV)&lt;/var&gt;,)&lt;br /&gt;      &lt;var&gt;$(&lt;/var&gt;&lt;func&gt;error&lt;/func&gt; &lt;var&gt;REV variable should be defined)&lt;/var&gt;&lt;br /&gt;   &lt;var&gt;endif&lt;/var&gt;&lt;br /&gt;   &lt;var&gt;ifeq&lt;/var&gt; (&lt;var&gt;$(SVN)&lt;/var&gt;,)&lt;br /&gt;      &lt;var&gt;$(&lt;/var&gt;&lt;func&gt;error&lt;/func&gt; &lt;var&gt;SVN variable should be defined)&lt;/var&gt;&lt;br /&gt;   &lt;var&gt;endif&lt;/var&gt;&lt;br /&gt;&lt;var&gt;endif&lt;/var&gt;&lt;br /&gt;&lt;var&gt;ifneq&lt;/var&gt; (&lt;var&gt;$(&lt;/var&gt;&lt;func&gt;filter&lt;/func&gt; &lt;var&gt;$(MAKECMDGOALS), build)&lt;/var&gt;,)&lt;br /&gt;   &lt;var&gt;ifeq&lt;/var&gt; (&lt;var&gt;$(ARCH)&lt;/var&gt;,)&lt;br /&gt;      &lt;var&gt;$(&lt;/var&gt;&lt;func&gt;error&lt;/func&gt; &lt;var&gt;ARCH variable should be defined)&lt;/var&gt;&lt;br /&gt;   &lt;var&gt;endif&lt;/var&gt;&lt;br /&gt;&lt;var&gt;endif&lt;/var&gt;&lt;br /&gt;&lt;br /&gt;&lt;var&gt;all: $(ALL)&lt;/var&gt;&lt;br /&gt;&lt;br /&gt;&lt;var&gt;src:&lt;/var&gt;&lt;br /&gt;        svn export -r &lt;var&gt;$(REV) $(SVN)&lt;/var&gt;&lt;br /&gt;&lt;br /&gt;&lt;var&gt;build:&lt;/var&gt;&lt;br /&gt;        gcc -march=&lt;var&gt;$(ARCH)&lt;/var&gt; test.c -o test&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;UPD:&lt;/b&gt; I missed this page, because thought that it's not the variable I need: &lt;a href="http://www.gnu.org/software/automake/manual/make/MAKEFILE_005fLIST-Variable.html"&gt;http://www.gnu.org/software/automake/manual/make/MAKEFILE_005fLIST-Variable.html&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3722286367705184557-8556855588424564719?l=darkmind2007.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://darkmind2007.blogspot.com/feeds/8556855588424564719/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://darkmind2007.blogspot.com/2008/04/how-to-know-makefile-name-and-targets.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3722286367705184557/posts/default/8556855588424564719'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3722286367705184557/posts/default/8556855588424564719'/><link rel='alternate' type='text/html' href='http://darkmind2007.blogspot.com/2008/04/how-to-know-makefile-name-and-targets.html' title='How to know makefile name and targets'/><author><name>D@rkmind</name><uri>http://www.blogger.com/profile/07798238268250031219</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3722286367705184557.post-1517890275579380759</id><published>2008-04-27T12:11:00.016+04:00</published><updated>2008-04-29T23:17:23.872+04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='PHP'/><category scheme='http://www.blogger.com/atom/ns#' term='HTTP'/><category scheme='http://www.blogger.com/atom/ns#' term='howto'/><category scheme='http://www.blogger.com/atom/ns#' term='socket'/><title type='text'>HTTP query from PHP</title><content type='html'>Here is a simple PHP script, which sends http request and reads output of the server. First of all it uses HTTP header to read amount of incoming data. But if there's no &lt;font class="highlight"&gt;Content-Length&lt;/font&gt; field, the script reads until EOF.&lt;br /&gt;&lt;br /&gt;&lt;code class="PHP"&gt;&lt;symb&gt;&amp;lt;?&lt;/symb&gt;&lt;br /&gt;   &lt;comment&gt;// just kind of query to Google's image search&lt;/comment&gt;&lt;br /&gt;   &lt;res&gt;$&lt;/res&gt;&lt;varfunc&gt;Artist&lt;/varfunc&gt; &lt;res&gt;=&lt;/res&gt; "&lt;val&gt;Evanescence&lt;/val&gt;";&lt;br /&gt;   &lt;res&gt;$&lt;/res&gt;&lt;varfunc&gt;Album&lt;/varfunc&gt; &lt;res&gt;=&lt;/res&gt; "&lt;val&gt;Fallen&lt;/val&gt;";&lt;br /&gt;&lt;br /&gt;   &lt;res&gt;$&lt;/res&gt;&lt;varfunc&gt;query&lt;/varfunc&gt; &lt;res&gt;=&lt;/res&gt; &lt;varfunc&gt;rawurlencode&lt;/varfunc&gt;&lt;symb&gt;(&lt;/symb&gt;"&lt;val&gt;\"&lt;/val&gt;"&lt;res&gt;.$&lt;/res&gt;&lt;varfunc&gt;Artist&lt;/varfunc&gt;&lt;res&gt;.&lt;/res&gt;"&lt;val&gt;\" \"&lt;/val&gt;"&lt;res&gt;.$&lt;/res&gt;&lt;varfunc&gt;Album&lt;/varfunc&gt;&lt;res&gt;.&lt;/res&gt;"&lt;val&gt;\" Cover&lt;/val&gt;"&lt;symb&gt;)&lt;/symb&gt;;&lt;br /&gt;   &lt;comment&gt;// encode part of url (query string)&lt;/comment&gt;&lt;br /&gt;   &lt;res&gt;$&lt;/res&gt;&lt;varfunc&gt;query&lt;/varfunc&gt; &lt;res&gt;=&lt;/res&gt; "&lt;val&gt;/images?gbv=2&amp;hl=ru&amp;newwindow=1&amp;q=&lt;/val&gt;"&lt;res&gt;.$&lt;/res&gt;&lt;varfunc&gt;query&lt;/varfunc&gt;;&lt;br /&gt;   &lt;comment&gt;// add HTTP request syntax&lt;/comment&gt;&lt;br /&gt;   &lt;res&gt;$&lt;/res&gt;&lt;varfunc&gt;query&lt;/varfunc&gt; &lt;res&gt;=&lt;/res&gt; "&lt;val&gt;GET&lt;/val&gt; "&lt;res&gt;.$&lt;/res&gt;&lt;varfunc&gt;query&lt;/varfunc&gt;&lt;res&gt;.&lt;/res&gt;" &lt;val&gt;HTTP/1.1&lt;/val&gt;&lt;symb&gt;\r\n\r\n&lt;/symb&gt;";&lt;br /&gt;&lt;br /&gt;   &lt;comment&gt;// open socket&lt;/comment&gt;&lt;br /&gt;   &lt;res&gt;$&lt;/res&gt;&lt;varfunc&gt;google_sock&lt;/varfunc&gt; &lt;res&gt;=&lt;/res&gt; &lt;varfunc&gt;fsockopen&lt;/varfunc&gt;&lt;symb&gt;(&lt;/symb&gt;&lt;varfunc&gt;gethostbyname&lt;/varfunc&gt;&lt;symb&gt;(&lt;/symb&gt;"&lt;val&gt;images.google.ru&lt;/val&gt;"&lt;symb&gt;)&lt;/symb&gt; ,&lt;val&gt;80&lt;/val&gt;, &lt;res&gt;$&lt;/res&gt;&lt;varfunc&gt;errno&lt;/varfunc&gt;, &lt;res&gt;$&lt;/res&gt;&lt;varfunc&gt;errstr&lt;/varfunc&gt;, &lt;val&gt;30&lt;/val&gt;&lt;symb&gt;)&lt;/symb&gt;;&lt;br /&gt;   &lt;res&gt;if&lt;/res&gt;&lt;symb&gt;(&lt;/symb&gt;&lt;res&gt;!$&lt;/res&gt;&lt;varfunc&gt;google_sock&lt;/varfunc&gt;&lt;symb&gt;)&lt;/symb&gt;&lt;br /&gt;      &lt;varfunc&gt;die&lt;/varfunc&gt;&lt;symb&gt;(&lt;/symb&gt;"&lt;val&gt;Couldn't connect to images.google.com&lt;/val&gt;"&lt;symb&gt;)&lt;/symb&gt;;&lt;br /&gt;&lt;br /&gt;   &lt;comment&gt;// send the query&lt;/comment&gt;&lt;br /&gt;   &lt;varfunc&gt;fputs&lt;/varfunc&gt;&lt;symb&gt;(&lt;/symb&gt;&lt;res&gt;$&lt;/res&gt;&lt;varfunc&gt;google_sock&lt;/varfunc&gt;, &lt;res&gt;$&lt;/res&gt;&lt;varfunc&gt;query&lt;/varfunc&gt;&lt;symb&gt;)&lt;/symb&gt;;&lt;br /&gt;&lt;br /&gt;   &lt;res&gt;$&lt;/res&gt;&lt;varfunc&gt;html&lt;/varfunc&gt; &lt;res&gt;=&lt;/res&gt; ""; &lt;comment&gt;// clear html code&lt;/comment&gt;&lt;br /&gt;   &lt;res&gt;$&lt;/res&gt;&lt;varfunc&gt;html_length&lt;/varfunc&gt; &lt;res&gt;=&lt;/res&gt; &lt;val&gt;0&lt;/val&gt;; &lt;comment&gt;// length of html&lt;/comment&gt;&lt;br /&gt;   &lt;res&gt;$&lt;/res&gt;&lt;varfunc&gt;header_line&lt;/varfunc&gt; &lt;res&gt;=&lt;/res&gt; ""; &lt;comment&gt;// line of HTTP header&lt;/comment&gt;&lt;br /&gt;   &lt;res&gt;do&lt;/res&gt;&lt;br /&gt;   &lt;symb&gt;{&lt;/symb&gt;&lt;br /&gt;      &lt;comment&gt;// get next line of HTTP header&lt;/comment&gt;&lt;br /&gt;      &lt;varfunc&gt;fscanf&lt;/varfunc&gt;&lt;symb&gt;(&lt;/symb&gt;&lt;res&gt;$&lt;/res&gt;&lt;varfunc&gt;google_sock&lt;/varfunc&gt;, "&lt;val&gt;%[^&lt;/val&gt;&lt;symb&gt;\n&lt;/symb&gt;&lt;val&gt;]&lt;/val&gt;", &lt;res&gt;$&lt;/res&gt;&lt;varfunc&gt;header_line&lt;/varfunc&gt;&lt;symb&gt;)&lt;/symb&gt;;&lt;br /&gt;      &lt;comment&gt;// remove symbols like \r&lt;/comment&gt;&lt;br /&gt;      &lt;res&gt;$&lt;/res&gt;&lt;varfunc&gt;header_line&lt;/varfunc&gt; &lt;res&gt;=&lt;/res&gt; &lt;varfunc&gt;trim&lt;/varfunc&gt;&lt;symb&gt;(&lt;/symb&gt;&lt;res&gt;$&lt;/res&gt;&lt;varfunc&gt;header_line&lt;/varfunc&gt;&lt;symb&gt;)&lt;/symb&gt;;&lt;br /&gt;&lt;br /&gt;      &lt;res&gt;$&lt;/res&gt;&lt;varfunc&gt;header_name&lt;/varfunc&gt; &lt;res&gt;=&lt;/res&gt; &lt;varfunc&gt;trim&lt;/varfunc&gt;&lt;symb&gt;(&lt;/symb&gt;&lt;varfunc&gt;strtok&lt;/varfunc&gt;&lt;symb&gt;(&lt;/symb&gt;&lt;res&gt;$&lt;/res&gt;&lt;varfunc&gt;header_line&lt;/varfunc&gt;, "&lt;val&gt;:&lt;/val&gt;"&lt;symb&gt;))&lt;/symb&gt;;&lt;br /&gt;      &lt;res&gt;if&lt;/res&gt;&lt;symb&gt;(&lt;/symb&gt;&lt;res&gt;$&lt;/res&gt;&lt;varfunc&gt;header_name&lt;/varfunc&gt; &lt;res&gt;==&lt;/res&gt; "&lt;val&gt;Content-Length&lt;/val&gt;"&lt;symb&gt;)&lt;/symb&gt;&lt;br /&gt;         &lt;res&gt;$&lt;/res&gt;&lt;varfunc&gt;html_length&lt;/varfunc&gt; &lt;res&gt;=&lt;/res&gt; &lt;varfunc&gt;strtok&lt;/varfunc&gt;&lt;symb&gt;(&lt;/symb&gt;"&lt;val&gt;:&lt;/val&gt;"&lt;symb&gt;)&lt;/symb&gt;;&lt;br /&gt;   &lt;symb&gt;}&lt;/symb&gt;&lt;br /&gt;   &lt;res&gt;while&lt;/res&gt;&lt;symb&gt;(&lt;/symb&gt;&lt;res&gt;$&lt;/res&gt;&lt;varfunc&gt;header_line&lt;/varfunc&gt; &lt;res&gt;!=&lt;/res&gt; ""&lt;symb&gt;)&lt;/symb&gt;;&lt;br /&gt;&lt;br /&gt;   &lt;res&gt;if&lt;/res&gt;&lt;symb&gt;(&lt;/symb&gt;&lt;res&gt;$&lt;/res&gt;&lt;varfunc&gt;html_length&lt;/varfunc&gt; &lt;res&gt;&amp;gt;&lt;/res&gt; &lt;val&gt;0&lt;/val&gt;&lt;symb&gt;)&lt;/symb&gt;&lt;br /&gt;      &lt;res&gt;$&lt;/res&gt;&lt;varfunc&gt;html&lt;/varfunc&gt; &lt;res&gt;=&lt;/res&gt; &lt;varfunc&gt;fread&lt;/varfunc&gt;&lt;symb&gt;(&lt;/symb&gt;&lt;res&gt;$&lt;/res&gt;&lt;varfunc&gt;google_sock&lt;/varfunc&gt;, &lt;res&gt;$&lt;/res&gt;&lt;varfunc&gt;html_length&lt;/varfunc&gt;&lt;symb&gt;)&lt;/symb&gt;;&lt;br /&gt;   &lt;res&gt;else&lt;/res&gt;&lt;br /&gt;   &lt;symb&gt;{&lt;/symb&gt;&lt;br /&gt;      &lt;res&gt;while&lt;/res&gt;&lt;symb&gt;(&lt;/symb&gt; &lt;res&gt;!&lt;/res&gt;&lt;varfunc&gt;feof&lt;/varfunc&gt;&lt;symb&gt;(&lt;/symb&gt;&lt;res&gt;$&lt;/res&gt;&lt;varfunc&gt;google_sock&lt;/varfunc&gt;&lt;symb&gt;) )&lt;/symb&gt;&lt;br /&gt;         &lt;res&gt;$&lt;/res&gt;&lt;varfunc&gt;html&lt;/varfunc&gt; &lt;res&gt;.=&lt;/res&gt; &lt;varfunc&gt;fread&lt;/varfunc&gt;&lt;symb&gt;(&lt;/symb&gt;&lt;res&gt;$&lt;/res&gt;&lt;varfunc&gt;google_sock&lt;/varfunc&gt;, &lt;val&gt;4096&lt;/val&gt;&lt;symb&gt;)&lt;/symb&gt;;&lt;br /&gt;   &lt;symb&gt;}&lt;/symb&gt;&lt;br /&gt;&lt;br /&gt;   &lt;varfunc&gt;fclose&lt;/varfunc&gt;&lt;symb&gt;(&lt;/symb&gt;&lt;res&gt;$&lt;/res&gt;&lt;varfunc&gt;google_sock&lt;/varfunc&gt;&lt;symb&gt;)&lt;/symb&gt;;&lt;br /&gt;&lt;br /&gt;   &lt;varfunc&gt;echo&lt;/varfunc&gt; &lt;res&gt;$&lt;/res&gt;&lt;varfunc&gt;html&lt;/varfunc&gt;;&lt;br /&gt;&lt;symb&gt;?&amp;gt;&lt;/symb&gt;&lt;/code&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3722286367705184557-1517890275579380759?l=darkmind2007.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://darkmind2007.blogspot.com/feeds/1517890275579380759/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://darkmind2007.blogspot.com/2008/04/http-query-from-php.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3722286367705184557/posts/default/1517890275579380759'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3722286367705184557/posts/default/1517890275579380759'/><link rel='alternate' type='text/html' href='http://darkmind2007.blogspot.com/2008/04/http-query-from-php.html' title='HTTP query from PHP'/><author><name>D@rkmind</name><uri>http://www.blogger.com/profile/07798238268250031219</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3722286367705184557.post-6685561204899493273</id><published>2008-04-22T10:56:00.008+04:00</published><updated>2008-04-22T11:17:12.588+04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Vim'/><category scheme='http://www.blogger.com/atom/ns#' term='knowledge'/><category scheme='http://www.blogger.com/atom/ns#' term='howto'/><title type='text'>Vim syntax highlighting</title><content type='html'>In most configurations, by default, Vim highlights language or file specific syntax (if not, try using &lt;font class="highlight"&gt;:syntax on&lt;/font&gt;. But it uses file's name or its extension to determine required syntax configuration. It's very comfortable, but in some cases we have to give a name to a file, which doesn't correspond contents of the file. Therefore, Vim can't correctly determine configuration. To do it manually one can use &lt;font class="highlight"&gt;:set filetype=&amp;lt;...&amp;gt;&lt;/font&gt;&lt;br /&gt;&lt;br /&gt;The list of available syntax highlightings can be found in &lt;font class="highlight"&gt;/usr/share/vim/vim63/syntax&lt;/font&gt;, just look through file names.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3722286367705184557-6685561204899493273?l=darkmind2007.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://darkmind2007.blogspot.com/feeds/6685561204899493273/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://darkmind2007.blogspot.com/2008/04/vim-syntax-highlighting.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3722286367705184557/posts/default/6685561204899493273'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3722286367705184557/posts/default/6685561204899493273'/><link rel='alternate' type='text/html' href='http://darkmind2007.blogspot.com/2008/04/vim-syntax-highlighting.html' title='Vim syntax highlighting'/><author><name>D@rkmind</name><uri>http://www.blogger.com/profile/07798238268250031219</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3722286367705184557.post-2951793162378042101</id><published>2008-04-17T00:02:00.004+04:00</published><updated>2009-02-04T14:40:09.592+03:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='knowledge'/><category scheme='http://www.blogger.com/atom/ns#' term='SVN'/><title type='text'>SVN and EOL style</title><content type='html'>Sometimes it happens that we should checkout or export file from repository with different End-Of-Line styles (0x0D 0x0A for Windows, 0x0A for Unix and 0x0D for MacOS). SVN let's you choose this style on checkout or export. All you need is to set property &lt;b&gt;svn:eol-style=native&lt;/b&gt; and then point out required EOL in command line:&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&amp;gt; svn export --native-eol CRLF &amp;lt;...&amp;gt;  # For Windows&lt;br /&gt;$ svn co --native-eol LF &amp;lt;...&amp;gt;  # For Linux&lt;br /&gt;$ svn export --native-eol CR &amp;lt;...&amp;gt;  # For MacOS&lt;br /&gt;&lt;/code&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3722286367705184557-2951793162378042101?l=darkmind2007.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://darkmind2007.blogspot.com/feeds/2951793162378042101/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://darkmind2007.blogspot.com/2008/04/svn-and-eol-style.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3722286367705184557/posts/default/2951793162378042101'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3722286367705184557/posts/default/2951793162378042101'/><link rel='alternate' type='text/html' href='http://darkmind2007.blogspot.com/2008/04/svn-and-eol-style.html' title='SVN and EOL style'/><author><name>D@rkmind</name><uri>http://www.blogger.com/profile/07798238268250031219</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3722286367705184557.post-7933267690632847007</id><published>2008-04-14T22:53:00.011+04:00</published><updated>2008-08-18T21:55:46.882+04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><category scheme='http://www.blogger.com/atom/ns#' term='BASH'/><category scheme='http://www.blogger.com/atom/ns#' term='investigation'/><category scheme='http://www.blogger.com/atom/ns#' term='shell'/><title type='text'>BASH parameter parsing</title><content type='html'>I always tried to parse parameters, which were fed to my shell script by means of &lt;i&gt;while&lt;/i&gt; loop. But when I was writing me next labwork, I noticed that my lecturer always use &lt;i&gt;for&lt;/i&gt; loop. So I tried to compare speed of these two methods. I wrote the following two sctipts, which just iterate through parameter set:&lt;br /&gt;&lt;br /&gt;&lt;b&gt;test1.sh&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&lt;code class="SH"&gt;&lt;comment&gt;#!/bin/bash&lt;/comment&gt;&lt;br /&gt;&lt;res&gt;for&lt;/res&gt; i &lt;res&gt;in&lt;/res&gt; &lt;varuse&gt;$*&lt;/varuse&gt;&lt;res&gt;; do&lt;/res&gt;&lt;br /&gt;   &lt;vardef&gt;a&lt;/vardef&gt;=&lt;val&gt;0&lt;/val&gt;; &lt;comment&gt;#just to do something&lt;/comment&gt;&lt;br /&gt;&lt;res&gt;done;&lt;/res&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;test2.sh&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&lt;code class="SH"&gt;&lt;comment&gt;#!/bin/bash&lt;/comment&gt;&lt;br /&gt;&lt;res&gt;while [ "&lt;/res&gt;&lt;varuse&gt;$1&lt;/varuse&gt;&lt;res&gt;" != "" ]; do&lt;/res&gt;&lt;br /&gt;   &lt;res&gt;shift&lt;/res&gt;;&lt;br /&gt;   &lt;vardef&gt;a&lt;/res&gt;=&lt;val&gt;0&lt;/val&gt;; &lt;comment&gt;# just to prevent time difference in this action during comparison&lt;/comment&gt;&lt;br /&gt;&lt;res&gt;done&lt;/res&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;After that, I fed 1000 arguments to both scripts and run &lt;i&gt;time&lt;/i&gt; tool:&lt;br /&gt;&lt;br /&gt;&lt;code&gt;$ time ./test1.sh `seq 1 1000`&lt;br /&gt;&lt;br /&gt;real    0m0.177s&lt;br /&gt;user    0m0.162s&lt;br /&gt;sys     0m0.016s&lt;br /&gt;$ time ./test2.sh `seq 1 1000`&lt;br /&gt;&lt;br /&gt;real    0m0.304s&lt;br /&gt;user    0m0.266s&lt;br /&gt;sys     0m0.037s&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Difference is amazing! But I thought that comparison &lt;i&gt;"$1" = ""&lt;/i&gt; in the second script, would take much time, so I wrote the third variant of script:&lt;br /&gt;&lt;br /&gt;&lt;code class="SH"&gt;&lt;comment&gt;#!/bin/bash&lt;/comment&gt;&lt;br /&gt;&lt;res&gt;while [&lt;/res&gt; &lt;varuse&gt;$#&lt;/varuse&gt; &lt;res&gt;-gt&lt;/res&gt; &lt;val&gt;0&lt;/val&gt; &lt;res&gt;]; do&lt;/res&gt;&lt;br /&gt;   &lt;res&gt;shift&lt;/res&gt;;&lt;br /&gt;   &lt;vardef&gt;a&lt;/vardef&gt;=&lt;val&gt;0&lt;/val&gt;;&lt;br /&gt;&lt;res&gt;done&lt;/res&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;run:&lt;br /&gt;&lt;br /&gt;&lt;code&gt;$ time ./test3.sh `seq 1 1000`&lt;br /&gt;&lt;br /&gt;real    0m0.343s&lt;br /&gt;user    0m0.316s&lt;br /&gt;sys     0m0.026s&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Look at this! In case of big number of arguments, it could take more time for shell to count them than just compare strings.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Resume:&lt;/b&gt; Ok, it's great and the first my thought was "forget about &lt;i&gt;while&lt;/i&gt; loop for parameter parsing and use &lt;i&gt;for&lt;/i&gt;", but... But I used to check the next parameter while parsing arguments which show a type of the next parameter (./test1.sh -o output_file). In this case it seems to be hard to use &lt;i&gt;for&lt;/i&gt;. So my opinion is - keep in mind that &lt;i&gt;shift&lt;/i&gt; operator is expensive, but kind of loop depends on current situation. K.I.S.S.! Don't make you code unreadable just to speed up it on ~0.1s :)&lt;br /&gt;&lt;br /&gt;&lt;b&gt;UPD:&lt;/b&gt;&lt;br /&gt;Example with &lt;i&gt;for&lt;/i&gt; doesn't allow us to feed arguments with spaces (like &lt;i&gt;./test1.sh "a b"&lt;/i&gt; or &lt;i&gt;./test1.sh a\ b&lt;/i&gt;)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3722286367705184557-7933267690632847007?l=darkmind2007.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://darkmind2007.blogspot.com/feeds/7933267690632847007/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://darkmind2007.blogspot.com/2008/04/bash-parameter-parsing.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3722286367705184557/posts/default/7933267690632847007'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3722286367705184557/posts/default/7933267690632847007'/><link rel='alternate' type='text/html' href='http://darkmind2007.blogspot.com/2008/04/bash-parameter-parsing.html' title='BASH parameter parsing'/><author><name>D@rkmind</name><uri>http://www.blogger.com/profile/07798238268250031219</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3722286367705184557.post-8506072570492964789</id><published>2008-04-08T00:23:00.003+04:00</published><updated>2008-04-08T00:43:39.353+04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='HTML'/><category scheme='http://www.blogger.com/atom/ns#' term='css'/><title type='text'>Update: Unremovable spaces by means of CSS</title><content type='html'>This is an update for &lt;a href="http://darkmind2007.blogspot.com/2008/03/unremovable-spaces-by-means-of-css.html"&gt;this&lt;/a&gt; post. I used &lt;i&gt;white-space: pre&lt;/i&gt; to tell browser not to remove sequences of spaces. But while posting previous subject, I found that this option has a very big minus: text becomes "unwrapable" and is clipped by borders of the nearest html table. After looking through many sites I found a new option (which became available recently) - &lt;i&gt;white-space: pre-wrap&lt;/i&gt;. It assumes that all spaces are indissoluble, but browser can wrap text on these spaces.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3722286367705184557-8506072570492964789?l=darkmind2007.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://darkmind2007.blogspot.com/feeds/8506072570492964789/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://darkmind2007.blogspot.com/2008/04/update-unremovable-spaces-by-means-of.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3722286367705184557/posts/default/8506072570492964789'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3722286367705184557/posts/default/8506072570492964789'/><link rel='alternate' type='text/html' href='http://darkmind2007.blogspot.com/2008/04/update-unremovable-spaces-by-means-of.html' title='Update: Unremovable spaces by means of CSS'/><author><name>D@rkmind</name><uri>http://www.blogger.com/profile/07798238268250031219</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3722286367705184557.post-8056339276276841945</id><published>2008-04-07T22:08:00.010+04:00</published><updated>2008-04-27T20:44:33.896+04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='GNU'/><category scheme='http://www.blogger.com/atom/ns#' term='make'/><title type='text'>Make with N jobs</title><content type='html'>It's widely known that GNU Make can run with several jobs. User just have to pass &lt;i&gt;-j&lt;/i&gt; key to Make command line. For example:&lt;br /&gt;&lt;br /&gt;&lt;code&gt;$ make -j 4 all&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;But lets write two very simple Makefiles and try recursive call of Make. Let's imagine we have &lt;i&gt;src&lt;/i&gt; directory, and two source files - &lt;i&gt;foo1.c&lt;/i&gt; and &lt;i&gt;foo2.c&lt;/i&gt; in this directory. The first Makefile will be located in this &lt;i&gt;src&lt;/i&gt; folder:&lt;br /&gt;&lt;br /&gt;&lt;code class="MAKE"&gt;&lt;var&gt;C&lt;/var&gt;=gcc&lt;br /&gt;&lt;var&gt;LINK&lt;/var&gt;=gcc&lt;br /&gt;&lt;var&gt;RM&lt;/var&gt;=rm -rf&lt;br /&gt;&lt;br /&gt;&lt;var&gt;BIN&lt;/var&gt;=foo&lt;br /&gt;&lt;var&gt;OBJ&lt;/var&gt;=foo1.o foo2.o&lt;br /&gt;&lt;br /&gt;&lt;var&gt;all:&lt;/var&gt; clean &lt;var&gt;$(BIN)&lt;/var&gt;&lt;br /&gt;&lt;br /&gt;&lt;var&gt;$(BIN): $(OBJ)&lt;/var&gt;&lt;br /&gt;        &lt;var&gt;$(LINK) $(OBJ)&lt;/var&gt; -o &lt;var&gt;$@&lt;/var&gt;&lt;br /&gt;&lt;br /&gt;&lt;var&gt;$(OBJ): %&lt;/var&gt;.o : &lt;var&gt;%&lt;/var&gt;.c&lt;br /&gt;        &lt;var&gt;$(C) $^&lt;/var&gt; -o &lt;var&gt;$@&lt;/var&gt;&lt;br /&gt;&lt;br /&gt;&lt;var&gt;clean:&lt;/var&gt;&lt;br /&gt;        &lt;var&gt;$(RM) $(BIN) $(OBJ)&lt;/var&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Ok, this will give us binary file from sources. Now go to the parent folder and write the second Makefile:&lt;br /&gt;&lt;br /&gt;&lt;code class="MAKE"&gt;&lt;var&gt;all:&lt;/var&gt;&lt;br /&gt;        (cd src; make)&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;And that's all! Call &lt;i&gt;Make&lt;/i&gt; from the parent directory and it will enter directory &lt;i&gt;src&lt;/i&gt; and run another make there. But what if we set number of jobs?&lt;br /&gt;&lt;br /&gt;&lt;code&gt;$ make -j 2&lt;br /&gt;make[1]: Entering directory '&amp;lt;...&amp;gt;/src'&lt;br /&gt;make[1]: warning: jobserver unavailable: using -j1. Add '+' to parent make rule.&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Google says that &lt;i&gt;Make&lt;/i&gt; passes additional information about jobserver on recursive call. But it does so only if he know that the child program is another &lt;i&gt;Make&lt;/i&gt;. In our case he doesn't know. But let's do little change in the second Makefile:&lt;br /&gt;&lt;br /&gt;&lt;code class="MAKE"&gt;&lt;var&gt;all:&lt;/var&gt;&lt;br /&gt;        (cd src; &lt;var&gt;$(MAKE)&lt;/var&gt;)&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Try running make with &lt;i&gt;-j 2&lt;/i&gt; again? Everything is Ok :) Because &lt;i&gt;$(MAKE)&lt;/i&gt; is a special variable, which says that the child process is &lt;i&gt;Make&lt;/i&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3722286367705184557-8056339276276841945?l=darkmind2007.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://darkmind2007.blogspot.com/feeds/8056339276276841945/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://darkmind2007.blogspot.com/2008/04/make-with-n-jobs.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3722286367705184557/posts/default/8056339276276841945'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3722286367705184557/posts/default/8056339276276841945'/><link rel='alternate' type='text/html' href='http://darkmind2007.blogspot.com/2008/04/make-with-n-jobs.html' title='Make with N jobs'/><author><name>D@rkmind</name><uri>http://www.blogger.com/profile/07798238268250031219</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3722286367705184557.post-2995344273823594200</id><published>2008-04-04T21:22:00.002+04:00</published><updated>2008-04-04T21:34:03.392+04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Magic'/><category scheme='http://www.blogger.com/atom/ns#' term='MTG'/><category scheme='http://www.blogger.com/atom/ns#' term='fun'/><title type='text'>Magic The Gathering, deck</title><content type='html'>Yes! I received a deck of MTG cards at the beginning of this week. It's an Elvish one. It could be very powerful with Elf tokens. All in all, it's a very interesting game, I think. I don't wanna spend a lot of money for this, it's just for fun :)&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp1.blogger.com/_7XbafVoYfZQ/R_ZmTrsT-JI/AAAAAAAAABM/LkcKtIMZ86g/s1600-h/magic.jpg"&gt;&lt;img style="float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;" src="http://bp1.blogger.com/_7XbafVoYfZQ/R_ZmTrsT-JI/AAAAAAAAABM/LkcKtIMZ86g/s320/magic.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5185444509295835282" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3722286367705184557-2995344273823594200?l=darkmind2007.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://darkmind2007.blogspot.com/feeds/2995344273823594200/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://darkmind2007.blogspot.com/2008/04/magic-gathering-deck.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3722286367705184557/posts/default/2995344273823594200'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3722286367705184557/posts/default/2995344273823594200'/><link rel='alternate' type='text/html' href='http://darkmind2007.blogspot.com/2008/04/magic-gathering-deck.html' title='Magic The Gathering, deck'/><author><name>D@rkmind</name><uri>http://www.blogger.com/profile/07798238268250031219</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://bp1.blogger.com/_7XbafVoYfZQ/R_ZmTrsT-JI/AAAAAAAAABM/LkcKtIMZ86g/s72-c/magic.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3722286367705184557.post-4795149025084098436</id><published>2008-03-31T17:04:00.006+04:00</published><updated>2008-03-31T17:48:49.801+04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='GMail'/><category scheme='http://www.blogger.com/atom/ns#' term='Google'/><category scheme='http://www.blogger.com/atom/ns#' term='experience'/><category scheme='http://www.blogger.com/atom/ns#' term='e-mail'/><title type='text'>My move to a new e-mail</title><content type='html'>It seems so simple - to register a new address and to tell it to your friends. But don't forget that in some point of view, your mailbox is something like your home when using the Web. Especially, on such services as Google or Yandex, where you have a lot of features, assigned to your mail account.&lt;br /&gt;First of all, I’ve tried to find function like &lt;i&gt;“Rename my mailbox”&lt;/i&gt;. I thought that if I can change, for example, my username in Windows or Linux, why can’t I just rename my mailbox? I was so naive! )) May be I missed something, but I haven’t found any information in Google’s help or among my friends how to do this simple step.&lt;br /&gt;So, the only way for me was creating a new account and copying all information from the old one. And it took for me equally two hours. Special Thank for my ISP for stable connect during this hard time )) Below are the common steps, which I have done.&lt;br /&gt;&lt;br /&gt;&lt;font class="SubHeader"&gt;The first evident step – register a new account&lt;/font&gt;&lt;br /&gt;There was no problem, my target mailbox’s name wasn’t occupied by anyone. By the way, it’s very convenient to work in two different browsers – the new account in Firefox and the old one in IE.&lt;br /&gt;&lt;br /&gt;&lt;font class="SubHeader"&gt;2. Forget about previous account – use forwarding&lt;/font&gt;&lt;br /&gt;For my Google accounts, I saw the 2 ways – make the old mailbox forward all incoming mail to the new one; or allow POP and IMAP access for the old mailbox and make the new mailbox check out updates from there. I preferred the second way. Why? GMail automatically puts a label for all mail, coming from the old mailbox. A have already configured &lt;i&gt;debugger129&lt;/i&gt; account (I downloaded incoming mail to my phone and iPod), so I had to do just simple activity – go to settings of my new mailbox switch to &lt;i&gt;“Accounts”&lt;/i&gt; tab, find &lt;i&gt;“Get mail from other accounts”&lt;/i&gt; and type login and password for &lt;i&gt;debugger129&lt;/i&gt;. Done! The next morning I had all my old mail with label &lt;i&gt;“debugger129”&lt;/i&gt; in &lt;i&gt;maxim.kukushkin&lt;/i&gt; mailbox.&lt;br /&gt;&lt;br /&gt;&lt;font class="SubHeader"&gt;3. Tell your friends&lt;/font&gt;&lt;br /&gt;I felt as spammer when sending absolutely equal mails to all my contacts )) Why didn’t I just copy all email addresses to the &lt;i&gt;“To”&lt;/i&gt; field and send only one message? Because everyone could see the list of other recipients. I don’t want to share my contact list with everyone, therefore I had to send copies. But before I could send mails, I imported the contact list from the old mailbox. &lt;b&gt;GMail-&amp;gt;Contacts-&amp;gt;Export-&amp;gt;Google’s CSV format&lt;/b&gt;, and then download the file. &lt;b&gt;New GMail-&amp;gt;Contacts-&amp;gt;Import-&amp;gt;Browse&lt;/b&gt;, and upload the previously downloaded file. All OK! All contacts are here now.&lt;br /&gt;&lt;br /&gt;&lt;font class="SubHeader"&gt;4. Change your contact information on most websites&lt;/font&gt;&lt;br /&gt;While searching through my contacts, trying to find human mailboxes, I came across a lot of addresses which belong to &lt;i&gt;diary.ru&lt;/i&gt;, &lt;i&gt;vkontakte.ru&lt;/i&gt;, etc. It was helpful for me. I remembered that I have an accounts on these websites and &lt;i&gt;vkontakte&lt;/i&gt;, for instance, uses my mailbox as login. I went to all of them immediately and updated my contact information.&lt;br /&gt;&lt;br /&gt;&lt;font class="SubHeader"&gt;5. Update your contact information in messengers and at work&lt;/font&gt;&lt;br /&gt;I remembered that I had entered e-mail information in a one of registration forms at work.&lt;br /&gt;&lt;br /&gt;&lt;font class="SubHeader"&gt;6. Google Blogger&lt;/font&gt;&lt;br /&gt;First of all, I had to create a Blogger account for my new mailbox. It’s simple, I just entered (or copied) the same information as it was in previous account. Next step – login to &lt;i&gt;Blogger&lt;/i&gt; with &lt;i&gt;debugger129&lt;/i&gt; account and invite &lt;i&gt;maxim.kukushkin&lt;/i&gt; to authors. Accept invitation. Return to &lt;i&gt;Blogger&lt;/i&gt; and set admin privileges for the new author &lt;i&gt;(maxim.kukushkin)&lt;/i&gt;. Delete &lt;i&gt;debugger129&lt;/i&gt; from admins and authors. That’s all! My blog now belongs to the new account.&lt;br /&gt;&lt;br /&gt;&lt;font class="SubHeader"&gt;7. Google Reader&lt;/font&gt;&lt;br /&gt;It took very little time. Just the same trick with Import/Export as it was for &lt;i&gt;GMail&lt;/i&gt; contacts :)&lt;br /&gt;&lt;br /&gt;&lt;font class="SubHeader"&gt;8. iGoogle&lt;/font&gt;&lt;br /&gt;I remembered that I have a lot of gadgets in &lt;i&gt;iGoogle&lt;/i&gt;, and I want most of them to appear within my new account. I realized that I don’t use games which were in my previous &lt;i&gt;iGoogle&lt;/i&gt;, and I didn’t waste time for searching for the games. Also, it wasn’t hard to find the required gadgets by searching for the by their title. The final touch – add theme. I haven’t found any gothic theme, so I decided on times of day, which I’ve seen on my friend’s &lt;i&gt;iGoogle&lt;/i&gt;. Done!&lt;br /&gt;&lt;br /&gt;&lt;font class="SubHeader"&gt;9. Account information&lt;/font&gt;&lt;br /&gt;Then I noticed &lt;i&gt;“My Account”&lt;/i&gt; title in the right upper corner of the &lt;i&gt;iGoogle&lt;/i&gt; and remembered to copy some information from previous account.&lt;br /&gt;&lt;br /&gt;&lt;font class="SubHeader"&gt;10. Google Notebook&lt;/font&gt;&lt;br /&gt;I haven’t found any ways to Import/Export all notes. I think, this feature is under development process inside &lt;i&gt;Google&lt;/i&gt;, because almost all other &lt;i&gt;Google’s&lt;/i&gt; services have this one. Ok… Copy/Paste/Copy/Paste… awful!...&lt;br /&gt;&lt;br /&gt;I think that’s all, because I haven’t touched other services yet :) Oh! Nearly forgot, at this moment I’m trying to find good transport for my new Jabber account and thinking about setting up my own transport on my own server. Just an idea…&lt;br /&gt;&lt;br /&gt;&lt;b&gt;P.S.&lt;/b&gt; While investigating Blogger’s settings, found that it provides &lt;i&gt;OpenID&lt;/i&gt;. I have an &lt;i&gt;OpenID&lt;/i&gt; now, welcome, Web2.0 )))&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3722286367705184557-4795149025084098436?l=darkmind2007.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://darkmind2007.blogspot.com/feeds/4795149025084098436/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://darkmind2007.blogspot.com/2008/03/my-move-to-new-e-mail.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3722286367705184557/posts/default/4795149025084098436'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3722286367705184557/posts/default/4795149025084098436'/><link rel='alternate' type='text/html' href='http://darkmind2007.blogspot.com/2008/03/my-move-to-new-e-mail.html' title='My move to a new e-mail'/><author><name>D@rkmind</name><uri>http://www.blogger.com/profile/07798238268250031219</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3722286367705184557.post-3888935352200942853</id><published>2008-03-26T21:42:00.008+03:00</published><updated>2008-03-30T00:28:37.146+03:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='fun'/><category scheme='http://www.blogger.com/atom/ns#' term='Google'/><title type='text'>Google Flight Simulator</title><content type='html'>Update your Google Earth application and press &lt;i&gt;Ctrl-Alt-A&lt;/i&gt; when it's loaded. You'll enter &lt;b&gt;Google Flight Simluator&lt;/b&gt;, which is based on &lt;b&gt;Google Earth&lt;/b&gt;. It provides you simple airplane control. Of course, picture isn't very good, but nevertheless it's very interesting to fly over Moscow for example :) By the way, if you try to land outside a runway, you'll crash ))) Three types of input devices are supported - keyboard, mouse and joystick. Keyboard seems to be very hard for controlling, mouse is simpler, but I enjoyed flying by means of joystick (similar to &lt;i&gt;Sega&lt;/i&gt;). Here are some screenshots:&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp3.blogger.com/_2u3CcHfBDGw/R-qbrr4pdwI/AAAAAAAAAB8/tdYphTmkFtY/s1600-h/GFS.jpg"&gt;&lt;img style="cursor: pointer;" src="http://bp3.blogger.com/_2u3CcHfBDGw/R-qbrr4pdwI/AAAAAAAAAB8/tdYphTmkFtY/s400/GFS.jpg" alt="One of Moscow airports, I don't know which one" title="One of Moscow airports, I don't know which one" id="BLOGGER_PHOTO_ID_5182125496060180226" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp1.blogger.com/_2u3CcHfBDGw/R-qbuL4pdxI/AAAAAAAAACE/aAtBZhAAoZ0/s1600-h/GFS_landing.jpg"&gt;&lt;img style="cursor: pointer;" src="http://bp1.blogger.com/_2u3CcHfBDGw/R-qbuL4pdxI/AAAAAAAAACE/aAtBZhAAoZ0/s400/GFS_landing.jpg" alt="Landing... ))" title="Landing... ))" id="BLOGGER_PHOTO_ID_5182125539009853202" border="0" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3722286367705184557-3888935352200942853?l=darkmind2007.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://darkmind2007.blogspot.com/feeds/3888935352200942853/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://darkmind2007.blogspot.com/2008/03/google-flight-simulator.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3722286367705184557/posts/default/3888935352200942853'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3722286367705184557/posts/default/3888935352200942853'/><link rel='alternate' type='text/html' href='http://darkmind2007.blogspot.com/2008/03/google-flight-simulator.html' title='Google Flight Simulator'/><author><name>D@rkmind</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://bp3.blogger.com/_2u3CcHfBDGw/R-qbrr4pdwI/AAAAAAAAAB8/tdYphTmkFtY/s72-c/GFS.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3722286367705184557.post-1319602554907546649</id><published>2008-03-26T01:13:00.002+03:00</published><updated>2008-04-19T21:10:08.765+04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='css'/><title type='text'>Unremovable spaces by means of CSS</title><content type='html'>As I started posting here I faced the challenge - when I write program code it's necessary to paste spaces actually before each line. Also, I decided to use &lt;i&gt;&amp;lt;code&amp;gt;&lt;/i&gt; tag to separate program code. By default, all sequences of spaces are replaced by one and to copy-paste a lot of &lt;i&gt;&amp;amp;nsbs;&lt;/i&gt; is very inconveniently. So I found resolution in CSS:&lt;br /&gt;&lt;br /&gt;&lt;code&gt;.post code{&lt;br /&gt;   white-space: pre;&lt;br /&gt;}&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;".post" is local class which is used for all posts; "pre" means that spaces shouldn't be deleted (like &lt;i&gt;&amp;lt;pre&amp;gt;&lt;/i&gt;). Other possible values are "normal" and "nowrap".&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3722286367705184557-1319602554907546649?l=darkmind2007.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://darkmind2007.blogspot.com/feeds/1319602554907546649/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://darkmind2007.blogspot.com/2008/03/unremovable-spaces-by-means-of-css.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3722286367705184557/posts/default/1319602554907546649'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3722286367705184557/posts/default/1319602554907546649'/><link rel='alternate' type='text/html' href='http://darkmind2007.blogspot.com/2008/03/unremovable-spaces-by-means-of-css.html' title='Unremovable spaces by means of CSS'/><author><name>D@rkmind</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3722286367705184557.post-6571284637121275713</id><published>2008-03-26T00:10:00.001+03:00</published><updated>2008-03-26T00:35:22.923+03:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Within Temptation'/><category scheme='http://www.blogger.com/atom/ns#' term='songs'/><category scheme='http://www.blogger.com/atom/ns#' term='favourite'/><title type='text'>Song of the day</title><content type='html'>&lt;b&gt;&lt;i&gt;Within Temptation - Deceiver of Fools&lt;/i&gt;&lt;/b&gt;. This song repeated in my mind the whole day :) And now, I'm listening it through my iPod and really enjoy Sharon's voice and music of the band. Here are the lyrics:&lt;br /&gt;&lt;br /&gt;&lt;i&gt;{He feeds on fear&lt;br /&gt;He feeds on pain&lt;br /&gt;He rules again&lt;br /&gt;With growing hate&lt;br /&gt;He will gain&lt;br /&gt;Their faith again&lt;br /&gt;&lt;br /&gt;No light in the darkness&lt;br /&gt;Is too small to see&lt;br /&gt;There's always a sparkle of hope&lt;br /&gt;If you just believe...}&lt;br /&gt;&lt;br /&gt;He told the tale so many times&lt;br /&gt;About the dream not meant to be&lt;br /&gt;In a world of the free&lt;br /&gt;&lt;br /&gt;{Plays with your mind}&lt;br /&gt;&lt;br /&gt;As faith for the future faded fast&lt;br /&gt;He grows strong with their displeasure&lt;br /&gt;It sets him free&lt;br /&gt;&lt;br /&gt;(chorus)&lt;br /&gt;Deceiver of hearts&lt;br /&gt;Deceiver of fools&lt;br /&gt;He rules with fear&lt;br /&gt;Deceiver of hopes&lt;br /&gt;Deceiver of fools&lt;br /&gt;He rules again&lt;br /&gt;&lt;br /&gt;He feeds on fear&lt;br /&gt;Poisons the truth&lt;br /&gt;To gain their faith&lt;br /&gt;To lead the way&lt;br /&gt;To a world of decay&lt;br /&gt;&lt;br /&gt;{Rules your heart}&lt;br /&gt;&lt;br /&gt;He'll sell your soul to the grave&lt;br /&gt;Without a hesitation to make&lt;br /&gt;He belongs to the dark&lt;br /&gt;&lt;br /&gt;(chorus)&lt;br /&gt;&lt;br /&gt;Please awake&lt;br /&gt;And see the truth&lt;br /&gt;He can only be&lt;br /&gt;If you believe what he tells you&lt;br /&gt;Remember who you are&lt;br /&gt;What you stand for&lt;br /&gt;And there will always be a way&lt;br /&gt;&lt;br /&gt;(chorus)&lt;br /&gt;&lt;br /&gt;In my heart there is a place&lt;br /&gt;In my heart there is a trace&lt;br /&gt;Of a small fire burning&lt;br /&gt;A sheltering ray shines through this night&lt;br /&gt;Although it's small, it's bright&lt;br /&gt;But darkness is lurking&lt;br /&gt;&lt;br /&gt;He will sell your soul to bitterness and cold&lt;br /&gt;Oh fear him&lt;br /&gt;&lt;br /&gt;Deceiver of hearts&lt;br /&gt;Deceiver of fools&lt;br /&gt;He rules with fear&lt;br /&gt;Deceiver of hopes&lt;br /&gt;Deceiver of fools&lt;br /&gt;Shall he rule again?&lt;/i&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3722286367705184557-6571284637121275713?l=darkmind2007.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://darkmind2007.blogspot.com/feeds/6571284637121275713/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://darkmind2007.blogspot.com/2008/03/song-of-day.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3722286367705184557/posts/default/6571284637121275713'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3722286367705184557/posts/default/6571284637121275713'/><link rel='alternate' type='text/html' href='http://darkmind2007.blogspot.com/2008/03/song-of-day.html' title='Song of the day'/><author><name>D@rkmind</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3722286367705184557.post-6837466687936918456</id><published>2008-03-25T15:19:00.002+03:00</published><updated>2008-04-27T20:54:35.997+04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='VBA'/><title type='text'>Continue of loop in VBA</title><content type='html'>As I understood from &lt;a href="http://qna.live.com/ShowQuestion.aspx?qid=5C9E329F876F47F69F04EA6E117F1FF2"&gt;this&lt;/a&gt; post, there's no special instruction to skip loop iteration in VBA. So, may be the only way to do it is to place a special label just before the end of the current loop and then use GoTo statement:&lt;br /&gt;&lt;br /&gt;&lt;code class="VBA"&gt;&lt;res&gt;For&lt;/res&gt; i = 1 &lt;res&gt;To&lt;/res&gt; 10&lt;br /&gt;   &lt;res&gt;If&lt;/res&gt; i = 5 &lt;res&gt;Then&lt;/res&gt;&lt;br /&gt;      &lt;res&gt;GoTo&lt;/res&gt; nextiteration&lt;br /&gt;   &lt;res&gt;End If&lt;/res&gt;&lt;br /&gt;   &lt;comment&gt;' do some more stuff&lt;/comment&gt;&lt;br /&gt;nextiteration:&lt;br /&gt;&lt;res&gt;Next&lt;/res&gt;&lt;/code&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3722286367705184557-6837466687936918456?l=darkmind2007.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://darkmind2007.blogspot.com/feeds/6837466687936918456/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://darkmind2007.blogspot.com/2008/03/continue-of-loop-in-vba.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3722286367705184557/posts/default/6837466687936918456'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3722286367705184557/posts/default/6837466687936918456'/><link rel='alternate' type='text/html' href='http://darkmind2007.blogspot.com/2008/03/continue-of-loop-in-vba.html' title='Continue of loop in VBA'/><author><name>D@rkmind</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3722286367705184557.post-3642165406712186511</id><published>2008-03-25T15:13:00.003+03:00</published><updated>2008-04-27T20:55:59.838+04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='VBA'/><title type='text'>File existance checking in VBA</title><content type='html'>I found this method in the Internet, in two different forums. Just write a simple function-wrapper:&lt;br /&gt;&lt;br /&gt;&lt;code class="VBA"&gt;&lt;res&gt;Function&lt;/res&gt; Fileexists(fname) &lt;res&gt;As Boolean&lt;/res&gt;&lt;br /&gt;   &lt;res&gt;If&lt;/res&gt; Dir(fname) &lt;&gt; "" &lt;res&gt;Then&lt;/res&gt;&lt;br /&gt;      Fileexists = &lt;res&gt;True&lt;/res&gt;&lt;br /&gt;   &lt;res&gt;Else&lt;/res&gt;&lt;br /&gt;      Fileexists = &lt;res&gt;False&lt;/res&gt;&lt;br /&gt;   &lt;res&gt;End If&lt;/res&gt;&lt;br /&gt;&lt;res&gt;End Function&lt;/res&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Then you can use this function just the same way as in many other languages.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3722286367705184557-3642165406712186511?l=darkmind2007.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://darkmind2007.blogspot.com/feeds/3642165406712186511/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://darkmind2007.blogspot.com/2008/03/file-existance-checking-in-vba.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3722286367705184557/posts/default/3642165406712186511'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3722286367705184557/posts/default/3642165406712186511'/><link rel='alternate' type='text/html' href='http://darkmind2007.blogspot.com/2008/03/file-existance-checking-in-vba.html' title='File existance checking in VBA'/><author><name>D@rkmind</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3722286367705184557.post-419316019507647481</id><published>2008-03-24T00:41:00.004+03:00</published><updated>2008-04-27T20:57:38.864+04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='VBA'/><title type='text'>Clearing the Clipboard in VBA</title><content type='html'>There is no special function to clear Clipboard, so we should use Win API functions. The following code clears the Clipboard:&lt;br /&gt;&lt;br /&gt;&lt;code class="VBA"&gt;&lt;comment&gt;' System functions&lt;/comment&gt;&lt;br /&gt;&lt;res&gt;Public Declare Function&lt;/res&gt; OpenClipboard &lt;res&gt;Lib&lt;/res&gt; "user32" (ByVal hWnd &lt;res&gt;As Long&lt;/res&gt;) &lt;res&gt;As Long&lt;/res&gt;&lt;br /&gt;&lt;res&gt;Public Declare Function&lt;/res&gt; EmptyClipboard &lt;res&gt;Lib&lt;/res&gt; "user32" () &lt;res&gt;As Long&lt;/res&gt;&lt;br /&gt;&lt;res&gt;Public Declare Function&lt;/res&gt; CloseClipboard &lt;res&gt;Lib&lt;/res&gt; "user32" () &lt;res&gt;As Long&lt;/res&gt;&lt;br /&gt;&lt;br /&gt;&lt;comment&gt;' Implementation of function which clears the Clipboard&lt;/comment&gt;&lt;br /&gt;&lt;res&gt;Public Function&lt;/res&gt; ClipboardEmpty() &lt;res&gt;As Boolean&lt;/res&gt;&lt;br /&gt;   &lt;res&gt;Dim&lt;/res&gt; l &lt;res&gt;As Long&lt;/res&gt;, i &lt;res&gt;As Long&lt;/res&gt;&lt;br /&gt;   l = OpenClipboard(0&amp;)&lt;br /&gt;   &lt;res&gt;If&lt;/res&gt; l &lt;&gt; 0 &lt;res&gt;Then&lt;/res&gt;&lt;br /&gt;      l = EmptyClipboard()&lt;br /&gt;      i = CloseClipboard()&lt;br /&gt;   &lt;res&gt;End If&lt;/res&gt;&lt;br /&gt;   ClipboardEmpty = (l &lt;&gt; 0)&lt;br /&gt;&lt;res&gt;End Function&lt;/res&gt;&lt;br /&gt;&lt;br /&gt;&lt;comment&gt;' Using the function&lt;/comment&gt;&lt;br /&gt;&lt;res&gt;If Not&lt;/res&gt; ClipboardEmpty() &lt;res&gt;Then&lt;/res&gt; MsgBox("Clipboard isn't empty")&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;This way you can prevent Excel messages like "There is a large amount of information on the Clipboard..." when closing a window (be means of VBA)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3722286367705184557-419316019507647481?l=darkmind2007.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://darkmind2007.blogspot.com/feeds/419316019507647481/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://darkmind2007.blogspot.com/2008/03/clearing-clipboard-in-vba.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3722286367705184557/posts/default/419316019507647481'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3722286367705184557/posts/default/419316019507647481'/><link rel='alternate' type='text/html' href='http://darkmind2007.blogspot.com/2008/03/clearing-clipboard-in-vba.html' title='Clearing the Clipboard in VBA'/><author><name>D@rkmind</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>
