안드로이드에서 GPS 를 이용해서 좌표를 구하는 간단한 예제이다.
http://www.fun25.co.kr/blog/android-simple-gps-example
아래는 Email을 전송하는 예제이다.
https://www.mkyong.com/android/how-to-send-email-in-android/
2016년 8월 7일 일요일
2016년 8월 2일 화요일
Install Chrome browser on Ubuntu 16.04
You can read the solution "How to install chrome browser" as following site
http://askubuntu.com/questions/510056/how-to-install-google-chrome
http://askubuntu.com/questions/510056/how-to-install-google-chrome
2016년 7월 29일 금요일
Search YUM package name
Sometimes, I can't know package name of YUM.
For example, Assume there is no ifconfig command on CentOS.
# ifconfig
command not found
Then, run yum command like this...
# yum provides ifconfig
....
....
net-tools-2.0-0.17.20131004git.el7.x86_64 : Basic networking tools
Repo : base
Matched from:
Filename : /sbin/ifconfig
And then, run yum command like this...
# yum install net-tools
For example, Assume there is no ifconfig command on CentOS.
# ifconfig
command not found
Then, run yum command like this...
# yum provides ifconfig
....
....
net-tools-2.0-0.17.20131004git.el7.x86_64 : Basic networking tools
Repo : base
Matched from:
Filename : /sbin/ifconfig
# yum install net-tools
2016년 7월 20일 수요일
UEFI 외장하드디스크에 Windows 10 설치하기 (on USB HDD)
아래 블로그에 USB HDD에 Windows 10을 설치하는 방법이 기술되어 있다.
http://blog.naver.com/PostView.nhn?blogId=baljern&logNo=220529120477&parentCategoryNo=&categoryNo=327&viewDate=&isShowPopularPosts=true&from=search
http://blog.naver.com/PostView.nhn?blogId=baljern&logNo=220529120477&parentCategoryNo=&categoryNo=327&viewDate=&isShowPopularPosts=true&from=search
2016년 5월 26일 목요일
C shell program example
Following example shows looping
#!/bin/csh
set j = $1
while ( $j <= 100 )
echo "Welcome $j times"
@ j++
## 또는 @ j += 3
end
Example Shell Code : Sleep for XX minutes
Example : Kill process which name is "my_proc"
kill -KILL `ps -ef | grep mamm | grep -v grep | awk -F' ' '{ print $2}'`
Example : Count file number in a folder
#!/bin/csh
set grouplist = "ABC HSS IBC IMGC SLF MRF MSS TAS"
#set CUR_DATE=`date -d "-2 min" +%Y-%m-%d-%H:%M:00`
set STD_DATE=`date +$1-00:00:00`
set INC_DATE=`date -d "+1 days" +$STD_DATE`
echo "$STD_DATE, $INC_DATE"
if ($#argv < 2) then
echo "./xxx.sh day, stat_type(1MIN/5MIN/1HOUR)"
echo "ex) ./xxx.sh 2016-03-22 5MIN"
exit
endif
set ARG_DAY = $1
set ARG_TYPE = $2
echo "$ARG_DAY, $ARG_TYPE"
foreach gname ( $grouplist )
printf "\n[ $gname ]\n"
set syslist = `grep $gname /home/ina/etc/ini/ASE/svc_system.ini | grep "=" | grep -v "#" | awk -F "=" '{print $2}'| awk -F "+" '{ for(i=1; i<=NF; i++) print $i }' ` ;
foreach sname ( $syslist )
printf "$sname : "
#set count_result = `ls -al $gname/$sname/5MIN/*$CUR_DATE* | awk '{print $8}' | awk -F\. '{print $3}' | awk -F\- '{print $1"-"$2"-"$3}' | sort | uniq -c`
set count_result = `ls -al $gname/$sname/$ARG_TYPE/*$ARG_DAY* | wc -l`
printf "$count_result\n"
if ($ARG_TYPE == "1MIN") then
if ($count_result != "1440") then
echo "1M : [$sname] : $count_result"
endif
else if ($ARG_TYPE == "5MIN") then
if ($count_result != "288") then
echo "5M : [$sname] : $count_result"
## for(i=0; i<288; i++)
set STAT_DATE=`date -d "+5 min" +$1-%H:%M:00`
set FILE_CHK = ls -al $gname/$sname/$ARG_TYPE/*$ARG_DAY* | awk '{print $8}' | awk -F\. '{print $4}' | grep $STAT_DATE
if($FILE_CHK == NULL) then
echo "Not Exist : $sname.5MIN.$STAT_DATE"
endif
else if ($ARG_TYPE == "1HOUR") then
if ($count_result != "24") then
echo "1H : [$sname] : $count_result"
endif
endif
### 1M = 1440, 5M = 288, 1H = 24 ###
end
end
endif
-------------------------------------------------------
if (0) then
echo "false case"
exit
endif
echo "true case"
#!/bin/csh
set j = $1
while ( $j <= 100 )
echo "Welcome $j times"
@ j++
## 또는 @ j += 3
end
Example Shell Code : Sleep for XX minutes
#!/bin/csh
##
## How to use
## example: sleep_minute.sh 10 (minutes)
##
set ma_value = $1
echo "I'm going to sleep for ${ma_value} minutes "
set j = 1
while ( ${j} <= ${ma_value} )
date
echo "${j} minutes are passed"
@ j++
sleep 60
end
|
---|
Example : Kill process which name is "my_proc"
kill -KILL `ps -ef | grep mamm | grep -v grep | awk -F' ' '{ print $2}'`
Example : Count file number in a folder
#!/bin/csh
set grouplist = "ABC HSS IBC IMGC SLF MRF MSS TAS"
#set CUR_DATE=`date -d "-2 min" +%Y-%m-%d-%H:%M:00`
set STD_DATE=`date +$1-00:00:00`
set INC_DATE=`date -d "+1 days" +$STD_DATE`
echo "$STD_DATE, $INC_DATE"
if ($#argv < 2) then
echo "./xxx.sh day, stat_type(1MIN/5MIN/1HOUR)"
echo "ex) ./xxx.sh 2016-03-22 5MIN"
exit
endif
set ARG_DAY = $1
set ARG_TYPE = $2
echo "$ARG_DAY, $ARG_TYPE"
foreach gname ( $grouplist )
printf "\n[ $gname ]\n"
set syslist = `grep $gname /home/ina/etc/ini/ASE/svc_system.ini | grep "=" | grep -v "#" | awk -F "=" '{print $2}'| awk -F "+" '{ for(i=1; i<=NF; i++) print $i }' ` ;
foreach sname ( $syslist )
printf "$sname : "
#set count_result = `ls -al $gname/$sname/5MIN/*$CUR_DATE* | awk '{print $8}' | awk -F\. '{print $3}' | awk -F\- '{print $1"-"$2"-"$3}' | sort | uniq -c`
set count_result = `ls -al $gname/$sname/$ARG_TYPE/*$ARG_DAY* | wc -l`
printf "$count_result\n"
if ($ARG_TYPE == "1MIN") then
if ($count_result != "1440") then
echo "1M : [$sname] : $count_result"
endif
else if ($ARG_TYPE == "5MIN") then
if ($count_result != "288") then
echo "5M : [$sname] : $count_result"
## for(i=0; i<288; i++)
set STAT_DATE=`date -d "+5 min" +$1-%H:%M:00`
set FILE_CHK = ls -al $gname/$sname/$ARG_TYPE/*$ARG_DAY* | awk '{print $8}' | awk -F\. '{print $4}' | grep $STAT_DATE
if($FILE_CHK == NULL) then
echo "Not Exist : $sname.5MIN.$STAT_DATE"
endif
else if ($ARG_TYPE == "1HOUR") then
if ($count_result != "24") then
echo "1H : [$sname] : $count_result"
endif
endif
### 1M = 1440, 5M = 288, 1H = 24 ###
end
end
endif
-------------------------------------------------------
if (0) then
echo "false case"
exit
endif
echo "true case"
2016년 4월 15일 금요일
Make a new disk on Linux(or CentOS) with VMware, VirtualBox
1) Make a virtual disk on VMware configuration GUI.
2) Boot up CentOS (Linux)
3) View physical disk list
fdisk -l
4) Create a logical partition
fdisk /dev/sdb
(and then make a new partition '/dev/sdb1')
5) Make a new filesystem
mkfs /dev/sdb1
6) Mount the new filesystem to special symbol '/home/andrew'
mount /dev/sdb1 /DISK.B
2) Boot up CentOS (Linux)
3) View physical disk list
fdisk -l
4) Create a logical partition
fdisk /dev/sdb
(and then make a new partition '/dev/sdb1')
5) Make a new filesystem
mkfs /dev/sdb1
6) Mount the new filesystem to special symbol '/home/andrew'
mount /dev/sdb1 /DISK.B
2016년 4월 12일 화요일
JFreechart JDBC Bar Chart Example
Java and JFreechart with JDBC (which is MySQL java driver)
1) Download following JAR files
2) Create sample DB table
3) Make a JAVA code like a following.
================================================================
import java.sql.*;
import java.io.*;
import org.jfree.data.category.DefaultCategoryDataset;
import org.jfree.chart.ChartFactory;
import org.jfree.chart.plot.PlotOrientation;
import org.jfree.chart.JFreeChart;
import org.jfree.chart.ChartUtilities;
public class BarChartJDBCExample {
public static void main(String[] args) throws Exception{
Class.forName("com.mysql.jdbc.Driver");
Connection conn = DriverManager.getConnection("jdbc:mysql://10.10.2.11:3306/andrew_db", "andrew", "andrew");
DefaultCategoryDataset my_bar_chart_dataset = new DefaultCategoryDataset();
Statement stmt = conn.createStatement();
try {
ResultSet query_set = stmt.executeQuery("select * from MSS_RAW_MSG_5M_TBL where STAT_TIME > '2016-04-09';");
while (query_set.next()) {
String stat_time = query_set.getString("STAT_TIME");
int call_setup = query_set.getInt("CALL_SETUP");
int call_term = query_set.getInt("CALL_TERM");
int regi = query_set.getInt("REGI");
my_bar_chart_dataset.addValue(call_setup, "CALL_SETUP", stat_time);
my_bar_chart_dataset.addValue(call_term, "CALL_TERM", stat_time);
my_bar_chart_dataset.addValue(regi, "REGISTER", stat_time);
}
==================================================================
I referred following blog.
< Java Chart Example >
http://thinktibits.blogspot.kr/p/java-chart-example-programs.html
http://thinktibits.blogspot.kr/2013/01/JFreeChart-XYDataset-Line-Chart-Java-Example.html
http://thinktibits.blogspot.kr/2013/01/JFreeChart-SVG-XY-Line-Chart-Graph-Java-Example.html
< Bar Chart >
http://thinktibits.blogspot.kr/2012/11/jfreechart-java-jdbc-bar-chart-example.html
< Pie Chart >
http://thinktibits.blogspot.kr/2012/11/jfreechart-jdbc-pie-chart-java-example.html
1) Download following JAR files
- jfreechart-x.y.z.jar (with jcommon-x.y.z.jar)
- ojdbc6.jar
- jdbc driver for MySQL Version x.y
2) Create sample DB table
/* Create Chart table */
create table chart_Data
(
category varchar2(20),
marks number
)
/* Insert data - Need COMMIT */
insert into chart_data values ('English',67)
insert into chart_data values ('Physics',67)
insert into chart_data values ('Chemistry',67)
insert into chart_data values ('Biology',67)
insert into chart_data values ('C',67)
/* Randomize mark values - Needs COMMIT */
update chart_data set marks=TRUNC(DBMS_RANDOM.value(40,99))
3) Make a JAVA code like a following.
================================================================
import java.sql.*;
import java.io.*;
import org.jfree.data.category.DefaultCategoryDataset;
import org.jfree.chart.ChartFactory;
import org.jfree.chart.plot.PlotOrientation;
import org.jfree.chart.JFreeChart;
import org.jfree.chart.ChartUtilities;
public class BarChartJDBCExample {
public static void main(String[] args) throws Exception{
Class.forName("com.mysql.jdbc.Driver");
Connection conn = DriverManager.getConnection("jdbc:mysql://10.10.2.11:3306/andrew_db", "andrew", "andrew");
DefaultCategoryDataset my_bar_chart_dataset = new DefaultCategoryDataset();
Statement stmt = conn.createStatement();
try {
ResultSet query_set = stmt.executeQuery("select * from MSS_RAW_MSG_5M_TBL where STAT_TIME > '2016-04-09';");
while (query_set.next()) {
String stat_time = query_set.getString("STAT_TIME");
int call_setup = query_set.getInt("CALL_SETUP");
int call_term = query_set.getInt("CALL_TERM");
int regi = query_set.getInt("REGI");
my_bar_chart_dataset.addValue(call_setup, "CALL_SETUP", stat_time);
my_bar_chart_dataset.addValue(call_term, "CALL_TERM", stat_time);
my_bar_chart_dataset.addValue(regi, "REGISTER", stat_time);
}
JFreeChart BarChartObject = ChartFactory.createLineChart("INA System", "Date", "TPS", my_bar_chart_dataset, PlotOrientation.VERTICAL, true, true, false);
query_set.close();
stmt.close();
conn.close();
int width = 1920; /* Width of the image */
int height = 1080; /* Height of the image */
File BarChart = new File("output_chart.png");
ChartUtilities.saveChartAsPNG(BarChart, BarChartObject, width, height);
}
catch (Exception i)
{
System.out.println(i);
}
}
}
I referred following blog.
< Java Chart Example >
http://thinktibits.blogspot.kr/p/java-chart-example-programs.html
http://thinktibits.blogspot.kr/2013/01/JFreeChart-XYDataset-Line-Chart-Java-Example.html
http://thinktibits.blogspot.kr/2013/01/JFreeChart-SVG-XY-Line-Chart-Graph-Java-Example.html
< Bar Chart >
http://thinktibits.blogspot.kr/2012/11/jfreechart-java-jdbc-bar-chart-example.html
< Pie Chart >
http://thinktibits.blogspot.kr/2012/11/jfreechart-jdbc-pie-chart-java-example.html
2016년 2월 15일 월요일
Install iftop on CentOS or RedHat (RHEL)
Visit following web site and check what is latest version of iftop
http://pkgs.repoforge.org/iftop/
Get iftop package.
wget http://pkgs.repoforge.org/iftop/iftop-1.0-0.pre3.el7.rf.x86_64.rpm
Install iftop by rpm tools
rpm -ivh iftop-1.0-0.pre3.el7.rf.x86_64.rpm
http://pkgs.repoforge.org/iftop/
Get iftop package.
wget http://pkgs.repoforge.org/iftop/iftop-1.0-0.pre3.el7.rf.x86_64.rpm
Install iftop by rpm tools
rpm -ivh iftop-1.0-0.pre3.el7.rf.x86_64.rpm
2016년 2월 2일 화요일
Routing Protocol Hierarchy (라우팅 프로토콜 체계)
Routing Protocol
- IGP (AS 내부에서 라우팅 프로토콜을 관리하기 위함)
+ RIP
+ OSPF
+ ISIS
+ EIGRP
- EGP (AS와 AS간 라우팅 프로토콜을 관리하기 위함)
+ BGP
2016년 1월 26일 화요일
Install R on RedHat (RHEL 6.6)
View following site and download source code (R-3.2.3.tar.gz)
https://cran.r-project.org/
[ Command Line ]
wget https://cran.r-project.org/src/base/R-3/R-3.2.3.tar.gz
tar xvf R-3.2.3.tar.gz
vi INSTALL
./configure
make
make check
make info
make pdf
make install
make install-info
[ To do before R-installing ]
Install texi2any program before building the R program
http://ftp.gnu.org/gnu/texinfo/
wget http://ftp.gnu.org/gnu/texinfo/texinfo-6.0.tar.xz
Install texlive program before building thr R program
yum install texlive*
Check if ncurses library is installed before R installing.
yum install ncurses-devel
2016년 1월 14일 목요일
Sydney news paper
http://m.smh.com.au/money/saving/kickstart-2016-with-a-financial-health-check-20160107-gm15ke.html
피드 구독하기:
글 (Atom)