Apr 29, 2012

Install Octave Plugin in Eclipse

It's been a very annoying thing since I started using Octave on Mac.
For no good editor was there for me to use.

At last I could not stand it any longer. So I did some search, and here is what I got:

    http://www.ibm.com/developerworks/opensource/tutorials/os-eclipse-octave/

Yes, you get it, right?

I get it right, and enjoy myself now.




Mar 13, 2012

Android Save to SD Card Setting and notes for the Market Upload setting

There is an option under the “Publishing options” area in your app's market "product details",
the devil's name is "Copy Protection"。

Set it to “ON”, the app data surely won't be saved to sd card, even if you explicitly specify "android:installLocation="preferExternal"" in your manifest.

If you are trapped here with this like me, you'd be happy to read this.

Hope this helped.

Mar 11, 2012

Dreamweaver and Xcode and Developer Folder

The dreamweaver site-> mobile applications requires you set ios developer sdk path.

Since Xcode 4.3 removed Developer folder and put it under /Applications/Xcode.app/Contents/Developer.

I tried to make an alias to that folder , but it didn't work.

So just put the whole path in the settings, all shall be fine.

Thank you!

Install Adobe Air SDK on a Mac


1. Download sdk from here:
  • http://www.adobe.com/devnet/air/air-sdk-download.html
2. extract the downloaded file to a location, and here is mine:
  • /Users/chengyue/Documents/Software/Adobe/AirSDK/AdobeAIRSDK/
3. Add the "bin" folder under the AdobeAIRSDK to your mac's PATH.
  • export PATH=$PATH:/Users/chengyue/Documents/Software/Adobe/AirSDK/AdobeAIRSDK/bin
Now, try the following command to see if it works.
  • adt -version
If you followed the steps above, you should see the version displayed on your screen.
Not?go back and check!
4. if your don't want to execute the export command every time you restart your system, then create a .bash_profile under your home folder, mine is "/Users/chengyue/.bash_profile"
  • cd
  • vi .bash_profile
  • write down the command, save it and quit.
5. (optional) Shift to your terminal, and start a new shell, try "echo $PATH", you should see
the AdobeAIRSDK/bin in the output.

Congrats!

FYI, you can check the former answer to this problem from Adobe:

Jan 28, 2012

command used to check if processor is 64bit

grep --color=always -iw lm /proc/cpuinfo

Jun 25, 2011

apache and htaccess

1. in your Directory

DirectoryIndex index.php index.html
Options Indexes FollowSymLinks MultiViews
AllowOverride All ##### this should be All
Order allow,deny
allow from all


2. in your /var/www/xxx folder, add file .htaccess
Options +FollowSymLinks
IndexIgnore */*

RewriteEngine on
# if a directory or a file exists, use it directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# otherwise forward it to index.php
RewriteRule . index.php

Jun 11, 2011

Cocos2D Complete

■CCLabelTTF Font List:
  List of iOS Fonts available in iOS 3.1 and above
  • Family name: AppleGothic
  • Font name: AppleGothic
  • Family name: Hiragino Kaku Gothic ProN
  • Font name: HiraKakuProN-W6
  • Font name: HiraKakuProN-W3
  • Family name: Arial Unicode MS
  • Font name: ArialUnicodeMS
  • Family name: Heiti K
  • Font name: STHeitiK-Medium
  • Font name: STHeitiK-Light
  • Family name: DB LCD Temp
  • Font name: DBLCDTempBlack
  • Family name: Helvetica
  • Font name: Helvetica-Oblique
  • Font name: Helvetica-BoldOblique
  • Font name: Helvetica
  • Font name: Helvetica-Bold
  • Family name: Marker Felt
  • Font name: MarkerFelt-Thin
  • Family name: Times New Roman
  • Font name: TimesNewRomanPSMT
  • Font name: TimesNewRomanPS-BoldMT
  • Font name: TimesNewRomanPS-BoldItalicMT
  • Font name: TimesNewRomanPS-ItalicMT
  • Family name: Verdana
  • Font name: Verdana-Bold
  • Font name: Verdana-BoldItalic
  • Font name: Verdana
  • Font name: Verdana-Italic
  • Family name: Georgia
  • Font name: Georgia-Bold
  • Font name: Georgia
  • Font name: Georgia-BoldItalic
  • Font name: Georgia-Italic
  • Family name: Arial Rounded MT Bold
  • Font name: ArialRoundedMTBold
  • Family name: Trebuchet MS
  • Font name: TrebuchetMS-Italic
  • Font name: TrebuchetMS
  • Font name: Trebuchet-BoldItalic
  • Font name: TrebuchetMS-Bold
  • Family name: Heiti TC
  • Font name: STHeitiTC-Light
  • Font name: STHeitiTC-Medium
  • Family name: Geeza Pro
  • Font name: GeezaPro-Bold
  • Font name: GeezaPro
  • Family name: Courier
  • Font name: Courier
  • Font name: Courier-BoldOblique
  • Font name: Courier-Oblique
  • Font name: Courier-Bold
  • Family name: Arial
  • Font name: ArialMT
  • Font name: Arial-BoldMT
  • Font name: Arial-BoldItalicMT
  • Font name: Arial-ItalicMT
  • Family name: Heiti J
  • Font name: STHeitiJ-Medium
  • Font name: STHeitiJ-Light
  • Family name: Arial Hebrew
  • Font name: ArialHebrew
  • Font name: ArialHebrew-Bold
  • Family name: Courier New
  • Font name: CourierNewPS-BoldMT
  • Font name: CourierNewPS-ItalicMT
  • Font name: CourierNewPS-BoldItalicMT
  • Font name: CourierNewPSMT
  • Family name: Zapfino
  • Font name: Zapfino
  • Family name: American Typewriter
  • Font name: AmericanTypewriter
  • Font name: AmericanTypewriter-Bold
  • Family name: Heiti SC
  • Font name: STHeitiSC-Medium
  • Font name: STHeitiSC-Light
  • Family name: Helvetica Neue
  • Font name: HelveticaNeue
  • Font name: HelveticaNeue-Bold
  • Family name: Thonburi
  • Font name: Thonburi-Bold
  • Font name: Thonburi

May 27, 2011

iOS4.2 Bug with UINavigationViewController

Everytime when I left the top view, I set the topView's title to @"TOP";
When I came back to the TOP, I would set the topView's title to @"", for that I had a backgroud image to be displayed as the title.
The problem was, with iOS4.2,the second time I left TOP view controller and went to a second level view controller, the back item in the NavigationBar disappeared.
"DISAPPEARED"!!!!!!!!!有木有!!!!!!!!!
I couldn't go back to the TOP!!!!!!!!!!!!!!
I got rejected by GREE for this f**king problem!!!!!!!

But, there's always a but!
I love but(this statement is still true by replacing the t with a double t)!

I came out with a solution.

1. set the top's title to @"TOP", don't set it back to @"";
2. every time you go back to the top , do this:
self.navigationItem.titleView = [[UIView alloc] initWithFrame:CGRectMake(0,0,1,1)];

Now, the problem disappeard!!!!
"DISAPPEARED"!!!!!!!!!有木有!!!!!!!!!

May 25, 2011

Weird problem with CCSprite

I added a CCSprite(with an image) as the background, the fps jumped to 30.0.
when I remove it or change the scale to less than 1.0, the fps would return to 60.0.
Now I am going to find out what's going on here.

Apr 14, 2011

Iphone Code Complete

1. how to count time.

CFAbsoluteTime time = CFAbsoluteTimeGetCurrent();


beware that the CFAbsoluteTime is a Double.


2. How to open a URL

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"your url here"]];



Apr 2, 2011

install ssh on ubuntu

I didn't use apt for a long time, so...first I updated apt...

> apt-get update

then,
> apt-get install openssh-server

after ssh get installed..

> /etc/init.d/ssh start

done!!
pretty simple, right?

Apr 1, 2011

About error messages and locales

Localization
1. create file for localization
/protected/messages/
/en/default.php
/cn/default.php
/jp/default.php

2. specific a lang
Yii::app()->language = "en"
: this means your en folder under /protected/messages.

3. in your default.php, write things as follows,

return array(
'name' => 'xing ming',
'required' => 'bu neng wei kong',
);
?>

4. anywhere you want to use the localized name, write,
Yii::t('default', 'name');

custum error message.
1. in your model/Model.php, find function rules.
return array(
array('name, mail', 'required', 'message' => Yii::t('default', 'required'); ),
);

2. This tag will show all the form errors in a block.
The second param is the title of the block.
Here I leave it blank.
errorSummary($model, ""); ?>



Mar 18, 2011

connect to remote mysql

1. if there is a firewall
sudo /sbin/iptables -A INPUT -p tcp -d 0/0 -s 0/0 --dport 3306 -j ACCEPT

2. in my.cnf, set
bind-address = your IP

Mar 12, 2011

memcached can't link to libevent.so

> ldd /usr/bin/memcached
> LD_DEBUG=libs /usr/bin/memcached -v
> sudo ln -s /usr/lib/libevent-2.0.so.5 /lib64/libevent-2.0.so.5

Mar 10, 2011

Install Git

install git on a plain CentOS 5.5 64bit machine:

you may not have these three libraries, so install them first.
> yum install openssl-devel.x86_64
> yum install curl-devel.x86_64
> yum install expat-devel.x86_64


now , go to your git source directory, and hit the following command,

> make
> make install

you shall now find the git commands as bellow,

/root/bin/git*

Jan 24, 2011

Yii - default timezone

1.set default timezone
Encountered an error which was described here:
http://php.net/manual/en/function.date-default-timezone-set.php
I added the following line to the index.php
date_default_timezone_set("Asia/Tokyo");

2.Gii

'modules'=>array(
'gii'=>array(
'class'=>'system.gii.GiiModule',
'password'=>'123456',
'ipFilters'=> array('localhost', '127.0.0.1', '192.168.2.249'),
),
),



3. Gii
"CDbConnection failed to open the DB connection: could not find driver"
I didn't get the proper pdo_php support.
I re-configured php using the following command:
./configure --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql --with-pdo-mysql

...fixed now

Sep 22, 2010

NOTES about YII

1. gii

'gii' =>array(
'class' => 'system.gii.GiiModule',
'password' => '****',
'ipFilters' => array(
'127.0.*',
),
),

Jun 29, 2009

Install Image::Magick

CentOS

# yum install ImageMagick
# yum install ImageMagick-devel
# yum install ImageMagick-perl

Jun 28, 2009

Install Memcached Under CentOS 5.2

Under CentOS 5.2

after doing
> yum install libevent
and installing memcached

when i am trying to start memcached, an error occurs.

> memcached: error while loading shared libraries: libevent-1.4.so.2: cannot open shared object file: No such file or directory

Here is the solution :

> export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH

Then , OK.

Jan 18, 2009

Read chm file on ubuntu

sudo aptitude install xchm