วันศุกร์ที่ 24 มกราคม พ.ศ. 2557

fix vsftp & iptables fix

setenforce 0

/etc/vsftpd/ftpusers
/etc/vsftpd/user_list

vi /etc/sysconfig/iptables-config

IPTABLES_MODULES="ip_conntrack_ftp"

ขั้นตอนการติดตั้ง FTP Server บน CentOS 6 ด้วยโปรแกรม vsftpd
1. ดาวน์โหลดโปรแกรม vsftpd
1
# yum install vsftpd

2. Start Service vsftpd 
1
# service vsftpd start

3. เปิดการใช้งาน vsftpd ใน Multi-user levels
1
# chkconfig vsftpd on
 ขั้นตอนการสร้าง Account FTP ให้กับแต่ละคน (FTP แบบ Authentication Required)
1. แก้ไขไฟล์ vsftpd.conf โดยพิมพ์คำสั่ง แก้ไขค่าตามคำอธิบายด้านล่าง และทำการบันทึก
1
# nano /etc/vsftpd/vsftpd.conf

1.1 ascii_upload_enable=YES ลบเครื่องหมาย # ออก
1.2 ascii_download_enable=YES ลบเครื่องหมาย # ออก
1.3 ftpd_banner=Welcome to blah FTP service. ลบเครื่องหมาย # ออก
1.4 use_localtime=YES เพิ่มไว้ที่บรรทัดสุดท้าย

2. สร้าง Account ใหม่ขึ้นมาสำหรับการทดสอบ
1
2
3
4
5
6
7
# useradd ftp1
# passwd ftp1
Changing password for user ostechnix.
New password:
BAD PASSWORD: it is based on a dictionary word
Retype new password:
passwd: all authentication tokens updated successfully.

3. Restart Service vsftpd
1
# service vsftpd restart

4. Update SELinux configuration เพื่อเปลี่ยน User ไปที่ $HOME directories
1
# setsebool -P ftp_home_dir on

วันอาทิตย์ที่ 19 มกราคม พ.ศ. 2557

Fix Mysql start & memcached


setenforce 0
killall memcached
service memcached start
service mysqld stop
mv /var/lib/mysql/mysql.sock /var/lib/mysql/mysql.sock.bak
service mysqld start

วันจันทร์ที่ 9 ธันวาคม พ.ศ. 2556

How can I fix a locale warning from perl?

# Setting for the new UTF-8 terminal support in Lion
export LC_CTYPE=en_US.UTF-8
export LC_ALL=en_US.UTF-8
# Setting for the new UTF-8 terminal support in Lion
LC_CTYPE=en_US.UTF-8
LC_ALL=en_US.UTF-8

วันอาทิตย์ที่ 1 กันยายน พ.ศ. 2556

how to set cornerRadius for only top-left and top-right corner of a UIView

Here's a method - I'm sure it could be shortened.... :D
-(UIView *)roundCornersOnView:(UIView *)view onTopLeft:(BOOL)tl topRight:(BOOL)tr bottomLeft:(BOOL)bl bottomRight:(BOOL)br radius:(float)radius {

UIRectCorner corner; //holds the corner


//Determine which corner(s) should be changed
if (tl) {
    corner = UIRectCornerTopLeft;
}
if (tr) {
    corner = UIRectCornerTopRight;
}
if (bl) {
    corner = UIRectCornerBottomLeft;
}
if (br) {
    corner = UIRectCornerBottomRight;
}
if (tl && tr) { //top
    corner = UIRectCornerTopRight | UIRectCornerTopLeft;
}
if (bl && br) { //bottom
    corner = UIRectCornerBottomLeft | UIRectCornerBottomRight;
}
if (tl && bl) { //left
    corner = UIRectCornerTopLeft | UIRectCornerBottomLeft;
}
if (tr && br) { //right
    corner = UIRectCornerTopRight | UIRectCornerBottomRight;
}

if (tl & tr & bl & br) {
    corner = UIRectCornerAllCorners; 
}

UIView *roundedView = view;
UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:roundedView.bounds byRoundingCorners:corner cornerRadii:CGSizeMake(radius, radius)];
CAShapeLayer *maskLayer = [CAShapeLayer layer];
maskLayer.frame = roundedView.bounds;
maskLayer.path = maskPath.CGPath;
roundedView.layer.mask = maskLayer;

return roundedView;
}
    UIButton *openInMaps = [UIButton new];
    [openInMaps setFrame:CGRectMake(15, 135, 114, 70)];
    openInMaps = (UIButton *)[self roundCornersOnView:openInMaps onTopLeft:NO topRight:NO bottomLeft:YES bottomRight:NO radius:5.0];

วันอังคารที่ 13 สิงหาคม พ.ศ. 2556

TSMessages

This framework provides an easy to use class to show little notification views on the top of the screen. (à la Tweetbot).
The notification moves from the top of the screen underneath the navigation bar and stays there for a few seconds, depending on the length of the displayed text. To dismiss a notification before the time runs out, the user can swipe it to the top or just tap it.
There are 4 different types already set up for you: Success, Error, Warning, Message (take a look at the screenshots)
It is very easy to add new notification types with a different design. Add the new type to the notificationType enum, add the needed design properties to the configuration file and set the name of the theme (used in the config file and images) in TSMessagesView.m inside the switch case.
Take a look at the Example project to see how to use this library. You have to open the workspace, not the project file, since the Example project uses cocoapods.




วันจันทร์ที่ 12 สิงหาคม พ.ศ. 2556

NJKWebViewProgress: progress for webview

NJKWebViewProgress is a progress interface library for UIWebView. Currently, UIWebView don't have official progress interface. You can implement progress bar for your in-app browser using this module.