Monday, October 28, 2013

HTML5&CSS3 - Link

@Xcode with Web
http://cordova.apache.org/#about

@Maker Css3
http://www.css3maker.com/index.html

@CSS3
http://www.hongkiat.com/blog/html5-web-applications/

@Fonts - You can use these in free.
http://crazypixels.net/50-precious-free-fonts-for-commercial-use/

Java - How to install java on CentOs

@ How to install java on CentOs.

@ Changes a user for the root.
$ sudo -s

@ Decompresses jdk-7u75-linux-x64.tar.gz (or upper version).
$ tar xvf /usr/local/src/jdk-7u75-linux-x64.tar.gz

@ Moves the java directory under the local directory.
$ mv /usr/local/src/jdk1.7.0_75 /usr/local/java

@ Changes the user and group ownership of each given file for root.
$ chown -R root.root /usr/local/java

@ Add the following comment into a user in /home/njoonk/.bash_profile
export JAVA_HOME=/usr/local/java
export PATH=$JAVA_HOME/bin:$PATH

Friday, October 18, 2013

Objective-C - How to remove Cocos2d

@When you can't updates Cocos2d new version.

$ cd /Users/username/Library/Developer/Xcode/Templates/File Templates
$ m -rf ./cocos2d

$ cd /Users/username/Library/Developer/Xcode/Templates
$ rm -rf ./cocos2d

$ cd /Users/username/Library/Application Support/Developer/Shared/Xcode/File Templates
$ rm -rf ./cocos2d\ 1.0.0/

$ cd /Users/username/Library/Application Support/Developer/Shared/Xcode/Project Templates/
$ rm -rf ./cocos2d\ 1.0.0/

Objective-C - iPhone to Server

I will write it
@You need to get the following library.
https://github.com/msgpack/msgpack-objectivec

@ On the Iphone
static void listenerCallback(CFSocketRef socket, CFSocketCallBackType type,
                             CFDataRef address, const void *data, void *info) {

    NSString* str = nil;
    switch (type) {
        case kCFSocketNoCallBack:
            str = @"kCFSocketNoCallBack";
            break;
        case kCFSocketReadCallBack:
            str = @"kCFSocketReadCallBack";
            break;
        case kCFSocketAcceptCallBack:
            str = @"kCFSocketAcceptCallBack";
            break;
        case kCFSocketDataCallBack:
            str = @"kCFSocketDataCallBack";
            break;
        case kCFSocketConnectCallBack:
            str = @"kCFSocketConnectCallBack";
            break;
        case kCFSocketWriteCallBack:
            str = @"kCFSocketWriteCallBack";
            break;
        default:
            break;
    }

    if(type == kCFSocketDataCallBack) {
        // Get a message from server
        NSData* receiveData = (NSData*)data;
        NSDictionary* parsed = [receiveData messagePackParse];
        NSNumber *numx = [parsed objectForKey:@"x"];
        NSNumber *numy = [parsed objectForKey:@"y"];
        NSLog(@"numx is %f", [numx floatValue]);
        NSLog(@"numy is %f", [numy floatValue]);

        /* another way to print
         UInt8 *gotData = CFDataGetBytePtr((CFDataRef)data);
         int len = CFDataGetLength((CFDataRef)data);
         for(int i=0; i < len; i++) {
             NSLog(@"%c",*(gotData+i));
         }
         */
    } else if(type == kCFSocketWriteCallBack) {
        // Send a message to server
        CGPoint translation = CGPointMake(5.0, 6.0);
        NSNumber *numx = [NSNumber numberWithFloat:translation.x];
        NSNumber *numy = [NSNumber numberWithFloat:translation.y];
        NSDictionary *someDictionary = [[NSDictionary alloc] initWithObjectsAndKeys:
                                        numx, @"x",
                                        numy, @"y",
                                        nil];
        NSData* packed = [someDictionary messagePack];
        CFSocketSendData(socket, NULL, (CFDataRef)packed, 10);
        // CFRelease((CFDataRef)packed);
    }

}

@ On the Server
....

Saturday, October 12, 2013

MyStory - An earthquake has happened on 11 march 2011 in Japan

There has been an earthquake in Japan.
It was very sad thing.
When the earthquake happened,
I was very anxious for my wife and my daughter.
So I had called my wife as soon as possible.
But I couldn't connect with her.
I feared for both her and my daughter's safety.
After I was allowed to leave the company,
I left the office a little early at 5 o'clock to get to my wife's job.
I went to the Shinagawa Station from Shibuya.
I think It took about 5 hours.
But we didn't meet there, because the communication network system wasn't working.
After a little time had passed, We were able to speak to each other by smart phone.
My wife said she was walking to the child-care institutions.
I had to walk to the same place.
I had reached home at 5 AM.
So altogether I had walked for 12 hours.
I was happy for my family safety.
But I am very worried about the accident at the nuclear power plant.
I worry about the radioactivity.

Tuesday, October 8, 2013

Java - Setting server.xml on tomcat 7

@ on Server.xml

Java - Basic Authentication on Tomcat 7

@$ cd /usr/local/tomcat/conf
@Add the following this on the web.xml
<security-constraint>
        <web-resource-collection>
                <web-resource-name>
                        My Protected WebSite
                </web-resource-name>
                <url-pattern> /* </url-pattern>
                <http-method> GET </http-method>
                <http-method> POST </http-method>
        </web-resource-collection>
        <auth-constraint>
                <!-- the same like in your tomcat-users.conf file -->
                <role-name> aname </role-name>
        </auth-constraint>
</security-constraint>
<login-config>
        <auth-method> BASIC </auth-method>
        <realm-name>  Basic Authentication </realm-name>
</login-config>
<security-role>
        <description> aname role </description>
        <role-name> aname </role-name>
</security-role>
---------------------------------------------------------------------------------------
 @tomcat-users.xml
  <role rolename="manager-gui"/>
  <role rolename="admin-gui"/>
  <role rolename="aname" />

  <user username="tomcat" password="pwd" roles="manager-gui,admin-gui"/>
  <user username="aname" password="pwd" roles="aname"/>

Mysql - Remove the bin log

@Remove the bin log
mysql -e "PURGE MASTER LOGS BEFORE DATE_SUB(CURRENT_DATE, INTERVAL 60 DAY)"