Skip to main content


Showing posts from May, 2014

DCEVM - A JRebel free alternative

In tomcat project, we have to restart the server whenever there is even tiny change made. DCEVM is really helpful.

Step 1: download the jar  file

Step 2: Attach the dcevm to your existing JDK/JVM

Step3: in your eclipse,  added below to the Arguments of Tomcat configuration

iOS codes snippets

source: image
NSString *path = [[NSBundle mainBundle] pathForResource:@"icon" ofType:@"png"];
myImage = [UIImage imageWithContentsOfFile:path];
2.change the background  of selected cell
UIView *myview = [[UIView alloc] init];
myview.frame = CGRectMake(0, 0, 320, 47);
myview.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"0006.png"]];
cell.selectedBackgroundView = myview;
3.Append button to the soft keyboard:
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillShow:) name:UIKeyboardWillShowNotification object:nil]; //addObserver:注册一个观察员name:消息名称
- (void)keyboardWillShow:(NSNotification *)note {
// create custom button
UIButton *doneButton = [UIButton buttonWithType:UIButtonTypeCustom];
doneButton.frame = CGRectMake(0, 163, 106, 53);
[doneButton setImage:[UIImage imageNamed:@"5.png"] forState:UIControlStateNormal];
[doneButton addTarget:self action:@…

Generate a UUID string with ARC enabled

Before ios 6: - (NSString *)uuidString {     // Returns a UUID
    CFUUIDRef uuid = CFUUIDCreate(kCFAllocatorDefault);     NSString *uuidString = (__bridge_transfer NSString *)CFUUIDCreateString(kCFAllocatorDefault, uuid);     CFRelease(uuid);
    return uuidString; }
If you are on OS X 10.8 or iOS 6 you can use the new NSUUID class to generate a string UUID, without having to go to Core Foundation:
NSString *uuidString = [[NSUUID UUID] UUIDString];