Monday, August 25, 2008
VTune: glibc-32bit version 9 or higher
My work around was to take replace the file data/preinstall_vtune_check.sh with one from an earlier build version (VTune 9.0 U1-969 or VTune U7-1448). Then the version check passed and I got an installed VTune.
Compiling the linux kernel
1. Download the kernel source from www.kernel.org let's say linux-x.y.z.tar.gz
2. Expand the archive in /usr/src directory "$tar -xzvf linux-x.y.x.tar.gz"
3. Create a linux link to the source directory
$ln -s linux-x.y.x linux
4. $cd linux
go into the source directory
5. If you want to delete the previously compiled kernel object files, configuration files run
$make mrproper
6. Configure the kernel (one of below)
6.1. $make config (you will be promted for each configuration parameter one by one)
6.2. $make menuconfig (you will be have text based menu in the terminal, easier for navigation, requires library ncurses installed)
6.3. $make xconfig (you will be have a graphical window to configure the kernel, you will need to have many packages installed).
7. Build the kernel
$ make
8. Build the modules
$make modules
9. Install the modules
$make modules_install
10. Install the kernel
$make install
This will create four files in directory /boot
- vmlinuz-x.y.z (the kernel)
- System.Map-x.y.z
- config-x.y.y
- initrd-x.y.z
Saturday, August 23, 2008
Slow sleep (suspend) in Windows Vista
In Windows Vista it takes significant time to get the system in low-power mode when you select Sleep (or close the Lid of your laptop). The reason for this is that in Vista sleep is not exactly the sleep in XP and is called hybrid sleep.
Hybrid sleep is a combination between the normal sleep (suspend) and hibernate. When Hybrid sleep is enabled, the data in the main memory is stored into the hard drive and then the system goes into low-power mode. The reason for saving the data from the main memory to the hard drive is that an electricity cut will cause the computer to turn off if it does not have battery and all the changes in unsaved files lost. Because of saving the memory into the hard drive the overall sleep process in vista takes quite long time - 30-180 seconds.
Hybrid sleep is more suitable for desktop computers since they don't have batteries. Laptops have batteries and when the power level of the battery reaches the critical level the system automatically hibernates if it is in low-power mode avoiding the risk of losing unsaved data.
To turn off hybrid sleep (bypass saving the data in memory to the hard drive) follow the steps:
1. Open "Power Options"
- Click the Start button and on the search type "Power Options"
2. For any power plan click "Change plan settings"
3. Click "Change advanced power settings"

4. Expand the "Sleep Node" and "Allow hybrid sleep"
- If "Allow hybrid sleep" does not exists then
4.1. Open "Command prompt" as administrator
- In the search box Start menu type "Command prompt" then right click on the icon and select "Run as administrator"
4.2. type "powercfg /hybenrate on"
if necessary start from step 1.
5. Ensure that under "Allow hybrid sleep" both "On battery" and "Plugged in" are selected off.
6. Press OK and if required restart the computer.
7. To make the Sleep processes be faster you have to disable
7.1. Superfetch; and
7.2. ReadyBoost for your devices.
Disable Superfetch.
1. Open up Services from Control Panel (services.msc)
2. Find the service Superfetch in the list, stop it and disable it for future use.

Disabling ReadyBoost
- Plug your USB storage device
- Right click on the drive letter of the USB storage device and select properties.
- Go to ReadyBoostTab
- Select "Do not use this device" option
- Click OK.

After doing the described procedures your computer should go into Sleep mode for about 5-8 seconds.
Monday, January 23, 2006
Tourism Adviser - Expert System in Prolog
Title: : Tourism Adviser Expert System
Author : Ferad Zyulkyarov
Date : 23.01.2006
University : Dokuz Eylul University
Department : Computer Engineering
Course : CSE423 Logic Programming and Expert Systems
Lecturer : Prof. Dr. Tatyana Yakhno
This is a very simple Expert System implemented in prolog (Visual Prolog).
It captures the knowledge of a hotel adviser. The knowledge base consists
of the "hotel" type facts that each fact specifies a single hotel.
The expert system begins running by unifying (staring) from the first
occurrence of the "run" predicate. It asks the user for a general
question. Depending on the given answer, the execution flow (unification)
branches on the corresponding "suitable_for" rule. The backtracking
continues until all rules have been exhausted (all solutions are found),
not until finding the first matching (solution).
The solution consists of two general types of rules:
1) derivation rules that are defined by "suitable_for" predicate;
2) and utility rules:
- price;
- ask_attribute;
- clear_facts;
- location_to_distance;
- clear_facts.
The entry point of the program is the first "run" rule.
References:
(1) PDC, Visual Prolog Language Tutorial, "Building a Small
Expert System", p.439-p.444, 2001
(2) Simple tourism adviser Expert System, avalable online at:
http://www.generation5.org/content/2002/prg01.asp,
last accessed on 08.12.2005
*/
facts
/*
hotel(Name, Distance, Stars, Season, Animation, Suit, Catering, BuildingType)
Specifies a hotel.
Name - the name of the hotel
Distance - the distance to the nearest city in kilometers.
Stars - the number of stars assigned to the hotel (1-5)
Season - the seasons that the hotel is open
summer - only summer
winter - only winter
all - all seasons
Animation - whether the hotel has animation (yes/no)
Suit - whether the hotel has a suit room (yes/no)
Catering - specifies the type of catering the hotel provides
all - all inclusive
breakfast - only breakfast
self - nothing
BuildingType - is the type of the rooms the hotel has
0 - only rooms
1 - only apartments
2 - only bungalow
3 - all the above
*/
hotel(string, integer, integer, symbol, integer, integer, symbol, integer)
/*
attribute(AttributeName, AttributeValue)
A pair of attribute name and value in the memory database.
AttributeName - is the name of the attribute.
AttributeValue - is the value of the attribute.
*/
attribute(symbol, symbol)
predicates
/*
The entri point of the program.
*/
nondeterm run
/*
Clears collected facts.
*/
clear_facts - determ ()
/*
ask_attribute(AttributeName, Message, AttributeValue)
Asks the user for the value of the attribute. The question
is accompanied with the message.
Inputs:
AttributeName - the name of the attribute
Message - the message associated with the question; can be
the possible values.
Outputs:
AttributeValue - the value of the attribute entered by the user.
*/
ask_attribute(symbol, symbol, symbol) - nondeterm (i, i, o)
/*
suitable_for(Criteria, Hotel)
Checks whether the specified hotel satisifes (is suitable for)
the specified criteria.
Input:
Criteria - the criteria
Hotel - the hotel
*/
nondeterm suitable_for(symbol, symbol)
/*
location_to_distance(Location, MinLimit, MaxLimit)
Obtains the range for the distance of the hotel.
Input:
Location - is the location (city or resort)
Output:
MinLimit - the minimum distance allowed
MaxLimit - the maximum distance allowed
*/
location_to_distance(symbol, integer, integer) - nondeterm (i, o, o)
/*
price(Hotel, Price)
Checks the price of the hotel. The test is done based onthe
stars of the hotel.
Inputs:
Hotel - the hotel to be checked
Output:
Price - the price category (expensive, moderate or cheap).
*/
nondeterm price(symbol, symbol)
clauses
% declaration of the facts
hotel("Hilton", 0, 5, all, 0, 1, breakfast, 0).
hotel("Efes", 1, 4, all, 0, 1, breakfast, 0).
hotel("Titanik", 550, 5, summer, 1, 1, all, 3).
hotel("Cesme Sheraton", 110, 5, summer, 1, 0, all, 0).
hotel("Lara", 110, 3, summer, 1, 0, all, 2).
hotel("Babadan", 1, 3, all, 0, 0, self, 0).
hotel("Bornova Yurt", 8, 1, all, 0, 0, self, 0).
hotel("Uludagi", 450, 5, winter, 1, 0, all, 2).
hotel("Kars", 900, 3, winter, 0, 0, all, 3).
hotel("Abant", 600, 3, winter, 0, 0, all, 1).
hotel("Bolu", 420, 3, winter, 0, 0, breakfast, 0).
hotel("Sari Kamis", 880, 4, winter, 0, 0, all, 3).
% The entry point
run:-
ask_attribute(location, "{resort, city}", Location),
hotel(Hotel, _, _, _, _, _, _, _),
suitable_for(Location, Hotel),
write("Suitable Hotel: ", Hotel),
nl, fail.
run:-
write("\nUnable to advise a hotel.\n"),
clear_facts,
readchar(_).
/* Utility Rules */
clear_facts:-
write("Please press the space button to exit.\n"),
retractall(_, dbasedom),
readchar(_).
ask_attribute(Attr, PossibleValues, AttrValue):-
attribute(Attr, AttrValue), !;
write("Enter ", Attr, " ", PossibleValues, " : "),
readln(AttrValue),
assertz(attribute(Attr, AttrValue)).
location_to_distance(Location, MinLimit, MaxLimit):-
Location = resort, MinLimit = 50, MaxLimit = 1000;
Location = city, MinLimit = -1, MaxLimit = 10;
Location = airport, MinLimit = 10, MaxLimit = 50.
price(Hotel, Cost):-
hotel(Hotel, _, Stars, _, _, _, _, _),
Stars >3, Stars < 6, Cost = expensive;
hotel(Hotel, _, Stars, _, _, _, _, _),
Stars > 1, Stars < 4, Cost = moderate;
hotel(Hotel, _, Stars, _, _, _, _, _),
Stars = 1, Cost = cheap.
/* Derivation rules */
suitable_for(city, Hotel):-
location_to_distance(city, MinLimit, MaxLimit),
hotel(Hotel, Distance, _, _, _, _, _, _),
Distance > MinLimit,
Distance < MaxLimit,
ask_attribute(trip_type, "{business, city visitation}", AttrVal),
suitable_for(AttrVal, Hotel).
suitable_for(resort, Hotel):-
location_to_distance(resort, MinLimit, MaxLimit),
hotel(Hotel, Distance, _, _, _, _, _, _),
Distance > MinLimit,
Distance < MaxLimit,
ask_attribute(season, "{summer, winter}", AttrVal),
suitable_for(AttrVal, Hotel).
suitable_for(business, Hotel):-
price(Hotel, Cost),
Cost = expensive.
suitable_for("city visitation", Hotel):-
price(Hotel, Cost),
Cost = moderate;
price(Hotel, Cost),
Cost = cheap.
suitable_for(summer, Hotel):-
hotel(Hotel, _, _, summer, _, _, _, _),
ask_attribute(guest_typem, "{honey month, friends, family, alone}", AttrVal),
suitable_for(AttrVal, Hotel).
suitable_for(winter, Hotel):-
hotel(Hotel, _, _, winter, _, _, _, _),
ask_attribute(guest_type, "{honey month, friends, family, alone}", AttrVal),
suitable_for(AttrVal, Hotel).
suitable_for("honey month", Hotel):-
hotel(Hotel, _, 5, _, _, 1, all, _).
suitable_for(friends, Hotel):-
hotel(Hotel, _, _, _, _, _, _, RoomType),
RoomType > 0,
price(Hotel, Price),
not(Price = expensive).
suitable_for(family, Hotel):-
hotel(Hotel, _, _, _, 1, _, all, RoomType),
RoomType > 0,
Price(Hotel, Price),
not(Price = expensive).
suitable_for(alone, Hotel):-
hotel(Hotel, _, _, _, _, _, _, 0),
price(Hotel, Price),
not(Price = cheap).
goal
run.
Tuesday, January 10, 2006
Kerberos – Explained Shortly
Protocol Description
Kerberos uses as its basis the Needham-Schroeder protocol. It makes use of a trusted third party, termed a Key Distribution Center (KDC), which consists of two logically separate parts: an Authentication Server (AS) and a Ticket Granting Server (TGS). Kerberos works on the basis of "tickets" which serve to prove the identity of users.
Kerberos maintains a database of secret keys; each entity on the network — whether a client or a server — shares a secret key known only to itself and to Kerberos. Knowledge of this key serves to prove an entity's identity. For communication between two entities, Kerberos generates a session key which they can use to secure their interactions.
ScenarioThis section gives an example of the Kerberos protocol in action. The following abbreviations will be used:
AS –Authentication Server;
TGS – Ticket Granting Server;
SS – Service Server.
In one sentence: the client authenticates itself to AS, then demonstrates to the TGS that it's authorized to receive a ticket for a service (and receives it), then demonstrates to the SS that it has been approved to receive the service, see the figure below.
In more detail:
A user enters a username and password on the client.
The client performs a one way hash on the entered password, and this becomes the secret key of the client.
The client sends a clear-text message to the AS requesting services on behalf of the user. Sample Message: "User XYZ would like to request services". Note: Neither the secret key nor the password is sent to the AS.
The AS checks to see if the client is in its database. If it is, the AS sends back the following two messages to the client:
Message A: Client/TGS session key encrypted using the secret key of the user.
Message B: Ticket-Granting Ticket (which includes the client ID, client network address, ticket validity period, and the client/TGS session key) encrypted using the secret key of the TGS.
Once the client receives messages A and B, it decrypts message A to obtain the client/TGS session key. This session key is used for further communications with TGS. (Note: The client cannot decrypt the Message B, as it is encrypted using TGS's secret key.) At this point, the client has enough information to authenticate itself to the TGS.
When requesting services, the client sends the following two messages to the TGS:
Message C: Composed of the Ticket-Granting Ticket from message B and the ID of the requested service.
Message D: Authenticator (which is composed of the client ID and the timestamp), encrypted using the client/TGS session key.
Upon receiving messages C and D, the TGS decrypts message D (Authenticator) using the client/TGS session key and sends the following two messages to the client:
Message E: Client-to-server ticket (which includes the client ID, client network address, validity period) encrypted using the service's secret key.
Message F: Client/server session key encrypted with the client/TGS session key.
Upon receiving messages E and F from TGS, the client has enough information to authenticate itself to the SS. The client connects to the SS and sends the following two messages:
Message G: the client-to-server ticket, encrypted using service's secret key.
Message H: a new Authenticator, which includes the client ID, timestamp and is encrypted using client/server session key.
The server decrypts the ticket using its own secret key and sends the following message to the client to confirm its true identity and willingness to serve the client:
Message I: the timestamp found in client's recent Authenticator plus 1, encrypted using the client/server session key.
The client decrypts the confirmation using its shared key with the server and checks whether the timestamp is correctly updated. If so, then the client can trust the server and can start issuing service requests to the server.
The server provides the requested services to the client.
