1、产看扩展包
VBoxManage list extpacks
2、卸载扩展包
VBoxManage extpack uninstall "Oracle VM VirtualBox Extension Pack"
3、安装扩展包
VBoxManage extpack install "PATH_TO_EXTENSION_PACK"
Learn and share.
1、产看扩展包
VBoxManage list extpacks
2、卸载扩展包
VBoxManage extpack uninstall "Oracle VM VirtualBox Extension Pack"
3、安装扩展包
VBoxManage extpack install "PATH_TO_EXTENSION_PACK"
以Tomcat为例,说明一下容器如何编译JSP
1.1 命令行方式
java -classpath %CLASS_PATH% org.apache.jasper.JspC -uriroot PATH_TO_WEB\website\ -d PATH_TO_WEB\website\WEB-INF\jspclasses -p com.neohope.pages -c hello -javaEncoding UTF-8 -compile PATH_TO_WEB\website\jsp\hello.jsp
上面的命令行是,将website项目中jsp\hello.jsp文件,生成对应的java文件,文件输出路径为WEB-INF\jspclasses,类包名为com.neohope.pages,类名hello,编码为UTF-8
1.2 Java代码方式
package com.neohope.jsp.complier;
import org.apache.jasper.JspC;
public class MyComplier {
public static void main(String args[]) {
try {
JspC jspc = new JspC();
jspc.setUriroot("PATH_TO_WEB\\JSP\\JSPComplier\\website");
jspc.setJspFiles("PATH_TO_WEB\\JSP\\JSPComplier\\website\\jsp\\hello.jsp");
jspc.setOutputDir("PATH_TO_WEB\\JSP\\JSPComplier\\website\\WEB-INF\\jspclasses");
jspc.setPackage("com.neohope.pages");
jspc.setClassName("hello");
jspc.setJavaEncoding("UTF-8");
jspc.setCompile(true);
jspc.execute();
System.out.println("job done!");
} catch (Exception ex) {
ex.printStackTrace();
}
}
}
代码地址:
JSPComplierSample
说起gpt来,就一把鼻涕一把泪的,因为工作原因,需要在windows进行开发,
没办法在mac book pro里安了个win7,后来为了方便,在mac下安了ntfs的读写驱动,
悲剧发生了,某天开机进入mac,很久没反应,强制重启后,windows分区已经挂掉了。
于是重装,用win7的光盘进行的分区,后来用第三方分区工具调整了下,ntfs不负众望,又挂了
好吧~~,又重装了一次
一波三折,终于稳定了。
但mac下,却认不到ntfs分区,一直认为是mac下ntfs驱动的问题,尝试过一些解决方案,都不行。
今天发现,mac下分区大小和win7下分区大小不一样,mac下的分区大小,仍是我在win7下调整前的状态
懂了,明显是gpt分区表错了啊。
网上找了一堆工具,还差点用gpt把hybrid MBR给覆盖了,晕。
最后,用gdisk终于搞定了,修改gpt的神器啊。
http://sourceforge.net/projects/gptfdisk/files/gptfdisk/0.8.5/
http://www.rodsbooks.com/gdisk/walkthrough.html
sudo进入gdisk后,选用/dev/disk0,然后用v命令进行校验,
gdisk发警告,mbr里有两个分区在gpt中不存在,
进入expert模式,用p和o命令打印gpt和mbr分区信息,发现真的对不上,
把分区表记录好,gpt备份好。
然后将gpt中错误的两个分区删掉,再根据mbr里的数据,重新建立两个分区,
再用v命令校验,没有问题,
保持修改,重启,终于搞定了。
注意:
我的情况是,在mac分区表错误,而win7下分区表正确,这说明是gpt错了,而hybrid MBR是对的。
而如果是相反的情况,就要根据gpt重新编辑mbr,这样的工具很多,貌似在mac,win,linux共存的时候发生的几率会比较高。
对硬盘分区表的修改,是很危险的工作,一定要备份数据,备份分区表,将风险尽量降低。
这几天在调试HTTP通讯的时候,偶尔会发生下面的异常:
java.io.IOException: Premature EOF
主要原因是:
client在读取server返回的文件时,本来已经读完,但client又去读了一次
此时,就会抛出上面的异常
另外,公司搬家后,测试Java取回文件的效率,会出现两种诡异的延时:
1、打开输入流的时候,奇慢无比,要3~4s
2、在从输入流中读取时,不时会有200ms的奇怪延时
在不同的客户端机器上,从同一个服务端取回,会有不同的表现
貌似和客户端操作系统种类和JDK版本都有关,总之很诡异了。
唉~~,时间紧迫,只好找了其他方法解决
有人说是HTTP头设置问题,有人说是IPV6问题,试过后,问题依旧啊。
最近在Windows2008R2上架设了Windows的FPT服务。
但无论怎样配置防火墙,本地都可以访问,远程只能显示登录框,登录后就卡住不动了。
各种配置入站出站规则。
1、允许了端口
2、允许了服务通过Microsoft FTP Service
还是不行。
最后,增加了一条配置:
允许C:\Windows\System32\svchost.exe通过防火墙,一切正常了。
好吧。。。
虽然这样有风险,但至少管用。
Finder:
killall -KILL Finder
Dock:
killall -KILL Dock
Menubar
killall -KILL SystemUIServer
1、生成xorg.conf文件
#如果有必要,停止gdm3 service gdm3 stop #生成空白文件 Xorg -configure #移动文件 mv ~/xorg.conf.new /etc/X11/xorg.conf #修改文件,增加需要的分辨率 #如果有必要,开启gdm3 service gdm3 start
2、xorg.conf.new文件
Section "ServerLayout"
Identifier "X.org Configured"
Screen 0 "Screen0" 0 0
InputDevice "Mouse0" "CorePointer"
InputDevice "Keyboard0" "CoreKeyboard"
EndSection
Section "Files"
ModulePath "/usr/lib/xorg/modules"
FontPath "/usr/share/fonts/X11/misc"
FontPath "/usr/share/fonts/X11/cyrillic"
FontPath "/usr/share/fonts/X11/100dpi/:unscaled"
FontPath "/usr/share/fonts/X11/75dpi/:unscaled"
FontPath "/usr/share/fonts/X11/Type1"
FontPath "/usr/share/fonts/X11/100dpi"
FontPath "/usr/share/fonts/X11/75dpi"
FontPath "/var/lib/defoma/x-ttcidfont-conf.d/dirs/TrueType"
FontPath "built-ins"
EndSection
Section "Module"
Load "record"
Load "glx"
Load "extmod"
Load "dbe"
Load "dri"
Load "dri2"
EndSection
Section "InputDevice"
Identifier "Keyboard0"
Driver "kbd"
EndSection
Section "InputDevice"
Identifier "Mouse0"
Driver "mouse"
Option "Protocol" "auto"
Option "Device" "/dev/input/mice"
Option "ZAxisMapping" "4 5 6 7"
EndSection
Section "Monitor"
Identifier "Monitor0"
VendorName "Monitor Vendor"
ModelName "Monitor Model"
EndSection
Section "Device"
### Available Driver options are:-
### Values: <i>: integer, <f>: float, <bool>: "True"/"False",
### <string>: "String", <freq>: "<f> Hz/kHz/MHz"
### [arg]: arg optional
Identifier "Card0"
Driver "vboxvideo"
VendorName "InnoTek Systemberatung GmbH"
BoardName "VirtualBox Graphics Adapter"
BusID "PCI:0:2:0"
EndSection
Section "Screen"
Identifier "Screen0"
Device "Card0"
Monitor "Monitor0"
SubSection "Display"
Viewport 0 0
Depth 1
EndSubSection
SubSection "Display"
Viewport 0 0
Depth 4
EndSubSection
SubSection "Display"
Viewport 0 0
Depth 8
EndSubSection
SubSection "Display"
Viewport 0 0
Depth 15
EndSubSection
SubSection "Display"
Viewport 0 0
Depth 16
EndSubSection
SubSection "Display"
Viewport 0 0
Depth 24
EndSubSection
EndSection
3、新版xorg.conf文件
Section "ServerLayout"
Identifier "X.org Configured"
Screen 0 "Screen0" 0 0
InputDevice "Mouse0" "CorePointer"
InputDevice "Keyboard0" "CoreKeyboard"
EndSection
Section "Files"
ModulePath "/usr/lib/xorg/modules"
FontPath "/usr/share/fonts/X11/misc"
FontPath "/usr/share/fonts/X11/cyrillic"
FontPath "/usr/share/fonts/X11/100dpi/:unscaled"
FontPath "/usr/share/fonts/X11/75dpi/:unscaled"
FontPath "/usr/share/fonts/X11/Type1"
FontPath "/usr/share/fonts/X11/100dpi"
FontPath "/usr/share/fonts/X11/75dpi"
FontPath "/var/lib/defoma/x-ttcidfont-conf.d/dirs/TrueType"
FontPath "built-ins"
EndSection
Section "Module"
Load "record"
Load "glx"
Load "extmod"
Load "dbe"
Load "dri"
Load "dri2"
EndSection
Section "InputDevice"
Identifier "Keyboard0"
Driver "kbd"
EndSection
Section "InputDevice"
Identifier "Mouse0"
Driver "mouse"
Option "Protocol" "auto"
Option "Device" "/dev/input/mice"
Option "ZAxisMapping" "4 5 6 7"
EndSection
Section "Monitor"
Identifier "Monitor0"
VendorName "Monitor Vendor"
ModelName "Monitor Model"
EndSection
Section "Device"
### Available Driver options are:-
### Values: <i>: integer, <f>: float, <bool>: "True"/"False",
### <string>: "String", <freq>: "<f> Hz/kHz/MHz"
### [arg]: arg optional
Identifier "Card0"
Driver "vboxvideo"
VendorName "InnoTek Systemberatung GmbH"
BoardName "VirtualBox Graphics Adapter"
BusID "PCI:0:2:0"
EndSection
Section "Screen"
Identifier "Screen0"
Device "Card0"
Monitor "Monitor0"
SubSection "Display"
Viewport 0 0
Depth 1
Modes "1280x800" "1024x768" "800x600"
EndSubSection
SubSection "Display"
Viewport 0 0
Depth 4
Modes "1280x800" "1024x768" "800x600"
EndSubSection
SubSection "Display"
Viewport 0 0
Depth 8
Modes "1280x800" "1024x768" "800x600"
EndSubSection
SubSection "Display"
Viewport 0 0
Depth 15
Modes "1280x800" "1024x768" "800x600"
EndSubSection
SubSection "Display"
Viewport 0 0
Depth 16
Modes "1280x800" "1024x768" "800x600"
EndSubSection
SubSection "Display"
Viewport 0 0
Depth 24
Modes "1280x800" "1024x768" "800x600"
EndSubSection
EndSection
试了不少方法,要么参数不支持,要不设置了没有用。
好吧,简单暴力一些。
编辑/boot/grub/grub.cfg,在启动参数前,增加两行:
### BEGIN /etc/grub.d/10_linux ###
menuentry 'Debian GNU/Linux, with Linux 2.6.32-5-amd64' --class debian --class gnu-linux --class gnu --class os {
#第一行>>>>>>set gfxpayload=1024x768x24
#第二行>>>>>>load_video
insmod part_msdos
insmod ext2
set root='(hd0,msdos1)'
search --no-floppy --fs-uuid --set a600ccdc-3768-464b-9b19-29ec051f93e5
echo 'Loading Linux 2.6.32-5-amd64 ...'
linux /boot/vmlinuz-2.6.32-5-amd64 root=UUID=a600ccdc-3768-464b-9b19-29ec051f93e5 ro quiet text
echo 'Loading initial ramdisk ...'
initrd /boot/initrd.img-2.6.32-5-amd64
}
menuentry 'Debian GNU/Linux, with Linux 2.6.32-5-amd64 (recovery mode)' --class debian --class gnu-linux --class gnu --class os {
set gfxpayload=1024x768
insmod part_msdos
insmod ext2
set root='(hd0,msdos1)'
search --no-floppy --fs-uuid --set a600ccdc-3768-464b-9b19-29ec051f93e5
echo 'Loading Linux 2.6.32-5-amd64 ...'
linux /boot/vmlinuz-2.6.32-5-amd64 root=UUID=a600ccdc-3768-464b-9b19-29ec051f93e5 ro single
echo 'Loading initial ramdisk ...'
initrd /boot/initrd.img-2.6.32-5-amd64
}
### END /etc/grub.d/10_linux ###
修改后为:
### BEGIN /etc/grub.d/10_linux ###
menuentry 'Debian GNU/Linux, with Linux 2.6.32-5-amd64' --class debian --class gnu-linux --class gnu --class os {
set gfxpayload=1024x768x24
load_video
insmod part_msdos
insmod ext2
set root='(hd0,msdos1)'
search --no-floppy --fs-uuid --set a600ccdc-3768-464b-9b19-29ec051f93e5
echo 'Loading Linux 2.6.32-5-amd64 ...'
linux /boot/vmlinuz-2.6.32-5-amd64 root=UUID=a600ccdc-3768-464b-9b19-29ec051f93e5 ro quiet text
echo 'Loading initial ramdisk ...'
initrd /boot/initrd.img-2.6.32-5-amd64
}
menuentry 'Debian GNU/Linux, with Linux 2.6.32-5-amd64 (recovery mode)' --class debian --class gnu-linux --class gnu --class os {
set gfxpayload=1024x768
insmod part_msdos
insmod ext2
set root='(hd0,msdos1)'
search --no-floppy --fs-uuid --set a600ccdc-3768-464b-9b19-29ec051f93e5
echo 'Loading Linux 2.6.32-5-amd64 ...'
linux /boot/vmlinuz-2.6.32-5-amd64 root=UUID=a600ccdc-3768-464b-9b19-29ec051f93e5 ro single
echo 'Loading initial ramdisk ...'
initrd /boot/initrd.img-2.6.32-5-amd64
}
### END /etc/grub.d/10_linux ###
1、查看设备是否存在
#执行发现设备不存在 ls /dev | grep mpt mpt-status #新建设备 mknod /dev/mptctl c 10 220
2、手动加载模块
modeprobe mptctl lsmod | grep mpt
3、自动加载模块
编辑/etc/moduels,增加一行
mptctl
4、重启搞定
1、扩展虚拟磁盘
1.1A我的xp虚拟机一共只有10G,我需要扩展到20G(要关虚拟机)
"D:\Program files\VMware\VMware Workstation\vmware-vdiskmanager.exe" -x 20GB "D:\VirtualMashines\VMware\WinXP\WinXP.vmdk"
1.1BVMWare10以后,可以直接在管理工具中
虚拟机-》设置-》硬盘-》实用工具-》扩展
1.2扩展后,开启虚拟机,自己到磁盘管理器中分配空间即可。
2、压缩WinXP虚拟磁盘(vmware-tools)
2.1管理工具(关闭虚拟机)
虚拟机-》设置-》硬盘-》实用工具-》碎片整理
2.2开启虚拟机
系统托盘图标-》vmware-tools-》压缩
3、压缩WinXP虚拟磁盘(vmware-vdiskmanager)
3.1需要到微软官网下载sdelete工具,然后在虚拟机中运行:
sdelete -z
3.2关闭虚拟机,运行:
"D:\Program files\VMware\VMware Workstation\vmware-vdiskmanager.exe" -k "D:\VirtualMashines\VMware\WinXP\WinXP.vmdk"
4、压缩Debian虚拟磁盘:
4.1A在虚拟机中运行zerofree命令,需要将分区挂载为只读模式
apt-get install zerofree umount /etc/home zerofree /dev/sda6
4.1B在虚拟机中运行dd命令,需要将分区挂载为读写模式
dd if=/dev/zero of=/bigemptyfile rm bigemptyfile
4.2关闭虚拟机,运行:
"D:\Program files\VMware\VMware Workstation\vmware-vdiskmanager.exe" -k "D:\VirtualMashines\VMware\Debian8\Debian8.vmdk"
5、压缩FreeBSD虚拟磁盘:
5.1A在虚拟机中运行dd命令,需要将分区挂载为读写模式
dd if=/dev/zero of=bigemptyfile bs=1m rm bigemptyfile
5.1B在虚拟机中运行dd命令,需要将分区挂载为读写模式(适用于影片空闲空间较小)
cat /dev/zero > bigemptyfile;sync;sleep 1;sync; rm -f bigemptyfile
5.2关闭虚拟机,运行:
"D:\Program files\VMware\VMware Workstation\vmware-vdiskmanager.exe" -k "D:\VirtualMashines\VMware\FreeBSD10\Debian8.vmdk"