You can edit ssh configurations within /etc/ssh/sshd_config file.
That's all :)
Sunday, January 16, 2011
Sunday, January 9, 2011
How to monitor your apache status.
I'll using mod_status which apache2 has provided for.
Let's head to the /etc/apache2/apache2.conf and added this code at the end of file.
If you need more configuration, please have it configured in /etc/apache2/mods-available/status.conf
It's easy to use and you can also use perl script to grab some information you'd like to.
Let's see if you've already got mod_status
browse to your /etc/apache2/mods-available/
just list the items and have a look. I think for apache2 they've just put it in already.
So now let's have a test.
$apache2ctl full statusIf it said that you need to add some kind of extended status,
Let's head to the /etc/apache2/apache2.conf and added this code at the end of file.
ExtendedStatus OnNow, your apache status will come up with full information.
If you need more configuration, please have it configured in /etc/apache2/mods-available/status.conf
<IfModule mod_status.c>
# Allow server status reports generated by mod_status,
# with the URL of http://servername/server-status
# Uncomment and change the ".example.com" to allow
# access from other hosts.
<Location /server-status>
SetHandler server-status
Order allow,deny
Order deny,allow
Deny from all
Allow from localhost ip6-localhost
Allow from .example.com
</Location>
</IfModule>
Wednesday, January 5, 2011
Heap Sort Algorithms with Java
It's my homework before new year.
Well not much to talk today. Let's have a look.
Have fun :)
Well not much to talk today. Let's have a look.
//*************Find Left and Right****************//
public static int left(int i){
return (2*i)+1;
}
public static int right(int i){
return (2*i)+2;
}
//************Max Heapify**********************//
public static void max_heapify(int x[],int i){
int l = left(i);
int r = right(i);
int largest;
if(l<=(heap_size) && x[l] > x[i]){
largest = l;
}
else
largest = i;
if(r<=(heap_size) && x[r] > x[largest]){
largest = r;
}
if(largest != i){
//SWAP
int temp = x[i];
x[i] = x[largest];
x[largest] = temp;
max_heapify(x,largest);
}
}
public static void build_max_heap(int x[]){
for(int i = (x.length/2)-1;i>=0;i--){
max_heapify(x,i);
}
}
public static void heap_sort(int x[]){These algorithms were derived from "Introduction to Algorithms by T Cormen, C Leiserson, R Rivest, and C Stein"
build_max_heap(x);
int temp;
heap_size = x.length-1;
for(int i = heap_size;i>=0;i--){
temp = x[0];
x[0] = x[i];
x[i] = temp;
heap_size--;
max_heapify(x,0);
}
}
Have fun :)
Tuesday, December 21, 2010
Doing some works on Load Balancer with Crossroads.
Well, it's finally about time to begins my senior project stuffs.
Let's say I've been doing busy with some jobs earlier, So I didn't have a chance to look at it much.
But It is nearly new year, everybody's going back their home after midterm examinations.
For me, It's time to move on and working on stuffs.
The less people, The more I can concentrate on this work. (I don't like to be surrounded by people much.)
Talk to much, let's see how I install crossroads on ubuntu. It's easy and work fine.
First download the crossroads package from their website.
Now it's time for configuration.
Crossroads provides two ways of configuration. Using command-line, or using xml.
Let's see the first one. If we need to use command-line, then we use "xr" command for all configuration.
A web interface for the balancer is started on port 8001
Instead of starting XR by hand, we may use xrcrl as preferable. But first, you've to create a configuration.
To do so, put the following in the file /etc/xrctl.xml
Credits : Crossroads
Let's say I've been doing busy with some jobs earlier, So I didn't have a chance to look at it much.
But It is nearly new year, everybody's going back their home after midterm examinations.
For me, It's time to move on and working on stuffs.
The less people, The more I can concentrate on this work. (I don't like to be surrounded by people much.)
Talk to much, let's see how I install crossroads on ubuntu. It's easy and work fine.
First download the crossroads package from their website.
$cd /Untar it.
$wget http://crossroads.e-tunity.com/downloads/crossroads-stable.tar.gz
$tar -xzvf crossroads-stable.tar.gzThen before starting our installation. Make sure that you've already installed the build-essential package.
$sudo apt-get install build-essentialLet's begin!
$cd crossroads-2.68Wait for a moment. Then we done!
$sudo make install
Now it's time for configuration.
Crossroads provides two ways of configuration. Using command-line, or using xml.
Let's see the first one. If we need to use command-line, then we use "xr" command for all configuration.
$xr --verbose --server tcp0:80 / #this will tell xr that we use this server as load balancerThis will make your server to listen to port 80 and to dispatch traffic to servers 10.10.10.2 and 10.10.10.3
-W 10.10.10.1:8001 / #and this will create our web interface on port 8001
-backend 10.10.10.2:80 / #this will create backend according to the ip address and port
-backend 10.10.10.3:80
A web interface for the balancer is started on port 8001
Instead of starting XR by hand, we may use xrcrl as preferable. But first, you've to create a configuration.
To do so, put the following in the file /etc/xrctl.xml
Then type these following commands to start the xr<?xml version="1.0" encoding="UTF-8"?> <configuration> <system> <uselogger>true</uselogger> <logdir>/tmp</logdir> </system> <service> <name>web</name> <server> <address>0:80</address> <type>tcp</type> <webinterface>10.10.10.1:8001</webinterface> <verbose>yes</verbose> </server> <backend> <address>10.10.10.2:80</address> </backend> <backend> <address>10.10.10.3:80</address> </backend> </service> </configuration>
$xrctl startOr to stop.
$xrctl stopThat's all for today. Late night again. OMG!!
Credits : Crossroads
Saturday, December 18, 2010
How to install FTP with vsftpd.
Very easy to configure. recommended!!
First install via apt-get
Disable anonymous login and enable local users login, give them write permission.
To Allow some users to login
TLS/SSL/FTPS
Add these code at the end of file.
If you need more option, please kindly visit this site which can provides you for further information.
Ubuntu Forum
Credits : epimeteo from Ubuntu Forum. Thx :)
First install via apt-get
$sudo apt-get install vsftpdLet's have it back up before doing anything is recommend!
$sudo cp /etc/vsftpd.conf /etc/vsftpd.conf.bakNow begin to configure!
Disable anonymous login and enable local users login, give them write permission.
To Deny some users to loginanonymous_enable=NO# Let local users login# If you connect from the internet with local users, you should enable TLS/SSL/FTPSlocal_enable=YES
# Write permissionswrite_enable=YES
In the file /etc/vsftpd.denied_users add the username of the users that can't login. One username per line.userlist_deny=YESuserlist_file=/etc/vsftpd.denied_users
To Allow some users to login
In the file /etc/vsftpd.allowed_users add the username of the users that can login. One username per line.userlist_deny=NOuserlist_enable=YESuserlist_file=/etc/vsftpd.allowed_users
TLS/SSL/FTPS
Add these code at the end of file.
Additional Optionsssl_enable=YESallow_anon_ssl=NOforce_local_data_ssl=YESforce_local_logins_ssl=YESssl_tlsv1=YESssl_sslv2=YESssl_sslv3=YES
Then, have it applied new configuration.# Show hidden files and the "." and ".." folders.# Useful to not write over hidden files:force_dot_files=YES
# Hide the info about the owner (user and group) of the files.hide_ids=YES
# Connection limit for each IP:max_per_ip=3
# Maximum number of clients:max_clients=5
$sudo /etc/init.d/vsftpd restartThat's all the configurations I've applied to my ftp server.
If you need more option, please kindly visit this site which can provides you for further information.
Ubuntu Forum
Credits : epimeteo from Ubuntu Forum. Thx :)
Thursday, December 16, 2010
Great book on Servlets & JSP
It's really good to think of reading a textbook instead of a bunch of papers of your class.
In Thailand, Educational system in higher level such Bachelor's Degree in many high-rank University
still using a bunch of papers, which we called "sheet", for teaching during class.
It's just a slide-printed on paper. So, seems like I can't find much of details in there.
For me, to know and understand what I learned from class is to read the whole details of the topics,
not only the topics and some of information that lied around the paper.
On my last exam I took, which is today, about noon. It's the Internet Programming class.
It's about Servlets and JSP. Unfortunately, I've skipped 2 classes, my head's gone empty
until I've found a book which tutor's using as reference. Head First Servlets and JSP
It's really great book! I recommended for this book if you're totally new to Servlets and JSP.
But, it required some of Java Skills. So, you might need to know Java before start reading this one.
Oh, I didn't buy the book actually, I borrowed it from the library at my Institute.
Don't look in the bad way. I don't have that much of money to spend, even I did spend a lot
on many books from Amazon.com
Anyway, I'm totally like this book. It have great content. Also,the way they represent details on each topic is
like..you know, It's comic, full of pictures and images. It's good for your brain when you've to
remember something so complicated.
That's all for today :)
In Thailand, Educational system in higher level such Bachelor's Degree in many high-rank University
still using a bunch of papers, which we called "sheet", for teaching during class.
It's just a slide-printed on paper. So, seems like I can't find much of details in there.
For me, to know and understand what I learned from class is to read the whole details of the topics,
not only the topics and some of information that lied around the paper.
On my last exam I took, which is today, about noon. It's the Internet Programming class.
It's about Servlets and JSP. Unfortunately, I've skipped 2 classes, my head's gone empty
until I've found a book which tutor's using as reference. Head First Servlets and JSP
It's really great book! I recommended for this book if you're totally new to Servlets and JSP.
But, it required some of Java Skills. So, you might need to know Java before start reading this one.
Oh, I didn't buy the book actually, I borrowed it from the library at my Institute.
Don't look in the bad way. I don't have that much of money to spend, even I did spend a lot
on many books from Amazon.com
Anyway, I'm totally like this book. It have great content. Also,the way they represent details on each topic is
like..you know, It's comic, full of pictures and images. It's good for your brain when you've to
remember something so complicated.
That's all for today :)
Tuesday, December 7, 2010
Insertion Sort and Merge Sort in Java
Well it's my homework in DAA (Design and Analysis of Algorithms)
Talking about the algorithms, itself is brought from the book that we've used
which is "Introduction to Algorithms 3rd edition"
It's a good book, but I do weak in maths somehow.
So, probably there is some of them I couldn't understand right away.
It's bad to have a worst logic and maths skill, you know?
whatever, let's see the code that I have written using Java.
(Somebody said that they doesn't like Java because of its performance,
But I don't. I prefer it than C/C++ in some way.)
Insertion Sort
then we lock the key so we won't get confuse between
the length of array we are caring and the one that is still out of our sight.
after that we just sorting it, by compare the value of an array, one by one.
when it have sorted, we just change the key. moving to the next one until the whole array is sorted.
Merge Sort
The first one is for divide an array into separate two of them.
Another one is for merging them together.
I won't explain it clearly because it will take me a while to try to explain it.
As you can see that I'm not English native, so It's quite hard to write.
And It's all for tonight. I'm late for my bed again.
Thanks for reading
:)
Talking about the algorithms, itself is brought from the book that we've used
which is "Introduction to Algorithms 3rd edition"
It's a good book, but I do weak in maths somehow.
So, probably there is some of them I couldn't understand right away.
It's bad to have a worst logic and maths skill, you know?
whatever, let's see the code that I have written using Java.
(Somebody said that they doesn't like Java because of its performance,
But I don't. I prefer it than C/C++ in some way.)
Insertion Sort
This one works based on the algorithms of insertion sort. First we find the key.public static void insertionSort_2(int x[]) {int i, j, key;for (j = 1; j < x.length; j++) {key = x[j];i = j - 1;while (i >= 0 && x[i] > key) {x[i + 1] = x[i];i = i - 1; .}x[i + 1] = key;}}
then we lock the key so we won't get confuse between
the length of array we are caring and the one that is still out of our sight.
after that we just sorting it, by compare the value of an array, one by one.
when it have sorted, we just change the key. moving to the next one until the whole array is sorted.
Merge Sort
Merge methodpublic static void merge_sort(int y[], int p, int r) {if (r > p) {int q = (p + r) / 2;merge_sort(y, p, q);merge_sort(y, q + 1, r);merge(y, p, q, r);}}
For merge sort, there are two method you need.public static void merge(int y[], int p, int q, int r) {int n1 = q - p + 2;int n2 = r - q + 1;int i, j, k;int []left = new int[n1];int []right = new int[n2];//Cp y to left arrayfor (i = 0; i < n1 - 1; i++) {left[i] = y[p + i];}left[n1 - 1] = INF;//Cp y to right arrayfor (i = 0; i < n2 - 1; i++) {right[i] = y[q + 1 + i];}right[n2 - 1] = INF;i = 0;j = 0;for (k = p; k <= r; k++) {if (left[i] <= right[j]) {y[k] = left[i];i++;} else {y[k] = right[j];j++;}}}
The first one is for divide an array into separate two of them.
Another one is for merging them together.
I won't explain it clearly because it will take me a while to try to explain it.
As you can see that I'm not English native, so It's quite hard to write.
And It's all for tonight. I'm late for my bed again.
Thanks for reading
:)
Subscribe to:
Posts (Atom)