2012年11月19日 星期一

李嘉誠的一番說話



李嘉誠的一番說話:
很多人想把握機會、但要做一件事情時,往往給自己找了很多理由讓自己一直處於矛盾之中!不斷浪費時間,虛度時光。如:
1 、我沒有口才——錯:沒有人天生就很會說話,臺上的演講大師也不是一下子就能出口成章,那是他們背後演練了無數次的結果!你罵人的時候很擅長、抱怨的時候也很擅長、但這種口才是沒有價值的口才,看
別人爭論的時候、自己滿嘴評頭論足、卻不知反省自己,倘若你付出努力練習,你今天是否還說自己沒口才?

2 、我沒有錢—— 錯: 不是沒有錢,而是沒有賺錢的腦袋。工作幾年了沒有錢麼?有、但是花掉了。花在沒有投資回報的事情上面。花在吃喝玩樂上、或存放貶值了,沒有實現價值最大化、所以錢就這樣入不敷出。每月當月光族、周而復始、沒有遠慮、當一天和尚敲一天鐘,得過且過。

3 、我沒有能力——錯: 不給自己機會去鍛煉,又有誰一出生就有能力?一畢業就是社會精英?一創業就馬上成功?當別人很努力的學習、很努力的積累、努力找方法,而你每天就只做了很少一點就覺得乏味。學了一些就覺得沒意思、看了幾頁書就不想看、跟自己也跟別人說沒興趣學。然後大半輩子過去一事無成,整天抱怨上天不給機會。能力是努力修來的、不努力想有能力,天才都會成蠢材。但努力,再笨的人也能成精英。

4 、我沒有時間——錯:時間很多、但浪費的也很多!別人很充實、你在看電視,別人在努力學習時、你在玩遊戲消遣虛度。總之時間就是覺得很多餘、你過得越來越無聊。別人賺錢了羡慕別人、但不去學別人好好把握時間創造價值,整天不學無術。
5 、我沒有心情——錯:心情好的時候去遊玩、心情不好的時候在家喝悶酒,心情好的時候去逛街、心情不好的時候玩遊戲,心情好的時候去享受、心情不好的時候就睡大覺。好壞心情都一樣,反正就是不做正事。
6 、我沒有興趣——錯:興趣是什麼?吃喝玩樂誰都有興趣,沒有成就哪來的盡興!沒錢拿什麼享受生活!你的興趣是什麼?是出去旅遊回來月光族、出去K歌回頭錢包空空、出去大量購物回來慘兮兮.... 打工有沒有興趣?擠公車有沒有興趣?上班簽到下班打卡有沒有興趣?家裡急需要一大筆錢拿不出來有沒有興趣?借了錢沒錢還有沒有興趣?賣老鼠藥的人對老鼠藥有興趣.....?

7 、我考慮考慮——錯:考慮做吧有可能就成了、不做吧好不甘心!一想整天上班也沒有個頭、還是明天開始做吧!又一想還是算了、這錢掙的也不容易!不不、就是打工掙錢也不容易,決定了不能放棄機會! 哎呀、天都黑了,明天再說吧!然後第二天又因為以上12345點、因為左思右想、繼續迴圈、最終不能決定。猶猶豫豫、耽誤了很多時間、還是一無所獲。
有句話是:“可憐之人必有可恨之處!” 這一生中不是沒有機遇,而是沒有爭取與把握!藉口太多,理由太多....!爭取之人必竭力爭取、一分錢都沒有也千方百計想辦法!不爭取之人給一百萬也動不起來、發財不了、還有可能一敗塗地。這就是行動力的欠缺!喜歡猶豫不決、喜歡拖延、喜歡半途而廢、最後一輩子平庸、碌碌無為!還有的人、做事三分鐘熱度,一開始熱情高漲、等會就繼續懶散,這種人成功的帽子也不會在你的頭上。
看看為什麼別人身價幾個億,你自己還在為錢奔波!不要羡慕別人命好,別人很困難的時候是怎麼堅挺過來的,怎麼克服困難、突破自己、改變命運的,你沒看到罷了!你看到的只是他成功後的光環!所以你抱怨嫉妒羡慕恨!
價值上千萬的一堂課,讀完受益終生。如果你覺得說的有道理,請將其傳播出去!好日誌真的不多了,這篇日誌強烈要求看過的每個人都轉載收藏,不然以後怕是找不到了。。

2012年10月8日 星期一

Mobile GPS cannot detect

Take your SIM out of the Nexus One
Power on the device
Turn WiFi on
Turn GPS on
Open application: GPS Status
Go into its Settings menu
Click on GPS and Sensors
Click Manage A-GPS state
Click Reset
Click Manage A-GPS state again
Click Download
Now put your phone on a stable, straight surface in order to enable the phone to get a lock. This time, you’ll see your phone get the lock back way faster than before.
With that done, now it’s time to put your SIM back in and use the network to secure a quick GPS fix as well.

2012年8月18日 星期六

資訊隱藏

 這星期突然對好久前做的研究好有興趣因手機越來越強,想把它在手機運行。特別找回一篇當年(1999)我在 San Jose, CA present 的文獻

 

Selective block assignment approach for robust digital image watermarking

Kam-Shing Ng, Lee Ming Cheng, City Univ. of Hong Kong (Hong Kong)

Abstract

Digital watermark is used to protect digital image against any illegal reproduction and tampering. In the selective block assignment process, the image is divided into N X N pixel blocks and each block is Discrete Cosine Transformed (DCT). The set of blocks will be then selectively chosen to encode the copyright message. Each selective block will be incremented by a value, in order to maintain the invisibility of the watermarking image, the incremented value should be within a range. The selection of blocks is based on measurement of the content. Depends on the amount of messages stored and the signal to noise ratio (SNR) of the resultant image required, a threshold is decided. In practice, the threshold will be set such that the duplicated message or an error correction mechanism can also be included in order to increase its robustness. The decoding process should be carried out by using the threshold values to get back the locations that have watermark information. Then the watermarked image is subtracted from the original image to obtain the secret data. Simulation results show that the watermarked image looks visually identical to the original and with an SNR of 44.7 dB for Lenna and with SNR 43 dB for airplane with size 256 X 256 pixels.

好覺得這個領域就快出現 普遍性的用途。我亦會先在我的小學網站試用,相信能成一時佳話。

2012年6月27日 星期三

Sign Google App


<quoted from other web>
You need to create Release Key for Signing your Application.
Step : 1 Right Click Project->Export Application->Select you Project->Next->Select new Keystore -> Complete all rest Steps
Step : 2 Note down your Alias name and Password given.
Step : 3 Now if you Complete all process of Filling Details you will get one .apk file and keystore file in you stored location.
Step : 4 Now Again Right Click Project->Export Application->Select you Project->Next->Use Existing Keystore -> Give location and password->Next
Step : 5 Now you alias name will comes in your Drop Down->Select it -> Enter Password -> Next
Step : 6 It will ask for location to store your final .apk file.
Step : 7 Select your location and store.
Step : 8 Now this Final .apk file is Your Signed Application.
Note : Keep this keystore file for further updated of your Application in Android Market ,also keep track of your Alias name and Password

GCM (Google Cloud Messaging)

http://developer.android.com/guide/google/gcm/gs.html

Change from C2DM to GCM on 28 Jne 2012

According to the document, migration is simply change the email into API key.


Migration is simple! The only change required in the application is replacing the email account passed in the sender parameter of the registration intent with the project ID generated when signing up for the new service. For example:
Intent registrationIntent = new Intent("com.google.android.c2dm.intent.REGISTER");
// sets the app name in the intent
registrationIntent.putExtra("app", PendingIntent.getBroadcast(this, 0, new Intent(), 0));
registrationIntent.putExtra("sender", senderID);
startService(registrationIntent);

2012年6月1日 星期五

LumiaChallenge 2012

 剛提交了三個作品到 Nokia 參加 LumiaChallenge 2012 的比賽,順便做個記錄。

CDict - When we type English passage, we always forget a word or how to spell a word.  This movie shows how to type the word using the language you know (in this example Chinese) directly into the editor and do the translation in cloud (Microsoft translation in this example) instantly.  The program can  intelligently check the Chinese inside.  Thus, it saves lots of time to check from web or dictionary and come back to type the passage.  In this movie, one sentence is for demo purpose.  In future, a whole passage can be done in any-input-language to any-output-language.
video demo - http://youtu.be/4ekTQBW696M  

人生計算機 - 我們每天都不自覺地問到人生的問題。本程式嘗試給出一個參考。透過古人的生活體驗,歸納出來的人生法則,我們把它量化做成這程式。程式包括二部份。1.每天的開心指數 2.人生的反思首部份只要把相關出生年月日輸入,程式就會把結果化為圖像。第二部份,用家輸入英文,程式會給出所佔人生部份的比例。 *以上並非隨機結果,亦只作為參考用途。

QueuEasy
With QueuEasy, we do not need to spend time on service waiting anymore. We can shop around until the shop pushes you back. This app requires to work with www.queueasy.com

2012年5月28日 星期一

iOS token



From : http://davehiren.blogspot.com/2012/03/get-device-token-for-apple-push.html


Get device token for apple push notifications in sencha touch and phone gap

Hello,

Recently I was working on Apple push notifications with sencha touch and phonegap project. Requirement was to get device token in JavaScript file so that it can be sent to server for getting push notifications. For that first thing we need to do is register device to get Push notifications.

Please make sure that you have real apple device like iPad, iPhone or iPod touch to test this. This will not work in Simulator.

To register device for push notifications add following in your AppDelegate.m file.  Find method


- (BOOL) application:(UIApplication*)application didFinishLaunchingWithOptions:(NSDictionary*)launchOptions

Also add following line to define token variable.


@synthesize token;


and add following code at end of the method.


NSLog(@"Registering for push notifications...");    
    [[UIApplication sharedApplication] 
     registerForRemoteNotificationTypes:
     (UIRemoteNotificationTypeAlert | 
      UIRemoteNotificationTypeBadge | 
      UIRemoteNotificationTypeSound)];

This will register device for getting push notifications. Please make sure that you have added provisioning profile which configured with non wild card app id and app is configured to receive  push notifications in your development portal. Also you need valid developer certificate.

After that you need to add following methods at end of the file.

- (void)application:(UIApplication *)app didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken { 

    
    self.token = [[[[deviceToken description]
                    stringByReplacingOccurrencesOfString: @"<" withString: @""]
                   stringByReplacingOccurrencesOfString: @">" withString: @""]
                  stringByReplacingOccurrencesOfString: @" " withString: @""];
    
    NSLog(@"My token is: %@", self.token);
}

- (void)application:(UIApplication *)app didFailToRegisterForRemoteNotificationsWithError:(NSError *)err { 
    
    NSString *str = [NSString stringWithFormat: @"Error: %@", err];
    NSLog(str);    
    
}

- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo {
    
    for (id key in userInfo) {
        NSLog(@"key: %@, value: %@", key, [userInfo objectForKey:key]);
    }    
    
}


This will get device token and store it to token. Now to send this token to JavaScript we will create a phonegap plugin. Please make sure that this code will work with Phonegap version 1.5.0. They named this version as Cardova.

First create folder inside plugins folder of your project folder and name it as PushToken and add two files to it PushToken.m and PushToken.h

Open PushToken.h file and add following code to it.



#import <Foundation/Foundation.h>
#import <Cordova/CDVPlugin.h>

@interface PushToken : CDVPlugin{
    
    NSString* callbackID;  
}

@property (nonatomic, copy) NSString* callbackID;

- (void) getToken:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options;

@end



Now open PushToken.m file and add following code to it.

#import "PushToken.h"
#import "AppDelegate.h"

@implementation PushToken

@synthesize callbackID;

-(void)getToken:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options  {
    self.callbackID = [arguments pop];
    
    NSString *token = ((AppDelegate *)[[UIApplication sharedApplication] delegate]).token;
    
    CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:[token stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];
    
    if(token.length != 0)
    {
        [self writeJavascript: [pluginResult toSuccessCallbackString:self.callbackID]];
    }else {    
        [self writeJavascript: [pluginResult toErrorCallbackString:self.callbackID]];
    }
}

@end

Now we have to map this plugin. For that open Cordova.plist file and following key value pair to it.

PushToken : PushToken

After that open AppDelegate.h file and add following line to it.

@property (retain, nonatomic) NSString* token;

That's it of phonegap side now we have to create JavaScript file form where we will execute this plugin code. Create JavaScript file with name PushToken.js and add it to www folder. Add following code to it.

var PushToken = {
    getToken: function(types, success, fail) {
        return Cordova.exec(success, fail, "PushToken", "getToken", types);
    }
};

Add link of this JavaScript file to your index.html page after phonegap JavaScript file. To get device token wherever you want use following code.


PushToken.getToken(     
                     ["getToken"] ,           
                     function(token) {
                              global.token = token; 
                     },
                     function(error) {
                              console.log("Error : \r\n"+error);      
                     }
          );

That's it and you have your device token.