Гном 2.30 је изашао. Покушаћу укратко да резимирам оно што је тим за превод Гнома урадио, као и шта сам ја покушавао да урадим за ово издање.

Програми

Пошто смо од издања 2.26 на 2.28 направили стварно огроман скок са 81% на 91% преведности, били поменути као један од најбољих тимова за 2.28 и вратили српски превод Гнома на стазе старе славе, сада смо само одржавали исти ритам. Не би смело да нам се опет деси да се онако опустимо, а за ово издање смо чак и повећали преведеност на 92%. Сви главни програми су потпуно преведени, као и још много програма који нису део скупа основних модула. Још једина два непреведена модула су Орка читач за особе са посебним потребама и Анјута — интегрисано окружење за развој, тј. IDE. Дефинитивно ова два програма не спадају у приоритетне, али ћу гледати да за Гном 3.0 (пошто је следеће издање 3.0) пробам да преведем Анјуту (мада искрено не верујем да ће домаћи програмери користити тај превод, осим можда неких нових клинаца који тек упадају у програмерске воде, па ће им можда бити лакше тако). Такође, има још доста програма „са стране“ који заслужују да буду преведени пре ова два, а сад имамо времена и за њих. И наравно, највећи приоритет је дефинитивно одржавање ових постојећих превода. То је, по мени, правац у коме ће се кретати даљи развој превода за Гноме, али далеко од тога да ће бити по пароли „на западу ништа ново“ јер, већ у Гному 3.0 ће вас сачекати једна лепа промена — свако појављивање речи „умножи“ (тј. на енглеском copy, када се садржај пребацује у клипборд) ће бити замењено са de facto коришћенијим у разговору „копирај“.

Друга ствар која ме јако брине је што на преводу Гнома сада практично раде само два човека — Милош Поповић и ја. Мало је тужно и несхватљиво да једно од најкоришћенијих окружења за линукс нема више преводиоца, а да, са друге стране на Убунту преводу за српски ради мала армија. Требало би овде мало погурати, видети има ли заинтересованих људи; у првој категорији, тј. најпожељнији су они који већ користе локализовано окружење. Верујем да таквих људи има, али наравно, не по цену квантитета да изгубимо квалитет. Честитке Милошу за изгурани 2.30, урадио је лавовски посао, али већ је постало монотоно да нас двојица честитамо један другоме више, треба нам свеже крви:)

Документација

Гном 2.30 је посебан по томе што је по први пут започет рад на превођењу документације. Све то је почело овде. Дакле, после изласка 2.28 сам започео превођење Гном документације, чисто да видим куда ће ме то одвести. Сада могу да кажем да је добро испало. Гном је добио превод документације свих игара на српски језик, што му дође негде око 9% превода целе документације. Добра ствар је што се ови преводи документације не мењају често тако да неће представљати велики проблем одржавати их касније, али, са друге стране, да се не лажемо – основни, изворни текст документације (на енглеском) и није нешто претерано од помоћи (а и лош је зато што је написан једном и ретко кад се и мења). Ево како то лепо изгледа на крају на проклетим лажима:

Када добијете нови Гном 2.30, погледајте Помоћ->Садржај за неку игрицу, требало би да у свим дистрибуцијама добијете документацију на српском.

Не планирам да стајем овде, план за 3.0 ми је да одржавам ове преводе и да преведем још пар модула из истих група, а то су GNOME applets, gnome-media, а ако стигнем и gnome-utils и неко конкретно програмче (најприоритетније, типа калкулатор и сл.). То би повећало проценат преведности за још оволико, тј. до 20%, а мени би дало потребно искуство за превод највеће и најважније документације за издање после 3.0, а то је корисничка документација (наравно, не за Гном 2, него за Гном 3). Уколико се појави још неко за превођење документације, тим боље. Толико од мене за Гном 2.30.

, , , , , ,

Programming languages playground

It’s summer. Day is sunny and all the kids went out to play. They all gathered at playground enjoying the beautiful day and we’re now going to describe some of them.

First kid that catches eye is one tall boy, larger then all the other kids and obviously older then all of them. His name is C. He’s casually dressed and is always smiling cheerfully. All the other smaller kids are swirling around him and he obviously enjoys playing with them. He knows he is the coolest kid there and that he got respect from all of them, but he is not presumptuous about it. He’s fast, his moves are sharp and intelligent, he’s very agile and he likes to help other kids, knowing that they are helpless without him. Look, he just helped that kid Python to climb that tree. Python could climb that tree himself, but it would take him forever, and he asked C for help and C, smiling as always, immediately picked him up and put him on branch. He really is like older brother for all of them.

Speaking of brothers, C really have one younger brother. His name is C++. Actually, they are stepbrothers, C’s fathers had thicker beards then C++’s father, and C++’s father have less hair. You could see these two kids look alike, but C++ is little smaller and younger. C++’s father thought he could give C a little brother that will be better at handling objects at playground, but that will still looks similar to C, and although he succeeded, other kids still prefer to play with C. He’s also a bit fat for a child of that age and little slower then his older brother, but granted – he’s better at handling various objects. Reason for it’s slowness is maybe because he carries with him a lot of equipment. He got with himself a little shovel, rake and little plastic bin, and man, he even have a Swiss knife. Other kids looks in awe at C++’s tools and possibilities with it, but they also heard from elders that those tools he’s carrying are just burden and that it takes a skilled person to use all those tools properly and wisely, and that you may even cut yourself if you try to use them without any training, so that’s why they mostly like to play with his older brother.

We already mentioned Python kid. He’s one of the kids that often asks C to help him. He is fast and agile, but alas, there are some times when only C can help. He’s one small kid with shaggy hair and he enjoys doing things both nice and quick. He never stops, he’s restless, his trousers are scraped on knees from constant running, jumping and falling. In one word, he’s very dynamic. Because of his dynamic nature, he often breaks things, but he can also very quickly put them together because he always carries duct tape with him. There is one more thing he always carries with him. If you ask him to do something, he’ll get to work immediately, no matter how hard that is and when the job is finished, he likes to take out couple of batteries from his pocket and to shout childishly ”batteries included!”.

Another kid similar to Python is Ruby. They are both very similar, but interestingly, they like to compete. If one of them does something, other kid will try to do the same, but quicker and nicer, showing that it’s better. They are even dressed similar, except Ruby likes to wear red.  When they have to do something in parallel and Python is faster then Ruby, he likes to say that Ruby’s red shirt is in fact woven from green threads. If, on the other hand, Ruby wins, he can then jump all day around Python making fun of him by shouting “Global Interpreter Lock!”. Ruby’s dad is from Japan and he really likes his kid. He’s so protective, and sometimes he worries so much about security of his child, that his child can’t develop normally because of him. C is also like older brother to Ruby and helps him a lot when he’s stuck.

PHP is one of the weirdest kids out there. He’s there, loves C, but rarely hangs with him or asks for help, mostly because he never needs it. He’s smallest, but also one of the fastest, most alive and most popular kids out there. Python and Ruby want to be as popular and fast as he is, when they grow up. Also, PHP doesn’t respect anyone, he is kind of rebel and has his own ways. One time, for example, kids wanted to build sand castle. They all gathered and started to talk how to do it. They mentioned “frameworks”, “scalability”, “paradigms”, “design patterns” and all those other stuff kids talk when they build a sand castles, and suddenly, in the middle of talk, they turned and saw that PHP already built his castle. He just said “Architecture – who needs that” and built it. Ironically, his castle was better and more stable then any of the other castles.

Of course, not all the kids likes C and playing with him. There is this kid called Java. Although he is dependant of C, he think he’s better then him and doesn’t like to ask him for any help. Yes, he is respecting him, but thinks he can do everything on his own. He doesn’t like to play with other children and is very introvert. This is, because when he was younger, he was extremely fat and slow, and other kids always made fun of him. He is not accepted since then. All the kids remember when once one long bearded man, dressed like a hippie calling himself RMS, came to them one day and talked to them that they should avoid Java because he is not open to other kids and speaking on and on about trap they will fall into if they hang out with Java. This made Java grow inferiority complex. Inferiority complex soon developed into superiority complex and that explains his behavior a lot. Since then, Java tried hard to overcome that obesity problem he had and although he’s slim now, scars from bullying and wrinkled skin are still visible. Even today, he tries to be more open, but like it’s all in vain. He doesn’t even want to hear about the other kids, he created his own tools, his own toys that are not compatible with other’s kids toys, even his own part of the playground he calls open and accessible for everyone, and tries to lures other kids to join him, but other kids know that, once you enter his part of the playground, there is no returning back. Because of lack of other kids’ company, he artificially created his own kids from his special DNK called JVM and now plays with them.

There is one other kid who also thinks he’s too good to hang with C. His name is C#. He is just an ordinary kid, but he thinks that somehow, he is more mature then other kids. He wears corporate suit with pink tie and always keep his head high. He doesn’t speak with other children – they are all stupid, idiotic fools for him. He is always surrounded with his fathers, who also wears corporate suits and forbid him to play with other kids. He is very spoiled because he’s very rich and his fathers buy him everything he wants. His suit is always clean because he really doesn’t want to play very much. If, for example, he needs to climb a tree, he just calls one of his dads and order him to buy him a ladder. In fact, he thinks that money is solution to all problems. Other kids despise him because of his attitude and his fathers and even elders don’t want to have anything with him (except maybe some other similar thinking men in corporate suits).

Oh, I almost forgot one other kid. His name is Visual Basic. Unfortunately, he is retarded. He just sits all day long by the sandbox, with his head low, drooling in sand and hitting himself in head with his hand. Poor kid.

, , , , , ,

Wallpaper
I have TFT monitor with 1280×1024 resolution and TV connected in nvidia twin view configuration with TV’s resolution of 800×600. Whenever I want to set up a desktop wallpaper on Gnome, I must adjust it, because Gnome “sees” my desktop as one large 2080×1024 desktop. So, I must manually open wallpaper in Gimp and create another picture that contains two wallpaper next to each other, one with 1280×1024 dimension, and another one, with 800×600 dimensions right of the first one. So, I decided that that’s enough. So I utilized imagemagick to accomplish this and put convinient function in my .bashrc file. Here it is:

make_wallpaper(){
    convert -background white "$1" -resize 1280x1024 \( "$1" -resize 800x600 \) +append "$2";
}

Of course, background color isn’t neccesary since it is not visible, I just put it as a reminder. All I have to do now is to call:

make_wallpaper original.png my.png

Sweet, ain’t it;)

, ,

How often do you use power button to shut down your computer? I never use it, and, even if I would have need to shutdown or restart my computer, I would use GUI way to do it (simply because, it is something that is rarely used, I never remember I could use power button in that split second when I want to shut it down)

But, if you (like me) don’t have keyboards with fancy shortcut buttons, why not use that same power button for some shortcut. Or, you can make fun of your Windows friends just by showing what power and mind-boggling functionality Linux have and just waits for yours ideas to unleash it. I think this is great example of that.

I will use Ubuntu to set it up, but, with minor (or even none) modification, this should work on any distro. First you will need, is to remove annoying gnome log-off screen that shows up when you press power button. For this, we will need to change two keys in gconf. Start gconf-editor and change those two keys:

  • /apps/gnome-power-manager/action_button_power
  • /apps/gnome-power-manager/buttons/power

to “nothing” (without quotes). This will disable log-off screen. Now, it’s all about editing /etc/acpi/powerbtn.sh to suit your needs. I will give you two possible scenarios, and there are no limits what you can do.

Enable/disable internet (forwarding)

I already had two little script to enable or disable internet to some users I am routing internet to. These are some iptables stuff (something like `iptables -I FORWARD -p ALL -s 192.168.0.122 -j DROP`) and I had to open console, execute it and later enable it. This can be done with this in /etc/acpi/powerbtn.sh:

#! /bin/sh
if [ -f /var/tmp/internet_off ]; then
    /etc/rc.start_internet
    rm /var/tmp/internet_off
else
    /etc/rc.stop_internet
    touch /var/tmp/internet_off
fi

This is stupid script. It checks for existence of file /var/tmp/internet_off that signalizes if forwarding is on. It then executes appropriate scripts. If you have someone dumb enough, you can tell them that they have no internet because your computer is turned off, and what they see on monitor is just a picture, or drop them a story about virtual (wau!) machine that run even when computer is off (everyone heard of vmware) – something like that:) You can even confirm this by pressing button in front of them to enable or disable their internet access.

Starting firefox

I use firefox all day. If I ever want to dedicate any button to any program, that is certainly firefox. But to start GUI program in shell script that is run as root, we need some workarounds. For example, you need to set DISPLAY and XAUTHORITY environment variable.

#! /bin/sh
export DISPLAY=:0
export XAUTHORITY=/home/your_username/.Xauthority
sudo -u your_username firefox

But, this script have few defects. If firefox is running, it will launch another windows, and we see ‘yourusername’ is all around. This is improved version:

#! /bin/sh
USERNAME=your_username
export DISPLAY=:0
export XAUTHORITY=/home/$USERNAME/.Xauthority
 
if ps -U $USERNAME -u $USERNAME|grep firefox; then
    sudo -u $USERNAME firefox -new-tab about:blank
else
    sudo -u $USERNAME firefox
fi

If firefox is running, it will just open new empty tab, otherwise it will launch it normally. Also, your username is pulled up as variable, so you just need to change second line to your username and this script will work. Have fun!

Further ideas

Only one function for button is nothing. Maybe we can split two different functionality by defining click and double-click on power button. Simple creating file on first click, and checking if file was created 2 seconds before current time (I will not go into details here). Also, you could use that button to open CD tray, why not:) Like anything in Linux, your creativity is your only limit. Do you have any ideas what to do else with this button? What would you put in /etc/acpi/powerbtn.sh?

, , ,

Увод

Пре него што изнесем рецепт, само да кажем да ово није за људе који се не разумеју добро у Линукс, iptables и apache. Да бисте ово извели код своје куће, потребно је да разумете шта радите, не само преписујете јер, у супротном нећете далеко догурати. Овај текст треба да Вам да генералну идеју и да Вас погура у правом правцу, неће урадити све за Вас. Не покушавам да Вас уплашим, само да скренем пажњу да нисам водио много рачуна о детаљима. Такође, ово је текст о Линуксу који ради као рутер и користи iptables и apache, тако да, ако то немате при руци, можете само да читате, али не и да испробате. Наравно, ако сте гуру, вероватно можете постићи сличне резултате и са другим алатима (поред iptables и apache-а), али сте онда сами на своме. Па да кренемо.

КОРИШЋЕЊЕ

Имате Линукс који ради као рутер, и док неким корисницима желите забранити приступ интернету, желите да им прикажете обавештење о о томе. Или желите да забраните приступ одређеним сајтовима, и, уместо жељеног сајта да прикажете Вашу страну са Вашег сервера о томе како корисник није био добар када је ишао на тај и тај сајт, или да је тај сајт забрањен…Свакакве остале идеје које могу одавде да изникну…

ОСНОВНЕ СТВАРИ

ОК, у згради имамо мали сервер који (углавном) служи као рутер за око 20так комшија који деле нет. Сви скупљамо паре и делимо конекцију. Проблем се јавља када неко не жели интернет за следећи месец, или није ту, или заборави да плати…До сада, имали смо просто решење са iptables алатом – REJECT-уј све пакете и дозволи да прођу само пакети са ИП адреса које су платиле за интернет, које би изгледало некако овако:

iptables -I FORWARD -i ext0 -o ext1 -j DROP
iptables -I FORWARD -p ALL -s 192.168.0.XX -j ACCEPT
iptables -I FORWARD -p ALL -d 192.168.0.XX -j ACCEPT

Онда смо комшија и ја дошли на идеју да онај ко није платио за интернет, када посети неки страну, добије страну на којој пише да није платио и сл. До сада му се интернет прегледач куцао при разрешавању ИП адресе хоста (јер ни DNS пакети нису могли да прођу).

Прва идеја која нам је пала на памет је хаковање нашег DNS сервера, али, иако универзално, ово решење је много зајебано за урадити, није проширљиво, тешко се мења и углавном…срање, тако да сам се одлучио за ово друго, изузетно ефикасно решење изложено даље.

Основна идеја је преусмерити све ХТТП захтеве од корисника који нису платили ка нашем серверу и приказати им једноставну страну обавештења. Решење се може поделити на два дела: део са iptables-има и део са apache-ом. Прво нам треба iptables део.

IPTABLES ДЕО

Проста линија која преусмерава одређеног корисника би била:

iptables -t nat -I PREROUTING -s 192.168.0.XX -p tcp --dport 80 -j REDIRECT --to-ports 3001

Објашњење на брзину је да се сви TCP пакети корисника са ИП адресом 192.168.0.XX који су намењени за порт 80 преусмеравају на порт 3001 нашег сервера. Ту ћемо ставити да наш сервер слуша. Овај, чек мало…па ово не ради! Зашто? Просто, када корисник затражи неку страну, на пример http://www.mozilla.com/en-US/firefox, прво треба разрешити ИП адресу, па се тек онда конектовати, тј. пре него што је иједан пакет за порт 80 послат, прво корисник шаље и прима пакете ка DNS серверу. А, ако имамо (као што је горе написано):

iptables -I FORWARD -i ext0 -o ext1 -j DROP

име хоста не може бити разрешено, па неће бити ни HTTP пакета. Дакле, морамо дозволити DNS пакете тамо и овамо са нечим оваквим:

iptables -I FORWARD -s 192.168.0.XX -p udp --dport 53 -j ACCEPT
iptables -I FORWARD -d 192.168.0.XX -p udp --sport 53 -j ACCEPT
iptables -t nat -I PREROUTING -s 192.168.0.XX -p tcp --dport 80 -j REDIRECT --to-ports 3001

Ово је у неку руку trade-off (српски речено: буџење) јер сада наш корисник није комплетно изолован од интернета – има приступ DNS серверима. ОК, први део са преусмеравањем је готов, сада да наместимо apache.

APACHE ДЕО

Све што треба урадити је направити нови виртуелни хост на apache-у. Иако је наша конфигурација жестоко измењена у односу на конфигурацију по инсталацији, све је било јако просто. Можда код Вас овај рецепт неће радити, али додавање следећих линија на крај httpd.conf-а је све што је било потребно:

Listen 192.168.0.1:3001
Listen 127.0.0.1:3001
NameVirtualHost *:3001
 
    ServerName 
    DocumentRoot /var/www/no_net/
    RewriteEngine On
    RewriteRule   ^.* /index.html

Када сте додали ово на крај, сада само направите нови htdocs корени директоријум (овде је /var/www/no_net/) са index.html-ом који ће садржати обавештење које ћемо приказати корисницима који нису платили интернет. Порт на коме ће овај виртуелни хост слушати (3001) је исти као онај дефинисан код iptables дела. Као што видите, Listen директива је само за localhost и за наш ЛАН, тако да хост није видљив са интернета. Ако погледате пажљиво у VirtualHost директиву, примећите две чудне линије:

RewriteEngine On
RewriteRule   ^.* /index.html

Ове линије раде замену свега у УРЛ-у са “/index.html”. Зашто? Па, хајде да претпоставимо да је наш корисник хтео да оде на сајт http://www.mozilla.com/en-US/firefox/. После тога се преусмерава на порт 3001. Одатле, корисников интернет прегледач тражи /en-US/firefox/ страну која, наравно, не постоји код нас. Најједноставније решење овог проблема је са apache-овим mod_rewrite модулом који ће замењивати све GET захтеве. Друга линија ради управо то – уз помоћ регуларних израза, замењује било шта са “/index.html”. Све што Вам је сада преостало да урадите је да направите фину index.html страну и то је то.

Али, чекај, ово је много просто да би било (geek) фенси. Зато ћемо да зачинимо сад мало са мало Bash магије.

НАПРЕДНЕ СТВАРИ

Пошто је наша мрежа на подмрежи 192.168.0.0/24, имамо 253 могућих ИП адреса и око 20 корисника. Генерално, у скрипти за подешавање iptables-а ћемо морати да поновимо 253-20 пута део:

iptables -I FORWARD -s 192.168.0.XX -p udp --dport 53 -j ACCEPT
iptables -I FORWARD -d 192.168.0.XX -p udp --sport 53 -j ACCEPT
iptables -t nat -I PREROUTING -s 192.168.0.XX -p tcp --dport 80 -j REDIRECT --to-ports 3001

и 20 пута део:

iptables -I FORWARD -p ALL -s 192.168.0.XX -j ACCEPT
iptables -I FORWARD -p ALL -d 192.168.0.XX -j ACCEPT

Хух…Или да унајмимо црнца или да научимо Bash.
Дакле, ево како сам то извео. Ово није никакво елеганци решење, али ће Вам дати идеју. Направите фајл /etc/allowed_ips и, у њему, ставите последње октете ИП адреса које имају интернет – један октет по линији. Дакле, ако 192.168.0.12 и 192.168.0.34 имају интернет, овај фајл би изгледао овако некако:

1
12
34

Наша подмрежа има фиксне адресе, и због једноставности, не пишемо целу ИП адресу (зато само последњи октет). Такође, приметите да је у овом фајлу наведен и сâм сервер (који има адресу 192.168.0.1). Сада, направите скрипту ip_allowing (ставите је где год Вам је згодно) са следећим садржајем:

#!/bin/bash
 
FILE=/etc/allowed_ips
ip_listing=`cat $FILE`
 
function check_exist {
    for i in $ip_listing; do
        if [ ${i:0:1} != "#" ]; then
            if [ "$i" = "$1" ]; then
                return 1
            fi
        fi
    done
    return 0
}
 
for ip in `seq 1 254`; do
    check_exist $ip
    if [ $? -eq 1 ]; then
        #ip exist
        iptables -I FORWARD -p ALL -s 192.168.0.$ip -j ACCEPT
        iptables -I FORWARD -p ALL -d 192.168.0.$ip -j ACCEPT
        echo allowing 192.168.0.$ip
    else
        #ip doesn't exist
        iptables -I FORWARD -s 192.168.0.$ip -p udp --dport 53 -j ACCEPT
        iptables -I FORWARD -d 192.168.0.$ip -p udp --sport 53 -j ACCEPT iptables -t nat -I PREROUTING -s 192.168.0.$ip -p tcp --dport 80 -j REDIRECT --to-ports 3001
    fi
done

Нема овде никакве вуду магије. Функција check_exist узима број (последњи октет) као први аргумент и проверава да је треба пустити ту ИП адресу и враћа 1 ако је у листингу, 0 ако није. Главни део иде у петљи од 1 до 254 и, или дозвољава приступ DNS серверима и ради преусмеравање, или дозвољава све пакете. Ако сте загледали, можда сте приметили линију:

if [ ${i:0:1} != "#" ]; then

Овом линијом смо дозволили да имамо (нешто што личи на) коментаре у нашем /etc/allowed_ips фајлу и да их игноришемо, тако да овај фајл сад може изгледати нпр. овако:

#server
1
#pera
12
#zika
34

Згодно, зар не. Све што нам је сада остало је да позовемо нашу скрипту (и да јој дамо exec привилегије, али то знате, иначе не бисте читали довде) одакле год да подешавате Ваше iptables-е. Пример би био:

iptables -I FORWARD -i ext0 -o ext1 -j DROP
/etc/rc.d/ip_allowing

Шта даље?

Као прво, ово је просто решење. Има две мане, а то су: корисници имају приступ DNS серверу и друга, ако корисник затражи непостојећу адресу (нпр. www.blabla-tucmuc-nemaovog.com), добиће страну у интернет прегледачу да она не постоји, тј. наше обавештење ће добити само ако је разрешавање успело. Ово су ситнице преко којих ја могу да прођем, а ако Ви не можете – решење лежи у подешавању DNS сервиса на серверу.
Осим ових мана, има много ствари које се могу унапредити. На пример, можда желите да забрањујете кориснике по MAC адреси, не по ИП адресама. Или, ако имате већу subnet маску, ово може бити споро, па треба размислити о томе да Ваше iptables команде раде са ИП опсезима. Или, можда желите да вучете дозвољене ИП адресе из неког другог извора, нпр. LDAP-а или MySQL-а, а не из фајла. Такође, уз избацивање одређених ствари, можете преусмерити кориснике само када траже одређени сајт, тако што би се у iptables команди користила и одредишна ИП адреса (-d), не само изворна. Што се тиче apache дела, приметите да је rewrite директива код виртуелног хоста гладна, тј. гута све и замењује у једну ствар. Ово нам не дозвољава да имамо више страна на том хосту. Ако бисте желели да имате две стране (на пример, index.html и contact.html), морали бисте да се играте са регуларним изразима и да замењујете било шта осим “/contact.html” у /index.html.

Могућности су неограничене. као и са свим у вези Линукса. Само треба да знате шта хоћете и како да то урадите – simple as that.

, , , , ,

Е, да сам јуче умро, не бих знао. Па јел то GCC много кул or what:)

Радим једно програмче и убијам се да провалим зашто ми “step over” у debug-у скакуће горе-доле по линијама кода, тотално хаотично, збуњујући ме и исписујући погрешне вредности…Кад, оно, ја укључио оптимизацију (и то ону -O2)…Ево и исечка из документације:

Unlike most other C compilers, GCC allows you to use -g with -O. The shortcuts taken by optimized code may occasionally
produce surprising results: some variables you declared may not exist at all; flow of control may briefly move where you
did not expect it; some statements may not be executed because they compute constant results or their values were already
at hand; some statements may execute in different places because they were moved out of loops.

, , ,

KDE and Cyrillic filenames

I just found out what I have been looking for a long time now – how to setup KDE to show Cyrillic filenames on ext2/ext3 partitions. As I later found out (in hard way) it has nothing to do with filesystem itself, e.g. ext2/ext3 partitions support UTF-8 – problem was in KDE (e.g. Linux) setup. One has to set locale, e.g. just put these few lines in your profile.d (at my slack it is in /etc/profile.d/), make new script in it and type this:

#!/bin/sh
 
LANG=en_US.UTF-8
LANGUAGE=$LANG
LC_ALL=$LANG
 
export LC_ALL LANGUAGE LANG

Although my KDE is in Cyrillic and my locale should be Serbian (sr_CS.UTF-8), I still used en_US (it doesn’t matter for KDE, it uses its own locale setup, this is only for terminal locale), the thing that matter in this script is that you should tell every program that you use UTF-8. Just login again and try to rename any file – it should be working now.

Although my KDE is in Cyrillic and my locale should be Serbian (sr_CS.UTF-8), I still used en_US (it doesn’t matter for KDE, it uses its own locale setup, this is only for terminal locale), the thing that matter in this script is that you should tell every program that you use UTF-8. Just login again and try to rename any file – it should be working now.
, ,