The Mobile Galaxy The New Mobile Era Has Come | Mobile – A Time To Remember

26Sep/110

Installing PyGTK on Mac Lion

NOTE: IF YOU HAVE USED MACPORTS/FINK, REMOVE ALL TRACES OF IT BEFORE CONTINUING

I assume you want to install gtk at ~/gtk, if not change the instructions accordingly.

First we need to install JHBuild:
curl -o gtk-osx-build-setup.sh https://raw.github.com/jralls/gtk-osx-build/master/gtk-osx-build-setup.sh
sh gtk-osx-build-setup.sh
Once JHBuild is installed run these commands:
export PATH=$HOME/.local/bin:$PATH
vi  ~/.jhbuildrc-custom

add the line:

build_policy = "updated-deps"

Save and exit the file.

By default JHBuild will install gtk to ~/gtk, if you want a different location edit ~/.jhbuildrc and change the install directory.

We are now ready to build GTK:
jhbuild bootstrap
Fix gettext error:

Fix gettext issue with compilation under OS X Lion by editing a single line in the source (I use vi, but use whatever editor you like):
vi ~/gtk/source/gettext-0.18.1.1/gettext-tools/gnulib-lib/stpncpy.c
Change line 34, replacing __stpncpy with __stncpy (no “p”) at the beginning of the line. Save and exit the file.

Once done then run:
jhbuild build meta-gtk-osx-bootstrap
jhbuild build meta-gtk-osx-core

Fix error:
GTK doesn't build on Lion because of a small problem at the linking step with a test program named "autotestkeywords". Please find the build log and patch attached. Does anyone know why including only headers in a file like autotestkeywords.cc would cause the symbol "_objc_msg_send_fixup" to be generated when using the 10.7 SDK as opposed to the 10.6 SDK? In any case, the patch causes linkage with the requisite frameworks.

vi ~/gtk/source/gtk+-2.24.0/tests/Makefile.in

tests/Makefile.in

old new
89 89 @HAVE_CXX_TRUE@am_autotestkeywords_OBJECTS =  \
90 90 @HAVE_CXX_TRUE@ autotestkeywords-autotestkeywords.$(OBJEXT)
91 91 autotestkeywords_OBJECTS = $(am_autotestkeywords_OBJECTS)
92 autotestkeywords_LDADD = $(LDADD)
93 92 AM_V_lt = $(am__v_lt_$(V))
94 93 am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY))
95 94 am__v_lt_0 = --silent
685 684 testtooltips_DEPENDENCIES = $(TEST_DEPS)
686 685 testvolumebutton_DEPENDENCIES = $(TEST_DEPS)
687 686 testwindows_DEPENDENCIES = $(TEST_DEPS)
687 autotestkeywords_LDADD = $(LDADDS)
688 688 flicker_LDADD = $(LDADDS)
689 689 simple_LDADD = $(LDADDS)
690 690 print_editor_LDADD = $(LDADDS)
jhbuild build meta-gtk-osx-python

jhbuild build meta-gtk-osx-themes
GTK and PyGTK should now have been built.

Now navigate to ~/gtk/inst/lib/python2.7/site-packages and copy the contents of the site-packages folder to
/Library/Python/2.7/site-packages

Or run:
echo "import site; site.addsitedir('~/gtk/inst/lib/python2.7/site-packages')" > /Library/Python/2.7/site-packages/gtkredirect.pth
Obviously replace ~/gtk/inst with the path to your gtk installation.

You got it, PyGTK.
The attached is compiled package. PyGTK2.24.6.Don't forget to modify
/Library/Python/2.7/site-packages/gtkredirect.pth to this package. :)
Share
Tagged as: , No Comments
24Sep/110

Objective-C 声明中加减号区别

减号表示一个函数、或者方法、或者消息的开始,或者可以说是实例方法。

-(void) action:(bool) enable
{
    //do something
}
在Objective-C里面没有public和private的概念,你可以认为全是public。
而用加号的意思就是其他函数可以直接调用这个类中的这个函数,而不用创建这个类的实例及类方法。
Share
2Sep/110

Unhide Library Folder in Mac OS X 10.7 Lion

Okay, so I know most of you probably don't have the dev release of Mac OS X 10.7 Lion, but I got it today, and a really big thing was changed... Apple hid the Library folder which is usually in your Home folder. After a little bit of searching, I found the answer on how to unhide it.

Because it is a folder hidden by Apple, it is flagged, so the Terminal command would be:

chflags nohidden /Users/<Username>/Library

or use an easier way.

chflags nohidden ~/Library/

This is especially helpful in Lion, yet it can be used in previous versions of Mac OS X.

Just a tip, if you want to unhide any file or folder on Mac that you hid using a period in front of its name, you can use this command:

mv /path/to/file/.name /path/to/file/newname

Hope this saves you the hassle of looking all over for these commands like I had to do!

Share
Tagged as: No Comments
28Aug/110

UITableVIew实现类似于电话本的首字母索引

实际上UITableView默认就支持象电话本那样的按首字母索引。 实现sectionIndexTitlesForTableView 和 sectionForSectionIndexTitle 这两个接口即可。 细节请参考UITableViewDataSource帮助文档。

- (NSArray *)sectionIndexTitlesForTableView:(UITableView *)tableView
{

NSMutableArray *toBeReturned = [[NSMutableArray alloc]init];

for(char c = ‘A’;c<=‘Z’;c++)

[toBeReturned addObject:[NSString stringWithFormat:@"%c",c]];

return toBeReturned;

}

- (NSInteger)tableView:(UITableView *)tableView sectionForSectionIndexTitle:(NSString *)title atIndex:(NSInteger)index
{

NSInteger count = 0;

for(NSString *character in arrayOfCharacters)

{

if([character isEqualToString:title])

{

return count;

}

count ++;

}

return 0;

}

- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section
{

if([arrayOfCharacters count]==0)

{

return @”";

}

return [arrayOfCharacters objectAtIndex:section];

}
Share
10Aug/110

FFMPEG Video/Audio Encoding Cheat Sheet

From: http://rodrigopolo.com/ffmpeg/cheats.html

Video Size and Aspect Ratios

iPhone:

Name Size Aspect
Wide 16:9 480x270 4:3
Old TV 4:3 427x320 16:9
Wide 16:9 /16 480x272 480:272
Old TV 4:3 /16 432x320 432:320

DV NTSC Video

Name Size Aspect
Wide 16:9 720x480 16:9
Old TV 4:3 720x480 4:3

Youtube and Vimeo Upload

Name Size Aspect
SD 4:3 640:480 4:3
HD 16:9 1280x720 16:9

HD, Blu-Ray, AVCHD

Name Size Aspect
720p 1280x720 16:9
1080p/i Anamorphic 1440x1080 16:9
1080p/i 1920x1080 16:9

Frame Rates

Name Standard Fps FFmpeg
Movies NTSC 23.976 24000/1001
Movies QuickTime N/A 29.976 10000000/417083
TV Video NTSC 29.97 30000/1001
Movies PAL 25 25
TV Video PAL 30 30

FFmpeg Encoding

X264 Presets

default fastfirstpass lossless_ultrafast lossless_slower
baseline slowfirstpass lossless_fast lossless_max
normal hq lossless_medium ipod320
main max lossless_slow ipod640

High quality 2 Pass

ffmpeg -y -i INPUT -r 30000/1001 -b 2M -bt 4M -vcodec libx264 -pass 1 -vpre fastfirstpass -an output.mp4
ffmpeg -y -i INPUT -r 30000/1001 -b 2M -bt 4M -vcodec libx264 -pass 2 -vpre hq -acodec libfaac -ac 2 -ar 48000 -ab 192k output.mp4

iPod-iPhone 320 width

ffmpeg -i INPUT -s 320x240 -r 30000/1001 -b 200k -bt 240k -vcodec libx264 -vpre ipod320 -acodec libfaac -ac 2 -ar 48000 -ab 192k output.mp4

iPod-iPhone 640 width

ffmpeg -i INPUT -s 640x480 -r 30000/1001 -b 200k -bt 240k -vcodec libx264 -vpre ipod640 -acodec libfaac -ac 2 -ar 48000 -ab 192k output.mp4

Hight quality, 2 pass without presset

ffmpeg -y -i input -r 24000/1001 -b 6144k -bt 8192k -vcodec libx264 -pass 1 -flags +loop -me_method dia -g 250 -qcomp 0.6 -qmin 10 -qmax 51 -qdiff 4 -bf 16 -b_strategy 1 -i_qfactor 0.71 -cmp +chroma -subq 1 -me_range 16 -coder 1 -sc_threshold 40 -flags2 -bpyramid-wpred-mixed_refs-dct8x8+fastpskip -keyint_min 25 -refs 1 -trellis 0 -directpred 1 -partitions -parti8x8-parti4x4-partp8x8-partp4x4-partb8x8-an output.mp4

ffmpeg -y -i input -r 24000/1001 -b 6144k -bt 8192k -vcodec libx264 -pass 2 -flags +loop -me_method umh -g 250 -qcomp 0.6 -qmin 10 -qmax 51 -qdiff 4 -bf 16 -b_strategy 1 -i_qfactor 0.71 -cmp +chroma -subq 8 -me_range 16 -coder 1 -sc_threshold 40 -flags2 +bpyramid+wpred+mixed_refs+dct8x8+fastpskip -keyint_min 25 -refs 4 -trellis 1 -directpred 3 -partitions +parti8x8+parti4x4+partp8x8+partb8x8-acodec libfaac -ac 2 -ar 44100 -ab 128k output.mp4

iPod-iPhone 320 width, without presset

ffmpeg -i INPUT -s 320x240 -r 30000/1001 -b 200k -bt 240k -vcodec libx264 -coder 0 -bf 0 -flags2 -wpred-dct8x8 -level 13 -maxrate 768k -bufsize 3M-acodec libfaac -ac 2 -ar 48000 -ab 192k output.mp4

iPod-iPhone 640 width, without presset

ffmpeg -i INPUT -s 320x240 -r 30000/1001 -b 200k -bt 240k -vcodec libx264 coder 0 -bf 0 -refs 1 -flags2 -wpred-dct8x8 -level 30 -maxrate 10M -bufsize 10M-acodec libfaac -ac 2 -ar 48000 -ab 192k output.mp4

iPod-iPhone, 2 pass custom

ffmpeg -y -i input -r 30000/1001 -s 480x272 -aspect 480:272 -vcodec libx264 -b 512k -bt 1024k -maxrate 4M -flags +loop -cmp +chroma -me_range 16 -g 300 -keyint_min 25 -sc_threshold 40 -i_qfactor 0.71 -rc_eq "blurCplx^(1-qComp)" -qcomp 0.6 -qmin 10 -qmax 51 -qdiff 4 -coder 0 -refs 1 -bufsize 4M -level 21 -partitions parti4x4+partp8x8+partb8x8 -subq 5 -f mp4 -pass 1 -an -title "Title" output.mp4

ffmpeg -y -i input -r 30000/1001 -s 480x272 -aspect 480:272 -vcodec libx264 -b 512k -bt 1024k -maxrate 4M -flags +loop -cmp +chroma -me_range 16 -g 300 keyint_min 25 -sc_threshold 40 -i_qfactor 0.71 -rc_eq "blurCplx^(1-qComp)" -qcomp 0.6 -qmin 10 -qmax 51 -qdiff 4 -coder 0 -refs 1 -bufsize 4M -level 21 -partitions parti4x4+partp8x8+partb8x8 -subq 5 -f mp4 -pass 2 -acodec libfaac -ac 2 -ar 44100 -ab 128k -title "Title" output.mp4

DV Video

To DV

ffmpeg -i input -target ntsc-dv -aspect 4:3 -y output.dv

From DV To Microsoft AVI DV

ffmpeg -i input.dv -vcodec copy -vtag dvsd -acodec pcm_s16le -f avi -aspect 4:3 -y output.avi

Audio

AAC Stereo HQ

-acodec libfaac -ac 2 -ar 48000 -ab 192k

AAC Stereo SQ

-acodec libfaac -ac 2 -ar 44100 -ab 128k

AAC 5.1 HQ

-acodec libfaac -ac 6 -ar 48000 -ab 448k

AAC 5.1 LQ

-acodec libfaac -ac 6 -ar 44100 -ab 224k

AAC to AC3 (Recomended use AviSynth for channel mapping)

ffmpeg -i intput.aac -vn -acodec ac3 -ac 6 -ar 48000 -ab 448k

AC3 to M4V (Mux to be opened and edited in other appz)

ffmpeg -i input.ac3 -vn -acodec copy output.m4v

AC3 to AAC (not working as expected)

ffmpeg -i input.ac3 -vn -r 30000/1001 -acodec libfaac -ac 6 -ar 48000 -ab 448k output.aac

Eac3To

AC3 5.1 Channel Mapping Fix

eac3to true_hd.ac3 fixed_true_hd.ac3 -blu-ray -448

AAC to AC3

  1. Open AAC on Audacity or SoundBooth
  2. Export to Wav
  3. Remux from Wav to Wav with FFmpeg:ffmpeg -i audio.wav â€"vn -acodec copy audio-out.wav
  4. Convert to AC3 with EAC3toeac3to.exe audio.wav Main.ac3 -448

Other FFmpeg Options

-threads thread count
-y overwrite output files
-ss time_off set the start time offset
-t duration record or transcode "duration" seconds of audio/video
-ildct Interlaced
Share
6Aug/110

素女经

《素女经》可谓是中国古代流传最广的房事养生专著了。是最为经典的房事养生巨著,在现代医学研究中有着重要的作用。
《素女经》强调, 房事和人的身体强弱是相互影响的, “凡人之所以衰微者, 皆伤于阴阳交接之道尔”。提出了初步的优生道理, 强调“爱乐”是两房事合的目的, 也是为要生育“贤良而长寿”的子女。首先提出“九殃”, 即在九种情况下不宜房事, 同时也提出了如何易于怀孕。,

全书共30个篇章,从不同的角度阐述了房事技巧与禁忌。

素女经(中国古代房事养生宝典) (AppStore Link) 素女经(中国古代房事养生宝典)
Developer: Aihua Sun
Rated: 17+
Price: $9.99 Download
Share
5Aug/110

QMessenger

QMessenger is a powerful group SMS text message and group email sender.
QMessenger provide the simple and clear contacts management.

Highlight

*Send group SMS with English and Chinese template
*Send group Email with English and Chinese template
*Select multi phone or email in a contact
*Add new contact
*Browse and edit contact
*WYSIWYG contacts management
*Simple and easy searching function
*Provide phone to name search
*Show contacts' name, phone number, email in one row

QMessenger (AppStore Link) QMessenger
Developer: Aihua Sun
Rated: 4+
Price: $2.99 Download

 

Share
15Jul/110

偷拍利器

超级特工是一款隐蔽拍摄的工具。偷拍利器, 请勿用于非法用途。
用于新闻记者,公安取证等领域,具有优秀的拍摄性能,隐蔽性高。从此拍摄不必在担心被周围的人发现。 

亮点

*可同时拍照和录像(录像时可以同时拍照)
*支持前后摄像头,箭头指向左边,启用的是前摄像头,箭头指向右边,启用的是后摄像头;
*旋转的水晶,表示正在录像,水晶顺时针旋转,表示用后摄像头录像,水晶逆时针旋转,表示前摄像头在工作
*拍摄的图像和视频保存在相册中,方便管理;
*支持拍摄预览,按钮在右上角;

Share