Sharon_Xu

Sharon_Xu 查看完整档案

苏州编辑  |  填写毕业院校和联  |  Factory Program Manager 编辑填写个人主网站
编辑
_ | |__ _ _ __ _ | '_ \| | | |/ _` | | |_) | |_| | (_| | |_.__/ \__,_|\__, | |___/ 个人简介什么都没有

个人动态

Sharon_Xu 回答了问题 · 2020-10-06

解决java 读取文件失败 FileOutputStream.open0

文件是只读,以后要检查,otz

关注 1 回答 1

Sharon_Xu 提出了问题 · 2020-10-05

解决java 读取文件失败 FileOutputStream.open0

~~###### 碰上系统级的Bug没办法,

手动复制的能修改,
程序复制的无法读取。~~

**### 解决了:文件属性被设置为只读了。

**

读取文件报错,拒绝访问。

文件名中有下划线,
确认文件路径正确。

~~把下划线取消后读取正常,
这个是什么bug?~~

具体是这样的:
手动复制该文件到盘根目录程序不能读取,
重新命名后能程序可以读取。
程序复制到盘符根目录下也不能读取,
重新命名也不能被程序读取。

抓狂了...

系统Win 7,
默认简体中文字符。
经试验改成英文也失败。

请教各位大佬了,
感谢。

关注 1 回答 1

Sharon_Xu 回答了问题 · 2019-06-02

解决我配置vnc用普通用户身份,为何还是会在root目录下建立档案?

要用sharon用户身份执行 vncserver :1 而不是root.

关注 1 回答 1

Sharon_Xu 提出了问题 · 2019-06-01

解决我配置vnc用普通用户身份,为何还是会在root目录下建立档案?

vim vncserver@:1.service

[Unit]
Description=Remote desktop service (VNC)
After=syslog.target network.target

[Service]
Type=forking

# Clean any existing files in /tmp/.X11-unix environment
ExecStartPre=/bin/sh -c '/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :'
ExecStart=/usr/sbin/runuser -l sharon -c "/usr/bin/vncserver %i"
PIDFile=/home/sharon/.vnc/%H%i.pid
ExecStop=/bin/sh -c '/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :'

[Install]
WantedBy=multi-user.target

我都是按照网上配置的,有些应用只能以普通用户身份(而不是root打开),所以我想要个普通身份登陆的。

我现在进去就是root的登陆画面,但是shell和应用都启动不来。

谢谢。

关注 1 回答 1

Sharon_Xu 提出了问题 · 2019-05-22

centos上有什么好用的图形备份工具推荐?

谢谢大家了。

关注 1 回答 0

Sharon_Xu 提出了问题 · 2019-05-03

linux dump备份

我是这么写的,

dump -0uan -f  /tmp/server-full-backup-`date '+%d-%B-%Y'`.dump  /

肯定不对啊,把cdrom proc都备份进去了

还原的时候

[root@localhost tmp]# xfsrestore -f server-full-backup-02-May-2019.dump /
xfsrestore: using file dump (drive_simple) strategy
xfsrestore: version 3.1.7 (dump format 3.0) - type ^C for status and control
xfsrestore: searching media for dump
xfsrestore: examining media file 0
xfsrestore: dump description:
xfsrestore: hostname: localhost.localdomain
xfsrestore: mount point: /
xfsrestore: volume: /dev/mapper/centos-root
xfsrestore: session time: Thu May 2 10:45:17 2019
xfsrestore: level: 0
xfsrestore: session label: "gh"
xfsrestore: media label: "ghj"
xfsrestore: file system id: 66469879-5572-4b84-9415-06fb87cd2f2b
xfsrestore: session id: c56383a8-b77e-4ee5-96d3-3047482da146
xfsrestore: media id: 3ed3a251-48bb-42a6-bd0b-488249e5fea0
xfsrestore: using online session inventory
xfsrestore: searching media for directory dump
xfsrestore: reading directories
xfsrestore: 18703 directories and 203144 entries processed
xfsrestore: directory post-processing
xfsrestore: WARNING: unable to set secure extended attribute for var/lib/nfs/rpc_pipefs: Operation not supported (95)
xfsrestore: WARNING: unable to set secure extended attribute for sys: Operation not supported (95)
xfsrestore: WARNING: unable to set secure extended attribute for proc: Operation not supported (95)
xfsrestore: restoring non-directory files
xfsrestore: NOTE: ino 68103552 gen 993728409 not referenced: placing in orphanage
xfsrestore: NOTE: ino 101883497 gen 1919238245 not referenced: placing in orphanage
xfsrestore: NOTE: ino 101883501 gen 2635724939 not referenced: placing in orphanage
xfsrestore: WARNING: path_to_handle of var/lib/nfs/rpc_pipefs failed:Inappropriate ioctl for device
xfsrestore: WARNING: attempt to set extended attributes (xflags 0x80000000, extsize = 0x0, projid = 0x0) of var/lib/nfs/rpc_pipefs failed: Bad file descriptor
xfsrestore: WARNING: path_to_handle of sys failed:Inappropriate ioctl for device
xfsrestore: WARNING: attempt to set extended attributes (xflags 0x80000000, extsize = 0x0, projid = 0x0) of sys failed: Bad file descriptor
xfsrestore: WARNING: path_to_handle of run failed:Inappropriate ioctl for device
xfsrestore: WARNING: attempt to set extended attributes (xflags 0x80000000, extsize = 0x0, projid = 0x0) of run failed: Bad file descriptor
xfsrestore: WARNING: path_to_handle of proc failed:Inappropriate ioctl for device
xfsrestore: WARNING: attempt to set extended attributes (xflags 0x80000000, extsize = 0x0, projid = 0x0) of proc failed: Bad file descriptor
xfsrestore: WARNING: open_by_handle of home failed:Bad file descriptor
xfsrestore: WARNING: attempt to set extended attributes (xflags 0x80000000, extsize = 0x0, projid = 0x0) of home failed: Bad file descriptor
xfsrestore: WARNING: path_to_handle of dev failed:Inappropriate ioctl for device
xfsrestore: WARNING: attempt to set extended attributes (xflags 0x80000000, extsize = 0x0, projid = 0x0) of dev failed: Bad file descriptor
xfsrestore: WARNING: open_by_handle of boot failed:Bad file descriptor
xfsrestore: WARNING: attempt to set extended attributes (xflags 0x80000000, extsize = 0x0, projid = 0x0) of boot failed: Bad file descriptor
xfsrestore: WARNING: unable to rmdir /orphanage: Directory not empty
xfsrestore: restore complete: 1165 seconds elapsed
xfsrestore: Restore Summary:
xfsrestore: stream 0 /tmp/server-full-backup-02-May-2019.dump OK (success)
xfsrestore: Restore Status: SUCCESS
1 这些warning是什么意思
2究竟该怎么dump整个系统啊

多谢了。

网上只举了备份了某个目录的例子,都找不到备份整个系统的例子,坑。

关注 1 回答 0

Sharon_Xu 提出了问题 · 2019-04-22

String.getBytes乱码

我没有中文啊,为什么也乱码

原字符
42 "SmallBeer" 3 5 1 3 2 6 1 1 0 2 130 1 40 1 2 0 0 0 20 60 |

到程序里面是

            String s = "42            \"SmallBeer\"        3               5                   1                   3                    2                      6                     1                         1                     0                     2                   130                     1              40               1              2                0              0                0               20                   60                   | \r\n";
                    byte[] _b  = s.getBytes("US-ASCII");
                    byte[] _bn  = s.getBytes();
                    byte[] _bu  = s.getBytes("UTF-8");
                    System.out.println(_b.toString());
                    Arrays.asList(_b).forEach(
                            b->{System.out.print(b+" ");});
                    
                    System.out.println();
                    System.out.println(_bn.toString());
                    Arrays.asList(_bn).forEach(
                            b->{System.out.print(b+" ");});
                    System.out.println();
                    System.out.println(_bu.toString());
                    Arrays.asList(_bu).forEach(
                            b->{System.out.print(b+" ");});

结果output

[B@74b0dfcd
[B@74b0dfcd
[B@32a87423
[B@32a87423
[B@20220e64
[B@20220e64

怎么完全不一样。

啊!啊!!啊!!!

关注 2 回答 1

Sharon_Xu 提出了问题 · 2019-04-16

onsubmit return check(); 还是会跳走,为什么

<script language="javascript">
   function CheckPost ()
   {
      if (addForm.user.value == "")
      {
          alert("请填写用户名!");
          addForm.username.focus();
          return false;
      }
     if (addForm.title.value.length < 5)
     {
          alert("标题不能少于5个字符!");
          addForm.title.focus();
          return false;
     }
     return true;
   }
</script>

<form action="test.php" method="post" name="addForm"  onsubmit="return CheckPost();">
     <div>用户:<input type="text" size="10" name="user" maxlength="20"/></div>
     <div>标题:<input type="text" name="title" maxlength="50"/></div>
     <div>内容:<textarea name="content" rows="8" cols="30"></textarea></div>
     <div>
           <input type="submit" name="submit" value="发表留言"/>
     </div>
</form>


源代码出处 [https://www.cnblogs.com/ahudyan-forever/p/5795463.html][1]

我试了,直接return false不会跳,但是 return CheckPost();还是会走到test.php
尽管途中出了alert警示窗

为什么,不太懂

关注 2 回答 1

Sharon_Xu 提出了问题 · 2019-04-11

servlet乱码

本来是"UTF-8"编码,是没有乱码的,
但是我写程序老是容易会中英字符混淆,就是因为输入法切换导致中文符号混入,于是我windows更新成
non-Unicode程序默认用英文。

然后之前写的中文字符串全都变乱码了,但是网页是正常的。

现在写的中文字符串代码里不是乱码,但是网页里是乱码,请问我该怎么办?

谢谢。

关注 2 回答 1

Sharon_Xu 提出了问题 · 2019-04-08

java List reference

java里面为什么List result会自动更新的?就是因为传的是引用吗?

public static void main(String[] args) throws IOException{
        Path startingDir = Paths.get("C:\\apache-tomcat-8.0.21");
        List<Path> result = new LinkedList<Path>();
        Files.walkFileTree(startingDir, new FindJavaVisitor(result));
        System.out.println("result.size()=" + result.size());        
    }
    
    private static class FindJavaVisitor extends SimpleFileVisitor<Path>{
        private List<Path> result;
        public FindJavaVisitor(List<Path> result){
            this.result = result;
        }
        @Override
        public FileVisitResult visitFile(Path file, BasicFileAttributes attrs){
            if(file.toString().endsWith(".java")){
                result.add(file.getFileName());
            }
            return FileVisitResult.CONTINUE;
        }
    }

关注 2 回答 1

认证与成就

  • 获得 3 次点赞
  • 获得 35 枚徽章 获得 0 枚金徽章, 获得 5 枚银徽章, 获得 30 枚铜徽章

擅长技能
编辑

(゚∀゚ )
暂时没有

开源项目 & 著作
编辑

(゚∀゚ )
暂时没有

注册于 2018-07-09
个人主页被 705 人浏览