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) {}
}

Older Entries

Follow

Get every new post delivered to your Inbox.