公司的电脑有时候访问论坛(特别是discuz 7)的时候会发生误认为页面是文件的情况出现,估计是ie判断页面content type的东东有问题,不知道在哪里改,今天看到一个帖子,先记录一下,看看回去之后有没有效果
这种情况是因为某种原因造成系统XML模块错误,可尝试以下解决方法。
退出所有浏览器,重注册XML模块,在开始菜单运行中输入 regsvr32 msxml3.dll,回车
现在天天在上海加班,简直就是变态,没有周末,没有节假日,每天9点到22点,真tmd郁闷。啥时候是头啊这种日子。
May 09 2009
公司的电脑有时候访问论坛(特别是discuz 7)的时候会发生误认为页面是文件的情况出现,估计是ie判断页面content type的东东有问题,不知道在哪里改,今天看到一个帖子,先记录一下,看看回去之后有没有效果
这种情况是因为某种原因造成系统XML模块错误,可尝试以下解决方法。
退出所有浏览器,重注册XML模块,在开始菜单运行中输入 regsvr32 msxml3.dll,回车
现在天天在上海加班,简直就是变态,没有周末,没有节假日,每天9点到22点,真tmd郁闷。啥时候是头啊这种日子。
Apr 30 2009
route [-f] [-p] [Command [Destination] [mask Netmask] [Gateway] [metric Metric]] [if Interface]]
f 
清除所有不是主路由(网掩码为 255.255.255.255 的路由)、环回网络路由(目标为 127.0.0.0,网掩码为 255.255.255.0 的路由)或多播路由(目标为 224.0.0.0,网掩码为 240.0.0.0 的路由)的条目的路由表。如果它与命令之一(例如 add、change 或 delete)结合使用,表会在运行命令之前清除。 
-p 
与 add 命令共同使用时,指定路由被添加到注册表并在启动 TCP/IP 协议的时候初始化 IP 路由表。默认情况下,启动 TCP/IP 协议时不会保存添加的路由。与 print 命令一起使用时,则显示永久路由列表。所有其它的命令都忽略此参数。永久路由存储在注册表中的位置是
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\PersistentRoutes
今天设置了一条永久路由,记录一下是怎么改的以后改回来。。。
Apr 29 2009
在很久以前,曾经在ip tunnel上面实现过
https://ssmax.net/archives/86.html
但是当时openvpn怎么设置都不行,今天有一台内网的机器需要这么搞透明代理,ip tunnel不管用了,只能用vpn来搞了。
先设置好openvpn
A(内网):
tun0      Link encap:UNSPEC  HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 
          inet addr:10.8.0.6  P-t-P:10.8.0.5  Mask:255.255.255.255
          UP POINTOPOINT RUNNING NOARP MULTICAST  MTU:1500  Metric:1
          RX packets:183 errors:0 dropped:0 overruns:0 frame:0
          TX packets:134 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:100
          RX bytes:27301 (26.6 KiB)  TX bytes:53300 (52.0 KiB)
B(外网):
tun0      Link encap:UNSPEC  HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 
          inet addr:10.8.0.1  P-t-P:10.8.0.2  Mask:255.255.255.255
          UP POINTOPOINT RUNNING NOARP MULTICAST  MTU:1500  Metric:1
          RX packets:134 errors:0 dropped:0 overruns:0 frame:0
          TX packets:186 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:100
          RX bytes:53300 (52.0 KiB)  TX bytes:27457 (26.8 KiB)
现在需要实现的是所有发到B的外网ip,80端口的包,都转发到A的80端口:
B机器上面,开打ip转发:
B> echo 1 > /proc/sys/net/ipv4/ip_forward
增加DNAT的iptable:
B> iptables -t nat -A PREROUTING -i eth0 -p tcp -m tcp –dport 80 -j DNAT –to-destination 10.8.0.6
在A机器上面,增加一个路由表vpntun,先看看/etc/iproute2/rt_tables 里面有什么路由表,然后在决定TABLE_ID,取值是 0 – 255,但是 0,253,254,255 都是系统保留的,不能用:
A> echo “200 vpntun” > /etc/iproute2/rt_tables
然后增加vpntun的默认路由,这里也可以指定via,不指定的话ip route 会自动去找。
A> ip route add default dev tun0 table vpntun
(((
或者指定via:
ip route add default dev tun0 via 10.8.0.5 table vpntun
)))
最后把从本机outbound的包,也就是从 10.8.0.6 发出来的包,全部指定查找路由表vpntun
ip rule add from 10.8.0.6 table vpntun
这样子,从A的tun0出去的响应包,就会默认回到B的vpn上面,再回到请求的client机上面。
这样实现的代理,传过来的ip包就是原来客户端请求的ip包,服务器也能直接拿到客户端的ip,所以对服务器来说,是透明的代理,其实应该叫NAT更好了,说明白一点就是端口映射,嘿嘿。
Apr 17 2009
一日早朝,王安石出列:“臣有奏:OOXX(以下省略1万字)。”刚说完身后跪下一片叫到“臣沙发”“臣板凳”“臣地板”“臣顶”“臣也顶”……最后几人面带笑容不语,神宗见状怒击龙椅“不许纯表情回帖。”
Apr 11 2009
注意:改完后会打开某些应用程序会蓝屏,而且是确定的发生,不是偶然,应该是应用程序也用到内核里面这段函数来获取内存限制的,所以呢,估计还是有一点问题。。。
昨天装了vista,听别人说是可以支持4G内存的,但是我自己怎么都弄不出来,PAE在开了DEP数据保护模式之下是默认开了的,也能认得出4G内存,但是能用的只有3.5G,最后网上找到一篇文章,一个牛人研究windows内核,发现是Windows许可证做的限制,如果把许可证换成windows 2008的就直接可以支持128G了,但是系统会有兼容性问题,所以牛人就自己修改内核,把从许可证里面获取内存限制的汇编代码改了一下。。。
原文如下:
http://www.geoffchappell.com/viewer.htm?doc=notes/windows/license/memory.htm
C:\Windows\system32\ntkrnlpe.exe
汇编:
| Opcode Bytes | Instruction | 
|---|---|
7C xx
 | 
jl default  | 
8B 45 FC  | 
mov eax,dword ptr [ebp-4]  | 
85 C0  | 
test eax,eax  | 
74 yy
 | 
je default  | 
改成
| Opcode Bytes | Instruction | 
|---|---|
B8 00 00 02 00  | 
mov eax,00020000h  | 
90  | 
nop  | 
90  | 
nop  | 
即可。。。
个人试验了一次,果然可行,具体步骤如下:
1、首先复制系统内核文件 ntkrnlpa.exe,并命名为 ntkrn128.exe,所有修改都在ntkrn128.exe上面进行,不要动原来的内核
2、用16进制编辑器(我用的是ultraedit)查找特征码:
特征串1:7C 11 8B 45 FC 85 C0 74 0a
特征串2:7C 10 8B 45 FC 85 C0 74 09
每一个特征串都是唯一的,你只会找到一个。
然后就是修改,把 后面七个字节全部改为 B8 00 00 02 00 90 90
也就是:
特征串1:7C 11 8B 45 FC 85 C0 74 0a   改为 7C 11 B8 00 00 02 00 90 90
特征串2:7C 10 8B 45 FC 85 C0 74 09 改为 7C 10 B8 00 00 02 00 90 90
然后保存文件,退出编辑器。
3、改了内核文件,就需要重新生成md5验证码,某则不能启动的,用editbin,visual stuido 有,也可以从最下面提供的下载包里面获取。
editbin /release C:\windows\system32\ntkrn128.exe
4、对内核文件进行签名,这两个工具在 Windows Software Development Kit (SDK) and the Windows Driver Kit (WDK) 都有,也可以从下面的下载包里面获取。
makecert -r -ss my -n “CN=My Own Testing Authority”
signtool sign -s my -n “My Own Testing Authority” C:\windows\system32\ntkrn128.exe
5、增加启动项,由于vista不能直接修改boot.ini,只能用bcdedit来修改了
把当前启动项拷贝一份新的:
bcdedit /copy {current} /d “Windows Vista 128G”
获得新启动项的guid
直接敲 bcdedit
….
Windows 启动加载器
——————-
标识符              {24914868-264b-11de-a6f3-001aa0c54a80}
device                  partition=C:
path                    \Windows\system32\winload.exe
description             Windows Vista 128G
….
这样就找到标识符guid {24914868-264b-11de-a6f3-001aa0c54a80},每个系统的都是不同的,一定要用自己看到的。
强制打开pae
bcdedit /set {guid} pae ForceEnable 
指定内核
bcdedit /set {guid} kernel ntkrn128.exe
打开测试签名:
bcdedit /set {guid} testsigning on
ok,搞定,这样子启动的时候就多了一个选项
Windows Vista 128G
选择以后启动,桌面显示测试模式,因为我们没有windows的签名,忍一下吧,嘿嘿。
到此我的4G内存全部用上了,而windows 6 最高支持128G内存,应该也是ok滴,哈哈。
不过用了这个修改版的内核,会有一些奇奇怪怪的蓝屏问题,估计是还有某些地方会检查所致吧。或者是我的rpwt。。。
修改内核用到的工具:
Apr 11 2009
装了个vista玩玩,果然很不习惯,雅黑字体不是一般的丑。。。不知道windows 7 又是什么样子的呢,等出来的时候又装个玩玩,现在还不能扔掉xp啊。。。
刚把qq装好。。。就收到华仔一条消息。。。竟然是摆酒啦,tnnd,他和他老婆从初中开始拍拖,一直拍到现在才摆酒,数下手指,一共拍拖15年,我不是一般的汗啊。。。我讲过要他单独请我一桌的,哈哈哈。
Apr 08 2009
现在的服务器一般都是多核了,但是中断很多时候都是只用一个核,如果有些中断要求比较高,可以把它独立分配给一个cpu使用。
查看irq资源
cat /proc/interrupts
           CPU0       CPU1       CPU2       CPU3       
  0:        131          0          0       1914   IO-APIC-edge      timer
  1:          0          0          0          2   IO-APIC-edge      i8042
  6:          0          0          0          3   IO-APIC-edge      floppy
  8:          0          0          0          0   IO-APIC-edge      rtc
  9:          0          0          0          1   IO-APIC-fasteoi   acpi
 12:          0          0          0          4   IO-APIC-edge      i8042
 16:          0          0          0         88   IO-APIC-fasteoi   uhci_hcd:usb1
 18:          0          0          0          0   IO-APIC-fasteoi   uhci_hcd:usb2
 19:          0          0          0          0   IO-APIC-fasteoi   uhci_hcd:usb3
 20:          0          0          0    3632390   IO-APIC-fasteoi   eth0
 21:          0          0          0     286964   IO-APIC-fasteoi   eth1
 22:          0          0          0        122   IO-APIC-fasteoi   ehci_hcd:usb4, ide0
 23:          0          0          0      71154   IO-APIC-fasteoi   megaraid
 24:      22742   71684193          0  501949119   IO-APIC-fasteoi   wct4xxp
NMI:          0          0          0          0   Non-maskable interrupts
LOC:    2928977    1633788    6945258    8115638   Local timer interrupts
RES:       1507       2361       3804       3442   Rescheduling interrupts
CAL:        263        226        288        168   function call interrupts
TLB:       5488       4201       5293       3658   TLB shootdowns
TRM:          0          0          0          0   Thermal event interrupts
SPU:          0          0          0          0   Spurious interrupts
ERR:          0
MIS:          0
wct4xxp 就是E1卡TE410P,这个对中端要求比较高,所以分配到独立的cpu来处理,irq号是24
cat /proc/irq/24/smp_affinity
00000003
smp_affinity 文件默认是全部ffffffff,8个f就是16的8次方位,一般一台机就几只cpu,所以够了,echo 3 > /proc/irq/24/smp_affinity 就是分配第一第二只cpu给该irq。
smp_affinity 具体定义:
Binding IRQ’s to a group of CPU’s is a new feature of the 2.4 kernel. While it was originally developed as part of Red Hat Content Accelerator, it is now a generic and independent kernel feature. Every IRQ source in Linux has an entry in /proc/irq directory. For example, the settings for IRQ 40 is stored in /proc/irq/40. IRQ affinity, or IRQ bindings, is configured though the smp_affinity setting in that directory. For example, the smp_affinity for IRQ 40 is in /proc/irq/40/smp_affinity. The value of the smp_affinity setting is a bitmask of all CPU’s that are permitted as a resource for the given IRQ. The default value for smp_affinity is the HEX value 0xffffffff. This means the processes for the IRQ are sent to all CPU’s. You are not allowed to turn off all CPU’s for an IRQ. If the IRQ controller does not support IRQ affinity, the value can not be changed from the default. If multiple CPU’s are defined, then the IRQ source uses the least busy CPU. This is called ‘lowest priority APIC routing.’ IRQ affinity is achieved by binding an IRQ to a specific CPU or group of CPU’s by echoing a HEX value to smp_affinity for the IRQ.
Apr 07 2009
java里面是32位:
static int | 
MAX_VALUEA constant holding the maximum value an int can have, 231-1. | 
static int | 
MIN_VALUEA constant holding the minimum value an int can have, -231. | 
mysql里面也是默认的32位:
M indicates the maximum display width for integer types
TINYINT[(M)] [UNSIGNED] [ZEROFILL]
A very small integer. The signed range is -128 to 127. The unsigned range is 0 to 255.
SMALLINT[(M)] [UNSIGNED] [ZEROFILL]A small integer. The signed range is -32768 to 32767. The unsigned range is 0 to 65535.MEDIUMINT[(M)] [UNSIGNED] [ZEROFILL]A medium-sized integer. The signed range is -8388608 to 8388607. The unsigned range is 0 to 16777215.INT[(M)] [UNSIGNED] [ZEROFILL]A normal-size integer. The signed range is -2147483648 to 2147483647. The unsigned range is 0 to 4294967295.INTEGER[(M)] [UNSIGNED] [ZEROFILL]This type is a synonym for INT.BIGINT[(M)] [UNSIGNED] [ZEROFILL]A large integer. The signed range is -9223372036854775808 to 9223372036854775807. The unsigned range is 0 to 18446744073709551615.SERIAL is an alias for BIGINT UNSIGNED NOT NULL AUTO_INCREMENT UNIQUE.
C的话就是看编译器了,32位就和java一样,现在基本都是32位的了,当初学TC的时候是16位的,造成一个错觉,一直都以为java的int类型虽然不是16位,但是也不够表示mysql里面的int,而且mysql里面int 是表示成 int(11) 的,而
M indicates the maximum display width for integer types
意思就是11表示的是mysql显示的列宽,而不是制定数据位数。。。以前竟然一直都以为11是指11位的十进制数,而32位的int最长是10位二进制,真是郁闷啊。。。哎,造成java编程的时候都用long来表示,不是一般的郁闷。。