Monday 29 December 2008

Студентската книжарничка и подобни

В магистратурата по "Софтуерни технологии" на ПУ "Паисий Хилендарски" когато се стигне до курсови проекти, независимо дали става въпрос за направата на уеб сайт/онлайн магазин или приложение за бази данни, темата обикновено е свързана с книгите - библиотека или книжарница. Този триместър заданието е комплексно - изисква да се приложат знания и по трите изучавани дисциплини. Иначе казано в онлайн книжарницата (или кой каквото сътвори, защото книжарницата е само кнотролен пример) трябва да е уеб базирано Java приложение, в което да присъстват в една или друга степен следните технологии:
  • HTML + CSS - като представителен слой;
  • JavaScript - най-малкото за валидация на формите;
  • XML - като персистентен механизъм (вместо база данни);
  • JSP и Servlet-и - отново за представителния слой и за изграждане на логиката на приложението;
  • MVC (Model, View, Controller design pattern) - цялостната архитектура на програмата трябва да отговаря на този шаблон за дизайн.
На пръв поглед възможността за създаване на пълна бъркотия изглежда доста реална. Всъщност в наши дни изброените технологии никак не са много, защото реалнте прокети, с които се сблъскват професионалните прогамисти са доста по-сложни и като архитектура (MVC е само част от картинката), и като изисквани технологии. Все пак за начинаещите това е едно доста добро начало и не би било излишно едно рамо в правилната посока. Според мен верния подход не е само един, но няма да разисквам повече. Най-близка до мисловната ми настройка е следната схема:
  1. Стартиране на нов проект като уеб приложение.
  2. Изграждане на механизма за съхранение на данните - оформяне на хранилището за данните в XML файл. Стуктурата му може да се установи в DTD или XML Schema файл, достъпен при необходимост от валидация.
  3. Като добавка може да се напишат Java Beans обектите, който ще подпомагат съхраняването на данните.
  4. Оформяне на вида на приложението (като се започне от индексната страница) - статичните страници могат да са в HTML формат, но динамичните е необходимо да бъдат JSP.
  5. Свързване на страниците и реализиране на функционалностите - разширяване на JSP и HTML страниците, чрез свързването им с реализираните на тази стъпка Servlet обекти. Последните трябва да могат да съхраняват данните в XML с помощта на Java Beans обектите.
  6. Дооформяне на външния вид на страниците посредством CSS, който е приложим както към HTML, така и към JSP файловете.
  7. Довършване на функционалността на страниците, чрез добавяне на JavaScript валидация на полетата за въвеждане на данните.
Тук не са задължителни нито последователността на стъпките, нито грануларността им (броят на степените, на които е разбита задачата). Подробностите по реализиране на всяка от стъпките могат да се видят с примери в документните файлове дадени по време на упражненията и разгледани вече един път там. В крайна сметка сметка изпълнен по този начин проекта би трябвало да е отговаря на MVC шаблона.

Tuesday 21 October 2008

Бази данни: Една реалистична задача

Тук е споделен PL/SQL скрипт, който може да е полезен (в съответните вариации разбира се) за задача като описаната тук.
Да предположим, че разполагаме с няколко-стотин таблици на Oracle DB Server (с версия примерно > 8.0i)
. На някои (приятел, колега, клиент, ...) е нужно да разполага със списък на стойностите от някои от колоните на част от таблиците в базата. Иначе казано предоставил ни е списък със следния формат:

име_таблица1, име_колона1
име_таблица2, име_колона1
...
име_таблицаN, име_колона1
име_таблицаN, име_колона2
...
Нашата скромна задачка е да разширим този списък с трета колонка, така че формата му да се промени на:
име_таблица1, име_колона1, стойност1
име_таблица1, име_колона1, стойност2
име_таблица1, име_колона1, стойност3
...
име_таблица2, име_колона1, стойност1
...
име_таблицаN, име_колона1, стойност1
име_таблицаN, име_колона1, стойност2
...
име_таблицаN, име_колона2
...
Единственото ограничение е всеки ред от списъка да е уникален, т.е. за всяка двойка таблица-колона да се вземат само неповтарящите се стойности от базата.

Остава преди да пристъпим към самото изпълнение на скрипта, да премислим как ще отработим входа и изхода му. Първо ще споменем за изхода, тъй като решението там е тривиално.
Изход: Може би най-удобния начин за представяне на таблични данни е ... таблицата. Затова още в началото на скрипта (преди още да се декларират променливите) се отделя една секция за следната DDL дефиниция:
DROP TABLE output PURGE;

CREATE TABLE output (
table_name VARCHAR2(100) NOT NULL,
column_name VARCHAR2(100) NOT NULL,
initial_value VARCHAR2(4000) NOT NULL,
CONSTRAINT unique_row UNIQUE (table_name, column_name, initial_value)
);
Разбира се ограничението за уникалност не е задължително да присъства, още повече, че самия скрипт я гарантира.
От друга страна това не може да е крайния изход, който да е необходим на човека дал ни задачата. За щастие работим с Oracle SQL Developer, при който в контекстното меню на всяка таблица ни е предоставена възможността да изведем данните в редица текстови формати. Изборът на крайния формат е според личните предпочитания и нужди и не изисква особено разяснение.
Вход: Нека няма предявено изискване за оптимизирано решение на задачата, но въпреки това като стъпка към него да използваме структурата на Oracle
асоцииран масив. Особеността, която ще приложим е свързана с размерността на входните данни - ще ги превърнем от двумерни в едномерни. Това означава, че ще разположим последователно двойките "таблица-колона" в масива по такъв начин, че самото индексиране да държи сметка за семантиката на данните, т.е. на нечетните индекси ще се намират таблиците, а на четните - колоните. Смисълът на това изкуствено намаляване на размерността на данните е, че се съкръщава използването на един цикъл. Приемаме, че някоя добра фея се погрижила за трансформирането на входните данни (които мога да наброяват хиляди), до инициализирания асоциативен масив показан по-долу. Би могла да се обсъди и възможността за използване на друг скрипт или разширяване на настоящия да върши и тази дейност, но това няма да стане точно тук.
DECLARE
TYPE Extraction IS TABLE OF VARCHAR2(100) INDEX BY binary_integer;
population Extraction;
it NUMBER; -- The iterator
nextit NUMBER; -- The iterator to be incremented with 1
intit NUMBER; -- iterator for the internal loop
countdist NUMBER := 0; -- Number of distinct records of current table
counter NUMBER := 0; -- Number of all the records of current table

TYPE DistinctiveCursor IS REF CURSOR;
dcursor DistinctiveCursor;
val VARCHAR2(4000);

BEGIN

-- Populating the massive associative array:
population(1) := 'table1';
population(2) := 'column1';
population(3) := 'table2';
population(4) := '
column1';
population(5) := '
table2';
population(6) := '
column2';
population(7) := '
table2';
population(8) := '
column3';
population(9) := '
table3';
population(10) := '
column1';

FOR it IN 1..10
LOOP
nextit := it + 1;
IF population.EXISTS(it) AND (MOD(it, 2) != 0) THEN -- iterates only the table names (odd members of the array)
--dbms_output.put_line('Current value for ' || it || ': ' || population(it) || '.');
IF population.EXISTS(nextit) THEN
--dbms_output.put_line('The next value for ' || nextit || ': ' || population(nextit) || '.');
EXECUTE IMMEDIATE ('SELECT COUNT(' || population(nextit) || ') FROM ' || population(it)) INTO counter ;
EXECUTE IMMEDIATE ('SELECT COUNT(DISTINCT(' || population(nextit) || ')) FROM ' || population(it)) INTO countdist;

OPEN dcursor FOR 'SELECT DISTINCT(' || population(nextit) || ') FROM ' || population(it);
LOOP
FETCH dcursor INTO val;
EXIT WHEN dcursor%NOTFOUND;
--dbms_output.put_line('Stoinost: ' || val);

-- Here goes the actual work of the script:
EXECUTE IMMEDIATE 'INSERT INTO output (table_name, column_name, initial_value) VALUES (:v1, :v2, :v3)'
USING population(it), population(nextit), COALESCE(val, '--- NO VALUE WAS FOUND IN THIS OBJECT! ---');

END LOOP;
CLOSE dcursor;
COMMIT;

END IF;

--dbms_output.put_line('### In this table there are total ' || counter || ' rows and ' || countdist || ' of them are unique.');

END IF;

END LOOP;

END;

Тънките моменти в скрипта са коментирани. В коментар е сложен и изхода към конзолата, който може да се използва за дебъг при случай на нужда.
Разбира се написването на този скрипт нямаше да стане без съответния уеб трафик генериран с помощта на Google. От всичко открито (има стотици наръчници за най-продваната база данни) най-голяма помощ ми оказа този блог.

Thursday 3 April 2008

Portable Development - the JAVA trail

In the previous post most of the questions were only glanced at their surface. Some of the topics deserve more in depth exploration, which cannot be achieved in a single article. Despite that here we'll take one more fast look at the intersection between the PortableApps suite and two of the most powerful and widely used open source tools (IDEs) for JAVA development - NetBeans and eclipse.
I chose them not only because of their popularity but also because they are Platforms and represent two different approaches in creating a platform on which any other desktop application, rich with features can be built.
The glance here focuses on the possible ability of the IDEs to be made portable. As NetBeans is my favorite development tool of all. More articles concerning this one will be posted on its specialized blog.

The Environment
The first thing about development in any platform is preparing the environment - installing the tools involved in the development chain and eventually configuring them. In the JAVA case these are the Virtual Machine (JVM) - the interpreter of the byte code, the Compiler - the major development tool that translates the source code into the interpreted byte code, the documenting tool (javadoc.exe), the packaging tool (packager.exe) and lots of others complementary executables bound together into a JAVA Development Kit (JDK). The details on the ways of installing the Development Kit on portable device are available in this blog.
Once you have these tools detached from the host system, you have enough to simply start coding. In the PA Menu you may install Notepad++ Portable (it is an excellent editor for writing the code, which can be configured to act as a simple IDE for managing very small projects) and Command Prompt Portable (a console which can be configured according to your mobile environment). But even without them any system should provide such minimum tools. Whether you have enough privileges to change the environment variables is a different topic.

The Integrated Development Environments
Generally the eclipse IDE is easier because it has no installer, but the NetBeans' one is flexible enough to let you put it on the USB drive. So let's do it step by step.

*** eclipse ***
Download the ZIP archive of your preferred version from http://www.eclipse.org/downloads/.
Unzip it into the folder 'X:\PortableApps\'. Switch the drive letter to what's relevant for you.
The directory 'eclipse' is created there. Open the PA Menu and refresh it. Two new icons appear. Both of them start the IDE. The second one starts it in a console, so if you don't need this feature, just move the executable to some subfolder and refresh again.
If on the system where you set up your portable environment there is JRE or JDK installed already, if you run your newly imported eclipse, it finds the runtime environment and configures itself according to it.
That is nice of eclipse but is not very portable in our sense. In this case the first time you start the IDE on a system without JAVA, it will cry out for help, asking you to point to it where the JAVA is. So now we're gonna have to fix that.
What I normally would do in the past is to open the 'X:\PortableApps\eclipse\configuration\config.ini' file and change the value of the appropriate variable to point. These days situation is different. In the last version (europa or 3.3) overall configuration is made more sophisticated. Just open Window > Preferences... from the program menu and navigate to Java > Installed JREs and change the default location to point where you installed the JAVA SDK on your USB disk.
Now you're independent of the system specifics.

I'd like to mention here the Aptana Studio IDE. It is not meant for JAVA but is an ultimate Web development tool designed around coding in AJAX, Ruby (the 'On Rails' platform), PHP, etc. Part of its robustness is due to the fact that it is built on the eclipse platform. That's why it can be installed in the PA Menu exactly the same way as the eclipse IDE. And that is the reason I mention it.

*** NetBeans ***
Installing it is quite similar, but let's go through it anyway.
Run the installer you downloaded from http://download.netbeans.org/netbeans/6.0/final/ (the latest stable release) or http://download.netbeans.org/netbeans/6.1/beta/ (the beta of the interesting new version).
I recommend the full version of the installer. After all you may not install everything but it is good to have the rest at hand (just in case).
Customizing what to install is possible on the first 'page' of the wizard. For default just press 'Next'. Then accept the 'License Agreement' and continue to the next page which is the most important step. Here you define the point of install and the source of the runtime. In both cases point to the appropriate folders on your portable device. Here is an example:
Install at: 'X:\PortableApps\NetBeans 6.1 Beta'
Get runtime from: 'X:\tools\jdk1.6.0_03'
Press 'Next' and then 'Install'. Now wait a while for the process to finish. The full installation takes up to 500 MegaBytes on the drive, but that doesn't count the two servers: Apache Tomcat 6.0.14 (about 12 MB more) and the GlassFish v2 (with its additional 142 MB). They both by default are installed in 'C:\Program Files'. If you find it sensible may move them to a portable location and reconfigure them accordingly (me, I wouldn't do it).
After pressing 'Finish' and refresh the PA Menu only the 'uninstall.exe' of the application appears - exactly the one you don't need at the moment.
What you can do is simply to switch places of the two executables. Go to the 'X:\PortableApps\NetBeans 6.1 Beta\bin' directory and move upfolder the 'netbeans.exe' file while placing here the uninstaller. Refresh again the PA Menu and that's it.

Monday 24 March 2008

Praise the Mobile Portability

Where in the technologies world the ability to store data and applications meets the possibility to use them just anywhere? The mobile disk devices of course. And when it comes to have one on an affordable price the first thing one can think of is the USB memory device.
They are produced in many shapes from many vendors and fast become bigger and bigger in storage space.
What's more important and interesting than what USB disks are is how can they be used.
Well just take a look at some sites: Pegtop, PortablePython or PortableApps.
Especially the last one!
It is a big one - an enormous impact on the world of mobile applications and the idea of carrying your digital personality with you everywhere. Even right now I'm writing this post using the portable version of Firefox (provided by PortableApps) while browsing the net. It is not just a set of solutions, it is a Platform.

The Applications Set
So if you decide to try it don't hesitate but download one of the three versions of the PortableApps suite. The menu is wonderful. It looks a bit familiar, because resembles the Windows' start menu (only placed on the right side of the screen). It also minimizes to the system tray where from it is accessible with a single click. One of the most useful features is its monitor of the free space available on the portable drive.
The applications available on the site are divided into categories and range from games and accessibility aids to "on the fly" development tools.

Development
Mentioning the latter group, the PHP web developers are given access to the robust solution XAMPP, which incorporates a database server (MySQL made portable - nice!), the programming language PHP (there is also an option to code in Perl) and the most popular free web server - Apache.
I'll leave the interesting tale of how to make some other development tools portable for another post, but I can not miss to mention the fine PortablePython platform, which includes the quite serious django web framework.
It is also possible for you to manage your projects if you are a C/C++|Java|Ruby developer - the powerful IDEs like NetBeans and eclipse are very easily made portable, and even accessible from the PA menu.

Extending beyond the PortableApps
Not only additional development tools can be added to the PA Suite, but any EXEcutable can be ported to the PA menu. You'll just have to place it properly on the USB drive - in the 'PortableApps' directory make another one for the application you will be accessing from the PA menu. Place your executable (and its supporting files - configurations, libraries, etc.) into that folder and you're almost done. Open the menu from the tray. From options choose 'Refresh App Icons' and an icon of your application should appear in the list on the left.
There are some drawbacks:
  • the *.exe file should be placed exactly into the newly created directory and nowhere else (shortcuts won't work);
  • and what's worse if there are other executables in the folder that you don't want to use (like uninstall.exe) they will show up in the menu. It looks ugly. So if you don't want them, you'll have to move them in a subfolder.
In my opinion such flaws are not so relevant. After all the PortableApps Suite is pretty self standardized and full of tools (just take a look at the bunch of apps available on their site - few things are missing and in time the list grows bigger). That's why it is so easy to make a regular (and not strictly tied to Windows internal libraries) application a portable one, available in the menu. It is enough to mimic the directory structure of the other portables. And if you're eager to investigate and experiment, you may also try some additional configurations (anything beyond that makes you a PortableApps.com Developer, right?).
In the near past I collected these little apps that work anywhere you place them and rarely are more than just an executable. These were small (mostly less than a MegaByte) and useful and sometimes very easy to lose them in the file system. Now finally they all found a home. And that home is everywhere where Windows lives.

Some portability beyond Windows
Well all this beauty cannot be accessed in Linux. Right?
Think again! I've used the PA Menu in Ubuntu Linux (with WINE installed of course). It is not as pretty as in the original case but it is useful after all. I haven't tried all the applications but at least the OpenOffice works :D Using the OpenOffice application from the PortableApps in Ubuntu or other Linux (if the distro comes with it) is generally stupid idea when you can use it natively - at least the performance will be better. But as long as portability is concerned, this is pretty much an achievement.
That's one of the aspects - even on Linux with WINE most of your portable Windows executables are useful.
The other aspect - did we all forget about JAVA? Yes, the predecessor of all this hype. The binaries that were expected to run even on toasters.
The thing is that the JAVA applications can not be ported in the PA Menu (at least not when there is no executable responsible for starting the JAR files). So what? They can be used after all. All the requirement is to have an appropriate JAVA Runtime Environment (or JRE) somewhere on the system. But wait! Although JAVA is very wide spread these days that doesn't make it omnipresent. And even if you find it on every system you poke your drive, how can you be sure that the version available will suffice? The answer to these questions is very simple - make your JAVA portable ;) Actually I made my USB drive a development environment for JAVA - I can execute, but also I can develop JAVA programs directly from the drive. That is very easy and is explained in some more details here.
And when we talk about JAVA the word everywhere is closest to the truth. On Linux and Windows I've used my "jarred" tools the same manner and they behave the same way.

So in this world of flexibility and unlimited possibilities for using applications and data all I can say is: Praise the portability and observe the horizon for the next generation.

Monday 11 February 2008

За колегите: Упражнявайте базите данни!

Здравейте, на нашата "голяма" Група!

В чекмеджето на нашата обща пощенска кутия (softuerni_07@вие.знаете.къде) днес сложих едно архивче. Целта му е да улесни всички при упражненията по бази данни.
Работата е там, че ни преподават основите на езика SQL чрез MS-SQL сървър. Само инсталацията на това чудовище е около едно CD, да не говорим колко пространство ще заеме на твърдия диск. Е, нужно ли е да използваш балистична ракета за да убиеш комар? (Аналогията не е много добра, защото всъщност езика SQL е по-голямото и значимо нещо отколкото иснтрумента, в който се използва. Но това е друга тема.) Тогава как да си помогнем за упражненията? Как да започнем с изучаването на един от най-лесните, приятни и мощни езици? Тук ще дам три връзки, които предоставят само едно първоначално насочване:
  1. SQLite - проектът. Сайтът на една наистина оригинална и все по-популярна идея.
  2. SQLite в Wikipedia - нещата обяснени малко по-подробно.
  3. SQL в W3Schools - едно много достъпно входно ниво за езика, с реална възможност за изпробване на наученото онлайн.

Що се отнася до файловете в архива:
  1. sqlite3.exe - тази самостоятелна програмка е напълно достатъчна за да си направите и редактирате база данни от командната линия (DOS Prompt). Ако все пак не обичате черния екран с мигащата чертичка, можете да използвате другата програмка
  2. SQLiteSpy.exe - това е графичната обвивка на горната програма - един малък, но достатъчно добър редактор, в който бързо се създават обектите на базата данни и се пишат заявките. Да, така е - всичко става много по-лесно, когато е визуално ориентирано.
  3. SQLiteSpy.db3 и World.db3 - съотвтно пък са две примерни бази от данни. Да, тук базата данни е един единствен файл в *.db3 формат (от 3-та версия на SQLite).

По-простичко трудно би могло да бъде, особено като се има предвид, че SQLite покрива минимум CRUD принципа (какво представлява той можете да разберете отново от Wikipedia) заложен в SQL стандарта. Накратко казано този принцип е свързан с базовите операции, които използваме при работата си с обектите на базата данни:
  • Create - това са операциите свързани със създаване на обекти и записи от данни (CREATE, INSERT).
  • Read или Retrieve се отнася до операциите за извличане на данни (SELECT, JOIN, UNION).
  • Update е свързан с операциите за обновяване на съществуващите данни в базата (ALTER, UPDATE).
  • Delete има отношение към изтриването на обекти и данни (DROP, DELETE).
Тук не е включена само функционалността за възстановяване и конкурентен достъп до данните (чрез COMMIT / ROLLBACK блокове), но това са по-скоро допълнителни екстри на сървърите и се отнасят за групово изпълнение на останалите опреции по извличане и модификации на данни и обекти.
Надявам се, че SQLite ще ви е от полза при изучаването на базите от данни.

Friday 1 February 2008

Lets speak some more Linux: Ubuntu-server

This post should be called: Ubuntu 7.10 Server edition or the struggle of a newbie with the console.

So the main question is - how to make things happen?

If you have less than moderate experience with the terminal it might be quite a test. And I would almost make a mistake - at first I panicked and took a wrong path but first things first...


Installing the server edition of the fine Ubuntu system is not much different from the variant with the alternate cd. You have this text mode installer, which asks you almost the same things. Almost. Lets point some situations:

* In the first place I shouldn't let it configure the network through the DHCP. Not a problem - fixable situation but cost me time to figure it out for I'm almost completely unfamiliar with the networking and stuff (ashamed).

* In the second place - the big advantage of the server edition is that it asks you to choose from and installs for you
  • DNS server - lets you provide and use the DNS (Domain Name System) service.
  • LAMP server - tool-chain for web developers, including Apache Web server, MySQL database server and PHP/Perl/Python programming languages, all these tuned for Linux.
  • Mail Server - managing electronic mail is always useful.
  • OpenSSH server - the free distribution of the server, which manages secure shell connections.
  • PostgreSQL Server - powerful and robust object-relational database server.
  • Print Server - manages the printers in the office and the jobs assigned to them.
  • Samba file server - this one lets you have a seamless local network and file-sharing system along with Windows machines.
with just one after you've made your mind.
CAUTION! - at this version (7.10 - the Gutsy Gibbon) just skip the mail server. Installing it cost me reinstalling the system - after rebooting the new system, you end up sudo-less, which in Ubuntu means you have no eyes, you have no ears and you definitely have no fingers. This is a situation where you basically have only around two toes on the left foot. That's all. And if you can manage the whole system this way you must be quite a guru.

* I wont address here the issue of partitioning the hard drives (especially when speaking for software RAID), because it is an enormous and quite different subject (in my case the partitioning was already done and I just formatted the available partitions).

* If you're connected to Internet the ATP will want to configure itself. This process may substantially slow down at 40%, 60% or 80% or just take forever. I had once the last case - on the next morning I should start the installation again. Somewhere in the Ubuntu forums someone said it happens sometimes. An easy work-around is if you just unplug the PC from the network, so you'll just let the APT will configure itself later.

After installing the specialized servers (remember! NO Mail Server in Gutsy!) it is almost done. If there are no glitches and delays the whole installation may take around twenty minutes. Cool! :)

There. After the reboot you're already there - at your shiny terminal. Don't forget that in Ubuntu you have up to seven virtual terminals (accessible by pressing Ctrl-Alt + F1 to F7).
So what's first?
For a moment I didn't know what to do. But there are things that must be done: check your network for example

Getting to know the console of your distro is like slowly and inevitably falling in love. Its like raising a child (not that I have one but you know what I mean).

....
And the lost path of thoughts made this post unproperly finished. But as long as this whole blog is some sort of a draft I publish it in such state. If questioned, answeres will be sought and eventually provided.

Честит Рожден Ден!

Днес моят много-уважаван колега, Тошко достигна Христовата възраст! Айде, живот и здраве и като утроиш тези две тройки да се радваш на много правнуци ;)

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

Много здраве и голяма веселба!

Thursday 24 January 2008

In Memorium: Heath Ledger

Една звезда угасна преди да достигнала най-големия си блясък!
Heath Ledger почина. Това как е станало не е от толкова голямо значение, колкото факта, че няма повече да ни радва с таланта си от екрана. Защото той беше наистина един много обещаващ актьор. Това личеше дори и в забавните му роли от "10 неща, които мразя в теб" и "Като рицарите". Дори противоречивия Холивуд забеляза наистина сериозното му превъплъщение за "Планианта Броукбек".
Аз да си призная съм голям BATMAN почитател и страшно се зарадвах, когато разбрах, кой ще играе ролята на Джокера в "The Dark Night" (отново на интересния Кристофър Нолан), бях много силно заинтригуван - определено очаквам вълнуващо изпълнение.
Това за съжаление е последния филм нa Heath.
А още нямаше 30.
Почивай в мир Heath и дано поне Господ се радва на играта ти там горе!

Tuesday 22 January 2008

Lets speak some Linux: How to make an alias of a command

The first thing to mention is that almost all of my Linux experience comes from the realm of Ubuntu. This is very nice system. It appeared little strange to me the first time, because my first Linux was SuSE 9.3 ... but I'm gettin' off the topic (it's gonna be chaos I told you). About distributions I'll talk later.

So. Ubuntu. No root password, still nifty super-user access.
Now the aliases. Simply put the alias is just a Linux command. It is a way to define a replacement for other Linux command. Generally one uses it to ease their lives by replacing a more complex command (with usually a big set of parameters) with a much shorter representation.

If you google for the 'alias linux' a lots of nice and detailed resources will come up.
Nevertheless in a nutshell my comprehension of the subject - there are two basic ways for defining an alias:

* In a file. When logged in Ubuntu as a regular user in your environment (e.g. your user's home directory) there is a hidden file called .bashrc. This is a configuration file for your bash shell, so everything defined here applies to the terminal window you use with your account (if you sudo
for example, the scope will change, and different configuration is applied). If you scroll down the file to line around 60-70 you will stumble upon lines which define some quick aliases. These are just simple examples but you can get the point. The syntax is:
$ alias alias_name='regular_linux_commad -with -options'
or just
$ alias ecl='/home/user/eclipse/eclipse'
if I want to run my eclipse IDE from the command line the fast way.

* On the console or inline. That's the quicker way - you just issue the command and the shell remembers it. Quicker but dirtier because the shell remembers your alias only for the current session. So if you want your alias to last for good (or at least for the lifetime of your Linux distribution or /home partition) after being defined only once, you'd better use the first way.
A thing about the above example - in aliases where you specify a path on a partition might appear traitorous, especially if you write relative paths in your alias - they become dependent on where you are at the moment. So if you ever use path in an alias, just make it absolute. Avoid the relative ones.
To summarize - the alias command defines aliases to complex commands and it's purpose is to simplify your experience with the shell. Put in other way the alias might be thought of as one-line shell script. That's a funny approach :D

That's for now. See you ;)

Thursday 17 January 2008

Честит Рожден Ден!

Днес баща ми има рожден ден (61). Честито, тате! Да си ми жив и много здрав още по две!

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

За сега толкова. Темата ще е с продължение...
Here we are! or Здавейте! (A word in my native language)

What is Internet if not a Reign of Structured Chaos.
Likewise this my blog will tend to be an initial spot, a starting point for massive display of topic shifting. Not only that but in time (if I'm safe and sound) it'll become a multilingual (for now just bilingual) one.
So what's the story? A blog is supposed to be a place where you can write anything and everything, and where you can save an escaping thought. For good! So I will. I intend to. Let's see what happens. Re-check after one year. Would it really be a genuine hotchpotch of topics? Would it have a substantial feedback if ever any?
Time will show.

И сега малко завръщане към родния език.
Не знам какво точно ще се получи от този дневник с времето и дали въобще, ще го поддържам, но ако даде Господ, тук ще има споделени мисли по много различни теми, като започнем от компютрите, като преминем през киното и стигнем до човешките взаимоотношения. Предвид, че това не са теми, а цели Вселени и факта, че не само темите, а и патоса ще варира
много - от сериозен и делови, до крайно шеговит, значи наистина се очертава един съвсем нормален, човешки миш-маш от мисли.

Хайде сполай ти и сполука johnniepop и дъъълги години да го списваш ;p

А на вас, които четете, дано намерите нещо и за себе си.
And to all of you who read this stuff, I hope you'll find something for your own.

Good luck!