linux Failed to open connection

安装完ubuntu后,用sudo passwd root 为root用户设置完密码后,su root切换到root账户后,在root账户下敲击命令每次有提示Failed to open connection to “session” message bus: ……
普通账户敲命令没有提示。
在网上搜了一下,用
sudo vi /etc/network/interfaces
添加
auto eth0
iface eth0 inet dhcp
用下面的命令使网络设置生效:
sudo /etc/init.d/networking restart
之后,还是有这个提示。
详细见图片。
怎么解决啊?
图片说明

1个回答

http://forums.debian.net/viewtopic.php?f=10&t=60421
这里面也有人遇到这种问题了,并且解决了,大致意思:

我在两个不同的场合遇到了这个错误。使用su命令-l选项会暂时解决问题,但是,你必须手动每次或编辑.profile或.bashrc中键入的选项。这两次我永久使用Synaptic来安装这两个GVFS-bin和GVFS,后端固定的错误/警告。你可能不小心删除了这些包与“易于得到的autoremove”或诸如此类的东西。

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
服务器内部错误 CDbConnection failed to open the DB connection.
服务器内部错误 CDbConnection failed to open the DB connection. 当前网页服务器在处理您的请求时,发生了一个内部错误. 请将此问题报告给服务器管理员 the webmaster. ![图片说明](https://img-ask.csdn.net/upload/201912/26/1577323577_413682.jpg) ## 我的这个IIS 是关闭状态 ![图片说明](https://img-ask.csdn.net/upload/201912/26/1577323643_581881.png) ## 这个网站依旧报这个错误 ![图片说明](https://img-ask.csdn.net/upload/201912/26/1577323697_880007.jpg) #在服务器里用浏览器访问正常 ![图片说明](https://img-ask.csdn.net/upload/201912/26/1577323798_194648.jpg) #感觉这个报错 和 IIS无关和系统有关 # #系统windows 2008 程序是html ,里面的内容就是上面最后一张图的内容“新建文本文档”,没有连接数据库,没有JS,没有css,就是这几个字,怪异的事,把IIS服务关了,依旧有这个报错 ---- 我写的文章有兴趣的看看吧,很怪异 服务器内部错误 CDbConnection failed to open the DB connection. https://blog.csdn.net/cplvfx/article/details/103716312
openoffice Linux注册
rpm已装,也装了freedesktop桌面,公司服务器linux centos64bit没有界面,就putty,ssh,ps-ef|grep soffice可以看到3个线程已启动,/bin/sh /opt/openoffice4/program/soffice --headless --accept="socket,host=127.0.0.1,port=8100;up;" --nofirststartwizard & 也能出来类似[1] 12751 ,但程序运行起来就报错,一直都是这个错Java.net.ConnectionException:connection failed:socket,host=local host,port=8100,tcpNoDelay=1:Java.net.connectionexception:connection refused…swftools都装好了flex paper也都调好了,这个doc2pdf出不来后面都没戏,另外,我用本地测试open office win版都是一次性pass的,估计是Linux无界面无法跳过注册?
公司GPU服务器两块nvidia 1080ti显卡,centos系统,无法startx
显卡驱动已经安装 按照网上教程装各种图形界面 startx都报错 相关错误日志和错误提示 ———————————— /var/log/Xorg.0.log日志如下 [ 883.706] X.Org X Server 1.19.5 Release Date: 2017-10-12 [ 883.707] X Protocol Version 11, Revision 0 [ 883.707] Build Operating System: 3.10.0-693.17.1.el7.x86_64 [ 883.708] Current Operating System: Linux yikumed-GPU 3.10.0-862.14.4.el7.x86_64 #1 SMP Wed Sep 26 15:12:11 UTC 2018 x86_64 [ 883.708] Kernel command line: BOOT_IMAGE=/vmlinuz-3.10.0-862.14.4.el7.x86_64 root=/dev/mapper/centos_yikumed--gpu-root ro crashkernel=auto rd.lvm.lv=centos_yikumed-gpu/root rd.lvm.lv=centos_yikumed-gpu/swap rhgb quiet LANG=zh_CN.UTF-8 [ 883.709] Build Date: 29 October 2018 03:33:19PM [ 883.709] Build ID: xorg-x11-server 1.19.5-5.1.el7_5.0.1 [ 883.710] Current version of pixman: 0.34.0 [ 883.710] Before reporting problems, check http://wiki.x.org to make sure that you have the latest version. [ 883.710] Markers: (--) probed, (**) from config file, (==) default setting, (++) from command line, (!!) notice, (II) informational, (WW) warning, (EE) error, (NI) not implemented, (??) unknown. [ 883.712] (==) Log file: "/var/log/Xorg.0.log", Time: Sat Nov 3 14:31:06 2018 [ 883.713] (==) Using config directory: "/etc/X11/xorg.conf.d" [ 883.713] (==) Using system config directory "/usr/share/X11/xorg.conf.d" [ 883.714] (==) No Layout section. Using the first Screen section. [ 883.714] (==) No screen section available. Using defaults. [ 883.714] (**) |-->Screen "Default Screen Section" (0) [ 883.714] (**) | |-->Monitor "<default monitor>" [ 883.714] (==) No monitor specified for screen "Default Screen Section". Using a default monitor configuration. [ 883.714] (==) Automatically adding devices [ 883.714] (==) Automatically enabling devices [ 883.714] (==) Automatically adding GPU devices [ 883.714] (==) Automatically binding GPU devices [ 883.714] (==) Max clients allowed: 256, resource mask: 0x1fffff [ 883.714] (==) FontPath set to: catalogue:/etc/X11/fontpath.d, built-ins [ 883.714] (==) ModulePath set to "/usr/lib64/xorg/modules" [ 883.714] (II) The server relies on udev to provide the list of input devices. If no devices become available, reconfigure udev or disable AutoAddDevices. [ 883.714] (II) Loader magic: 0x557fe15eb020 [ 883.714] (II) Module ABI versions: [ 883.714] X.Org ANSI C Emulation: 0.4 [ 883.714] X.Org Video Driver: 23.0 [ 883.714] X.Org XInput driver : 24.1 [ 883.714] X.Org Server Extension : 10.0 [ 883.714] (II) xfree86: Adding drm device (/dev/dri/card0) [ 883.715] (II) xfree86: Adding drm device (/dev/dri/card1) [ 883.743] (--) PCI: (0:23:0:0) 10de:1b06:1028:3600 rev 161, Mem @ 0x91000000/16777216, 0x380060000000/268435456, 0x380070000000/33554432, I/O @ 0x00005000/128, BIOS @ 0x????????/524288 [ 883.743] (--) PCI:*(0:115:0:0) 10de:1b06:1028:3600 rev 161, Mem @ 0xc4000000/16777216, 0xb0000000/268435456, 0xc0000000/33554432, I/O @ 0x00009000/128, BIOS @ 0x????????/524288 [ 883.743] (II) LoadModule: "glx" [ 883.744] (II) Loading /usr/lib64/xorg/modules/extensions/libglx.so [ 883.745] (II) Module glx: vendor="X.Org Foundation" [ 883.745] compiled for 1.19.5, module version = 1.0.0 [ 883.745] ABI class: X.Org Server Extension, version 10.0 [ 884.113] (==) Matched nouveau as autoconfigured driver 0 [ 884.113] (==) Matched nouveau as autoconfigured driver 1 [ 884.113] (==) Matched nouveau as autoconfigured driver 2 [ 884.113] (==) Matched modesetting as autoconfigured driver 3 [ 884.113] (==) Matched fbdev as autoconfigured driver 4 [ 884.113] (==) Matched vesa as autoconfigured driver 5 [ 884.113] (==) Assigned the driver to the xf86ConfigLayout [ 884.113] (II) LoadModule: "nouveau" [ 884.113] (II) Loading /usr/lib64/xorg/modules/drivers/nouveau_drv.so [ 884.114] (II) Module nouveau: vendor="X.Org Foundation" [ 884.114] compiled for 1.19.3, module version = 1.0.13 [ 884.114] Module class: X.Org Video Driver [ 884.114] ABI class: X.Org Video Driver, version 23.0 [ 884.114] (II) LoadModule: "modesetting" [ 884.115] (II) Loading /usr/lib64/xorg/modules/drivers/modesetting_drv.so [ 884.115] (II) Module modesetting: vendor="X.Org Foundation" [ 884.115] compiled for 1.19.5, module version = 1.19.5 [ 884.115] Module class: X.Org Video Driver [ 884.115] ABI class: X.Org Video Driver, version 23.0 [ 884.115] (II) LoadModule: "fbdev" [ 884.115] (II) Loading /usr/lib64/xorg/modules/drivers/fbdev_drv.so [ 884.115] (II) Module fbdev: vendor="X.Org Foundation" [ 884.115] compiled for 1.19.3, module version = 0.4.3 [ 884.115] Module class: X.Org Video Driver [ 884.115] ABI class: X.Org Video Driver, version 23.0 [ 884.115] (II) LoadModule: "vesa" [ 884.116] (II) Loading /usr/lib64/xorg/modules/drivers/vesa_drv.so [ 884.116] (II) Module vesa: vendor="X.Org Foundation" [ 884.116] compiled for 1.19.3, module version = 2.3.2 [ 884.116] Module class: X.Org Video Driver [ 884.116] ABI class: X.Org Video Driver, version 23.0 [ 884.116] (II) NOUVEAU driver [ 884.116] (II) NOUVEAU driver for NVIDIA chipset families : [ 884.116] RIVA TNT (NV04) [ 884.116] RIVA TNT2 (NV05) [ 884.116] GeForce 256 (NV10) [ 884.116] GeForce 2 (NV11, NV15) [ 884.116] GeForce 4MX (NV17, NV18) [ 884.116] GeForce 3 (NV20) [ 884.116] GeForce 4Ti (NV25, NV28) [ 884.116] GeForce FX (NV3x) [ 884.116] GeForce 6 (NV4x) [ 884.116] GeForce 7 (G7x) [ 884.116] GeForce 8 (G8x) [ 884.116] GeForce GTX 200 (NVA0) [ 884.117] GeForce GTX 400 (NVC0) [ 884.117] (II) modesetting: Driver for Modesetting Kernel Drivers: kms [ 884.117] (II) FBDEV: driver for framebuffer: fbdev [ 884.117] (II) VESA: driver for VESA chipsets: vesa [ 884.117] (++) using VT number 2 [ 884.120] (EE) [drm] Failed to open DRM device for (null): -2 [ 884.120] (EE) [drm] Failed to open DRM device for (null): -2 [ 884.120] (EE) [drm] Failed to open DRM device for (null): -2 [ 884.120] (EE) [drm] Failed to open DRM device for (null): -2 [ 884.120] (EE) [drm] Failed to open DRM device for (null): -2 [ 884.120] (EE) [drm] Failed to open DRM device for pci:0000:73:00.0: -2 [ 884.120] (EE) [drm] Failed to open DRM device for pci:0000:73:00.0: -2 [ 884.120] (EE) [drm] Failed to open DRM device for pci:0000:73:00.0: -2 [ 884.121] (WW) Falling back to old probe method for modesetting [ 884.121] (II) Loading sub module "fbdevhw" [ 884.121] (II) LoadModule: "fbdevhw" [ 884.121] (II) Loading /usr/lib64/xorg/modules/libfbdevhw.so [ 884.121] (II) Module fbdevhw: vendor="X.Org Foundation" [ 884.121] compiled for 1.19.5, module version = 0.0.2 [ 884.121] ABI class: X.Org Video Driver, version 23.0 [ 884.121] (EE) open /dev/fb0: No such file or directory [ 884.121] (WW) Falling back to old probe method for fbdev [ 884.121] (II) Loading sub module "fbdevhw" [ 884.121] (II) LoadModule: "fbdevhw" [ 884.122] (II) Loading /usr/lib64/xorg/modules/libfbdevhw.so [ 884.122] (II) Module fbdevhw: vendor="X.Org Foundation" [ 884.122] compiled for 1.19.5, module version = 0.0.2 [ 884.122] ABI class: X.Org Video Driver, version 23.0 [ 884.122] (EE) open /dev/fb0: No such file or directory [ 884.122] vesa: Ignoring device with a bound kernel driver [ 884.122] (WW) Falling back to old probe method for vesa [ 884.122] (EE) Screen 0 deleted because of no matching config section. [ 884.122] (II) UnloadModule: "modesetting" [ 884.122] (EE) Screen 0 deleted because of no matching config section. [ 884.122] (II) UnloadModule: "fbdev" [ 884.122] (II) UnloadSubModule: "fbdevhw" [ 884.122] (EE) Screen 0 deleted because of no matching config section. [ 884.122] (II) UnloadModule: "vesa" [ 884.122] (EE) Device(s) detected, but none match those in the config file. [ 884.122] (EE) Fatal server error: [ 884.122] (EE) no screens found(EE) [ 884.122] (EE) Please consult the The X.Org Foundation support at http://wiki.x.org for help. [ 884.122] (EE) Please also check the log file at "/var/log/Xorg.0.log" for additional information. [ 884.122] (EE) [ 884.124] (EE) Server terminated with error (1). Closing log file. —————————————————————————— 运行startx错误提示 xauth: file /root/.serverauth.3246 does not exist xauth: (stdin):2: unknown command "8236e144403225f38c522dc0f25435bd" xauth: (stdin):3: unknown command "8236e144403225f38c522dc0f25435bd" X.Org X Server 1.19.5 Release Date: 2017-10-12 X Protocol Version 11, Revision 0 Build Operating System: 3.10.0-693.17.1.el7.x86_64 Current Operating System: Linux yikumed-GPU 3.10.0-862.14.4.el7.x86_64 #1 SMP Wed Sep 26 15:12:11 UTC 2018 x86_64 Kernel command line: BOOT_IMAGE=/vmlinuz-3.10.0-862.14.4.el7.x86_64 root=/dev/mapper/centos_yikumed--gpu-root ro crashkernel=auto rd.lvm.lv=centos_yikumed-gpu/root rd.lvm.lv=centos_yikumed-gpu/swap rhgb quiet LANG=zh_CN.UTF-8 Build Date: 29 October 2018 03:33:19PM Build ID: xorg-x11-server 1.19.5-5.1.el7_5.0.1 Current version of pixman: 0.34.0 Before reporting problems, check http://wiki.x.org to make sure that you have the latest version. Markers: (--) probed, (**) from config file, (==) default setting, (++) from command line, (!!) notice, (II) informational, (WW) warning, (EE) error, (NI) not implemented, (??) unknown. (==) Log file: "/var/log/Xorg.0.log", Time: Sat Nov 3 12:39:52 2018 (==) Using config directory: "/etc/X11/xorg.conf.d" (==) Using system config directory "/usr/share/X11/xorg.conf.d" vesa: Ignoring device with a bound kernel driver (EE) Fatal server error: (EE) no screens found(EE) (EE) Please consult the The X.Org Foundation support at http://wiki.x.org for help. (EE) Please also check the log file at "/var/log/Xorg.0.log" for additional information. (EE) (EE) Server terminated with error (1). Closing log file. xinit: giving up xinit: unable to connect to X server: Connection refused xinit: server error
linux调用swt网页截屏
在linux weblogic 服务器调用swt进行网页截屏时报错,困扰了大半个月了,还请各位朋友帮帮~~, 使用的是 DJNativeSwing-SWT.jar DJNativeSwing.jar swt.jar jna-4.0.0.jar NativeSwing[1]: Exception in thread "main" java.lang.reflect.InvocationTargetException NativeSwing[1]: at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) NativeSwing[1]: at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) NativeSwing[1]: at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) NativeSwing[1]: at java.lang.reflect.Method.invoke(Method.java:597) NativeSwing[1]: at chrriis.common.NetworkURLClassLoader.main(NetworkURLClassLoader.java:96) NativeSwing[1]: Caused by: org.eclipse.swt.SWTError: No more handles [gtk_init_check() failed] NativeSwing[1]: at org.eclipse.swt.SWT.error(Unknown Source) NativeSwing[1]: at org.eclipse.swt.widgets.Display.createDisplay(Unknown Source) NativeSwing[1]: at org.eclipse.swt.widgets.Display.create(Unknown Source) NativeSwing[1]: at org.eclipse.swt.graphics.Device.<init>(Unknown Source) NativeSwing[1]: at org.eclipse.swt.widgets.Display.<init>(Unknown Source) NativeSwing[1]: at chrriis.dj.nativeswing.swtimpl.NativeInterface$OutProcess.runNativeSide(NativeInterface.java:999) NativeSwing[1]: at chrriis.dj.nativeswing.swtimpl.NativeInterface.main(NativeInterface.java:1096) NativeSwing[1]: ... 5 more NativeSwing[2]: Exception in thread "main" java.lang.reflect.InvocationTargetException NativeSwing[2]: at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) NativeSwing[2]: at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) NativeSwing[2]: at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) NativeSwing[2]: at java.lang.reflect.Method.invoke(Method.java:597) NativeSwing[2]: at chrriis.common.NetworkURLClassLoader.main(NetworkURLClassLoader.java:96) NativeSwing[2]: Caused by: org.eclipse.swt.SWTError: No more handles [gtk_init_check() failed] NativeSwing[2]: at org.eclipse.swt.SWT.error(Unknown Source) NativeSwing[2]: at org.eclipse.swt.widgets.Display.createDisplay(Unknown Source) NativeSwing[2]: at org.eclipse.swt.widgets.Display.create(Unknown Source) NativeSwing[2]: at org.eclipse.swt.graphics.Device.<init>(Unknown Source) NativeSwing[2]: at org.eclipse.swt.widgets.Display.<init>(Unknown Source) NativeSwing[2]: at chrriis.dj.nativeswing.swtimpl.NativeInterface$OutProcess.runNativeSide(NativeInterface.java:999) NativeSwing[2]: at chrriis.dj.nativeswing.swtimpl.NativeInterface.main(NativeInterface.java:1096) NativeSwing[2]: ... 5 more NativeSwing[3]: Exception in thread "main" java.lang.reflect.InvocationTargetException NativeSwing[3]: at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) NativeSwing[3]: at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) NativeSwing[3]: at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) NativeSwing[3]: at java.lang.reflect.Method.invoke(Method.java:597) NativeSwing[3]: at chrriis.common.NetworkURLClassLoader.main(NetworkURLClassLoader.java:96) NativeSwing[3]: Caused by: org.eclipse.swt.SWTError: No more handles [gtk_init_check() failed] NativeSwing[3]: at org.eclipse.swt.SWT.error(Unknown Source) NativeSwing[3]: at org.eclipse.swt.widgets.Display.createDisplay(Unknown Source) NativeSwing[3]: at org.eclipse.swt.widgets.Display.create(Unknown Source) NativeSwing[3]: at org.eclipse.swt.graphics.Device.<init>(Unknown Source) NativeSwing[3]: at org.eclipse.swt.widgets.Display.<init>(Unknown Source) NativeSwing[3]: at chrriis.dj.nativeswing.swtimpl.NativeInterface$OutProcess.runNativeSide(NativeInterface.java:999) NativeSwing[3]: at chrriis.dj.nativeswing.swtimpl.NativeInterface.main(NativeInterface.java:1096) NativeSwing[3]: ... 5 more java.lang.RuntimeException: java.net.SocketException: Connection reset NativeInterface.open:java.lang.RuntimeException: java.net.SocketException: Connection reset at chrriis.dj.nativeswing.swtimpl.OutProcessSocketsMessagingInterface.openChannel(OutProcessSocketsMessagingInterface.java:64) at chrriis.dj.nativeswing.swtimpl.MessagingInterface.initialize(MessagingInterface.java:51) at chrriis.dj.nativeswing.swtimpl.OutProcessSocketsMessagingInterface.<init>(OutProcessSocketsMessagingInterface.java:29) at chrriis.dj.nativeswing.swtimpl.OutProcessSocketsMessagingInterface$SwingOutProcessSocketsMessagingInterface.<init>(OutProcessSocketsMessagingInterface.java:151) at chrriis.dj.nativeswing.swtimpl.NativeInterface$OutProcess.createOutProcessMessagingInterface(NativeInterface.java:830) at chrriis.dj.nativeswing.swtimpl.NativeInterface$OutProcess.createOutProcessCommunicationChannel(NativeInterface.java:540) at chrriis.dj.nativeswing.swtimpl.NativeInterface.open(NativeInterface.java:244) at sunline.common.logic.filter.FileFilter.doFilter(FileFilter.java:103) at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:60) at sunline.common.logic.filter.EncodingFilter.doFilter(EncodingFilter.java:39) at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:60) at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3739) at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3705) at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321) at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120) at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2282) at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2181) at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1491) at weblogic.work.ExecuteThread.execute(ExecuteThread.java:256) at weblogic.work.ExecuteThread.run(ExecuteThread.java:221) Caused by: java.net.SocketException: Connection reset at java.net.SocketInputStream.read(SocketInputStream.java:168) at java.io.BufferedInputStream.fill(BufferedInputStream.java:218) at java.io.BufferedInputStream.read1(BufferedInputStream.java:258) at java.io.BufferedInputStream.read(BufferedInputStream.java:317) at java.io.ObjectInputStream$PeekInputStream.read(ObjectInputStream.java:2266) at java.io.ObjectInputStream$PeekInputStream.readFully(ObjectInputStream.java:2279) at java.io.ObjectInputStream$BlockDataInputStream.readShort(ObjectInputStream.java:2750) at java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:780) at java.io.ObjectInputStream.<init>(ObjectInputStream.java:280) at chrriis.dj.nativeswing.swtimpl.OutProcessSocketsMessagingInterface.openChannel(OutProcessSocketsMessagingInterface.java:62) ... 19 more
linux文件传输,初学,请大家帮忙,谢谢
我 已经连接上了服务端,它有怎样的信息传输功能呢?![图片说明](https://img-ask.csdn.net/upload/201505/06/1430904207_926408.png) #include <pthread.h> #include <signal.h> #include <stdlib.h> #include <stdio.h> #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include <sys/select.h> #include <errno.h> #include <fcntl.h> #include <sys/stat.h> #include <string.h> #include <unistd.h> #include <sys/time.h> #include <arpa/inet.h> #include "serv_client.h" int main(int argc,char** argv) { int sockfd; int clientfd; uint16_t port; int ret; pid_t pid; struct sockaddr_in server_addr; if ( 2 != argc ){ printf("usage:command listen_port\n"); return -1; } port = atoi(argv[1]); server_addr.sin_family = AF_INET; server_addr.sin_addr.s_addr = INADDR_ANY; server_addr.sin_port = htons(port); sockfd = socket(PF_INET,SOCK_STREAM,0); if (sockfd < 0) { perror("open data stream socket failed!\n"); return -1; } ret = bind(sockfd,(struct sockaddr *)&server_addr,sizeof(server_addr)); if(ret < 0) { perror("bind data socket failed!\n"); return -1; } ret = listen(sockfd, SOMAXCONN ); if( ret < 0) { perror("listening data stream failed!\n"); return -1; } printf("Waiting for client conneciton...\n"); while(1) { clientfd = accept(sockfd, NULL, NULL); if( clientfd < 0) { perror("accept data connection error!\n"); return -1; } pid = fork(); if ( pid < 0 ){ perror("fork error!\n"); } if ( 0 == pid ){ //chid process printf("one client come ...\n"); serv_client(clientfd); return 0; } close(clientfd); } } #include <pthread.h> #include <signal.h> #include <stdlib.h> #include <stdio.h> #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include <errno.h> #include <fcntl.h> #include <sys/stat.h> #include <string.h> #include <dirent.h> #include <unistd.h> #include <netdb.h> #include <sys/time.h> #include "client_process.h" void usage() { printf("command ip_addr port\n"); } int main(int argc,char **argv) { struct sockaddr_in server; int sockfd; int port; int ip_addr; int ret; if ( 3 != argc ){ usage(); return -1; } sockfd = socket(PF_INET, SOCK_STREAM , 0); if(sockfd < 0) { perror("data stream socket create failed!\n"); return -1; } server.sin_family = AF_INET; port = atoi(argv[2]); server.sin_port = htons(port); ret = inet_pton(AF_INET, argv[1], &server.sin_addr.s_addr); if ( ret <=0 ){ printf("your ip address is unvalide!\n"); usage(); return -1; } ret = connect(sockfd,(struct sockaddr*) &server,sizeof(struct sockaddr_in)); if(ret < 0) { perror("data connection is failed!\n"); return -1; } printf("connect to server successfully!\n"); clinet_process( sockfd ); }
linux系统下使用snmpset命令始终报错,,,
[root@localhost 桌面]# snmpset -v2c -c public -On localhost system.sysName.0 s linux Error in packet. Reason: noAccess Failed object: .1.3.6.1.2.1.1.5.0 始终处于这个错误,请各路大神帮帮我,感激不尽,,,,我的conmpd.conf文件是: ############################################################################### # # snmpd.conf: # An example configuration file for configuring the ucd-snmp snmpd agent. # ############################################################################### # # This file is intended to only be as a starting point. Many more # configuration directives exist than are mentioned in this file. For # full details, see the snmpd.conf(5) manual page. # # All lines beginning with a '#' are comments and are intended for you # to read. All other lines are configuration commands for the agent. ############################################################################### # Access Control ############################################################################### # As shipped, the snmpd demon will only respond to queries on the # system mib group until this file is replaced or modified for # security purposes. Examples are shown below about how to increase the # level of access. # By far, the most common question I get about the agent is "why won't # it work?", when really it should be "how do I configure the agent to # allow me to access it?" # # By default, the agent responds to the "public" community for read # only access, if run out of the box without any configuration file in # place. The following examples show you other ways of configuring # the agent so that you can change the community names, and give # yourself write access to the mib tree as well. # # For more information, read the FAQ as well as the snmpd.conf(5) # manual page. #### # First, map the community name "public" into a "security name" # sec.name source community com2sec notConfigUser default public #### # Second, map the security name into a group name: # groupName securityModel securityName group notConfigGroup v1 notConfigUser group notConfigGroup v2c notConfigUser #### # Third, create a view for us to let the group have rights to: # Make at least snmpwalk -v 1 localhost -c public system fast again. # name incl/excl subtree mask(optional) view systemview included .1 view systemview included .1.3.6.1.2.1.1 view systemview included .1.3.6.1.2.1.25.1.1 #### # Finally, grant the group read-only access to the systemview view. # group context sec.model sec.level prefix read write notif access notConfigGroup "" any noauth exact systemview none none # ----------------------------------------------------------------------------- # Here is a commented out example configuration that allows less # restrictive access. # YOU SHOULD CHANGE THE "COMMUNITY" TOKEN BELOW TO A NEW KEYWORD ONLY # KNOWN AT YOUR SITE. YOU *MUST* CHANGE THE NETWORK TOKEN BELOW TO # SOMETHING REFLECTING YOUR LOCAL NETWORK ADDRESS SPACE. ## sec.name source community #com2sec local localhost COMMUNITY #com2sec mynetwork NETWORK/24 COMMUNITY ## group.name sec.model sec.name #group MyRWGroup any local #group MyROGroup any mynetwork # #group MyRWGroup any otherv3user #... ## incl/excl subtree mask #view all included .1 80 ## -or just the mib2 tree- #view mib2 included .iso.org.dod.internet.mgmt.mib-2 fc ## context sec.model sec.level prefix read write notif #access MyROGroup "" any noauth 0 all none none #access MyRWGroup "" any noauth 0 all all all ############################################################################### # Sample configuration to make net-snmpd RFC 1213. # Unfortunately v1 and v2c don't allow any user based authentification, so # opening up the default config is not an option from a security point. # # WARNING: If you uncomment the following lines you allow write access to your # snmpd daemon from any source! To avoid this use different names for your # community or split out the write access to a different community and # restrict it to your local network. # Also remember to comment the syslocation and syscontact parameters later as # otherwise they are still read only (see FAQ for net-snmp). # # First, map the community name "public" into a "security name" # sec.name source community #com2sec notConfigUser default public # Second, map the security name into a group name: # groupName securityModel securityName #group notConfigGroup v1 notConfigUser #group notConfigGroup v2c notConfigUser # Third, create a view for us to let the group have rights to: # Open up the whole tree for ro, make the RFC 1213 required ones rw. # name incl/excl subtree mask(optional) #view roview included .1 #view rwview included system.sysContact #view rwview included system.sysName #view rwview included system.sysLocation #view rwview included interfaces.ifTable.ifEntry.ifAdminStatus #view rwview included at.atTable.atEntry.atPhysAddress #view rwview included at.atTable.atEntry.atNetAddress #view rwview included ip.ipForwarding #view rwview included ip.ipDefaultTTL #view rwview included ip.ipRouteTable.ipRouteEntry.ipRouteDest #view rwview included ip.ipRouteTable.ipRouteEntry.ipRouteIfIndex #view rwview included ip.ipRouteTable.ipRouteEntry.ipRouteMetric1 #view rwview included ip.ipRouteTable.ipRouteEntry.ipRouteMetric2 #view rwview included ip.ipRouteTable.ipRouteEntry.ipRouteMetric3 #view rwview included ip.ipRouteTable.ipRouteEntry.ipRouteMetric4 #view rwview included ip.ipRouteTable.ipRouteEntry.ipRouteType #view rwview included ip.ipRouteTable.ipRouteEntry.ipRouteAge #view rwview included ip.ipRouteTable.ipRouteEntry.ipRouteMask #view rwview included ip.ipRouteTable.ipRouteEntry.ipRouteMetric5 #view rwview included ip.ipNetToMediaTable.ipNetToMediaEntry.ipNetToMediaIfIndex #view rwview included ip.ipNetToMediaTable.ipNetToMediaEntry.ipNetToMediaPhysAddress #view rwview included ip.ipNetToMediaTable.ipNetToMediaEntry.ipNetToMediaNetAddress #view rwview included ip.ipNetToMediaTable.ipNetToMediaEntry.ipNetToMediaType #view rwview included tcp.tcpConnTable.tcpConnEntry.tcpConnState #view rwview included egp.egpNeighTable.egpNeighEntry.egpNeighEventTrigger #view rwview included snmp.snmpEnableAuthenTraps # Finally, grant the group read-only access to the systemview view. # group context sec.model sec.level prefix read write notif #access notConfigGroup "" any noauth exact roview rwview none ############################################################################### # System contact information # # It is also possible to set the sysContact and sysLocation system # variables through the snmpd.conf file: syslocation Unknown (edit /etc/snmp/snmpd.conf) syscontact Root <root@localhost> (configure /etc/snmp/snmp.local.conf) # Example output of snmpwalk: # % snmpwalk -v 1 localhost -c public system # system.sysDescr.0 = "SunOS name sun4c" # system.sysObjectID.0 = OID: enterprises.ucdavis.ucdSnmpAgent.sunos4 # system.sysUpTime.0 = Timeticks: (595637548) 68 days, 22:32:55 # system.sysContact.0 = "Me <me@somewhere.org>" # system.sysName.0 = "name" # system.sysLocation.0 = "Right here, right now." # system.sysServices.0 = 72 ############################################################################### # Logging # # We do not want annoying "Connection from UDP: " messages in syslog. # If the following option is commented out, snmpd will print each incoming # connection, which can be useful for debugging. dontLogTCPWrappersConnects yes # ----------------------------------------------------------------------------- ############################################################################### # Process checks. # # The following are examples of how to use the agent to check for # processes running on the host. The syntax looks something like: # # proc NAME [MAX=0] [MIN=0] # # NAME: the name of the process to check for. It must match # exactly (ie, http will not find httpd processes). # MAX: the maximum number allowed to be running. Defaults to 0. # MIN: the minimum number to be running. Defaults to 0. # # Examples (commented out by default): # # Make sure mountd is running proc mountd # Make sure there are no more than 4 ntalkds running, but 0 is ok too. proc ntalkd 4 # Make sure at least one sendmail, but less than or equal to 10 are running. proc sendmail 10 1 # A snmpwalk of the process mib tree would look something like this: # # % snmpwalk -v 1 localhost -c public .1.3.6.1.4.1.2021.2 # enterprises.ucdavis.procTable.prEntry.prIndex.1 = 1 # enterprises.ucdavis.procTable.prEntry.prIndex.2 = 2 # enterprises.ucdavis.procTable.prEntry.prIndex.3 = 3 # enterprises.ucdavis.procTable.prEntry.prNames.1 = "mountd" # enterprises.ucdavis.procTable.prEntry.prNames.2 = "ntalkd" # enterprises.ucdavis.procTable.prEntry.prNames.3 = "sendmail" # enterprises.ucdavis.procTable.prEntry.prMin.1 = 0 # enterprises.ucdavis.procTable.prEntry.prMin.2 = 0 # enterprises.ucdavis.procTable.prEntry.prMin.3 = 1 # enterprises.ucdavis.procTable.prEntry.prMax.1 = 0 # enterprises.ucdavis.procTable.prEntry.prMax.2 = 4 # enterprises.ucdavis.procTable.prEntry.prMax.3 = 10 # enterprises.ucdavis.procTable.prEntry.prCount.1 = 0 # enterprises.ucdavis.procTable.prEntry.prCount.2 = 0 # enterprises.ucdavis.procTable.prEntry.prCount.3 = 1 # enterprises.ucdavis.procTable.prEntry.prErrorFlag.1 = 1 # enterprises.ucdavis.procTable.prEntry.prErrorFlag.2 = 0 # enterprises.ucdavis.procTable.prEntry.prErrorFlag.3 = 0 # enterprises.ucdavis.procTable.prEntry.prErrMessage.1 = "No mountd process running." # enterprises.ucdavis.procTable.prEntry.prErrMessage.2 = "" # enterprises.ucdavis.procTable.prEntry.prErrMessage.3 = "" # enterprises.ucdavis.procTable.prEntry.prErrFix.1 = 0 # enterprises.ucdavis.procTable.prEntry.prErrFix.2 = 0 # enterprises.ucdavis.procTable.prEntry.prErrFix.3 = 0 # # Note that the errorFlag for mountd is set to 1 because one is not # running (in this case an rpc.mountd is, but thats not good enough), # and the ErrMessage tells you what's wrong. The configuration # imposed in the snmpd.conf file is also shown. # # Special Case: When the min and max numbers are both 0, it assumes # you want a max of infinity and a min of 1. # # ----------------------------------------------------------------------------- ############################################################################### # Executables/scripts # # # You can also have programs run by the agent that return a single # line of output and an exit code. Here are two examples. # # exec NAME PROGRAM [ARGS ...] # # NAME: A generic name. The name must be unique for each exec statement. # PROGRAM: The program to run. Include the path! # ARGS: optional arguments to be passed to the program # a simple hello world exec echotest /bin/echo hello world # Run a shell script containing: # # #!/bin/sh # echo hello world # echo hi there # exit 35 # # Note: this has been specifically commented out to prevent # accidental security holes due to someone else on your system writing # a /tmp/shtest before you do. Uncomment to use it. # #exec shelltest /bin/sh /tmp/shtest # Then, # % snmpwalk -v 1 localhost -c public .1.3.6.1.4.1.2021.8 # enterprises.ucdavis.extTable.extEntry.extIndex.1 = 1 # enterprises.ucdavis.extTable.extEntry.extIndex.2 = 2 # enterprises.ucdavis.extTable.extEntry.extNames.1 = "echotest" # enterprises.ucdavis.extTable.extEntry.extNames.2 = "shelltest" # enterprises.ucdavis.extTable.extEntry.extCommand.1 = "/bin/echo hello world" # enterprises.ucdavis.extTable.extEntry.extCommand.2 = "/bin/sh /tmp/shtest" # enterprises.ucdavis.extTable.extEntry.extResult.1 = 0 # enterprises.ucdavis.extTable.extEntry.extResult.2 = 35 # enterprises.ucdavis.extTable.extEntry.extOutput.1 = "hello world." # enterprises.ucdavis.extTable.extEntry.extOutput.2 = "hello world." # enterprises.ucdavis.extTable.extEntry.extErrFix.1 = 0 # enterprises.ucdavis.extTable.extEntry.extErrFix.2 = 0 # Note that the second line of the /tmp/shtest shell script is cut # off. Also note that the exit status of 35 was returned. # ----------------------------------------------------------------------------- ############################################################################### # disk checks # # The agent can check the amount of available disk space, and make # sure it is above a set limit. # disk PATH [MIN=100000] # # PATH: mount path to the disk in question. # MIN: Disks with space below this value will have the Mib's errorFlag set. # Default value = 100000. # Check the / partition and make sure it contains at least 10 megs. disk / 10000 # % snmpwalk -v 1 localhost -c public .1.3.6.1.4.1.2021.9 # enterprises.ucdavis.diskTable.dskEntry.diskIndex.1 = 0 # enterprises.ucdavis.diskTable.dskEntry.diskPath.1 = "/" Hex: 2F # enterprises.ucdavis.diskTable.dskEntry.diskDevice.1 = "/dev/dsk/c201d6s0" # enterprises.ucdavis.diskTable.dskEntry.diskMinimum.1 = 10000 # enterprises.ucdavis.diskTable.dskEntry.diskTotal.1 = 837130 # enterprises.ucdavis.diskTable.dskEntry.diskAvail.1 = 316325 # enterprises.ucdavis.diskTable.dskEntry.diskUsed.1 = 437092 # enterprises.ucdavis.diskTable.dskEntry.diskPercent.1 = 58 # enterprises.ucdavis.diskTable.dskEntry.diskErrorFlag.1 = 0 # enterprises.ucdavis.diskTable.dskEntry.diskErrorMsg.1 = "" # ----------------------------------------------------------------------------- ############################################################################### # load average checks # # load [1MAX=12.0] [5MAX=12.0] [15MAX=12.0] # # 1MAX: If the 1 minute load average is above this limit at query # time, the errorFlag will be set. # 5MAX: Similar, but for 5 min average. # 15MAX: Similar, but for 15 min average. # Check for loads: load 12 14 14 # % snmpwalk -v 1 localhost -c public .1.3.6.1.4.1.2021.10 # enterprises.ucdavis.loadTable.laEntry.loadaveIndex.1 = 1 # enterprises.ucdavis.loadTable.laEntry.loadaveIndex.2 = 2 # enterprises.ucdavis.loadTable.laEntry.loadaveIndex.3 = 3 # enterprises.ucdavis.loadTable.laEntry.loadaveNames.1 = "Load-1" # enterprises.ucdavis.loadTable.laEntry.loadaveNames.2 = "Load-5" # enterprises.ucdavis.loadTable.laEntry.loadaveNames.3 = "Load-15" # enterprises.ucdavis.loadTable.laEntry.loadaveLoad.1 = "0.49" Hex: 30 2E 34 39 # enterprises.ucdavis.loadTable.laEntry.loadaveLoad.2 = "0.31" Hex: 30 2E 33 31 # enterprises.ucdavis.loadTable.laEntry.loadaveLoad.3 = "0.26" Hex: 30 2E 32 36 # enterprises.ucdavis.loadTable.laEntry.loadaveConfig.1 = "12.00" # enterprises.ucdavis.loadTable.laEntry.loadaveConfig.2 = "14.00" # enterprises.ucdavis.loadTable.laEntry.loadaveConfig.3 = "14.00" # enterprises.ucdavis.loadTable.laEntry.loadaveErrorFlag.1 = 0 # enterprises.ucdavis.loadTable.laEntry.loadaveErrorFlag.2 = 0 # enterprises.ucdavis.loadTable.laEntry.loadaveErrorFlag.3 = 0 # enterprises.ucdavis.loadTable.laEntry.loadaveErrMessage.1 = "" # enterprises.ucdavis.loadTable.laEntry.loadaveErrMessage.2 = "" # enterprises.ucdavis.loadTable.laEntry.loadaveErrMessage.3 = "" # ----------------------------------------------------------------------------- ############################################################################### # Extensible sections. # # This alleviates the multiple line output problem found in the # previous executable mib by placing each mib in its own mib table: # Run a shell script containing: # # #!/bin/sh # echo hello world # echo hi there # exit 35 # # Note: this has been specifically commented out to prevent # accidental security holes due to someone else on your system writing # a /tmp/shtest before you do. Uncomment to use it. # # exec .1.3.6.1.4.1.2021.50 shelltest /bin/sh /tmp/shtest # % snmpwalk -v 1 localhost -c public .1.3.6.1.4.1.2021.50 # enterprises.ucdavis.50.1.1 = 1 # enterprises.ucdavis.50.2.1 = "shelltest" # enterprises.ucdavis.50.3.1 = "/bin/sh /tmp/shtest" # enterprises.ucdavis.50.100.1 = 35 # enterprises.ucdavis.50.101.1 = "hello world." # enterprises.ucdavis.50.101.2 = "hi there." # enterprises.ucdavis.50.102.1 = 0 # Now the Output has grown to two lines, and we can see the 'hi # there.' output as the second line from our shell script. # # Note that you must alter the mib.txt file to be correct if you want # the .50.* outputs above to change to reasonable text descriptions. # Other ideas: # # exec .1.3.6.1.4.1.2021.51 ps /bin/ps # exec .1.3.6.1.4.1.2021.52 top /usr/local/bin/top # exec .1.3.6.1.4.1.2021.53 mailq /usr/bin/mailq # ----------------------------------------------------------------------------- ############################################################################### # Pass through control. # # Usage: # pass MIBOID EXEC-COMMAND # # This will pass total control of the mib underneath the MIBOID # portion of the mib to the EXEC-COMMAND. # # Note: You'll have to change the path of the passtest script to your # source directory or install it in the given location. # # Example: (see the script for details) # (commented out here since it requires that you place the # script in the right location. (its not installed by default)) # pass .1.3.6.1.4.1.2021.255 /bin/sh /usr/local/local/passtest # % snmpwalk -v 1 localhost -c public .1.3.6.1.4.1.2021.255 # enterprises.ucdavis.255.1 = "life the universe and everything" # enterprises.ucdavis.255.2.1 = 42 # enterprises.ucdavis.255.2.2 = OID: 42.42.42 # enterprises.ucdavis.255.3 = Timeticks: (363136200) 42 days, 0:42:42 # enterprises.ucdavis.255.4 = IpAddress: 127.0.0.1 # enterprises.ucdavis.255.5 = 42 # enterprises.ucdavis.255.6 = Gauge: 42 # # % snmpget -v 1 localhost public .1.3.6.1.4.1.2021.255.5 # enterprises.ucdavis.255.5 = 42 # # % snmpset -v 1 localhost public .1.3.6.1.4.1.2021.255.1 s "New string" # enterprises.ucdavis.255.1 = "New string" # # For specific usage information, see the man/snmpd.conf.5 manual page # as well as the local/passtest script used in the above example. ############################################################################### # Further Information # # See the snmpd.conf manual page, and the output of "snmpd -H".
pgjdbc数据库的ssl证书验证源码有几点不懂的地方
postgresql 数据库用证书验证,看了一下源码,但是ssl证书验证有几点不懂的地方. 下面是pgjdbc获取完数据库的连接后, 开始启用ssl证书验证的流程. 我的问题: 过程我都看明白了, 但是不知道为什么它要这么做, 还是说这是个标准, 有人可以帮我讲解一下,或者给点资料参考也行, 谢谢 为了保持代码的简洁性,代码有删减. ``` private PGStream enableSSL(PGStream pgStream, SslMode sslMode, Properties info, int connectTimeout) throws IOException, PSQLException { // 发送SSL请求包 pgStream.sendInteger4(8);//发送一个4字节的整数到后端。 pgStream.sendInteger2(1234);//发送一个2字节整数(短)到后端。 pgStream.sendInteger2(5679); pgStream.flush();//将任何挂起的输出刷新到后端。 // Now get the response from the backend, one of N, E, S. 现在从后端(N, E, S)中获取响应。 int beresp = pgStream.receiveChar();//从后端接收单个字符。 switch (beresp) { case 'S': // ssl 服务器支持ssl **org.herodbsql.ssl.MakeSSL.convert(pgStream, info);** return pgStream; } } ``` 上面可以看到,jdbc给数据库发了几个字节的整数, 然后获取响应,走不同的switch,但是不知道为什么这么做,接着进去看,convert方法 ``` public static void convert(PGStream stream, Properties info) throws PSQLException, IOException { LOGGER.log(Level.FINE, "converting regular socket connection to ssl"); **SSLSocketFactory factory = SocketFactoryFactory.getSslSocketFactory(info);** SSLSocket newConnection; // 将常规套接字连接转换为ssl newConnection = (SSLSocket) factory.createSocket(stream.getSocket(), stream.getHostSpec().getHost(), stream.getHostSpec().getPort(), true); // 我们必须手动调用,否则将隐藏异常 newConnection.setUseClientMode(true);// 设置使用客户端模式 newConnection.startHandshake();// 开始握手 stream.changeSocket(newConnection); } ``` 在看SocketFactoryFactory.getSslSocketFactory(info); ``` public static SSLSocketFactory getSslSocketFactory(Properties info) throws PSQLException {//获取Ssl套接字工厂 String classname = PGProperty.SSL_FACTORY.get(info);// 获取要使用的SSL工厂的类名 if (classname == null || "org.herodbsql.ssl.jdbc4.LibPQFactory".equals(classname) || "org.herodbsql.ssl.LibPQFactory".equals(classname)) { return new LibPQFactory(info); } } ``` 接着看 new LibPQFactory(info); 这个方法应该就是加载证书的地方 ``` public LibPQFactory(Properties info) throws PSQLException { try { SSLContext ctx = SSLContext.getInstance("TLS"); // or "SSL" ? // 确定默认文件位置 String pathsep = System.getProperty("file.separator");// 获取windows或者linux的文件夹分隔符 String defaultdir; boolean defaultfile = false; if (System.getProperty("os.name").toLowerCase().contains("windows")) { // It is Windows defaultdir = System.getenv("APPDATA") + pathsep + "herodbsql" + pathsep; // 获取指定环境变量的值。环境变量是一个依赖于系统的外部命名值。 } else { defaultdir = System.getProperty("user.home") + pathsep + ".herodbsql" + pathsep; } // Load the client's certificate and key 加载客户机的证书和密钥 String sslcertfile = PGProperty.SSL_CERT.get(info); if (sslcertfile == null) { // Fall back to default 退回到默认状态 defaultfile = true; sslcertfile = defaultdir + "herodbsql.crt"; } String sslkeyfile = PGProperty.SSL_KEY.get(info); if (sslkeyfile == null) { // Fall back to default defaultfile = true; sslkeyfile = defaultdir + "herodbsql.pk8"; } // Determine the callback handler 确定回调处理程序 CallbackHandler cbh; String sslpasswordcallback = PGProperty.SSL_PASSWORD_CALLBACK.get(info); if (sslpasswordcallback != null) { try { cbh = (CallbackHandler) ObjectFactory.instantiate(sslpasswordcallback, info, false, null); } catch (Exception e) { throw new PSQLException( GT.tr("The password callback class provided {0} could not be instantiated.", sslpasswordcallback), PSQLState.CONNECTION_FAILURE, e); } } else { cbh = new ConsoleCallbackHandler(PGProperty.SSL_PASSWORD.get(info));// 获取 sslkey的加密密码 } // If the properties are empty, give null to prevent client key selection 如果属性为空,则为null,以防止选择客户机密钥 km = new LazyKeyManager(("".equals(sslcertfile) ? null : sslcertfile), ("".equals(sslkeyfile) ? null : sslkeyfile), cbh, defaultfile);//创建lazykeymanagerduixinag TrustManager[] tm; SslMode sslMode = SslMode.of(info); if (!sslMode.verifyCertificate()) { // server validation is not required 不需要服务器验证 tm = new TrustManager[]{new NonValidatingTM()}; } else { // Load the server certificate 加载服务器证书 TrustManagerFactory tmf = TrustManagerFactory.getInstance("PKIX");// 创建证书信任管理器工厂 KeyStore ks; try { ks = KeyStore.getInstance("jks");// 读取秘钥是所需要用到的工具类 } catch (KeyStoreException e) { // this should never happen throw new NoSuchAlgorithmException("jks KeyStore not available"); } String sslrootcertfile = PGProperty.SSL_ROOT_CERT.get(info);//获取根证书 if (sslrootcertfile == null) { // Fall back to default sslrootcertfile = defaultdir + "root.crt"; } FileInputStream fis; try { fis = new FileInputStream(sslrootcertfile); // 获取根证书ca的文件流 } catch (FileNotFoundException ex) { throw new PSQLException( GT.tr("Could not open SSL root certificate file {0}.", sslrootcertfile), PSQLState.CONNECTION_FAILURE, ex); } try { CertificateFactory cf = CertificateFactory.getInstance("X.509");// // 获取X.509工厂实例 // Certificate[] certs = cf.generateCertificates(fis).toArray(new Certificate[]{}); //Does // not work in java 1.4 Object[] certs = cf.generateCertificates(fis).toArray(new Certificate[]{});//生成ca证书的数组视图 ks.load(null, null); for (int i = 0; i < certs.length; i++) { ks.setCertificateEntry("cert" + i, (Certificate) certs[i]);//设置证书条目 将给定的可信证书分配给给定的别名。 } tmf.init(ks); } catch (IOException ioex) { throw new PSQLException( GT.tr("Could not read SSL root certificate file {0}.", sslrootcertfile), PSQLState.CONNECTION_FAILURE, ioex); } catch (GeneralSecurityException gsex) { throw new PSQLException( GT.tr("Loading the SSL root certificate {0} into a TrustManager failed.", sslrootcertfile), PSQLState.CONNECTION_FAILURE, gsex); } finally { try { fis.close(); } catch (IOException e) { /* ignore */ } } tm = tmf.getTrustManagers(); } // finally we can initialize the context 最后,我们可以初始化上下文 try { ctx.init(new KeyManager[]{km}, tm, null); } catch (KeyManagementException ex) { throw new PSQLException(GT.tr("Could not initialize SSL context."), PSQLState.CONNECTION_FAILURE, ex); } factory = ctx.getSocketFactory(); } catch (NoSuchAlgorithmException ex) { throw new PSQLException(GT.tr("Could not find a java cryptographic algorithm: {0}.", ex.getMessage()), PSQLState.CONNECTION_FAILURE, ex); } } ```
java项目在本地上运行无问题,打war包到服务器上,部分功能有问题
tomcat日志: 23-Nov-2017 00:49:07.772 INFO [main] org.apache.catalina.core.StandardServer.await A valid shutdown command was received via the shutdown port. Stopping the Server instance. 23-Nov-2017 00:49:07.773 INFO [main] org.apache.coyote.AbstractProtocol.pause Pausing ProtocolHandler ["http-nio-8080"] 23-Nov-2017 00:49:07.824 INFO [main] org.apache.coyote.AbstractProtocol.pause Pausing ProtocolHandler ["ajp-nio-8009"] 23-Nov-2017 00:49:07.874 INFO [main] org.apache.catalina.core.StandardService.stopInternal Stopping service Catalina 23-Nov-2017 00:49:08.461 WARNING [localhost-startStop-2] org.apache.catalina.loader.WebappClassLoaderBase.clearReferencesJdbc The web application [MaintainSystem] registered the JDBC driver [com.mysql.jdbc.Driver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered. 23-Nov-2017 00:49:08.462 WARNING [localhost-startStop-2] org.apache.catalina.loader.WebappClassLoaderBase.clearReferencesThreads The web application [MaintainSystem] appears to have started a thread named [FileWatchdog] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread: java.lang.Thread.sleep(Native Method) org.apache.log4j.helpers.FileWatchdog.run(FileWatchdog.java:104) 23-Nov-2017 00:49:08.462 WARNING [localhost-startStop-2] org.apache.catalina.loader.WebappClassLoaderBase.clearReferencesThreads The web application [MaintainSystem] appears to have started a thread named [cluster-ClusterId{value='5a1593f852e92b26c5f5d86c', description='null'}-192.168.7.178:27017] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread: java.net.PlainSocketImpl.socketConnect(Native Method) java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350) java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206) java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188) java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) java.net.Socket.connect(Socket.java:589) com.mongodb.connection.SocketStreamHelper.initialize(SocketStreamHelper.java:50) com.mongodb.connection.SocketStream.open(SocketStream.java:58) com.mongodb.connection.InternalStreamConnection.open(InternalStreamConnection.java:114) com.mongodb.connection.DefaultServerMonitor$ServerMonitorRunnable.run(DefaultServerMonitor.java:128) java.lang.Thread.run(Thread.java:745) 23-Nov-2017 00:49:08.463 WARNING [localhost-startStop-2] org.apache.catalina.loader.WebappClassLoaderBase.clearReferencesThreads The web application [MaintainSystem] appears to have started a thread named [Thread-5] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread: java.lang.Thread.sleep(Native Method) com.xd.util.DatabaseCleaner.run(DatabaseCleaner.java:50) 23-Nov-2017 00:49:08.480 INFO [main] org.apache.coyote.AbstractProtocol.stop Stopping ProtocolHandler ["http-nio-8080"] 23-Nov-2017 00:49:08.490 INFO [main] org.apache.coyote.AbstractProtocol.stop Stopping ProtocolHandler ["ajp-nio-8009"] 23-Nov-2017 00:49:08.589 INFO [main] org.apache.coyote.AbstractProtocol.destroy Destroying ProtocolHandler ["http-nio-8080"] 23-Nov-2017 00:49:08.591 INFO [main] org.apache.coyote.AbstractProtocol.destroy Destroying ProtocolHandler ["ajp-nio-8009"] 23-Nov-2017 00:49:21.473 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server version: Apache Tomcat/8.0.20 23-Nov-2017 00:49:21.475 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server built: Feb 15 2015 18:10:42 UTC 23-Nov-2017 00:49:21.475 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server number: 8.0.20.0 23-Nov-2017 00:49:21.475 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Name: Linux 23-Nov-2017 00:49:21.475 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Version: 2.6.32-573.el6.x86_64 23-Nov-2017 00:49:21.475 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Architecture: amd64 23-Nov-2017 00:49:21.475 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Java Home: /home/dabai/jdk1.8.0_91/jre 23-Nov-2017 00:49:21.475 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Version: 1.8.0_91-b14 23-Nov-2017 00:49:21.476 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Vendor: Oracle Corporation 23-Nov-2017 00:49:21.476 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_BASE: /home/dabai/apache-tomcat-8.0.20 23-Nov-2017 00:49:21.476 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_HOME: /home/dabai/apache-tomcat-8.0.20 23-Nov-2017 00:49:21.476 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.config.file=/home/dabai/apache-tomcat-8.0.20/conf/logging.properties 23-Nov-2017 00:49:21.477 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager 23-Nov-2017 00:49:21.477 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.endorsed.dirs=/home/dabai/apache-tomcat-8.0.20/endorsed 23-Nov-2017 00:49:21.477 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.base=/home/dabai/apache-tomcat-8.0.20 23-Nov-2017 00:49:21.477 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.home=/home/dabai/apache-tomcat-8.0.20 23-Nov-2017 00:49:21.478 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.io.tmpdir=/home/dabai/apache-tomcat-8.0.20/temp 23-Nov-2017 00:49:21.478 INFO [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: /usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib 23-Nov-2017 00:49:21.607 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["http-nio-8080"] 23-Nov-2017 00:49:21.621 INFO [main] org.apache.tomcat.util.net.NioSelectorPool.getSharedSelector Using a shared selector for servlet write/read 23-Nov-2017 00:49:21.624 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["ajp-nio-8009"] 23-Nov-2017 00:49:21.625 INFO [main] org.apache.tomcat.util.net.NioSelectorPool.getSharedSelector Using a shared selector for servlet write/read 23-Nov-2017 00:49:21.626 INFO [main] org.apache.catalina.startup.Catalina.load Initialization processed in 632 ms 23-Nov-2017 00:49:21.658 INFO [main] org.apache.catalina.core.StandardService.startInternal Starting service Catalina 23-Nov-2017 00:49:21.658 INFO [main] org.apache.catalina.core.StandardEngine.startInternal Starting Servlet Engine: Apache Tomcat/8.0.20 23-Nov-2017 00:49:21.681 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployWAR Deploying web application archive /home/dabai/apache-tomcat-8.0.20/webapps/MaintainSystem.war 23-Nov-2017 00:50:06.881 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployWAR Deployment of web application archive /home/dabai/apache-tomcat-8.0.20/webapps/MaintainSystem.war has finished in 45,198 ms 23-Nov-2017 00:50:06.882 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory /home/dabai/apache-tomcat-8.0.20/webapps/examples 23-Nov-2017 00:50:07.077 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory /home/dabai/apache-tomcat-8.0.20/webapps/examples has finished in 195 ms 23-Nov-2017 00:50:07.078 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory /home/dabai/apache-tomcat-8.0.20/webapps/manager 23-Nov-2017 00:50:07.103 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory /home/dabai/apache-tomcat-8.0.20/webapps/manager has finished in 25 ms 23-Nov-2017 00:50:07.104 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory /home/dabai/apache-tomcat-8.0.20/webapps/host-manager 23-Nov-2017 00:50:07.132 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory /home/dabai/apache-tomcat-8.0.20/webapps/host-manager has finished in 28 ms 23-Nov-2017 00:50:07.133 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory /home/dabai/apache-tomcat-8.0.20/webapps/docs 23-Nov-2017 00:50:07.156 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory /home/dabai/apache-tomcat-8.0.20/webapps/docs has finished in 23 ms 23-Nov-2017 00:50:07.157 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory /home/dabai/apache-tomcat-8.0.20/webapps/ROOT 23-Nov-2017 00:50:07.177 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory /home/dabai/apache-tomcat-8.0.20/webapps/ROOT has finished in 19 ms 23-Nov-2017 00:50:07.185 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["http-nio-8080"] 23-Nov-2017 00:50:07.198 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["ajp-nio-8009"] 23-Nov-2017 00:50:07.201 INFO [main] org.apache.catalina.startup.Catalina.start Server startup in 45574 ms web项目运行后,报错提示: Failed to load resource: the server responded with a status of 500 (Internal Server Error) saveOpMiInfo.do?urlCode=49D4:75 Uncaught ReferenceError: maxlengthBind is not defined at saveOpMiInfo.do?urlCode=49D4:75 saveOpMiInfo.do Failed to load resource: the server responded with a status of 500 (Internal Server Error)
在MySQL中安装sqljieba插件的时候报错
在mysql中安装sqljieba插件的时候报错 sudo cp libsqljieba.so /usr/lib/mysql/plugin sudo cp -r ./dict /usr/share # 安装错误 install plugin sqljieba soname 'libsqljieba.so'; ERROR 2013 (HY000): Lost connection to MySQL server during query 查看插件路径下是有的 +------------------------+ | @@plugin_dir | +------------------------+ | /usr/lib/mysql/plugin/ | +------------------------+ c@PC:/usr/lib/mysql/plugin$ ll 总用量 792 drwxr-xr-x 2 root root 4096 6月 14 13:40 ./ drwxr-xr-x 3 root root 4096 6月 14 13:40 ../ -rw-r--r-- 1 root root 21224 4月 20 19:52 adt_null.so -rw-r--r-- 1 root root 6288 4月 20 19:52 auth_socket.so -rw-r--r-- 1 root root 44144 4月 20 19:52 connection_control.so -rw-r--r-- 1 root root 108696 4月 20 19:52 innodb_engine.so -rw-r--r-- 1 root root 88608 4月 20 19:52 keyring_file.so -rw-r--r-- 1 root root 154592 4月 20 19:52 libmemcached.so -rwxr-xr-x 1 root root 141592 6月 14 02:20 libsqljieba.so 后来查看日志 发现在执行指令的时候程序抛出异常了 在读取 /usr/share/dict/jieba.dict.utf8报错了 # 查看错误日志文件 vim /var/log/mysql/error.log 2018-06-14 14:37:01 ./deps/cppjieba/DictTrie.hpp:153 FATAL exp: [ifs.is_open()] false. open /usr/share/dict/jieba.dict.utf8 failed. 06:37:01 UTC - mysqld got signal 6 ; This could be because you hit a bug. It is also possible that this binary or one of the libraries it was linked against is corrupt, improperly built, or misconfigured. This error can also be caused by malfunctioning hardware. Attempting to collect some information that could help diagnose the problem. As this is a crash and something is definitely wrong, the information collection process might fail. key_buffer_size=16777216 read_buffer_size=131072 max_used_connections=1 max_threads=151 thread_count=1 connection_count=1 It is possible that mysqld could use up to key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 76387 K bytes of memory Hope that's ok; if not, decrease some variables in the equation. Thread pointer: 0x7f8b0c000ae0 Attempting backtrace. You can use the following information to find out where mysqld died. If you see no messages after this, something went terribly wrong... stack_bottom = 7f8b2c125e70 thread_stack 0x30000 /usr/sbin/mysqld(my_print_stacktrace+0x3b)[0xe907ab] /usr/sbin/mysqld(handle_fatal_signal+0x489)[0x789b49] /lib/x86_64-linux-gnu/libpthread.so.0(+0x11390)[0x7f8b45a80390] /lib/x86_64-linux-gnu/libc.so.6(gsignal+0x38)[0x7f8b44e39428] /lib/x86_64-linux-gnu/libc.so.6(abort+0x16a)[0x7f8b44e3b02a] /usr/lib/mysql/plugin/libsqljieba.so(_ZN6limonp6LoggerD1Ev+0xf5)[0x7f8b245e6495] /usr/lib/mysql/plugin/libsqljieba.so(_ZN8cppjieba8DictTrie8LoadDictERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x716)[0x7f8b245eecb6] /usr/lib/mysql/plugin/libsqljieba.so(+0x7ce5)[0x7f8b245e4ce5] /usr/sbin/mysqld[0xc707f4] /usr/sbin/mysqld[0xc76b0a] /usr/sbin/mysqld(_ZN22Sql_cmd_install_plugin7executeEP3THD+0x1a)[0xc76d9a] /usr/sbin/mysqld(_Z21mysql_execute_commandP3THDb+0x24de)[0xc4e29e] /usr/sbin/mysqld(_Z11mysql_parseP3THDP12Parser_state+0x3ad)[0xc52b3d] /usr/sbin/mysqld(_Z16dispatch_commandP3THDPK8COM_DATA19enum_server_command+0x102a)[0xc53c7a] /usr/sbin/mysqld(_Z10do_commandP3THD+0x1c7)[0xc55137] /usr/sbin/mysqld(handle_connection+0x288)[0xd16788] /usr/sbin/mysqld(pfs_spawn_thread+0x1b4)[0xec9294] /lib/x86_64-linux-gnu/libpthread.so.0(+0x76ba)[0x7f8b45a766ba] /lib/x86_64-linux-gnu/libc.so.6(clone+0x6d)[0x7f8b44f0b41d] 最后确认一下 /usr/share/dict/jieba.dict.utf8文件时存在的 并且权限也是OK的 pc@PC:/usr/share/dict$ ll 总用量 11356 drwxr-xr-x 3 mysql mysql 4096 6月 14 02:20 ./ drwxr-xr-x 111 root root 4096 6月 14 13:40 ../ -rw-r--r-- 1 mysql mysql 519739 6月 14 13:43 hmm_model.utf8 -rw-r--r-- 1 mysql mysql 5998717 6月 14 13:43 idf.utf8 -rw-r--r-- 1 mysql mysql 5071204 6月 14 13:43 jieba.dict.utf8 drwxr-xr-x 2 mysql mysql 4096 6月 14 02:20 pos_dict/ -rw-r--r-- 1 mysql mysql 683 6月 14 13:43 README.md -rw-r--r-- 1 mysql mysql 8974 6月 14 13:43 stop_words.utf8 -rw-r--r-- 1 mysql mysql 49 6月 14 13:43 user.dict.utf8
大学四年自学走来,这些私藏的实用工具/学习网站我贡献出来了
大学四年,看课本是不可能一直看课本的了,对于学习,特别是自学,善于搜索网上的一些资源来辅助,还是非常有必要的,下面我就把这几年私藏的各种资源,网站贡献出来给你们。主要有:电子书搜索、实用工具、在线视频学习网站、非视频学习网站、软件下载、面试/求职必备网站。 注意:文中提到的所有资源,文末我都给你整理好了,你们只管拿去,如果觉得不错,转发、分享就是最大的支持了。 一、电子书搜索 对于大部分程序员...
JSON解析——net.sf.json.JSONObject
简介 在程序开发过程中,在参数传递,函数返回值等方面,越来越多的使用JSON。JSON(JavaScript Object Notation)是一种轻量级的数据交换格式,同时也易于机器解析和生成、易于理解、阅读和撰写,而且Json采用完全独立于语言的文本格式,这使得Json成为理想的数据交换语言。 JSON建构于两种结构: “名称/值”对的集合(A Collection of name/va...
卸载 x 雷某度!GitHub 标星 1.5w+,从此我只用这款全能高速下载工具!
作者 | Rocky0429 来源 | Python空间 大家好,我是 Rocky0429,一个喜欢在网上收集各种资源的蒟蒻… 网上资源眼花缭乱,下载的方式也同样千奇百怪,比如 BT 下载,磁力链接,网盘资源等等等等,下个资源可真不容易,不一样的方式要用不同的下载软件,因此某比较有名的 x 雷和某度网盘成了我经常使用的工具。 作为一个没有钱的穷鬼,某度网盘几十 kb 的下载速度让我...
2019年还剩1天,我从外包公司离职了
这日子过的可真快啊,2019年还剩1天,外包公司干了不到3个月,我离职了
我一个37岁的程序员朋友
周末了,人一旦没有点事情干,心里就瞎想,而且跟几个老男人坐在一起,更容易瞎想,我自己现在也是 30 岁了,也是无时无刻在担心自己的职业生涯,担心丢掉工作没有收入,担心身体机能下降,担心突...
计算机网络的核心概念
这是《计算机网络》系列文章的第二篇文章 我们第一篇文章讲述了计算机网络的基本概念,互联网的基本名词,什么是协议以及几种接入网以及网络传输的物理媒体,那么本篇文章我们来探讨一下网络核心、交换网络、时延、丢包、吞吐量以及计算机网络的协议层次和网络攻击。 网络核心 网络的核心是由因特网端系统和链路构成的网状网络,下面这幅图正确的表达了这一点 那么在不同的 ISP 和本地以及家庭网络是如何交换信息的呢?...
python自动下载图片
近日闲来无事,总有一种无形的力量萦绕在朕身边,让朕精神涣散,昏昏欲睡。 可是,像朕这么有职业操守的社畜怎么能在上班期间睡瞌睡呢,我不禁陷入了沉思。。。。 突然旁边的IOS同事问:‘嘿,兄弟,我发现一个网站的图片很有意思啊,能不能帮我保存下来提升我的开发灵感?’ 作为一个坚强的社畜怎么能说自己不行呢,当时朕就不假思索的答应:‘oh, It’s simple. Wait for me a few
一名大专同学的四个问题
【前言】   收到一封来信,赶上各种事情拖了几日,利用今天要放下工作的时机,做个回复。   2020年到了,就以这一封信,作为开年标志吧。 【正文】   您好,我是一名现在有很多困惑的大二学生。有一些问题想要向您请教。   先说一下我的基本情况,高考失利,不想复读,来到广州一所大专读计算机应用技术专业。学校是偏艺术类的,计算机专业没有实验室更不用说工作室了。而且学校的学风也不好。但我很想在计算机领...
复习一周,京东+百度一面,不小心都拿了Offer
京东和百度一面都问了啥,面试官百般刁难,可惜我全会。
Java 14 都快来了,为什么还有这么多人固守Java 8?
从Java 9开始,Java版本的发布就让人眼花缭乱了。每隔6个月,都会冒出一个新版本出来,Java 10 , Java 11, Java 12, Java 13, 到2020年3月份,...
达摩院十大科技趋势发布:2020 非同小可!
【CSDN编者按】1月2日,阿里巴巴发布《达摩院2020十大科技趋势》,十大科技趋势分别是:人工智能从感知智能向认知智能演进;计算存储一体化突破AI算力瓶颈;工业互联网的超融合;机器间大规模协作成为可能;模块化降低芯片设计门槛;规模化生产级区块链应用将走入大众;量子计算进入攻坚期;新材料推动半导体器件革新;保护数据隐私的AI技术将加速落地;云成为IT技术创新的中心 。 新的画卷,正在徐徐展开。...
轻松搭建基于 SpringBoot + Vue 的 Web 商城应用
首先介绍下在本文出现的几个比较重要的概念: 函数计算(Function Compute): 函数计算是一个事件驱动的服务,通过函数计算,用户无需管理服务器等运行情况,只需编写代码并上传。函数计算准备计算资源,并以弹性伸缩的方式运行用户代码,而用户只需根据实际代码运行所消耗的资源进行付费。Fun: Fun 是一个用于支持 Serverless 应用部署的工具,能帮助您便捷地管理函数计算、API ...
讲真,这两个IDE插件,可以让你写出质量杠杠的代码
周末躺在床上看《拯救大兵瑞恩》 周末在闲逛的时候,发现了两个优秀的 IDE 插件,据说可以提高代码的质量,我就安装了一下,试了试以后发现,确实很不错,就推荐给大家。 01、Alibaba Java 代码规范插件 《阿里巴巴 Java 开发手册》,相信大家都不会感到陌生,其 IDEA 插件的下载次数据说达到了 80 万次,我今天又贡献了一次。嘿嘿。 该项目的插件地址: https://github....
Python+OpenCV实时图像处理
目录 1、导入库文件 2、设计GUI 3、调用摄像头 4、实时图像处理 4.1、阈值二值化 4.2、边缘检测 4.3、轮廓检测 4.4、高斯滤波 4.5、色彩转换 4.6、调节对比度 5、退出系统 初学OpenCV图像处理的小伙伴肯定对什么高斯函数、滤波处理、阈值二值化等特性非常头疼,这里给各位分享一个小项目,可通过摄像头实时动态查看各类图像处理的特点,也可对各位调参、测试...
2020年一线城市程序员工资大调查
人才需求 一线城市共发布岗位38115个,招聘120827人。 其中 beijing 22805 guangzhou 25081 shanghai 39614 shenzhen 33327 工资分布 2020年中国一线城市程序员的平均工资为16285元,工资中位数为14583元,其中95%的人的工资位于5000到20000元之间。 和往年数据比较: yea...
为什么猝死的都是程序员,基本上不见产品经理猝死呢?
相信大家时不时听到程序员猝死的消息,但是基本上听不到产品经理猝死的消息,这是为什么呢? 我们先百度搜一下:程序员猝死,出现将近700多万条搜索结果: 搜索一下:产品经理猝死,只有400万条的搜索结果,从搜索结果数量上来看,程序员猝死的搜索结果就比产品经理猝死的搜索结果高了一倍,而且从下图可以看到,首页里面的五条搜索结果,其实只有两条才是符合条件。 所以程序员猝死的概率真的比产品经理大,并不是错...
害怕面试被问HashMap?这一篇就搞定了!
声明:本文以jdk1.8为主! 搞定HashMap 作为一个Java从业者,面试的时候肯定会被问到过HashMap,因为对于HashMap来说,可以说是Java集合中的精髓了,如果你觉得自己对它掌握的还不够好,我想今天这篇文章会非常适合你,至少,看了今天这篇文章,以后不怕面试被问HashMap了 其实在我学习HashMap的过程中,我个人觉得HashMap还是挺复杂的,如果真的想把它搞得明明白...
毕业5年,我问遍了身边的大佬,总结了他们的学习方法
我问了身边10个大佬,总结了他们的学习方法,原来成功都是有迹可循的。
程序员如何通过造轮子走向人生巅峰?
前言:你所做的事情,也许暂时看不到成果。但不要灰心,你不是没有成长,而是在扎根。 程序员圈经常流行的一句话:“不要重复造轮子”。在计算机领域,我们将封装好的组件、库,叫做轮子。因为它可以拿来直接用,直接塞进我们的项目中,就能实现对应的功能。 有些同学会问,人家都已经做好了,你再来重新弄一遍,有什么意义?这不是在浪费时间吗。 殊不知,造轮子是一种学习方式,能快速进步,造得好,是自己超强能力的表...
推荐10个堪称神器的学习网站
每天都会收到很多读者的私信,问我:“二哥,有什么推荐的学习网站吗?最近很浮躁,手头的一些网站都看烦了,想看看二哥这里有什么新鲜货。” 今天一早做了个恶梦,梦到被老板辞退了。虽然说在我们公司,只有我辞退老板的份,没有老板辞退我这一说,但是还是被吓得 4 点多都起来了。(主要是因为我掌握着公司所有的核心源码,哈哈哈) 既然 4 点多起来,就得好好利用起来。于是我就挑选了 10 个堪称神器的学习网站,推...
这些软件太强了,Windows必装!尤其程序员!
Windows可谓是大多数人的生产力工具,集娱乐办公于一体,虽然在程序员这个群体中都说苹果是信仰,但是大部分不都是从Windows过来的,而且现在依然有很多的程序员用Windows。 所以,今天我就把我私藏的Windows必装的软件分享给大家,如果有一个你没有用过甚至没有听过,那你就赚了????,这可都是提升你幸福感的高效率生产力工具哦! 走起!???? NO、1 ScreenToGif 屏幕,摄像头和白板...
阿里面试一个ArrayList我都能跟面试官扯半小时
我是真的没想到,面试官会这样问我ArrayList。
曾经优秀的人,怎么就突然不优秀了。
职场上有很多辛酸事,很多合伙人出局的故事,很多技术骨干被裁员的故事。说来模板都类似,曾经是名校毕业,曾经是优秀员工,曾经被领导表扬,曾经业绩突出,然而突然有一天,因为种种原因,被裁员了,...
大学四年因为知道了这32个网站,我成了别人眼中的大神!
依稀记得,毕业那天,我们导员发给我毕业证的时候对我说“你可是咱们系的风云人物啊”,哎呀,别提当时多开心啦????,嗯,我们导员是所有导员中最帅的一个,真的???? 不过,导员说的是实话,很多人都叫我大神的,为啥,因为我知道这32个网站啊,你说强不强????,这次是绝对的干货,看好啦,走起来! PS:每个网站都是学计算机混互联网必须知道的,真的牛杯,我就不过多介绍了,大家自行探索,觉得没用的,尽管留言吐槽吧???? 社...
良心推荐,我珍藏的一些Chrome插件
上次搬家的时候,发了一个朋友圈,附带的照片中不小心暴露了自己的 Chrome 浏览器插件之多,于是就有小伙伴评论说分享一下我觉得还不错的浏览器插件。 我下面就把我日常工作和学习中经常用到的一些 Chrome 浏览器插件分享给大家,随便一个都能提高你的“生活品质”和工作效率。 Markdown Here Markdown Here 可以让你更愉快的写邮件,由于支持 Markdown 直接转电子邮...
看完这篇HTTP,跟面试官扯皮就没问题了
我是一名程序员,我的主要编程语言是 Java,我更是一名 Web 开发人员,所以我必须要了解 HTTP,所以本篇文章就来带你从 HTTP 入门到进阶,看完让你有一种恍然大悟、醍醐灌顶的感觉。 最初在有网络之前,我们的电脑都是单机的,单机系统是孤立的,我还记得 05 年前那会儿家里有个电脑,想打电脑游戏还得两个人在一个电脑上玩儿,及其不方便。我就想为什么家里人不让上网,我的同学 xxx 家里有网,每...
史上最全的IDEA快捷键总结
现在Idea成了主流开发工具,这篇博客对其使用的快捷键做了总结,希望对大家的开发工作有所帮助。
阿里程序员写了一个新手都写不出的低级bug,被骂惨了。
这种新手都不会范的错,居然被一个工作好几年的小伙子写出来,差点被当场开除了。
谁是华为扫地僧?
是的,华为也有扫地僧!2020年2月11-12日,“养在深闺人不知”的华为2012实验室扫地僧们,将在华为开发者大会2020(Cloud)上,和大家见面。到时,你可以和扫地僧们,吃一个洋...
Idea 中最常用的10款插件(提高开发效率),一定要学会使用!
学习使用一些插件,可以提高开发效率。对于我们开发人员很有帮助。这篇博客介绍了开发中使用的插件。
AI 没让人类失业,搞 AI 的人先失业了
最近和几个 AI 领域的大佬闲聊 根据他们讲的消息和段子 改编出下面这个故事 如有雷同 都是巧合 1. 老王创业失败,被限制高消费 “这里写我跑路的消息实在太夸张了。” 王葱葱哼笑一下,把消息分享给群里。 阿杰也看了消息,笑了笑。在座几位也都笑了。 王葱葱是个有名的人物,21岁那年以全额奖学金进入 KMU 攻读人工智能博士,累计发表论文 40 余篇,个人技术博客更是成为深度学习领域内风向标。 ...
2020年,冯唐49岁:我给20、30岁IT职场年轻人的建议
点击“技术领导力”关注∆每天早上8:30推送 作者|Mr.K 编辑| Emma 来源|技术领导力(ID:jishulingdaoli) 前天的推文《冯唐:职场人35岁以后,方法论比经验重要》,收到了不少读者的反馈,觉得挺受启发。其实,冯唐写了不少关于职场方面的文章,都挺不错的。可惜大家只记住了“春风十里不如你”、“如何避免成为油腻腻的中年人”等不那么正经的文章。 本文整理了冯...
最全最强!世界大学计算机专业排名总结!
我正在参与CSDN200进20,希望得到您的支持,扫码续投票5次。感谢您! (为表示感谢,您投票后私信我,我把我总结的人工智能手推笔记和思维导图发送给您,感谢!) 目录 泰晤士高等教育世界大学排名 QS 世界大学排名 US News 世界大学排名 世界大学学术排名(Academic Ranking of World Universities) 泰晤士高等教育世界大学排名 中国共...
作为一名大学生,如何在B站上快乐的学习?
B站是个宝,谁用谁知道???? 作为一名大学生,你必须掌握的一项能力就是自学能力,很多看起来很牛X的人,你可以了解下,人家私底下一定是花大量的时间自学的,你可能会说,我也想学习啊,可是嘞,该学习啥嘞,不怕告诉你,互联网时代,最不缺的就是学习资源,最宝贵的是啥? 你可能会说是时间,不,不是时间,而是你的注意力,懂了吧! 那么,你说学习资源多,我咋不知道,那今天我就告诉你一个你必须知道的学习的地方,人称...
那些年,我们信了课本里的那些鬼话
教材永远都是有错误的,从小学到大学,我们不断的学习了很多错误知识。 斑羚飞渡 在我们学习的很多小学课文里,有很多是错误文章,或者说是假课文。像《斑羚飞渡》: 随着镰刀头羊的那声吼叫,整个斑羚群迅速分成两拨,老年斑羚为一拨,年轻斑羚为一拨。 就在这时,我看见,从那拨老斑羚里走出一只公斑羚来。公斑羚朝那拨年轻斑羚示意性地咩了一声,一只半大的斑羚应声走了出来。一老一少走到伤心崖,后退了几步,突...
一个程序在计算机中是如何运行的?超级干货!!!
强烈声明:本文很干,请自备茶水!???? 开门见山,咱不说废话! 你有没有想过,你写的程序,是如何在计算机中运行的吗?比如我们搞Java的,肯定写过这段代码 public class HelloWorld { public static void main(String[] args) { System.out.println("Hello World!"); } ...
【蘑菇街技术部年会】程序员与女神共舞,鼻血再次没止住。(文末内推)
蘑菇街技术部的年会,别开生面,一样全是美女。
那个在阿里养猪的工程师,5年了……
简介: 在阿里,走过1825天,没有趴下,依旧斗志满满,被称为“五年陈”。他们会被授予一枚戒指,过程就叫做“授戒仪式”。今天,咱们听听阿里的那些“五年陈”们的故事。 下一个五年,猪圈见! 我就是那个在养猪场里敲代码的工程师,一年多前我和20位工程师去了四川的猪场,出发前总架构师慷慨激昂的说:同学们,中国的养猪产业将因为我们而改变。但到了猪场,发现根本不是那么回事:要个WIFI,没有;...
为什么程序猿都不愿意去外包?
分享外包的组织架构,盈利模式,亲身经历,以及根据一些外包朋友的反馈,写了这篇文章 ,希望对正在找工作的老铁有所帮助
Java校招入职华为,半年后我跑路了
何来 我,一个双非本科弟弟,有幸在 19 届的秋招中得到前东家华为(以下简称 hw)的赏识,当时秋招签订就业协议,说是入了某 java bg,之后一系列组织架构调整原因等等让人无法理解的神操作,最终毕业前夕,被通知调往其他 bg 做嵌入式开发(纯 C 语言)。 由于已至于校招末尾,之前拿到的其他 offer 又无法再收回,一时感到无力回天,只得默默接受。 毕业后,直接入职开始了嵌入式苦旅,由于从未...
立即提问