Similar Motives

Leave a comment

Definition of a motif (in musical term) according to Wikipedia:

In music, a motif or motive is a short musical idea,[1]salient recurring figure, musical fragment or succession of notes that has some special importance in or is characteristic of a composition.

A motif in a composition so important, that its composer keep repeating that in that composition, or present them in his other compositions.

The composer (or probably some other composers) can cleverly reuse (and hide the motif somewhere). The reason of doing so is that they save time not to recreate a whole new compositions to have listeners like/listen to them.

An example is that the motif in Final Fantasy VIII Laguna Battle Theme is similar to Auron’s Theme-FFX OST.



Let’s Look around Another World…

In software development, there is a similar concept called “Don’t Reinvent the Wheel.” In that case, developers use existing (usually open source) tools/libraries to build some essential functionalities. That is to prevent them spending time recreating recurring functionalities, and let them focus on the main logic. Sometimes, other tools can emerge from there.

Although it looks out of topic..

In my perspective, both are essentially similar.

Getting Started with RAPP on Webbynode

Leave a comment

Advantages over other settings in Webbynode:

  • Deployment through command line (git push via webbynode gem). This is similar to Heroku, but with different choices.
    The ReadyStack probably uses git clone from public repositories.
  • Neat directory structure. Because of that, RAPP is convenient to be customised as necessary.

Disadvantages:

  • More initial setups for deployment from Windows (e.g. git, ssh, plink, etc.)

Setup details are on Webbynode Guide on RAPP. The RAPP bootstrap guide didn’t work out pretty smooth on my laptop, probably due to some settings. So, I tried the following settings.

Settings on Webby

  • Ubuntu 10.04
  • Ruby Enterprise Edition (REE) 1.8.7, Rails 3, Passenger 3, Nginx
  • My SSH public key on /var/rapp/.ssh/authorized_keys (see Public Key Authentication section on Security) –> probably I should have used wn add_key on my laptop instead

Settings on my laptop

  • Fedora 14
  • REE 1.8.7, Rails 3
  • My SSH private key on /home/myuser/.ssh/priv_key

Here are some stuff from my first deployment. Hurray! My first app has been deployed.

Security

Public Key Authentication

The main reason is to prevent password’s brute force attack.

In my laptop, I did the following.

1. Save the Webby IP

$ webby_ip=66.58.30.39 #whatever ip it is.. probably better to put this line on ~/.bashrc, or configure /etc/hosts

2. Create SSH public/private key pair

$ ssh-keygen -t dsa
[enter your details..]

3. Copy public key to Webby

username can be rootgit, or any other Operating System users in the Webby. The users must have SSH access enabled (by default, each OS user has SSH enabled I guess).

$ ssh username@$webby_ip mkdir -p .ssh
[password prompt]
$ cd ~
$ cat .ssh/id_rsa.pub | ssh username@$webby_ip “cat – >> ~/.ssh/authorized_keys”
[password prompt]

In the Webby, change .ssh folder and authorized_keys file permissions. This is to ensure that keys inside .ssh can only be accessed by username

$ ssh username@$webby_ip
[prompt for unlocking your private key]
$ chmod 700 .ssh
$ chmod 600 .ssh/authorized_keys
Reference: SSH login without password

User/Group Management

This part is optional. Some say that ssh using root is not a good security practice. Some probably want to have user-centric app folders configuration.

Add group

# groupadd developers
# grep developers /etc/group

Add user to group

# useradd -G developers your_username
# passwd your_username
# id your_username #print out username details

Reference: Howto: Linux Add User To Group

Create home folder for user

# cd /home
# mkdir your_username
# chown your_username:your_username your_username

List of all users

# awk -F”:” ‘{ print “username: ” $1 “\t\tuid:” $3 }’ /etc/passwd
Reference: How to list all your USERs..

JSF 2.0 CDI

Leave a comment


@Qualifier
@Retention(value=RetentionPolicy.RUNTIME)
@Target(value={ElementType.TYPE, ElementType.METHOD, ElementType.PARAMETER, ElementType.FIELD})
public @interface UserBeanCDI {}

public class FriendsBean implements Serializable {
@Inject @UserBeanCDI
private UserBean userBean;
@Inject
public FriendsBean(@UserBeanCDI UserBean userBean) {}
}

Fedora 13 “Goddard”

1 Comment

I used to have dual boot Fedora 11 and Windows Vista. Being satisfied with Fedora 11 “Leonidas” and knowing Windows 7 and Fedora 13 “Goddard” has been released, I decided not to use dual boot. I would like to use Fedora 13 as the main operating system (OS). Other OSs would have to be installed on VirtualBox, in case they are needed. (Well, they are needed anyway.)

Technically, I had no problems with dual boot. The main reason why I left dual boot was that it was so difficult to organize my data that they were badly cluttered. Another reason is that I will have to get some ideas on OSSEC HIDS server and agent modes.
So, my plans are/were as follows.
  1. Test and install the burnt Fedora 13 DVD on VirtualBox <OK>
    The DVD I burned was slightly corrupted, but I managed to install with default settings… 

     

  2. Install Fedora 13 on my laptop (Lenovo X61) <OK>
    Similar to Fedora 11, Fedora 13 provides seamless default installation.
    My first impression on the installed Fedora 13 was it has made good improvement for security. Aside from data Storage encryption has been in Fedora 11, Fedora 13 now provides more tools for managing authentication data (password and public keys).
  3. Install VirtualBox on Fedora 13 <OK>
    So, I made Fedora 13 as the VirtualBox host/OSSEC server. Some dependencies on QT had to be resolved. I also had to update kernel, and install kernel header of the right kernel version.
  4. Install Windows 7 as guest OS on VirtualBox <OK>
    I allocated 512MB RAM, which is not enough for starting Google Chrome or IE8 (but Safari can start up..). The main purpose of this guest is to read data from my Nokia 5630 and Skype-ing (hehe.. just for fun).
    To get the sound card to work, I installed some kind of RealTek stuff and use Windows Update.

  5. Install 1 Windows and 1 Linux OS as VirtualBox guest OS <OK>
    WinXP (with 256MB RAM) has been installed.
    Now trying to experiment with several Linux, especially Linux Mint.
    I have tried Fedora 13, Ubuntu 10.04, and DSL4. Unfortunately… Fedora 13 too huge. I tried installing Ubuntu but it failed starting up smoothly after 3 times installations (corrupted or probably need more than 512 RAM). DSL does not get along well with VirtualBox Guest Additions.

  6. Install anything else needed for guest OS<OK>
    For folder sharing, VirtualBox Guest Additions were installed.
    In Windows 7 and XP guests, the shared folder can be accessed in
    \\VBOXSVR\<shared_folder_name>
    In Linux guests, some commands are needed to be executed to mount the shared folder…
  7. Restore data <OK>

My laptop spec:

[root@niamutiara Downloads]# lspci
00:00.0 Host bridge: Intel Corporation Mobile PM965/GM965/GL960 Memory Controller Hub (rev 0c)
00:02.0 VGA compatible controller: Intel Corporation Mobile GM965/GL960 Integrated Graphics Controller (rev 0c)
00:02.1 Display controller: Intel Corporation Mobile GM965/GL960 Integrated Graphics Controller (rev 0c)
00:19.0 Ethernet controller: Intel Corporation 82566MM Gigabit Network Connection (rev 03)
00:1a.0 USB Controller: Intel Corporation 82801H (ICH8 Family) USB UHCI Controller #4 (rev 03)
00:1a.1 USB Controller: Intel Corporation 82801H (ICH8 Family) USB UHCI Controller #5 (rev 03)
00:1a.7 USB Controller: Intel Corporation 82801H (ICH8 Family) USB2 EHCI Controller #2 (rev 03)
00:1b.0 Audio device: Intel Corporation 82801H (ICH8 Family) HD Audio Controller (rev 03)
00:1c.0 PCI bridge: Intel Corporation 82801H (ICH8 Family) PCI Express Port 1 (rev 03)
00:1c.1 PCI bridge: Intel Corporation 82801H (ICH8 Family) PCI Express Port 2 (rev 03)
00:1d.0 USB Controller: Intel Corporation 82801H (ICH8 Family) USB UHCI Controller #1 (rev 03)
00:1d.1 USB Controller: Intel Corporation 82801H (ICH8 Family) USB UHCI Controller #2 (rev 03)
00:1d.7 USB Controller: Intel Corporation 82801H (ICH8 Family) USB2 EHCI Controller #1 (rev 03)
00:1e.0 PCI bridge: Intel Corporation 82801 Mobile PCI Bridge (rev f3)
00:1f.0 ISA bridge: Intel Corporation 82801HBM (ICH8M-E) LPC Interface Controller (rev 03)
00:1f.2 IDE interface: Intel Corporation 82801HBM/HEM (ICH8M/ICH8M-E) SATA IDE Controller (rev 03)
00:1f.3 SMBus: Intel Corporation 82801H (ICH8 Family) SMBus Controller (rev 03)
03:00.0 Network controller: Intel Corporation PRO/Wireless 3945ABG [Golan] Network Connection (rev 02)
05:00.0 CardBus bridge: Ricoh Co Ltd RL5c476 II (rev ba)
05:00.1 FireWire (IEEE 1394): Ricoh Co Ltd R5C832 IEEE 1394 Controller (rev 04)
05:00.2 SD Host controller: Ricoh Co Ltd R5C822 SD/SDIO/MMC/MS/MSPro Host Adapter (rev 21)


 

List of Things to be Installed Immediately After Getting Linux Work in My Laptop

Leave a comment

I’ve installed Fedora 11 i386 on my Lenovo X61 three times. Well, it’s not that I wanted to break my own hard disk… It’s just that I did small mistakes that made me [to think] to reinstall Fedora. :P

I guess I always install the same additional plugins and applications after each of the Linux installations. So… I think I should list them here.

Repositories to be Added

  • Fedora 11 – i386 (during Fedora 11 installation)
  • RPM Fusion Free (you’ll get the Non-Free as well)

More

Installing Canon MP145 Printer/Scanner Drivers on Linux

2 Comments

Thanks to Jonath who gave me permission to translate his blog post.

This guide has been tested in Fedora 9 and 11.

1. Downloading the Drivers

Download three archives from link1, link2, and link3, and extract them. (Right click and choose Extract here, or use whatever commands you like to extract them.)

In the extracted archives, you will see some packages (.rpm and .deb) or other archives that may not be needed.

2. Installing the Drivers

Using GUI:

Double click the following packages, and authenticate installation using root password.

  1. cnijfilter-common-2.80-1.i386.rpm (from link1)
  2. scangearmp-common-1.10-1.i386.rpm (from link2)
  3. scangearmp-mp140series-1.10-1.i386.rpm (from link2)
  4. cnijfilter-mp140series-2.80-1.i386.rpm (from link3)

Using Command Line:

  1. Login to root using su
  2. Enter the following four commands
    rpm -ivh scangearmp-common-1.10-1.i386.rpm
    rpm -ivh scangearmp-mp140series-1.10-1.i386.rpm
    rpm -ivh cnijfilter-common-2.80-1.i386.rpm
    rpm -ivh cnijfilter-mp140series-2.80-1.i386.rpm

Another way is to use sudo before every rpm above, if you don’t like using su.

3. Configuring and Testing the Printer

Make sure that your printer is plugged in to your computer and turned on.

  1. Go to System > Administration > Printing.
    [screenshot]
  2. Right click on MP140-series and choose Properties.
    [screenshot]
  3. Click the Change button on Make and Model.
  4. Wait for the new window to load a list of printers.
  5. Select printer from database, choose Canon, and click Forward.
    [screenshot]
  6. Choose MP140 Ver 2.8 as the printer model, and click Forward.
    [screenshot]
  7. Choose Try to copy the option settings over from the old PPD. After that, click Apply.
    [screenshot]

You can print a test page to test the printer.

4. Testing/Using the Scanner

The scanner driver only works in GIMP.

In GIMP 2.6.6, choose File > Create > ScanGear MP.
In some older versions of GIMP, choose File > Acquire > ScanGear MP.

Two Fatal Small Mistakes in Linux and How to Avoid Them

4 Comments

Since I’m a newbie, I wrote this for myself :P

In the past two days, I did two small mistakes and caused myself to reinstall Fedora 11 twice. (In other words, I’ve installed it 3 times ^^;)

Here are the two mistakes.

More

Older Entries

Follow

Get every new post delivered to your Inbox.