Share my knowledge, feel my life. Eric Shan' Blog myBloggie 2.1.6 © 2005   
Mar 2025 April 2025 May 2025
S M T W T F S
    1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30    
Categories
About[5]
Blackberry[1]
dotNet and C Charp[1]
IPhone[10]
Life[4]
Unix&Linux[19]
WEB programming[16]
Windows API[5]
Windows Mobile[1]
Windows Multimedia[4]
Recent
CentOS mount CDrom and USB
CentOS GHOST(幽灵)漏洞修复方法
centos 改变语言并立即生效
centos vpn 接通后无法连接internet
让vlc播放中文字幕不出乱码
centos 取消屏保
php中ob_flush和flush的用法
CentOS检查,添加,删除自启动服务
CentOS中开机自动启动某个服务
Top命令中的翻页
Archives
February 2010[4]
September 2009[1]
August 2009[1]
January 2009[7]
October 2008[10]
June 2008[2]
December 2007[14]
November 2007[5]
May 2007[9]
April 2007[3]
March 2007[10]
User List
Eric Shan[66]
Search
Syndication
04 May 2008   01:20:25 pm
VC6 Include path and lib path adjust for compile and linking
I met some error like "incorrect <rpcndr.h> version. Use the header that matches with the MIDL compiler", to resolve it, change the include path like below, then download the latest rpcndr.h from http://www.cs.bgu.ac.il/~pcprogs/install/Microsoft_SDK/Include/

WMFSDK
DSHOW
DSHOW/Baseclasses

Link path should be:

WMFSDKLIB
DSHOWLIB
Category : Windows Multimedia | By : Eric Shan | Comments [0] | Trackbacks [0]
25 Dec 2007   01:04:05 pm
Windows下IPhone Toolchain,及Hello.app的完成
根据http://iphone.fiveforty.net/wiki/index.php/Toolchain_installation_-_Windows,看似简单其实花了整个星期才完成.

1.安装cygwin, http://www.cygwin.com 没有什么困难,选项都选到即可.
2.IPhone文件,下载dmg,再用http://iphone.fiveforty.net/wiki/index.php/Talk:Decrypt_Firmware下载解密工具,解完密用TransMac把整个文件系统解出来. TransMac在XP下运行的很好.
3.下载XCode,可以到Emule去下.
4.在Cygwin下svn, svn co http://llvm.org/svn/llvm-project/llvm/trunk 和 svn checkout http://iphone-dev.googlecode.com/svn/trunk/ iphone-dev ,这两个可花了很长时间,遇到多次错误说:

REPORT request failed on '/svn/!svn/vcc/default'
REPORT of '/svn/!svn/vcc/default': 200 OK (http://iphone-dev.googlecode.com)

只要再次运行svn checkout http://iphone-dev.googlecode.com/svn/trunk/ iphone-dev即可在中断后继续

6.7.8.9遇到过的问题很多,每次google后总能找到solution,遇到过的有:
http://code.google.com/p/iphone-dev/issues/detail?id=98
http://code.google.com/p/iphone-dev/issues/detail?id=99
http://code.google.com/p/iphone-dev/issues/detail?id=101

对于symbol link,要用实际的dylib替换才能使链接成功,例如libc.dylib,照教程的说法只要$ ln -s libSystem.B.dylib libc.dylib 即可,实际不行,必须用libSystem.B.dylib完整替换掉libc.dylib,而不是建个link即可.

IPhone ToolChain的完成以最终生成/usr/local/bin/arm-apple-darwin-gcc.exe为完成.

接着build Hello.app,源代码http://iphone.fiveforty.net/wiki/index.php/UIKit_Hello_World
在/home下建个目录Hello,建源代码文件.对于makefile,仔细研究一下makefile的语法,参考一下http://book.csdn.net/bookfiles/132/ 如果直接从网站paste到txt的话注意一下用TAB替换那些开始的空格,TAB在makefile里代表命令行的开始.

最终生成hello.o, helloapplication.o, link成Hello.

把info.plist和Hello放入新建的Hellp.app目录, winscp上传至IPhone的/Application,改Hello成755权限,马上可以看到有一个没有背景图标的Hello.重起Iphone,lauch Hello可以看到自己的成果了.

所有源代码,object file and makefile及最后link出的Hello application都打包在http://blog.tntsoft.com/download/Hello.zip


Category : IPhone | By : Eric Shan | Comments [0] | Trackbacks [0]
22 Dec 2007   09:48:25 am
Linux/Unix Command quick reference
http://sunsite.utk.edu/UNIX-help/quickref.html

Unix Help
UNIX Quick Reference Sheet
This a summary of some common Unix commands. Some of these commands may not be on your Unix Systems and some commands may not work exactly as show. - The Management



1 Log In Session

1.1 Log In
Enter username at login: prompt. Be carefull - Unix is case sensitive.
Enter password at password: prompt.


1.2 Change Password
passwd


1.3 Log Out
logout or exit


2 File System

2.1 Create a File

cat > file Enter text and end with ctrl-D
vi file Edit file using the vi editor

2.2 Make a Directory

mkdir directory-name
2.3 Display File Contents

cat file display contents of file
more file display contents of file one screenfull at a time.
view file a read only version of vi.
less file similar to, but more powerfull than more.
See the man page for more infomation on less.

2.4 Comparing Files

diff file1 file2 line by comparison
cmp file1 file2 byte by byte comparison

2.5 Changing Access Modes

chmod mode file1 file2 ...
chmod -R mode dir (changes all files in dir )


Mode Settings

u user (owner)
g group
o other

+ add permission
- remove permission

r read
w write
x execute


Example: chmod go+rwx public.html adds read, write, and execute permissions for group and other on public.html.


2.6 List Files and Directories

ls list contents of directory
ls -a include files with "." (dot files)
ls -l list contents in long format (show modes)

2.7 Move (or Rename) Files and Directories

mv src-file dest-file rename src-file to dest-file
mv src-file dest-dir move a file into a directory
mv src-dir dest-dir rename src-dir, or move to dest-dir
mv -i src dest copy & prompt before overwriting

2.8 Copy Files

cp src-file dest-file copy src-file to dest-file
cp src-file dest-dir copy a file into a directory
cp -R src-dir dest-dir copy one directory into another
cp -i src dest copy & prompt before overwriting

2.9 Remove File

rm file remove (delete) a file
rmdir dir remove an empty directory
rm -r dir remove a directory and its contents
rm -i file remove file, but prompt before deleting


2.10 Compressing files

compress file encode file, replacing it with file.Z
zcat file.Z display compressed file
uncompress file.Z decode file.Z, replacing it with file


2.11 Find Name of Current Directory

pwd display absolute path of working directory


2.12 Pathnames

simple:
One filename or directory name for accessing local file or directory.
Example: foo.c

absolute:
List of directory names from root directory to desired file or directory name, each separated by /.
Example: /src/shared

relative:
List of directory names from working directory to desired file or directory name, each separated by /.
Example: Mail/inbox/23

2.13 Directory Abbreviations

~ Your home (login) directory
~username Another user's home directory
. Working (current) directory
.. Parent of working directory
../.. Parent of parent directory

2.14 Change Working Directory

cd / go to the root directory
cd go to your login (home) directory
cd ~username go to username's login (home) directory
not allowed in the Bourne shell
cd ~username/directory go to username's indicated directory
cd .. go up one directory level from here
cd ../.. go up two directory levels from here
cd /full/path/name/from/root change directory to absolute path named
note the leading slash
cd path/from/current/directory change directory to path relative to here.
note there is no leading slash

3.0 Commands

3.1 Date

date display date and time

3.2 Wild Cards

? single character wild card
* Arbitrary number of characters

3.3 Printing

lpr file print file on default printer
lpr -Pprinter file print file on printer
lpr -c# file print # copies of file
lpr -d file interpret file as a dvi file
lpq show print queue (-Pprinter also valid)
lprm -# remove print request # (listed with lpq)

3.4 Redirection

command > file direct output of command to file instead of
to standard output (screen), replacing current
contents of file
command > > file as above, except output is appended to the current
contents of file
command < file command receives input from file instead of
from standard input (keyboard)
cmd1 | cmd2 "pipe" output of cmd1 to input of cmd2
script file log everything displayed on the terminal to file;
end with exit

4 Search Files

grep string filelist show lines containing string in any file
in filelist
grep -v string filelist show lines not containing string
grep -i string filelist show lines containing string, ignore case

5 Information on Users

finger user or
finger user@machine get information on a user
finger @machine list users on machine
who list current users

6 Timesavers

6.1 Aliases

alias string command abbreviate command to string

6.2 History: Command Repetition
Commands may be recalled

history show command history
!num repeat command with history number num
!str repeat last command beginning with string str
!! repeat entire last command line
!$ repeat last word of last command line

7.0 Process and Job Control

7.1 Important Terms

pid Process IDentification number. See section 7.2.
job-id Job identification number. See section 7.2.


7.2 Display Process and/or Job IDs
ps report processes and pid numbers
ps gx as above, but include "hidden" processes
jobs report current jobs and job id numbers

7.3 Stop (Suspend) a Job

ctrl-Z NOTErocess still exists!

7.4 Run a Job in the Background

To start a job in background add & to the end of the command.
Example: xv foo.gif &

To force a running job into the background:
ctrl-Z stop the job
bg "push" the job into the background


7.5 Bring a Job to the Foreground

fg bring a job to foreground
fg %job-id foreground by job-id (see 7.2)


7.6 Kill a Process or Job

ctrl-C kill foreground process
kill -KILL pid# see 7.2 for
kill -KILL %job-id# displaying pids & job-ids


8.0 Mail Handler (MH)
MH commands are issued directly to the terminal.


inc incorporate new mail
scan show list of mail messages
show show current message
next show next message
prev show previous message
repl reply to current message
forw forward current message
comp compose a mail message
rmm remove current mail message
cmd -help print help on mh commmand cmd


The file .mh_profile is used to enable/disable MH features. man mh-profile for more information.

9.0 On-line Assistance
On-line Documentation

man command-name display on-line manual pages
man -k string list one-line summaries of manual pages containing string

--------------------------------------------------------------------------------
Category : Unix&Linux | By : Eric Shan | Comments [0] | Trackbacks [0]
20 Dec 2007   02:05:47 pm
一篇关于在unix linux下用点和反斜杠(./)执行命令的解释
http://www.linfo.org/dot_slash.html

About the Use of Dot-Slash in Commands

The combination of a dot followed directly by a forward slash (./) is often used to precede commands in Linux and other Unix-like operating systems. Although this requirement can seem confusing and even tedious to new users, it exists for good reason and can be useful to understand.

Commands in Unix-like operating systems are either built-ins or executables. The former (e.g., alias, cd, echo, kill, ls and pwd) are part of the shell that is currently running, and thus the shell can always locate them. In contrast, the shell needs help in finding the latter, which can be divided into compiled programs and shell scripts. A compiled program is a program whose source code (i.e., its original, human-readable form) has been converted through the use of a compiler into an executable file (i.e., a ready-to-run form).

A shell is a program that provides the traditional, text-only user interface for Unix-like operating systems. Its primary function is to read commands that are typed in at the command line (i.e., in a text-only mode) and then execute (i.e., run) them. A shell script is a short program that is written in a shell programming language and interpreted (i.e., converted into runnable form) by a shell process.

When some text is typed into a shell and then the ENTER key is pressed, the shell assumes that it is a command. The shell immediately checks to see if the first string (i.e., sequence of characters) in that text is a built-in command or the absolute path (i.e., location relative to the root directory) to an executable.

If it is neither of these, the shell will search the directories listed in that users' PATH environmental variable for a file with that name. PATH (all upper case letters) tells the shell which directories to search for commands in response to commands issued by the user.

If the command is found, it will be executed, assuming that there are no other problems. If it is not found, an error message, such as command not found, will be returned.

Most users work most of the time in their home directory and subdirectories thereof because of convenience and for safety reasons. However, by default such directories are not included in the user's PATH variable. Thus when the user creates a script or compiles a program in one of those directories and attempts to run it by merely typing in its name, an error message will be returned.

However, this problem can be easily overcome by typing a dot and slash in front of the command name. This is merely an abbreviated way to inform the shell that the absolute path of that file is the current directory (i.e., the directory in which the user is currently working). In Unix-like operating systems, a single dot is used to represent the current directory in a path (i.e., the location of a file or directory in the filesystem), including those used in commands. Likewise, forward slashes are used to separate directories and files in paths.

Files in the current directory can be accessed for reading and writing by merely entering the command name (e.g., cat or vi) followed by the name of the file. That is, no absolute path is necessary. However, when execution is desired, either an absolute path (or its dot slash equivalent) or the inclusion of the directory containing the command's executable file in the PATH variable is necessary. This is a built-in safety mechanism.

A user could eliminate the need to precede commands by a dot slash by appending a single dot to the PATH variable, because this would tell the shell to also search the current directory. However, this is generally not advisable on safety and security grounds. For example, were the user to inadvertently create a shell script with the same name as a standard command, the shell could execute the former instead of the latter, thereby causing the system to malfunction, or worse.1

A better alternative if one wants to eliminate the need to precede commands by a dot slash is to create a special directory for the executable files of such commands, and then add this directory to the PATH variable. For example, a user named bob could create a directory named bin in his home directory (i.e., /home/bob/bin/) for this purpose.

Another approach for making it easy to run a program that is installed in a non-standard directory is to create a symbolic link to it (using the ln command with its -s option), and then put the link in a directory that is already in the PATH variable. This can be a safer alternative to adding more directories to PATH.

The dot slash should not be confused with Slashdot, which is the name of a popular web site about computer technology.



________
1An extreme example would be the situation in which an ordinary user created a shell script such as rm -r /, which would delete all files and directories in the system for which the user had writing permission, and named this script ls. Were the system administrator to navigate to the directory in which this script was located and attempt to run the standard ls command in order to view the contents of that directory, the shell would instead run the script with the same name and thereby remove the contents of all currently mounted partitions on the computer!
Category : IPhone | By : Eric Shan | Comments [0] | Trackbacks [0]
16 Dec 2007   12:44:18 pm
Console, tty and ps
The difference between console and tty in Unix could be dscribed at http://uwsg.iu.edu/UAU/navigate/tty.html, that is console is the monitor and the keyboard connect to the host with a device of normally /dev/console, while tty is the terminal, ssh or telnet client which map to /dev/ttyp0 , ttyp1, ttyp2. tty means Ternimal Type.

To know how many active tty are active, use ps -a. To send a message to other tty like ttyp3, you can

$ echo "you message" > ttyp3

Other command like write, talk, mesg, wall are using in other unix system.

ps -vx and ps -ux can display all the process currently running and it's status. To kill any process just kill [PID], so I guess it can kill tty user and kick them out from the system.

console和tty的区别可以参考http://uwsg.iu.edu/UAU/navigate/tty.html, console就是接在主机上的键盘与显示器对应于/dec/console,而tty可以是terminal,ssh或telnet的客户端,他们对应/dev/ttyp0,ttyp1,ttyp2等, tty代表Terminal Type.

想要知道当前有多少tty正在接入,用ps -a指令, 向另一个tty发消息可以

$ echo "you message" > ttyp3

其他指令有write, talk, mesg, wall .

ps -vxps -ux 可以显示当前所有process,杀进程就kill [进程号],所以要踢tty用户,可以考虑kill.
Category : IPhone | By : Eric Shan | Comments [0] | Trackbacks [0]
16 Dec 2007   08:56:40 am
Iphone, Unix Shell prompt changes. 修改Iphone的unix提示符
After install Unix shell on my Iphone of DropBear and BinKIt, I can now log into unix shell with MobileTerminal and Putty.

I need the prompt to show the current working path, I google and found bash should be able to define it under file of:

/etc/profile - generic system-wide profile
.bash_profile - personal profile that is processed every time you login
.bashrc - setup file processed every time you open a non-login shell

In the file I will to add a setence of

export PS1="w> "

So this will make my prompt shows currenty path and a '>', you can type command 'export' to see your current settings, command 'set' can see the current environment parameters.

In finally neither .bash_profile nor .bashrc can take effect and only create a new file of /etc/profile with a single sentence of export PS1="w> " make the job done.

在iphone下装完unix shell,DropBearBinKIt, 我要提示符自动显示当前目录,查了一下bash可以用三种文件完成,但是最后只有/etc/profile中加入export PS1="w> "起作用
Category : IPhone | By : Eric Shan | Comments [0] | Trackbacks [0]
28 Nov 2007   07:27:59 am
VC VS2005 Link出的EXE居然要额外的Dll支持,都是winsxs惹的祸
vc vs2005, LINK 了一个简单的dos console的exe, 在本机上运行没有问题,但在没有装VS2005的机器上报错: This application has failed to start because the application configuration is incorrect. Reinstalling the application may fix this problem

结果解决的办法是把VS2005下的两个文件考到和主程序同一目录下:

C:\Program FilesMicrosoft Visual Studio 8VCredistDebug_NonRedistx86Microsoft.VC80.DebugCRT

msvcr80d.dll
Microsoft.VC80.DebugCRT.manifest

至于winsxs, 可以参考:

http://davidlenihan.com/2007/07/winsxs.html
http://msdn2.microsoft.com/en-us/library/aa376307.aspx
http://msdn2.microsoft.com/EN-US/library/aa369532.aspx


English Version:

I linked a simple DOS(Console)exe, running in my PC is fine, but when copy to others PC, it reports error of:

This application has failed to start because the application configuration is incorrect. Reinstalling the application may fix this problem

The solution is copy two files from VS2005 to the same path of your exe:

C:\Program FilesMicrosoft Visual Studio 8VCredistDebug_NonRedistx86Microsoft.VC80.DebugCRT

msvcr80d.dll
Microsoft.VC80.DebugCRT.manifest

The winsxs is the reason of it, for detail see:

http://davidlenihan.com/2007/07/winsxs.html
http://msdn2.microsoft.com/en-us/library/aa376307.aspx
http://msdn2.microsoft.com/EN-US/library/aa369532.aspx
Category : Windows API | By : Eric Shan | Comments [0] | Trackbacks [0]
05 May 2007   02:10:10 pm
ListView排序新特性
在codeproject(http://www.codeproject.com/cpp/ListCtrlSort.asp)上看到这样一篇文章,大致是说在XP下,ListView的排序是:

sort1
sort2
sort10
sort20

而不再是

sort1
sort10
sort2
sort20

这很好啊,但是作者说不清楚如何可以在自己的app中达到这个效果.于是作者用LVM_SORTITEMSEX加上自己的sort function来达到这个效果. 这个sort function当然有点复杂.所以在评论中MVP建议使用StrCmpLogicalW来做sort的工作.这个StrCmpLogicalW是只在XP以上版本,而且只有Unicode.
Category : Windows API | By : Eric Shan | Comments [0] | Trackbacks [0]
29 Apr 2007   01:27:38 pm
Blackberry开发初探
下载Blackberry JDE 4.2.1安装,同时必须安装jdk-1_5_0_11-windows-i586-p.exe.

文档BlackBery_Java_Development_Environment_3.pdf是一个很不错的起步,告诉程序的入口及hello,
和windows一样,main最终也是要进入消息循环enterEventDispatcher才开始运做.

对于package文档写的不明白,说是要放在什么目录下,我就放在当前目录下,在workspace看来就
成为了根目录了.

build->link后生成.cod,一旦launch后就被彻底加入了simulator实在和Windows不同.

另外没有icon的app在blackberry里是一个Dos的图标,很请切.

从整个ide看来和VC6非常相似,只是找不到alt+f8,自动对齐.
Category : Blackberry | By : Eric Shan | Comments [0] | Trackbacks [0]
11 Apr 2007   06:04:31 am
How to tell a DVD video media - 怎样区分光碟是否是DVD
In my program, I need to tell if a disk is a video DVD or just a file DVD.

From DeviceIoControl plus IOCTL_STORAGE_GET_MEDIA_TYPES_EX we can tell the driver is a CD-ROM or DVD-ROM. Surely CD-ROM can not read DVD disk. So CD-ROM driver is filtered.

But DVD-ROM can also read CD media. Use GetVolumeInformation we can tell if a media is a CDFS disk. So CD in a DVD-ROM is filtered.

Now I found both DVD video and DVD file are UDF. I remember when Autoplay of Windows could precisely tell between DVD and file DVD. So I google autoplay, and get this http://msdn.microsoft.com/msdnmag/issues/01/11/autoplay/ . It mentioned: The primary difference in the handling of CDs and DVD movies is the way Autoplay identifies the media type. Autoplay checks for the presence of the video_ts.ifo file inside the video_ts folder located in the media's root folder. So that my way.

我需要分辨出DVD影视盘.用DeviceIoControl和 IOCTL_STORAGE_GET_MEDIA_TYPES_EX 可以过滤掉CD-ROM驱动器,但是DVD驱动器也可以读CD,所以用GetVolumeInformation可以知道碟是否CDFS,从而过滤掉CD碟片.这样我发现DVD影视盘和DVD文件盘都可以是UDF.我琢磨了一下,想到系统的自动播放是怎么写的,google了一下得出:http://msdn.microsoft.com/msdnmag/issues/01/11/autoplay/ 这里提到Autoplay先分辨Media Type,然后查在根目录下是否有video_ts目录,video_ts目录下是否有video_ts.ifo.看来就是这样了.
Category : Windows Multimedia | By : Eric Shan | Comments [0] | Trackbacks [0]
 
Prev 1 2 3 ...5 6 7 Next
Template theme : aura
Powered by myBloggie Copyright © 2004 2006
-- myWebland --

Sponsed by TNTSoft Store