วันอาทิตย์ที่ 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.




iOS-NBUKit: Component For Working With Photos Providing A Camera View, Gallery, Image Filter View, And More

Customizable camera, assets, image editing, gallery, picker and UIKit subclasses.

faceimageview - A UIImageView clone that adjusts image content to show faces.

UIImageView clone with a catch:

FaceImageView automatically scales its image to fill the bounds and keep any faces detected in view. This can be useful if you want to display people-based dynamic content with UIViewContentModeScaleToFill but are having issues with it displaying the wrong part of the image, like the background, or someone's feet.

The class uses the CoreImage face detection APIs available in iOS 5.0 or later. This API works in many clear cases, but is not all that reliable. If no faces are detected in an image, FaceImageView defaults to centering the image, like UIImageView's behavior with UIViewContentModeScaleToFill.

A small demo app is included to try out different images and view sizes.
https://github.com/dingbat/faceimageview