Saturday 26 September 2009

Opening Iso file in Linux

Ones who like trying many Linux distros or ones who like playing PSX game on emulator (stop piracy hehehe :D ), at least had once facing an iso file. If you want to open and read the contain, you can do it with this command on terminal (login as root):

# mount file.iso /destination/directory -o loop

then open /destination/directory.

That command means mounting a file name 'file.iso' to '/destination/directory'. While '-o loop' means mount will try to find some unused loop device and use that. You can change 'file.iso' with your file name, and change '/destination/directory' to your destination directory.

For example, if you have a file 'Movie.iso' in '/tmp' directory that you want to be mounted on '/mnt/Movie'. To mount it, type command:

# mount /tmp/Movie.iso /mnt/Movie -o loop

Next, open /mnt/Movie directory to view the contain of Film.iso.


Have a good try....;)

Toribash, an Innovative game

If you want to taste an interesting and unique game, Toribash worth to try.
This physic turn based fighting game genre is really innovative, differ from other games with same kind of genre. Two thumbs up game :).



On this game, a player must control every movement of his character to make its 'physical body' move, this can be done by managing contraction, relaxation, holding, extending of its joint. every single move of a joint can create a different style of movement.

It can be played online, but you must register an account to play for free. Eventhough this game can be played on single player mode and multiplayer, sadly, it not provide feature of LAN multiplayer gaming. The good news, it can be played with a low specification computer, even without a 3D accelerated video card. I have test it on my computer; Intel Pentium 4 3.06 GHz processor, 1 GB DDR2 memory, and (surprise!!!) Via P4M890 Graphic Chipset... It run smoothly :).

This game can be installed on Linux, Windows, and Mac platform.

Sorry for my bad english...

Happy gaming....:)

Tuesday 2 June 2009

Gnome on Slackware 12.2, (GSB 2.26.1 current ) in My Opinion....

After installing every package of GSB 2.26.1 current from http://gnomeslackbuild.org and look of the gnome, i got a little happiness, because it is quite nice, but......I got more uncomfortable from this gsb-current. First, my login manager was changed to gnome (kdm was the default login manager), second, it is lack of performance than kde (default slackware 12.2), so many wasting cpu time when running its application, last, this gsb-current looks like not compatible with default kde, because kde menu become scrumble after i install this gsb-current......But at least it can run mono-develop which the reason for me to install this gsb-current.....


























For every body who want to test this gsb-current can download it from http://www.slackware.org.uk/gsb/gsb-current/


My advice, don't try this gsb-current ini on your production System Operating......:)

Wednesday 29 April 2009

Exchanging two variables value without using temporary storage in C language

You can exchange values in C language without the need of the temporary storage location using three bitwise Exclusive-OR operator, look at code below:



#include <stdio.h>

int main(int argc, char *argv[])
{
int A;
int B;

A = 16;
B = 30;

printf("A=%d B=%d\n",A,B);
A ^= B;
B ^= A;
A ^= B;
printf("A=%d B=%d\n",A,B);

return 0;
}





The code after compiled will exchange value of variabel A with B, where A = 16 and B = 30 become A = 30 and B = 16.

How it works?
Value of A is XOR-ed with B value, the result then stored in A, then B XOR-ed with the altered A , this will produce the original value of A, this value then stored in B. Last, altered A value is XOR-ed with the altered B, this will produce the original B.


Here the schematically detail of its process:

A = 16 (decimal) --> 10 (hexadecimal) --> 0001 0000 (binary)
B = 30 (decimal) --> 1E (hexadecimal) --> 0001 1110 (binary)

on A ^= B statement, A being XOR-ed with B:

0001 0000 --> A
0001 1110 --> B
---------- XOR
0000 1110 --> A

the result 0000 1110 then stored in A,

on B ^= A statement, B being XOR-ed with A:

0001 1110 --> B
0000 1110 --> A
---------- XOR
0001 0000 --> B

the result 0001 0000 (16 decimal) stored in B,

on A ^= B statement, B XOR-ed with A:

0000 1110 --> A
0001 0000 --> B
---------- XOR
0001 1110 --> A

the result 0001 1110 (30 decimal) stored in A.

So the final result is:
A = 30 dan B = 16.



Have a nice try :).

Simple File Encryption

If you have a few confidential files, and you want to keep its privacy, you can use the gpg package (GNU Privacy Guard) which is a version of PGP (Pretty Good Privacy) distributed under GPL license. This package almost have been included on every Linux distro. It offers two modes of encryption: asymmetric (public key) and symmetric.

Imagine that you have a very important specification of new project you have worked on, saved in the file named PROJECT.pdf, and you want to hide it from unauthorised access. In order to do thus, use:

$ gpg --output Cipher --symmetric --cipher-algo TWOFISH PROJECT.pdf

gpg will prompt you for a password/passphrase that will be the key for securing your data. Type it and confirm. It should be as complicated as possible, but also easy to remember.

Let's walk through the command we entered. We told gpg to encrypt the PROJECT.pdf file using symmetric encryptin (--symmetric) and the TWOFISH cipher algorithm (--cipher-algo TWOFISH). Without the last option, gpg would use the default cipher, CAST5. the output will be stored in Cipher file (--output Cipher). You should be aware that, in case the given output file exists, the program will ask if it should be overwritten.

If you want to decrypt your file, use:

$ gpg --output PROJECT.pdf --decrypt Cipher

The --decrypt Cipher option means decrypt the file named Cipher whereas --output PROJECT.pdf specifies the ouput file name. gpg will automatically recognise the cipher that was used and will prompt for a password.



Reference:
1.Hakin9 Magazine, January 2005. www.hakin9.org.
2.GnuPG 1.4.9 Manual.

Monday 20 April 2009

Simple GUI with MATLAB® pragmatically programming

You must now what is a GUI before trying this stuff. A graphical user interface (GUI) is a graphical display that contains devices, or components, that enable a user to perform interactive tasks. To perform these tasks, the user of the GUI does not have to create a script or type commands at the command line. Often, the user does not have to know the details of the task at hand.

The GUI components can be menus, toolbars, push buttons, radio buttons, list boxes, and sliders, just to name a few. In MATLAB® software, a GUI can also display data in tabular form or as plots, and can group related components.

The following figure illustrates a simple GUI.















The GUI contains
-A push button component
-An edit button component

When you click a push button, A string "Hello World" will be showed in edit box.


How Does a GUI Work?
Each component, and the GUI itself, is associated with one or more user-written routines known as callbacks. The execution of each callback is triggered by a particular user action such as a button push, mouse click, selection of a menu item, or the cursor passing over a component. You, as the creator of the GUI, provide these callbacks.

So what Is a Callback?
A callback is a function that you write and associate with a specific component in the GUI or with the GUI figure itself. The callbacks control GUI or component behavior by performing some action in response to an event for its component. The event can be a mouse click on a push button, menu selection, key press, etc.

Okay, too much talking (too long so boring, I too exhausted to write this hahaha :) ). Here the source code listing:



function simple_gui
% Simple GUI with MATLAB to show how it works

% Initialize and hide the GUI as it is being constructed
fh = figure('Visible', 'off', 'Position', [360, 400, 300, 180]);

%Construct the components
% Push Button
hButton = uicontrol(fh, 'Style', 'pushbutton',...
'String', 'Push Button',...
'Position', [20, 120, 70, 25],...
'Callback',{@hButton_Callback});
% Edit Button
hEdit = uicontrol(fh, 'Style', 'edit',...
'String', '',...
'Position', [100 115 130 35]);

% Make the GUI visible.
set(fh,'Visible','on');

% Callback for hButton to show string 'Hello World' in edit Button
function hButton_Callback(source, eventdata)
set(hEdit, 'String', 'Hello World');
end

end







Well, i will explain it shortly,


function simple_gui
.
.
.
end
Every MATLAB® script with callback should be started by 'function' and ended with 'end' because this script is written using nested functions.

% blablabla
Every statement starting with '%' is a comment and will not executed by MATLAB®.


fh = figure('Visible', 'off', 'Position', [360, 400, 300, 180]);
This statement ini create figure object called fh, not visible to user. A GUI is a figure object. The Position property is a four-element vector that specifies the location of the GUI on the screen and its size: [distance from left, distance from bottom, width, height]. Default units are pixels.


hButton = uicontrol(fh, 'Style', 'pushbutton',...
'String', 'Push Button',...
'Position', [20, 120, 70, 25],...
'Callback',{@hButton_Callback});
This statement create a push button user interface control objects hButton, With fh as its GUI parent, has a String 'Push Button' on it, locate in a position 20 from left of screen, 120 from bottom screen, 70 width, 25 height, also has a callback function 'hButton_Callback' in response with event on this object.


hEdit = uicontrol(fh, 'Style', 'edit',...
'String', '',...
'Position', [100 115 130 35]);
Same explanation with hButton, but the object is an edit box.

set(fh,'Visible','on');
Setting property fh so it will be shown in screen with its components (a push button and edit box).


function hButton_Callback(source, eventdata)
set(hEdit, 'String', 'Hello World');
end
This part is a callback to hButton object. When the push button is pressed it will trigger edit box to show 'Hello World' on it.


Save the source code in a text file with extension M or m, then run it from MATLAB® command line.















Reference:
1. MATLAB® R2008A help file.
2. My fresh brain :).



Have a nice Try,


Juan Rio Sipayung

A Child Called "It", a review


Although this book has been published a couple years ago, I think this book worthy to be reviewed, remembering the story on it was a true story that happens to its writer.

This book entitled with A Child Called 'It' narrating how tragic a struggle of life of a young boy. David J. Pelzer writer, the young boy, was tortured by his own mother. Told from the point of view of the author as a young boy being starved, stabbed, smashed face-first into mirrors, forced to eat the contents of his sibling's diapers and a spoonful of ammonia, and burned over a gas stove by a maniacal, alcoholic mom. Sometimes his mother claimed he had violated some rule--no walking on the grass at school!--but mostly it was pure sadism. Inexplicably, his father didn't protect him; only an alert schoolteacher saved David.


Here an excerpt when he is forced to eat the contents of his sibling's diapers:

...
...
Father tried to make the vacation more fun by taking the three
of us to play on the new super slide. Russell, who was still a
toddler, stayed in the cabin with Mother. One day, when Ron,
Stan and I were playing at a neighbor's cabin, Mother came ou
onto the porch and yelled for us to come in immediately. Once
in the cabin, I was scolded for making too much noise. For my
punishment, I was not allowed to go with Father and my
brothers to the super slide. I sat on a chair in a corner, shivering
hoping that something would happen so the three of them
wouldn't leave. I knew Mother had something hideous on her
mind. As soon as they left, she brought out one of Russell's
soiled diapers. She smeared the diaper on my face. I tried to si
perfectly still. I knew if I moved, it would only be worse. I
didn't look up. I couldn't see Mother standing over me, but I
could hear her heavy breathing.

After what seemed like an hour, Mother knelt down beside me
and in a soft voice said, "Eat it!"

I looked straight ahead, avoiding her eyes. "No way!" I said
to myself. Like so many times before, avoiding her was the
wrong thing to do. Mother smacked me from side to side. I
clung to the chair, fearing if I fell off she would jump on me.
"I said eat it!" she sneered.

Switching tactics, I began to cry. "Slow her down", I thought
to myself. I began to count to myself, trying to concentrate.
Time was my only ally. Mother answered my crying with more
blows to my face, stopping only when she heard Russell crying.

Even with my face covered with defecation, I was pleased. I
thought I might win. I tried to wipe the shit away, flicking it
onto the wooden floor. I could hear Mother singing softly to
Russell, and I imagined him cradled in her arms, I prayed he
wouldn't fall asleep. A few minutes later my luck ran out.

Still smiling, Mother returned to her conquest. She grabbed
me by the back of the neck and led me to the kitchen. There,
spread out on the counter top, was another full diaper. The smell
turned my stomach. "Now, you are going to eat it!" she said.
Mother had the same look in her eyes that she had the day she
wanted me to lie on top of the gas stove back at the house.
Without moving my head, I moved my eyes, searching for the
daisycolored clock that I knew was on the wall. A few seconds
later, I realized the clock was behind me. Without the clock, I
felt helpless. I knew I needed to lock my concentration on
something, in order to keep any kind of control of the situation.
Before I could find the clock, Mother's hands seized my neck.
Again she repeated, "Eat it!" I held my breath. The smell was
overpowering. I tried to focus on the top corner of the diaper.
Seconds seemed like hours. Mother must have known my plan.
She slammed my face into the diaper and rubbed it from side to
side.
...
...






Happy Reading,


Juan Rio Sipayung

Rosetta Stone V3.2 On Linux with Wine

There is no version of Rosetta Stone that is produced for Linux, only Windows and MacOS, i think its developer scared of its possibility to get a market :). But don't be disappointed with this fact, today we can use Rosetta Stone V3.2 on linux although by using Wine. No problems when installling it on linux, and no error message :). Its run smoothly and fine.
















I'll try to review it a little to someone who don't know what a creature this Rosetta Stone.....

Rosetta Stone is a software used for making easy learning on mastering a certain language. Many language being covered by this software; English, French, Spanish, Japanese, Chinese, Russian, Arabian, etc. Each language oftenly packed to three level. We must buy each level to use this software. This software has a speech processing in it so every user of it can learn native speak of certain language.
Below screenshot when I use Rosetta Stone with Spanish language pack.















Try this software, you'll not regret :).

What is a Virtual Machine on Linux (Virtualization in Linux)

With Virtualization, you can run unmodified operating systems - including all of the software that is installed on them - directly on top of your existing operating system, in a special environment that is called a "virtual machine". Your physical computer is then usually called the "host", while the virtual machine is often called a "guest".

Virtualization allows the guest code to run unmodified, directly on the host computer, and the guest operating system "thinks" it's running on real machine. In the background, however, Virtual Machine intercepts certain operations that the guest performs to make sure that the guest does not interfere with other programs on the host.


The techniques and features that Virtual Machine provides are useful for several scenarios:

1. Operating system support. With Virtual Machine, one can run software written for one operating system on another (for example, Windows software on Linux) without having to reboot to use it. You can even install in a Virtual Machine an old operating system such as DOS or OS/2 if your real computer's hardware is no longer supported.

2. Infrastructure consolidation. Virtualization can significantly reduce hardware and electricity costs. The full performance provided by today's powerful hardware is only rarely really needed, and typical servers have an average load only a fraction of their theoretical power. So, instead of running many such physical computers that are only partially used, one can pack many virtual machines onto a few powerful hosts and balance the loads between them.

3. Testing and disaster recovery. Once installed, a virtualization and its virtual hard disk can be considered a "container" that can be arbitrarily frozen, woken up, copied, backed up, and transported between hosts.one can save a particular state of a virtual machine and revert back to that state, if necessary. This way, one can freely experiment with a computing environment.


Techniques used by Virtual Machines

There are some techniques used by Virtual machines to emulate Operating System on other System Operating:

1. Paravirtualization. In the computer world, paravirtualization is a virtualization technique that show software interface to the Virtual machine which are same to the actual hardware but not identical.
2. Dynamic Recompilation. This technique were part of some Virtual machine, where System is recompiled as a part being executed before the program. By compiling before executing, System can bring the result code to the run-time program environment, and wish in resulting more efficient code from information explotation which is not provided by traditional static compiler.
3. Emulation. A technique allowing computer program to run in other platform (Computer Architecture or Operating System), although the program was created on different platform.
4. Dynamic Translation. Just-in-time compilation (JIT), known as dynamic translation, is a technique to increase bytecode-compiled programming systems performance, by translating running bytecode to native machine code. JIT was created according two idea on run-time environments, those are bytecode compilation and dynamic compilation.


Some examples of virtual machine, their licenses and operation methods:
1. Bochs, LGPL license, Emulation.
2. DOSBox, GPL license, Emulation using Dynamic Translation or interpretation.
3. DOSEMU, GPL Version 2 license, Hardware Virtualization.
4. GXemul, BSD license, Emulation using Dynamic Translation
5. PearPC, GPL license, Emulation using Dynamic Translation.
6. Qemu, GPL/LGPL license, Emulation and Virtualization.
7. VirtualBox, GPL version 2; full version with extra enterprise features is proprietary (free for personal and educational use and evaluation), Virtualization.
8. VMware Workstation Proprietary license, virtualization.




Reference:
1.Sun xVM VirtualBox User Manual Version 2.1.2. 2004-2009 Sun Microsystems, Inc. http://www.virtualbox.org
2. Info Linux, January 2006 Edition. www.infolinux.web.id
3. Comparison of virtual machine. Wikipedia. Retreived on 13 August 2008.

Comix, software makes comic reading easier

For every one who loves reading comic, can use this Comix

"Comix is an image viewer specifically designed to handle comic books. It reads ZIP, RAR, and tar archives (also gzip or bzip2 compressed) as well as plain image files."















Here a screenshot when comix open Naruto comic Series 1















It has many view mode; fit screen mode, fit width mode, fit height mode, etc.

Just an information, I have each series of Naruto comic electronic edition until this day (Bleach too...). If you wanna have it call us....:), we give you free....:)


Yours sincerely,


Juan Rio Sipayung

Monday 13 April 2009

Running Mavis Beacon Teaches Typing Deluxe 17 on Wine

Finally after a long time learning typing with Mavis Beacon 15, on Windows XP, through Virtual Box, i must take a stop. Doesn't mean i'm stop to learn but stop using it with Virtual Machine, because Mavis Beacon 17 (there is version 20 the newer version, but i think version 17 is much better than 20) now can be running on Wine.

But there are 2 problems after installing this mavis beacon:
1. no sound of "mavis music", "background music", and "mavis voiceover" when typing.
2. Alphanumeric being typed looks weird than the example being showed (look at the two picture below)



























For problem no.1, Actually, I don't know the solution until now :(. For Problem no.2, it can be solved by copying font file from Windows XP installation to "~/.wine/drive_c/windows/Fonts" (depends on path of your wine installation). According to my own test, this Mavis Beacon need 2 type font i.e times.ttf and comic.ttf (or cour.ttf). Both can be obtained from "C:\Windows\Fonts" default Windows XP installation folder. After finish copying the file, rerunning Mavis. Then.....
Voila...., its look normal now....:)

Wednesday 8 April 2009

Playing Nintendo64 games in PC

Almost every consoles game have their emulators (there are emulators for Playstation 2, but still unaccurate, Playstation 3 definitely maybe not have been created). In this time I'll introduce you with Nintendo64 emulator Mupen64Plus (Maybe you asking on your mind why I'm not using other emulators?.., well, honestly, I only have this emulator installed on my PC :), and also have the Rom :) ).

Mupen64Plus is a plugin-based N64 emulator for Linux which is capable of accurately playing many games. Included are four MIPS R4300 CPU emulators, with dynamic recompilers for 32-bit x86 and 64-bit amd64 systems, and necessary plugins for audio, graphical rendering (RDP), signal co-processor (RSP), and input. There are 3 OpenGL video plugins included: glN64, RiceVideoLinux, and Glide64.

The most current documentation can be found at the project's homepage:

http://code.google.com/p/mupen64plus


here a screenshot when mupen64plus playing Paper Mario



for more screenshot here


There is a part i dislike, its input configuration reverse for right and left arrow, so the setting for right and left arrow must be reversed in joystick....., its annoying. I hope its programmers fix it..


Happy Happy-Ing


Juan Rio Sipayung

Tuesday 31 March 2009

How to extracting many zip file at once

Extracting 1 to 5 zip files isn't a hard job, we just choose the files then right-click on the files then choose extract.

How about extracting many zip files, for example 100 files or maybe 1000 files. Well, this job really become tedious and frustrating (honestly, i ever do this hard job, its torture me, believe me....). so, what is the solution?

I finishing him (i mean the problem), with making a bash shell script (i got this idea from book "Mastering Unix Shell Scripting" by Randal K. Michael published by wiley). here the script (i hope you already knew what kind of creature is shell script he he he..):





#!/bin/sh

# extract.sh, created at 15 February 2009
# (c) Juan Rio Sipayung aka Joielechong, GPL
# This Script will extracting all file in this script current directory
# to '/destination', you can change '/destination' to whatever destination
# folder you want e.g '/home/user' or '/tmp', of course
# you must have the write permission.


# This variable use to store the numbers of zip file being extracted
count=0

# Do extracting each zip file until no more
for file in *.zip
do
# unzipping file, -d option allows extraction in an arbitrary directory
# here we extracting to '/destination' as example, change '/destination'
#to your destination folder
unzip $file -d /destination
# Count each zip file being extracted
count=$(($count+1))
done

# This part telling user that no zip file in the current directory
# Still not working i don't know why, if you know tell me :).......
#if [ "$count" = 0 ]; then
# echo "No zip file is extracted"
#fi

# show how many the zip file being extracted
if [ "$count" != 0 ]; then
echo "$count zip file extracted"
echo "Extracting complete"
fi

exit 0





Save this source code and name it extract.sh, and put it on the folder where your zip files are, then run it from terminal and wait for the result :).....


notes:
1. Every single step was done on system with Slackware 12.2 with KDE desktop manager.
2. This script can be use to extracting rar file, tar.gz file or other compression file type, of course you must do a couple change to this script.




Happy Hacking,


Juan Rio Sipayung