在Windows 7下安装了VirtualBox,然后通过VirtualBox虚拟安装了CentOS 56,现在想在CentOS下访问Windows中的一些文件,需要在VirtualBox中配置数据空间:
VirtualBox 408
[root@zuantianyang-lnx ~]# lsb_release -a
LSB Version: :core-40-amd64:core-40-ia32:core-40-noarch:graphics-40-amd64:graphics-40-ia32:graphics-40-noarch:printing-40-amd64:printing-40-ia32:printing-40-noarch
Distributor ID: CentOS
Description: CentOS release 56 (Final)
Release: 56
Codename: Final
1安装VirtualBox Guest Addition。点击"设备"菜单下面的“安装增强功能”:
[root@zuantianyang-lnx VBOXADDITIONS_408_71778]$ ls -lrt
总计 37520
-r-xr-xr-x 1 root root 278832 05-31 22:17 VBoxWindowsAdditionsexe
-r-xr-xr-x 1 root root 9284432 05-31 22:17 VBoxWindowsAdditions-amd64exe
-r-xr-xr-x 1 root root 14664192 05-31 22:17 VBoxSolarisAdditionspkg
-r-xr-xr-x 1 root root 7853516 05-31 22:17 VBoxLinuxAdditionsrun
-r-xr-xr-x 1 root root 5523 05-31 22:17 runasrootsh
-r-xr-xr-x 1 root root 6966 05-31 22:17 autorunsh
-r-xr-xr-x 1 root root 647 05-31 22:17 AUTORUNINF
dr-xr-xr-x 2 root root 4096 05-31 22:17 64Bit
dr-xr-xr-x 3 root root 4096 05-31 22:17 32Bit
-r-xr-xr-x 1 root root 6190464 05-31 22:17 VBoxWindowsAdditions-x86exe
[root@zuantianyang-lnx VBOXADDITIONS_408_71778]$ /VBoxLinuxAdditionsrun
2 VirtualBox的设置中找到数据空间,添加要共享的文件夹,选择Auto-Mount和固定分配:
设备-->分配数据空间-->添加数据空间
我选择了整个Win7下的C盘, 数据空间位置C:, 数据空间名称C_DRIVE
3 确认/sbin/mountvboxsf存在
4查看boxvfs模块是否加载:lsmod | grep vboxvfs,如果没有加载,执行modprobe vboxvfs命令加载
5 创建好mount点:
[root@zuantianyang-lnx ~]# cd /
[root@zuantianyang-lnx /]# mkdir WIN7_C_DRIVE
[root@zuantianyang-lnx /]# mount -t vboxsf C_DRIVE WIN7_C_DRIVE
C_DRIVE是数据空间名称,对应的是共享的Windows下的文件夹。
6想让机器重启后还能访问Windows的文件夹,在CentOS重启后自动mount即可,需要修改/etc/fstab,加入
C_DRIVE /WIN7_C_DRIVE vboxsf defaults 0 0保存即可,挂载windows的共享目录C_DRIVE到CenOS下/WIN7_C_DRIVE
[root@zuantianyang-lnx ~]# cd /etc/
[root@zuantianyang-lnx etc]# vi fstab
/dev/VolGroup00/LogVol00 / ext3 defaults 1 1
LABEL=/boot /boot ext3 defaults 1 2
tmpfs /dev/shm tmpfs defaults 0 0
devpts /dev/pts devpts gid=5,mode=620 0 0
sysfs /sys sysfs defaults 0 0
proc /proc proc defaults 0 0
/dev/VolGroup00/LogVol01 swap swap defaults 0 0
# Automatically mount Windows7 C_DRIVE to /WIN7_C_DRIVE during startup, byrneyang
C_DRIVE /WIN7_C_DRIVE vboxsf defaults 0 0
7取消挂载
#sudo umount -f /mnt/shared
Building the VirtualBox Guest Additions kernel modules FAILD
使用VirtualBox安装Linux的朋友往往会同时安装增强工具Guest Addtions,该工具的主要目的是使鼠标可以在真实机与虚拟机之间自由穿梭、自动根据VirtualBox窗口大小改变X尺寸等。但往往安装时都会遇到挫折!
原因常常在于这么几点:
1当你点击安装Guest Additions时,桌面会出现虚拟安装光盘文件夹,里面就是增强工具包,但如果你需要安装增强包,就需要至少有读和执行的权限,但光盘文件是无法修改文件权限属性的,所以你需要复制光盘文件里的所以文件,在桌面上新建个文件夹,把文件粘贴进入!修改文件权限。
这里根据你安装的虚拟系统不同选择不同的文件执行,如安装的是Linux,就chmod 777 VboxLinuxAdditions-x86run。
这是即可安装增加工具:/VboxLinuxAdditions-x86run(注:执行当前文件夹下的VboxLinuxAdditions-x86run,需要在终端运行命令)。
2当你在终端中执行/VboxLinuxAdditions-x86run时,系统还可能还会提示你:
Building the VirtualBox Guest Additions kernel modules [失败]
出现这种提示,往往说明你没有安装-gcc -make -kernel-default-devel -kernel-sources -kernel-headers 这样几个必要的软件包。
你可以从系统安装光盘中找到它们,并安装到系统中,并且当你安装gcc时,可能还会提示你有软件包的依赖关系,按提示安装依赖包即可!
3,mount数据空间时注意,数据空间的名字不要跟/mnt下你新建的文件夹名称一样。
比如,要共享host系统中的 tempfolder 文件夹,数据空间默认名称就是 tempfolder ,命令可以是:
sudo mkdir /mnt/share/
到此基本上没有问题了,重启后你的系统会更加完美!
总结:如果你安装软件时遇到依赖包问题,建议使用YUM安装软件,摆脱依赖包问题!
第一步:将IKAnalyzerjar包存放在一个文件夹中,比如mylib文件夹
第二步:建一个IKAnalyzerjar包相关的pomxml文件,需要在pomxml中定义其maven坐标及其相应的依赖代码即可,同样将pom文件存放在上述jar文件同一文件夹下,IKAnalyzerjar坐标及依赖代码如下:
<project xmlns=""
xmlns:xsi=""
xsi:schemaLocation="
">
<modelVersion>400</modelVersion>
<groupId>orgwlteaik-analyzer</groupId>
<artifactId>ik-analyzer</artifactId>
<version>328</version>
<name>IK Analyzer 3</name>
<description>A dictionary and grammar-based Chinese segmenter</description>
<dependencies>
<dependency>
<groupId>orgapachelucene</groupId>
<artifactId>lucene-core</artifactId>
<version>303</version>
<optional>true</optional>
</dependency>
<dependency>
<groupId>orgapachesolr</groupId>
<artifactId>solr-core</artifactId>
<version>141</version>
<optional>true</optional>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>382</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>orgapachelucene</groupId>
<artifactId>lucene-analyzers</artifactId>
<version>303</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>orgapachelucene</groupId>
<artifactId>lucene-smartcn</artifactId>
<version>303</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
第三步:打开CMD,进入到mylib文件夹,运行下面命令
mvn install:install-file \
-Dfile=IKAnalyzer328jar \
-DgroupId=orgwlteaik-analyzer \
-DartifactId=ik-analyzer \
-Dversion=328 \
-Dpackaging=jar
这样你就可以将IKAnalyzer328jar安装到您Maven本地的库文件夹相应目录中。你可以根据你需要安装包的实际情况修改上面的几个参数的设定值即可。之后你可以在pomxml文件中通过以下依赖在项目中引入上述的包,如下:
<dependency>
<groupId>orgwlteaik-analyzer</groupId>
<artifactId>ik-analyzer</artifactId>
<version>328</version>
</dependency>
当然你也可以不将IKAnalyzer328jar发布到您本地的Maven库中,而是通过下面配置引入,效果和上面的差不多:
<dependency>
<groupId>orgwltea</groupId>
<artifactId>IKAnalyzer</artifactId>
<version>328</version>
<systemPath>C:\Users\yangping\Desktop\a\IKAnalyzer328jar</systemPath>
</dependency>
首先感谢你向我们团队提问。
有区别的:
5000:
1、主频22,在当今CPU中,性能是入门级中的低端。
2、较新,制程45nm,功耗低。
3、有部分CPU有开四核的可能。若能稳定开核并小超,其性能将达到翼龙四核925一致,一跃为高端处理器。
5000+:
1、主频26,比5000默认主频高。且有黑盒版本,就是不锁倍频。
2、较旧,制程65nm,功耗高。
3、纯双核处理器。若不考虑开核因素,性能强于5000,主观速度体验还是很大的。
差价在50元以内。
5000,淘宝包开核的在300元左右。
1、I3 3210是intel第三代双核CPU,I5 2430虽然是二代CPU,但是4核CPU,性能秒杀I3 3210只是发热耗电稍高。
2、旧机是独立显卡,新机T430I是集成显卡。
重新安装下系统试试,建议WIN7旗舰版,T430I性能虽然一般,但正常办公软件,上上网还是足够流畅的,改善性能只能加一根2G内存,或者换SSD硬盘,其他无法升级。
Option Explicit
'五子棋程序 人机对战版本
'需要2个Label控件 2个CommandButton控件
Private Declare Function SetWindowRgn Lib "user32" (ByVal hWnd As Long, ByVal hRgn As Long, ByVal bRedraw As Boolean) As Long
Private Declare Function CreateRoundRectRgn Lib "gdi32" (ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long, ByVal X3 As Long, ByVal Y3 As Long) As Long
'Dim PlayStep() As String '记录棋谱的数组
'Dim Label2Cap As String
Private Const BoxL As Single = 50, BoxT As Single = 50, BoxW As Single = 25, BoxN As Integer = 18
Dim Table() As Long '棋盘(0-BoxN,0-BoxN) 0-空 1-黑子 2-白子
Dim PsCore() As Long '定义当前玩家桌面空格的分数
Dim CsCore() As Long '定义当前电脑桌面空格的分数
Dim pWin() As Boolean '定义玩家的获胜组合
Dim cWin() As Boolean '定义电脑的获胜组合
Dim pFlag() As Boolean '定义玩家的获胜组合标志
Dim cFlag() As Boolean '定义电脑的获胜组合标志
Dim ThePlayFlag As Boolean '定义游戏有效标志
Private Sub Command1_Click()
If Not ThePlayFlag Then Call InitPlayEnvironment: Exit Sub
If MsgBox("本局还没有下完,是否重新开始?(Y/N)", vbYesNo) = vbNo Then Exit Sub
Call InitPlayEnvironment
End Sub
Private Sub Command2_Click()
End
End Sub
Private Sub Form_Load()
Dim i As Long, lw As Long, lh As Long
'Label2Cap = "000 黑方 行 00 列 00"
MeWidth = 10815: MeHeight = 8040
' MeCaption = "五子棋 - 人机对战": MeShow
lw = MeWidth \ ScreenTwipsPerPixelX: lh = MeHeight \ ScreenTwipsPerPixelY
SetWindowRgn MehWnd, CreateRoundRectRgn(0, 0, lw, lh, 60, 60), True
With Label1
Alignment = vbCenter: FontSize = 12: FontBold = True
ForeColor = vbRed: BackStyle = 0: AutoSize = True: Move 8910, 510
End With
Label2AutoSize = True: Label2WordWrap = True
Label2BackStyle = 0: Label2Move 8040, 1050, 2280
Command1Move 8025, 7035, 1020, 435: Command1Caption = "再来一局"
Command2Move 9300, 7035, 1020, 435: Command2Caption = "不玩了"
Call DrawChessBoard: MeFillStyle = 0: Call InitPlayEnvironment
End Sub
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
End
End Sub
Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
Dim iRow As Long, iCol As Long, i As Long, k As Long, t As String
If Not ThePlayFlag Then Exit Sub
If Button = vbLeftButton Then '左键下棋
iRow = -1: iCol = -1
For i = 0 To BoxN '鼠标必须落在交叉点 半径10以内 若是则给出行列号
If (Y + 10) > (BoxT + i BoxW) And (Y - 10) <= (BoxT + i BoxW) Then iRow = i
If (X + 10) > (BoxL + i BoxW) And (X - 10) <= (BoxL + i BoxW) Then iCol = i
Next
If (iRow = -1) Or (iCol = -1) Then Beep: Exit Sub
If Table(iCol, iRow) > 0 Then Exit Sub
Table(iCol, iRow) = 2: Label1Caption = "下一步 黑方"
MeFillColor = vbWhite: MeCircle (iCol BoxW + BoxT, iRow BoxW + BoxL), 8
For i = 0 To UBound(cWin, 3)
If cWin(iCol, iRow, i) = True Then cFlag(i) = False
Next
Call CheckWin: Call DianNao '检查当前玩家是否获胜 调用电脑算法
End If
End Sub
Public Sub InitPlayEnvironment()
'
' 模块名称: InitPlayEnvironment [初始化过程]
'
' 描述: 1 设置背景音乐。 2 设置游戏状态有效。
' 3 初始化游戏状态标签。 4 直接指定电脑的第一步走法。
' 5 初始化基本得分桌面。 6 电脑和玩家获胜标志初始化。
' 7 初始化所有获胜组合。 8 重新设定玩家的获胜标志。
'
Dim i As Long, j As Long, m As Long, n As Long
ThePlayFlag = True: Label1Caption = "下一步 白方": Label2Caption = ""
MeFillColor = vbBlack: MeFillStyle = 0: MeAutoRedraw = True
MeCls: MeCircle (9 BoxW + BoxL, 9 BoxW + BoxT), 8
ReDim Table(0 To BoxN, 0 To BoxN) As Long
ReDim pFlag(NumsWin(BoxN + 1) - 1) As Boolean
ReDim cFlag(UBound(pFlag)) As Boolean
ReDim PsCore(BoxN, BoxN) As Long, CsCore(BoxN, BoxN) As Long
ReDim pWin(BoxN, BoxN, UBound(pFlag)) As Boolean
ReDim cWin(BoxN, BoxN, UBound(pFlag)) As Boolean
For i = 0 To UBound(pFlag): pFlag(i) = True: cFlag(i) = True: Next
Table(9, 9) = 1 '假定电脑先手 并下了(9, 9)位 将其值设为1
' 初始化获胜组合
For i = 0 To BoxN: For j = 0 To BoxN - 4
For m = 0 To 4
pWin(j + m, i, n) = True: cWin(j + m, i, n) = True
Next
n = n + 1
Next: Next
For i = 0 To BoxN: For j = 0 To BoxN - 4
For m = 0 To 4
pWin(i, j + m, n) = True: cWin(i, j + m, n) = True
Next
n = n + 1
Next: Next
For i = 0 To BoxN - 4: For j = 0 To BoxN - 4
For m = 0 To 4
pWin(j + m, i + m, n) = True: cWin(j + m, i + m, n) = True
Next
n = n + 1
Next: Next
For i = 0 To BoxN - 4: For j = BoxN To 4 Step -1
For m = 0 To 4
pWin(j - m, i + m, n) = True: cWin(j - m, i + m, n) = True
Next
n = n + 1
Next: Next
' 初始化获胜组合结束
For i = 0 To UBound(pWin, 3) '由于电脑已下了(9, 9)位 所以需要重新设定玩家的获胜标志
If pWin(9, 9, i) = True Then pFlag(i) = False
Next
End Sub
Public Function DrawChessBoard() As Long
'容器的(BoxL, BoxT)为左上角坐标画一个 BoxNBoxN, 每格边长为 BoxW 象素的棋盘
Dim i As Long, j As Long, cx As Long, cy As Long
MeScaleMode = 3: MeFillStyle = 1: MeAutoRedraw = True: MeCls
For i = 0 To BoxN '画棋盘
MeLine (BoxL + i BoxW, BoxT)-(BoxL + i BoxW, BoxT + BoxN BoxW)
MeLine (BoxL, BoxT + i BoxW)-(BoxL + BoxN BoxW, BoxT + i BoxW)
MeCurrentX = BoxL + i BoxW - IIf(i > 9, 6, 2)
MeCurrentY = BoxT - 20: MePrint Format(i)
MeCurrentX = BoxL - IIf(i > 9, 23, 20)
MeCurrentY = BoxT + i BoxW - 6: MePrint Format(i)
Next
For i = 3 To 16 Step 6: For j = 3 To 16 Step 6 '画小标志
cx = BoxL + j BoxW - 3: cy = BoxT + i BoxW - 3
MeLine (cx, cy)-(cx + 6, cy + 6), , B
Next: Next
MeAutoRedraw = False: Set MePicture = MeImage
End Function
Public Sub CheckWin()
'
' 模块名称: CheckWin [获胜检查算法]
'
' 描述: 1 检查是否和棋。 2 检查电脑是否获胜。 3 检查玩家是否获胜。
'
Dim i As Long, j As Long, k As Long, m As Long, n As Long
Dim cA As Long, pA As Long, cN As Long
For i = 0 To UBound(cFlag): cN = IIf(cFlag(i) = False, cN + 1, cN): Next
If cN = UBound(cFlag) - 1 Then '设定和棋规则
Label1Caption = "双方和棋!": ThePlayFlag = False: Exit Sub
End If
For i = 0 To UBound(cFlag) '检查电脑是否获胜
If cFlag(i) = True Then
cA = 0: For j = 0 To BoxN: For k = 0 To BoxN
If Table(j, k) = 1 And cWin(j, k, i) = True Then cA = cA + 1
Next: Next
If cA = 5 Then Label1Caption = "电脑获胜!": ThePlayFlag = False: Exit Sub
End If
Next
For i = 0 To UBound(pFlag) '检查玩家是否获胜
If pFlag(i) = True Then
pA = 0: For j = 0 To BoxN: For k = 0 To BoxN
If Table(j, k) = 2 And pWin(j, k, i) = True Then pA = pA + 1
Next: Next
If pA = 5 Then Label1Caption = "玩家获胜!": ThePlayFlag = False: Exit Sub
End If
Next
End Sub
Public Sub DianNao()
'
' 模块名称: DianNao [电脑算法]
' 描述: 1 初始化赋值系统。 2 赋值加强算法。 3 计算电脑和玩家的最佳攻击位。
' 4 比较电脑和玩家的最佳攻击位并决定电脑的最佳策略。 5 执行检查获胜函数。
'
Dim i As Long, j As Long, k As Long, m As Long, n As Long
Dim Dc As Long, cAb As Long, pAb As Long
ReDim PsCore(BoxN, BoxN) As Long, CsCore(BoxN, BoxN) As Long '初始化赋值数组
' 电脑加强算法
For i = 0 To UBound(cFlag)
If cFlag(i) = True Then
cAb = 0
For j = 0 To BoxN: For k = 0 To BoxN
If Table(j, k) = 1 And cWin(j, k, i) = True Then cAb = cAb + 1
Next: Next
Select Case cAb
Case 3
For m = 0 To BoxN: For n = 0 To BoxN
If Table(m, n) = 0 And cWin(m, n, i) = True Then CsCore(m, n) = CsCore(m, n) + 5
Next: Next
Case 4
For m = 0 To BoxN: For n = 0 To BoxN
If Table(m, n) = 0 And cWin(m, n, i) = True Then
Table(m, n) = 1: Label1Caption = "下一步 白方"
MeFillColor = vbBlack: MeCircle (m BoxW + BoxL, n BoxW + BoxT), 8
For Dc = 0 To UBound(pWin, 3)
If pWin(m, n, Dc) = True Then pFlag(Dc) = False: Call CheckWin: Exit Sub
Next
End If
Next: Next
End Select
End If
Next
For i = 0 To UBound(pFlag)
If pFlag(i) = True Then
pAb = 0
For j = 0 To BoxN: For k = 0 To BoxN
If Table(j, k) = 2 And pWin(j, k, i) = True Then pAb = pAb + 1
Next: Next
Select Case pAb
Case 3
For m = 0 To BoxN: For n = 0 To BoxN
If Table(m, n) = 0 And pWin(m, n, i) = True Then PsCore(m, n) = PsCore(m, n) + 30
Next: Next
Case 4
For m = 0 To BoxN: For n = 0 To BoxN
If Table(m, n) = 0 And pWin(m, n, i) = True Then
Table(m, n) = 1: Label1Caption = "下一步 白方"
MeFillColor = vbBlack: MeCircle (m BoxW + BoxL, n BoxW + BoxT), 8
For Dc = 0 To UBound(pWin, 3)
If pWin(m, n, Dc) = True Then pFlag(Dc) = False: Call CheckWin: Exit Sub
Next
End If
Next: Next
End Select
End If
Next
' 电脑加强算法结束
' 赋值系统
For i = 0 To UBound(cFlag)
If cFlag(i) = True Then
For j = 0 To BoxN: For k = 0 To BoxN
If (Table(j, k) = 0) And cWin(j, k, i) Then
For m = 0 To BoxN: For n = 0 To BoxN
If (Table(m, n) = 1) And cWin(m, n, i) Then CsCore(j, k) = CsCore(j, k) + 1
Next: Next
End If
Next: Next
End If
Next
For i = 0 To UBound(pFlag)
If pFlag(i) = True Then
For j = 0 To BoxN: For k = 0 To BoxN
If (Table(j, k) = 0) And pWin(j, k, i) Then
For m = 0 To BoxN: For n = 0 To BoxN
If (Table(m, n) = 2) And pWin(m, n, i) Then PsCore(j, k) = PsCore(j, k) + 1
Next: Next
End If
Next: Next
End If
Next
' 赋值系统结束
' 分值比较算法
Dim a As Long, b As Long, c As Long, d As Long
Dim cS As Long, pS As Long
For i = 0 To BoxN: For j = 0 To BoxN
If CsCore(i, j) > cS Then cS = CsCore(i, j): a = i: b = j
Next: Next
For i = 0 To BoxN: For j = 0 To BoxN
If PsCore(i, j) > pS Then pS = PsCore(i, j): c = i: d = j
Next: Next
If cS > pS Then
Table(a, b) = 1: Label1Caption = "下一步 白方"
MeFillColor = vbBlack: MeCircle (a BoxW + BoxL, b BoxW + BoxT), 8
For i = 0 To UBound(pWin, 3)
If pWin(a, b, i) = True Then pFlag(i) = False
Next
Else
Table(c, d) = 1: Label1Caption = "下一步 白方"
MeFillColor = vbBlack: MeCircle (c BoxW + BoxL, d BoxW + BoxL), 8
For i = 0 To UBound(pWin, 3)
If pWin(c, d, i) = True Then pFlag(i) = False
Next
End If
' 分值比较算法结束
Call CheckWin
End Sub
Public Function NumsWin(ByVal n As Long) As Long
'根据输入的棋盘布局 nn 计算总共有多少种获胜组合
'假定棋盘为 10 10 相应的棋盘数组就是 Table(9, 9)
'水平方向 每一列获胜组合是6 共10列 610=60
'垂直方向 每一行获胜组合是6 共10行 810=60
'正对角线方向 6 + (5 + 4 + 3 + 2 + 1) 2 = 36
'反对角线方向 6 + (5 + 4 + 3 + 2 + 1) 2 = 36
'总的获胜组合数为 60 + 60 + 36 + 36 = 192
Dim i As Long, t As Long
For i = n - 5 To 1 Step -1: t = t + i: Next
NumsWin = 2 (2 t + n - 4) + 2 n (n - 4)
End Function
欢迎分享,转载请注明来源:品搜搜测评网