2009年4月22日 星期三

Microsoft Visual Studio 2008 Tips

* How to add command parameter in the Microsoft Visual Studio while compiling the code and debug.
Select Project > Project-Name-Property (Alt-F7) > Configuration Property > Debug > Command-Parameter
Input the command parameter here and it will redirect to the execution file while debugging
e.g -a 123

* How to set the definition in the preprocessor
Select Project > Project-Name-Property (Alt-F7) > Configuration Property > C/C++ > Preprocessor > Preprocessor definition
Set the definition here
WIN32;DEBUGMODE

* How to run and debuging test in the MVS
Debug F5
Run without debugging Ctrl + F5

Updated 2009/06/04
* What is the system architecture in the Microsoft Visual Studio?
A. .sln ==> Solution file
.vcproject ==> VC project file
a VC solution consists multiple VC projects

How to distinguish a Win32 AP or other form (e.g. static library or dll ..) in the MVS
A. In the Project Property page
The Default values of project
Configuration type: Application(.exe), static library
The usuage of MFC: Use the standard windows library
ATL usuage: No use ATL
Word Set: Use MultiByte Sets, Use UnicCode Sets

What is the execution file output foler path?
Win32 Application (.exe): Project Property page -> Configuration Property -> Linker -> Command line
Static library: Project Property page -> Configuration Property -> Manager -> Command line
The general settings can be found in the Linker/Manager=>General=>Output Directory

How to link the static library while tring to build a Win32 Application (.exe)?
A.
1. Set the include directory to include the header files of the static library prototype
Project Property page -> Configuration Property -> C/C++ -> other include directory -> set the header file path (Note: the path is dependency to the vc project file)
2. Set the library path and name
Project Property page -> Configuration Property -> Linker -> Input -> Other dependency -> set the library file path (Note: the library path is dependency to the vc project file)

2009年4月9日 星期四

Linux Service - NFS

Server side:
Edit the config file
/etc/exports
/usr/local/src/folder *(ro,insecure)

We can use exportfs to display the current exported file folder
# exportfs -rv

Client side
# mount -t nfs IP-Address:exported-folder mount-folder
e.g.
# mount -t nfs 172.17.11.100:/usr/local/src/folder /mnt/nfs

2009年4月6日 星期一

network interface configuration

FreeBSD (1 public NIC 1 private NIC example)
/etc/rc.conf
ifconfig_le0="inet X.X.X.X netmask 255.255.255.192"
ifconfig_le1="inet 192.168.102.254 netmask 255.255.255.0"
defaultrouter="Y.Y.Y.Y"

Ubuntu Linux (1 public NIC, 2 private NICs)
/etc/network/interfaces
auto eth2
iface eth2 inet static
address X.X.X.X
netmask 255.255.255.224
gateway X'.X'.X'.X'

auto eth3
iface eth3 inet static
address 192.168.102.254
netmask 255.255.255.0

auto eth4
iface eth4 inet static
address 172.17.11.251
netmask 255.255.0.0

How to restart the Ubuntu Linux network interface setting
# /etc/init.d/networking restart
# sudo ifconfig down; sudo ifconfig up

2009年4月5日 星期日

How to view the ipf rules status?

Refer from http://www.freebsd.org/doc/en/books/handbook/firewalls-ipf.html

When supplied with either -i for inbound or -o for outbound, it will retrieve and display the appropriate list of filter rules currently installed and in use by the kernel.

ipfstat -in displays the inbound internal rules table with rule number.

ipfstat -on displays the outbound internal rules table with the rule number.

The output will look something like this:

@1 pass out on xl0 from any to any
@2 block out on dc0 from any to any
@3 pass out quick on dc0 proto tcp/udp from any to any keep state

How to view the ipf rules status?

Refer from http://www.freebsd.org/doc/en/books/handbook/firewalls-ipf.html

When supplied with either -i for inbound or -o for outbound, it will retrieve and display the appropriate list of filter rules currently installed and in use by the kernel.

ipfstat -in displays the inbound internal rules table with rule number.

ipfstat -on displays the outbound internal rules table with the rule number.

The output will look something like this:

@1 pass out on xl0 from any to any
@2 block out on dc0 from any to any
@3 pass out quick on dc0 proto tcp/udp from any to any keep state

How to cancel the denied IPs which was blocked by the denyhost

delete the IP address entries which was record in the denyhost blocking list
(e.g. /usr/share/denyhosts/data/hosts-restricted)