Search

Favourite Projects

Barsy

Ads

A little awk script to change encoding in parts of file.

March 24th, 2011 by lukav

We’re in the process of migrating our ancient CVS with the more modern GIT. However I stumbled in the following problem. We make the commits comment in Bulgarian language with windows-1251 encoding. Git uses utf8 although I’m not sure if it does this natively or the client determines the commends encoding. So I had to change all the commit comments from cp1251 to UTF8. I couldn’t  just change the hole file, because some of the files have already changed the encoding in the work process and I wanted to keep the history and current encoding intact.

One way was to use “cvs admin -m rev:comment” command which changes the comment for a given revision in CVS, but that would mean I have to write a script that goes over each file, get all the log, then tries to figure out each revision and comment and use the admin command. Further more it had to work with multi-row comments. Although it is possible it seamed to me too much trouble with many points of breaking the comments.

So I looked at the idea of modifying the RCV files directly. I needed a tool to figure out the parts in the RCV (that is ,v file) between the lines containing only “log” and “text” and change the encoding only for those part. It doesn’t seam complicated, but when I tried to use my favorite ‘sed’ it couldn’t call the external ‘iconv’ for just parts of the file. So I needed an alternative.

After googling around it turns out awk was the tool for the job. It has the ability of calling system() function that executed external program for certain line.

So here it is. A awk file that looks for /^log$/ and then start to execute iconv for each line until it finds /^text$/.

#!/usr/bin/awk -f

/^log$/ {
    flag = 1
    print
    next
}

flag == 1 {
    str = gsub(/"/,"\\\"")
    system("echo \""$0"\" | iconv -f cp1251 -t utf8")
}

flag != 1 {print}

/^text$/ {
 flag = 0
 next
}

Of course the file can be easily modified for different tasks.
Enjoy it.

Posted in EN, Tech | No Comments »

#p2pvt WebTech 2010 Veliko Turnovo

April 26th, 2010 by lukav

Another year has passed and yet we all gathered together in Veliko Turnovo for P2P WebTech conference. I was very pleased with this year edition. The lectors ware great and the lectures ware very interesting and useful … well may be with one or two exceptions 🙂

We made some new friends from Mozilla and MariaDB (the new MySQL so to speak). We spend a good evening exploring the great opportunity of our beautiful country – cheep alcohol 😉 ending in a local pub with a great band: Jerihon you should check them out.

I should also give my spacial thanks SuperHosting.bg for giving a way a brand new Laptop. They gave it away to ME 😀

Another interesting event was the DrumBeat competition. There ware 11 teams that had to propose an OpenSource Project idea in about 15 minutes. I was left out for the jury. I was very supprized that 6 or 7 of them had the same bases. If I should summarize the idea I would say “Self driven community knowledge educational program”. Obviously people realize that the current educational system suck and a very interesting and promising idea would be to implement the open community method (like wikepedia) to make better schoolbooks and test for the young generation. This certainly needs more investigation and tough.

Looking forward for the future whatever it may be …

Cheers

Posted in EN, Soul, Tech | No Comments »

Broko.bg

September 4th, 2009 by lukav

Привет приятели! 🙂

Скоро не съм пускал нищо тук, така че реших да ви представя нещо ново и интересно.
Колко от вас обичат да вършат досадните но необходими неща бързо, лесно и удобно сядайки за малко пред компютъра?
Ние като хора обичащи тези глезотии, решихме какво ни липсва и какво можем да направим и съвсем скоро, ще ви предоставим възможност да опростите ежегодното застраховане на вашия автомобил, а и на други неща, стартирайки услугата http://broko.bg/. Това ще е услуга, чрез която вие не само ще можете да направите вашата застраховка, но и тя ще се грижи да не се получава така, че малко преди да тръгнете на път да откриете, че застраховката ви е изтекла.

Разбира се няма да спрем само до там. Постоянно измисляме нови глезотии и полезни услуги за да улесним досадните задължения и да ви оставим да се забавлявате с по приятни дейности.

Очакваме вашите коментари и предложения!
http://broko.bg/

Поздрави.
И ни очаквайте скоро 🙂

Posted in BG, Other, Tech | 2 Comments »

Как да си подкараме проверка на правописа в pidgin и последните версии на Ubuntu

March 17th, 2009 by lukav

Здравейте приятели,

отдавна не съм писал тук и сега е момента да споделя нещо, което много ме дразнеше в последните версии на Ubunutu, EEEUbuntu, Kubuntu и други Bunto-та 😉 .
Аз ползвам pidgin за кратки текстови съобщения. Сложил съм си и skype4pidgin за да си го ползвам и за skype. Много ми харесваше, че има проверка на правописа, но след последния упгрейд той изчезна 🙁 . Много досадно. След няколко борби разбрах как да си го подкарам пак 🙂 така че следвайте тази процедура.

в един терминал изпълнете следните команди:

sudo apt-get -y install aspell-bg python-enchant
cd ~
mkdir .enchant
echo "*:aspell" > .enchant/enchant.ordering

накратко това ще инсталира aspell с поддръжка на български и enchant, който pidgin намира и ползва. Всъщност enchant използва самия aspell за да проверява думичките и да им намира алтернативи.
Последните три реда правят една папка “.enchant” във вашата домашна папка в която се слага конфигурационен файл на enchant за да ползва aspell.

И това е… вече няма да ни е толкова срам, че ядем букви като пишем бързо, защото един бърз поглед преди да пратим е достатъчен за да видим подчертаните.

🙂

Posted in BG, Tech | No Comments »

History Import Kopete To Pidgin

March 30th, 2008 by lukav

Since I’ve switch to Kubuntu I’ve been using Kopete as an Instant Messaging client. I’ve wanted to test Pidgin, but I didn’t want to lose my history again. Unfortunatelly I couldn’t find a tool to transfer my history from Kopete to Pidgin, so I’ve write a little script to do the job.

So here is it:

history_import_kopete2pidgin.tar.gz

In order to use it you need to install xalan and then just run the script with your user.

The script was written for my Timezone, so it might be necessary to edit  history_import_kopete2pidgin_filename.xslt file and enter yours

Hope this is useful for someone

Posted in EN, Tech | 4 Comments »

HowTo install hpt374 raid driver in debian

February 22nd, 2008 by lukav

Over the year I had to compile and install several times hpt374 driver for the HighPoint IDE controller.

Although the hardware is very old and probably nobody use it anymore I decide to put down this howto, for anyone interested.

The last time we’ve upgraded debian to etch with kernel 2.6.18-6-686 so the instruction will assume this kernel version.

First install the kernel-headers package

apt-get install linux-headers-2.6.18-6-686

then download the driver in this case hpt374-opensource-v2.17-1114
extract to some folder, for example: /usr/src/hpt374-2.6.18-6-686/

compile the driver

make KERNELDIR=/usr/src/linux-headers-2.6.18-6-686

you should now have hpt374.ko. Copy this file in the kernel modules directory

cp hpt374.ko /lib/modules/2.6.18-6-686/kernel/drivers/ide/pci/

We need to populate the modules dependencies

depmod -r 2.6.18-6-686

add hpt374 to /etc/initramfs-tools/modules if it is not already there

echo hpt374 >> /etc/initramfs-tools/modules

update the initrd image so the module gets loaded on system start up

update-initramfs -u -k 2.6.18-6-686

And thats it. You should now be able to reboot and use the new kernel with the raid

P.S. I’ve wrote this in a hurry, so I’ve may missed something.

Posted in EN, Tech | 1 Comment »

Как да сложим кирилица на eeePC

January 2nd, 2008 by lukav

За тези от вас, който са си купили прекрасното eeePC, тези инструкции ще ви помогнат да си сложите кирилица.

Ако следвате инструкциите в края ще имате иконка в трея за индикация на кой език сте и ще сменяте между български и английски с комбинация на клавишите alt+shift.

ВНИМАНИЕ ! ! ! Ако не спазвате инструкциите точно, може eeePC-то да престане да стартира, при което ще трябва да си го преинсталирате от диск-а!

Ще използваме конзола за да променим някой файлове. За да си пуснем конзолата натискаме CTRL+ALT+T.

Като за начало трябва да спрем програмката scim, която върви по подразбиране с eeePC. В конзолата изпълнете следното:

sudo killall scim-panel-gtk
sudo killall scim-launcher

Update за 901: изпълнете sudo killall gcin

Сега трябва да деисталираме scim. Това става с командата:

sudo apt-get remove --purge scim*

Update за 901: изпълнете sudo apt-get remove –purge gcin*

Следваща стъпка е да настроим вградената функционалност на Xorg за превключване на кирилица:

sudo kwrite /etc/X11/xorg.conf

В редактора намерете секцията описваща клавиатурата (Section “InputDevices”- Identifier “keyboard”) и я направете да изглежда така:

Section "InputDevice"
	Identifier  "keyboard"
	Driver      "kbd"
	Option	    "CoreKeyboard"
	Option	    "XkbRules" "xorg"
	Option	    "XkbLayout" "us,bg"
	Option	    "XkbVariant" ",phonetic"
	Option	    "XkbOptions" "grp:alt_shift_toggle"
EndSection

За любителите на BDS сменете “,phonetic” с “,bds”.
Запишете файла (ctrl+S) и затворете редактора.

Следваща стъпка е да си инсталираме индикатор за текущия режим:

wget http://lukav.com/eeepc/kkbswitch_1.4.3-3_i386.deb
sudo dpkg -i kkbswitch_1.4.3-3_i386.deb

Сега е необходимо да направим така, че kkbswitch се стартира всеки път. За целта създаваме нов файл, който ще се изпълнява след стартиране на Xorg:

sudo kwrite /etc/X11/Xsession.d/98x11-kkbswitch

Файла трябва да съдържа:

/usr/bin/kkbswitch &

не пропускайте “&” в края на реда!

Сега трябва да рестартирате eeePC-то и ако сте спазвали инструкциите докрай би трябвало да можете да пишете на кирилица, като превключвате с alt+shift.

В трея ще имате иконка, която ще се сменя между 1 и 2 при натискане на alt+shift.

Ако натиснете десен клавиш върху нея и изберете конфигуриране може да изберете иконки за English и Български.

Ако искате менютата в програмите да ви излизат на български. Изпълнете:

sudo dpkg-reconfigure locales

Намерете bg_BG.UTF-8 и го активирайте. На следващия екран го изберете като “Default locale”.

Това е набързо написано описание и сигурно има и правописни грешки 🙁 . Но ще се опитам да го допълня и поправя с времето.

Posted in BG, Tech | 17 Comments »

IE css float print problem

August 28th, 2007 by lukav

The latest discovery on IE problems was that when you use float divs and you decide to print, IE either ignore the floats or to be more precise, if you don’t explicitly specify width it just expands them to 100%.

There are some posts on the network, but all of them suggest to not use floats when printing. However this was no good for me, cause I arranged my forms with css and no tables. The solution to fix the width of floats was also no good, since I have different internationalization and some text differ in length.

So since I couldn’t find any css solution I had to make a simple JS hack.

In turns out IE has two useful events – onbeforeprint and onafterprint. So I just used those to go over all my floating elements and set the width before printing:

// We try to fix printing styles because IE is has problems
if (OAT.Browser.isIE) {
 OAT.Event.attach(window,"beforeprint",function() {
 	var elm = IB.PageContent.getElementsByTagName('div');
 	for (var i=0;i<elm.length;i++)
 		if (OAT.Dom.isClass(elm[i],'right') || OAT.Dom.isClass(elm[i],'left')) {
 			var size = OAT.Dom.getWH(elm[i]);
 			elm[i].style.width = size[0] + 'px';
 		}
 	}
 });
}

The example uses the OAT library, but you can guess what it does.

This fix works fine with the little exception that the divs move a little before print, but I can live with this for now.

Posted in EN, OAT, Tech | 2 Comments »

Joost Invitation, please – or – how is my blog doing.

May 5th, 2007 by lukav

Hi all,

Today my colleague and partner turned my attention to the next service from the founders of Skype called Joost. It sounds very interesting and shows how “the network” is slowly overtaking the “the networks”. By this I mean that each day I find that people are using the Internet for staff that they thought are only available by other means. For example before 7-8 years the source for reliable information was the newspaper or TV. Today the Internet Network is not considered less reliable source and is perfectly normal to say “I found on the net” or “I read in the Internet”.

I see the future where TV, video and radio are only both for convenience not for necessity. If my parents bought а TV so they can stay informed and up to date – they spare the money on computer because ‘their boy (me)” was interest in that new thing. IMO lets say in 5 years time parents will buy a computer so they can stay up to date – Watch TV, read articles and books listen to the radio etc and would buy a TV just to make it more easy and to get the kid off the PC.

So the revolution that started 10 years ago have not yet finished and there are things yet to see and come.

I’m very excited to try out joost, but I need someone to send me invitation. So if you read this and you have one please PLEASE send it to me.

If I actually get one by this blog, then my blog is not doing so bad 😉

Posted in EN, Other, Tech | 3 Comments »

Test a page in various browsers.

April 24th, 2007 by lukav

There is a very interesting service out there:

http://browsershots.org/

It makes a screenshot of a page with various browsers like: Dillo 0.8, Epiphany 2.14, Epiphany 2.16, Firebird 0.6, Firebird 0.7, Firefox 1.0, Firefox 1.5, Firefox 2.0, Firefox 3.0, Flock 0.7, Galeon 2.0, Iceweasel 2.0, Konqueror 3.5, Mozilla 1.0, Mozilla 1.1, Mozilla 1.2, Mozilla 1.3, Mozilla 1.4, Mozilla 1.5, Mozilla 1.6, Mozilla 1.7, Navigator 4.8, Opera 9.2, Opera 9.10, Phoenix 0.1, Phoenix 0.2, Phoenix 0.3, Phoenix 0.4, Phoenix 0.5, SeaMonkey 1.0, SeaMonkey 1.1, Windows MSIE 5.0, MSIE 5.5, MSIE 6.0, MSIE 7.0.

Great idea and a vary usefull one.

I’ve test it with my blog you can have a look here:http://browsershots.org/website/http://lukav.com/wordpress/

Posted in EN, Tech | No Comments »

« Previous Entries