http://www.impressivewebs.com/inline-block/
http://robertnyman.com/2010/02/24/css-display-inline-block-why-it-rocks-and-why-it-sucks/
http://www.quirksmode.org/css/display.html
http://www.w3schools.com/cssref/pr_class_display.asp
Thursday, December 8, 2011
Tuesday, September 20, 2011
How To boot into text mode in linux fedora
Power on computer when bios info shows up on the screen press F2 or F3, the GRUB boot screen appears.
Select the Fedora that you want to boot into, Press the a key boot kernel argument will show up. in the end of the argument string add '3'
Original argument
after modified in the end of arguments add a 3
the number 3 will cause fedora boot into text mode.
Select the Fedora that you want to boot into, Press the a key boot kernel argument will show up. in the end of the argument string add '3'
Original argument
kernel /vmlinuz-2.6.40.4-5.fc15.x86_64 root=LABEL=/ acpi=on rhgb quiet
after modified in the end of arguments add a 3
kernel /vmlinuz-2.6.40.4-5.fc15.x86_64 root=LABEL=/ acpi=on rhgb quiet 3
and press enter to be continuethe number 3 will cause fedora boot into text mode.
Monday, September 19, 2011
Transaction Log issue for SQL Server
-- View Transaction log
DBCC Log(myDbName)
-- Change Recovery model to simple
ALTER DATABASE myDbName SET RECOVERY SIMPLE
-- enable auto shrink option
ALTER DATABASE myDbName SET AUTO_SHRINK ON
-- Shrink DB Log file
DBCC SHRINKFILE(myDbName_log, TRUNCATEONLY)
SELECT * FROM sys.database_files
DBCC Log(myDbName)
If the recovery model is set to SIMPLE the log data will be cleared automatically.
-- How to Change Recovery Model to simple
use myDbName-- Change Recovery model to simple
ALTER DATABASE myDbName SET RECOVERY SIMPLE
-- enable auto shrink option
ALTER DATABASE myDbName SET AUTO_SHRINK ON
-- Shrink DB Log file
DBCC SHRINKFILE(myDbName_log, TRUNCATEONLY)
-- This command help you to find out what is database log file name
USE myDbNameSELECT * FROM sys.database_files
Thursday, September 15, 2011
the Linux rights of files and directory
1. the "file1" can be a file or directory
|---- owner
||----- group
|||------- other users
chmod 467 file1
1 = Execute
2 = Write
4 = Read
3 = 2+1 can Write, Execute
5 = 4+1 can Read, Execute
6 = 4+2 can Read, Write
7 = 4+2+1 can Read, Write, Execute
6 = 4+2 can Read, Write
7 = 4+2+1 can Read, Write, Execute
Basic vi Commands
Copy line yy
Copy next n line Nyy (N is number of lines to be copy)
Past line p
Insert before cursor i
Insert current line I
Replace R
Delete [Delete]
Delete Line dd
Undo u
Page Up [Ctrl] + b
Page Down [Ctrl] + f
To Begin of file :0 or 1G
To End of file :$ or G
Move To n line :nG (n is number of line)
Move beginning of line 0
Move end of line $
Search forward string /string
Search backward string ?string
to next match string n
to prev match string N
Save :w
Save and Exit :x or :wq
Exit :q
Exit without save :q!
Copy next n line Nyy (N is number of lines to be copy)
Past line p
Insert before cursor i
Insert current line I
Replace R
Delete [Delete]
Delete Line dd
Undo u
Page Up [Ctrl] + b
Page Down [Ctrl] + f
To Begin of file :0 or 1G
To End of file :$ or G
Move To n line :nG (n is number of line)
Move beginning of line 0
Move end of line $
Search forward string /string
Search backward string ?string
to next match string n
to prev match string N
Save :w
Save and Exit :x or :wq
Exit :q
Exit without save :q!
How to install Samba CentOS
Install samba
# yum install samba
Configure samba
# vi /etc/samba/smb.conf
[global]
workgroup = Linux
netbios name = CentOS_Srv
;name resolve order = bcast host lmhosts wins
server string = CentOS Samba v.%v
security = user
passdb backend = tdbsam
[www]
comment = Public WWW
path = /var/www
create mask = 0660
directory mask = 0771
writable = yes
valid users = user1 user2
Add User for samba
# useradd user1 -d /mnt/data/home/user1
# chown user1:user1 /mnt/data/home/user1
# passwd user1
# Enter your password
# smbpasswd -a user1
# /etc/init.d/smb restart
Configure Firewall for samba
Change IPTables
# vi /etc/sysconfig/iptables
#Includes the following before the REJECT line:
-A INPUT -p udp -m udp --dport 137 -j ACCEPT
-A INPUT -p udp -m udp --dport 138 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 139 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 445 -j ACCEPT
# service iptables restart
Run samba when OS starting
# chkconfig --levels 235 smb on
Client test
net use Z: \\192.168.6.2\www /user:user1
http://wiki.centos.org/HowTos/SetUpSamba
# yum install samba
Configure samba
# vi /etc/samba/smb.conf
[global]
workgroup = Linux
netbios name = CentOS_Srv
;name resolve order = bcast host lmhosts wins
server string = CentOS Samba v.%v
security = user
passdb backend = tdbsam
[www]
comment = Public WWW
path = /var/www
create mask = 0660
directory mask = 0771
writable = yes
valid users = user1 user2
Add User for samba
# useradd user1 -d /mnt/data/home/user1
# chown user1:user1 /mnt/data/home/user1
# passwd user1
# Enter your password
# smbpasswd -a user1
# /etc/init.d/smb restart
Configure Firewall for samba
Change IPTables
# vi /etc/sysconfig/iptables
#Includes the following before the REJECT line:
-A INPUT -p udp -m udp --dport 137 -j ACCEPT
-A INPUT -p udp -m udp --dport 138 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 139 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 445 -j ACCEPT
# service iptables restart
Run samba when OS starting
# chkconfig --levels 235 smb on
Client test
net use Z: \\192.168.6.2\www /user:user1
http://wiki.centos.org/HowTos/SetUpSamba
Wednesday, September 14, 2011
Config Network Adapter for CentOS Linux
vi /etc/sysconfig/network-scripts/ifcfg-eth0
#####################################
# for static ip
#DEVICE="eth0"
#BOOTPROTO="static"
#HWADDR="00:30:48:56:A6:2E"
#IPADDR="10.1.1.5"
#NETMASK="255.255.255.192"
#ONBOOT="yes"
#####################################
# for dhcp ip
DEVICE="eth0"
BOOTPROTO="dhcp"
ONBOOT="yes"
vi /etc/sysconfig/network
NETWORKING=yes
# for static ip
#HOSTNAME=host1.mysite.com
#GATEWAY=10.1.1.1
ifdown eth0
ifup eth0
or /etc/init.d/network restart
Monday, September 5, 2011
Using comparison operators in a unsafe way
// Using operators in a unsafe way
// declare a variable to null
string s = null;
// in this example below will be fine because the right side won't be invoke when left side is true.
if(s == null || s.Length == 0)
// for 'and' operator comparison
// if left side get true the right side will invoke
// if left side get false the right side will never invoke
// this example below will be throw a exception while right side is execute.
if(s == null && s.Length == 0)
// declare functions
func1(param){return param;}
func2(param){return param;}
// which function being call
if(func1(true) && func2(true)) func1 func2
if(func1(false) && func2(true)) func1
if(func1(true) || func2(true)) func1
if(func1(false) || func2(true)) func1 func2
// the concept above can also apply to C/C++, java and javascript ....
// declare a variable to null
string s = null;
// for the 'or' operator comparison
// if left side get true the right side will never be invoke
// if left side get false, the right side will come.// if left side get true the right side will never be invoke
// in this example below will be fine because the right side won't be invoke when left side is true.
if(s == null || s.Length == 0)
// for 'and' operator comparison
// if left side get true the right side will invoke
// if left side get false the right side will never invoke
// this example below will be throw a exception while right side is execute.
if(s == null && s.Length == 0)
// declare functions
func1(param){return param;}
func2(param){return param;}
// which function being call
if(func1(true) && func2(true)) func1 func2
if(func1(false) && func2(true)) func1
if(func1(true) || func2(true)) func1
if(func1(false) || func2(true)) func1 func2
// the concept above can also apply to C/C++, java and javascript ....
Thursday, September 1, 2011
Change IP Address Using Netsh.exe Command
Netsh command
Applies To: Windows Server 2003, Windows Server 2003 R2, Windows Server 2003 with SP1, Windows Server 2003 with SP2
to change DNS
netsh int ip set dns "Local Area Connection" static 192.168.0.254 primary
The "Local Area Connection" is your Adapter name, It could also be "local area connection 2" or "wireless network connection"...
Syntax
netsh int ipv4 set address [name=]InterfaceName [source=]{dhcp | static [addr=]IPAddress[mask=]SubnetMask [gateway=]{none | DefaultGateway [[gwmetric=]GatewayMetric]}}
MSDN Document
Applies To: Windows Server 2003, Windows Server 2003 R2, Windows Server 2003 with SP1, Windows Server 2003 with SP2
to change the ipv4 address, subnet mask and getway
netsh int ipv4 set address "Local Area Connection" static 192.168.0.2 255.255.255.0 192.168.0.254 1netsh int ip set dns "Local Area Connection" static 192.168.0.254 primary
The "Local Area Connection" is your Adapter name, It could also be "local area connection 2" or "wireless network connection"...
Syntax
netsh int ipv4 set address [name=]InterfaceName [source=]{dhcp | static [addr=]IPAddress[mask=]SubnetMask [gateway=]{none | DefaultGateway [[gwmetric=]GatewayMetric]}}
MSDN Document
Tuesday, August 2, 2011
javascript undefined
var a;
var b = null;
var c = "";
// d is not declare
// var a;
typeof(a) return undefined
a == undefined return true
a === undefined return true
// var b = null;
typeof(b) return object
b == undefined return true
b === undefined return false
// var c = "";
typeof(c) return string
c == undefined return false
c === undefined return false
// d is no declare
typeof(d) return undefined
d == undefined throw exception
d === undefined throw exception
var b = null;
var c = "";
// d is not declare
// var a;
typeof(a) return undefined
a == undefined return true
a === undefined return true
// var b = null;
typeof(b) return object
b == undefined return true
b === undefined return false
// var c = "";
typeof(c) return string
c == undefined return false
c === undefined return false
// d is no declare
typeof(d) return undefined
d == undefined throw exception
d === undefined throw exception
Saturday, July 30, 2011
jQuery Examples
// ajax callback functions
success(data, textStatus, jqXHR)
A function to be called if the request succeeds.
error(jqXHR, textStatus, errorThrown)
A function to be called if the request fails.
complete(jqXHR, textStatus)
A function to be called when the request finishes
(after success and error callbacks are executed).
success(data, textStatus, jqXHR)
A function to be called if the request succeeds.
error(jqXHR, textStatus, errorThrown)
A function to be called if the request fails.
complete(jqXHR, textStatus)
A function to be called when the request finishes
(after success and error callbacks are executed).
Sunday, July 10, 2011
How to sned mail using gmail SMTP in c#
string subject = "gmail test ";
string message = "<h3>test sending gmail message content in HTML body</h3>";
MailMessage mailMsg = new MailMessage();
mailMsg.From = new System.Net.Mail.MailAddress("sender@gmail.com", "display name", System.Text.Encoding.UTF8);
mailMsg.To.Add(new MailAddress("reciver@gmail.com"));
mailMsg.SubjectEncoding = System.Text.Encoding.UTF8;
mailMsg.BodyEncoding = Encoding.UTF8;
//
mailMsg.Subject = subject;
mailMsg.Body = message;
mailMsg.IsBodyHtml = true;
System.Net.Mail.SmtpClient client = new System.Net.Mail.SmtpClient();
// user name and password to SMTP
client.Credentials = new System.Net.NetworkCredential("sender", "1234");
//gmail smtp port: 587
client.Port = 587;
client.Host = "smtp.gmail.com";
// gmail required SSL
client.EnableSsl = true;
client.Send(mailMsg);
string message = "<h3>test sending gmail message content in HTML body</h3>";
MailMessage mailMsg = new MailMessage();
mailMsg.From = new System.Net.Mail.MailAddress("sender@gmail.com", "display name", System.Text.Encoding.UTF8);
mailMsg.To.Add(new MailAddress("reciver@gmail.com"));
mailMsg.SubjectEncoding = System.Text.Encoding.UTF8;
mailMsg.BodyEncoding = Encoding.UTF8;
//
mailMsg.Subject = subject;
mailMsg.Body = message;
mailMsg.IsBodyHtml = true;
System.Net.Mail.SmtpClient client = new System.Net.Mail.SmtpClient();
// user name and password to SMTP
client.Credentials = new System.Net.NetworkCredential("sender", "1234");
//gmail smtp port: 587
client.Port = 587;
client.Host = "smtp.gmail.com";
// gmail required SSL
client.EnableSsl = true;
client.Send(mailMsg);
Tuesday, May 10, 2011
Subscribe to:
Posts (Atom)