深度优先

这个家伙好懒,除了文章什么都没留下

0%

1, 保证电脑上安装了jdk6以上版本的java,并配置了好环境变量 ;
地址:http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html

2, ActiveMq
官方下载地址:http://activemq.apache.org/download-archives.html

4, bin目录下由win32/ win64可以供选择.

5, 我这里是进入 win64 ,运行activemq.bat 脚本

6, ActiveMQ默认启动到8161端口,启动完了后在浏览器地址栏输入:http://localhost:8161/admin要求输入用户名密码,默认用户名密码为admin、admin,后便可看到如下图的ActiveMQ控制台界面了

7, 服务端默认端口是 61616 , 我们程序中配置文件按照如下方式配置.

1
2
3
4
<bean id="targetConnectionFactory" class="org.apache.activemq.ActiveMQConnectionFactory">
<!--property name="brokerURL" value="failover:tcp://10.0.26.71:61616" /> -->
<property name="brokerURL" value="failover:tcp://127.0.0.1:61616" />
</bean>

附上conf配置文件链接:

https://www.tuicool.com/articles/rmmAbyu

今早远程连接不上服务器,以为服务器又宕机了。

提示信息:

An authentication error has occurred.

The function requested is not supported.

Remote computer:

然后搜了一下,发现是更新补丁的锅。正好今天开机时发现电脑在更新。

OK,那就卸载那个更新。当然不,参照这个改下

远程桌面发生身份验证错误,要求的函数不受支持

An authentication error has occurred. The function requested is not supported.

Windows 7 (win7)远程登录服务器以前都是正常的,今天登录远程桌面一直是这样的错误。

Windows 10 (win10)出现身份验证错误,要求的函数不正确,这可能是由于CredSSP加密Oracle修正。

卸载更新KB4103718(适用于基于 x64 的系统的 Windows 7 月度安全质量汇总),重启Windows 7即可正常登录。

或者使用微软官方建议修改本地组策略:

计算机配置>管理模板>系统>凭据分配>加密Oracle修正 选择启用并选择易受攻击。

易受攻击– 使用 CredSSP 的客户端应用程序将通过支持回退到不安全的版本使远程服务器遭受攻击,但使用 CredSSP 的服务将接受未修补的客户端。

english

Group Policy -> Computer Configuration -> Administrative Templates -> System -> Credentials Delegation> Encrypted Oracle Remediation change to Vulnerable

Vulnerable – Client applications that use CredSSP will expose the remote servers to attacks by supporting fallback to insecure versions, and services that use CredSSP will accept unpatched clients.

https://support.microsoft.com/zh-cn/help/4093492/credssp-updates-for-cve-2018-0886-march-13-2018

https://support.microsoft.com/en-hk/help/4093492/credssp-updates-for-cve-2018-0886-march-13-2018

以Win10为例:

1、Win+R 运行gpedit.msc

2、找到如下目录

3、找到这个

4、修改设置为

再远程连接服务器即可成功!

贴代码:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
using System;
using System.Collections.Generic;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Net;
using System.Net.Security;
using System.Security.Cryptography.X509Certificates;
using System.Text;
using System.Threading.Tasks;

namespace ImgCodeToStrTest
{
public class ImgCodeToStrHelper
{
private const String host = "https://ocrapi-document.taobao.com";
private const String path = "/ocrservice/document";
private const String method = "POST";
private const String appcode = "xxxx";

public static string ImgCodeToStr(string base64)
{
String querys = "";
String bodys = "{\"img\":\" "+ base64 + "\",\"url\":\"\",\"prob\":false}";
String url = host + path;
HttpWebRequest httpRequest = null;
HttpWebResponse httpResponse = null;

if (0 < querys.Length)
{
url = url + "?" + querys;
}

if (host.Contains("https://"))
{
ServicePointManager.ServerCertificateValidationCallback = new RemoteCertificateValidationCallback(CheckValidationResult);
httpRequest = (HttpWebRequest)WebRequest.CreateDefault(new Uri(url));
}
else
{
httpRequest = (HttpWebRequest)WebRequest.Create(url);
}
httpRequest.Method = method;
httpRequest.Headers.Add("Authorization", "APPCODE " + appcode);
//根据API的要求,定义相对应的Content-Type
httpRequest.ContentType = "application/json; charset=UTF-8";
if (0 < bodys.Length)
{
byte[] data = Encoding.UTF8.GetBytes(bodys);
using (Stream stream = httpRequest.GetRequestStream())
{
stream.Write(data, 0, data.Length);
}
}
try
{
httpResponse = (HttpWebResponse)httpRequest.GetResponse();
}
catch (WebException ex)
{
httpResponse = (HttpWebResponse)ex.Response;
}
Stream st = httpResponse.GetResponseStream();
StreamReader reader = new StreamReader(st, Encoding.GetEncoding("utf-8"));
return reader.ReadToEnd();
}
public static bool CheckValidationResult(object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors errors)
{
return true;
}
public static string ImgToBase64(string filePath)
{
//用streamread读这个文件
System.IO.StreamReader sr = new StreamReader(filePath, Encoding.Default, true);

int index;
//实例化一个内存流
System.IO.MemoryStream tempStream = new MemoryStream();
//将流转换为字节数组
while ((index = sr.BaseStream.ReadByte()) != -1)
{
tempStream.WriteByte(((byte)index));
}
byte[] array = tempStream.ToArray();
tempStream.Close();
//将得到的字节数组转换为base64位编码
string result = Convert.ToBase64String(array);
return result;
}


/// <summary>
/// 计算bitmap某一区域内argb的数量
/// </summary>
/// <param name="bitmap">图片</param>
/// <param name="argb">rgb值</param>
/// <param name="point">起始点</param>
/// <param name="width">横向宽度</param>
/// <param name="height">纵向宽度</param>
/// <returns>rgb像素点的数量</returns>
public static int bmpSum(Bitmap bitmap, int argb, Point point, int width = 50, int height = 50)
{
int count = 0, x, y;
Color pixel;
for (x = 0; x < width; x++)
{
for (y = 0; y < height; y++)
{
pixel = bitmap.GetPixel(x + point.X, y + point.Y);//获取当前像素的值
if (pixel.ToArgb() == argb)
{
count++;
}
}
}
return count;
}

public static int bmpSum(Bitmap bitmap,out char RroB)
{
int redCount = 0,blackCount=0, x, y;
Color pixel;
for (x = 0; x < bitmap.Width; x++)
{
for (y = 0; y < bitmap.Height; y++)
{
pixel = bitmap.GetPixel(x , y);//获取当前像素的值
if (pixel.R > 165 && pixel.R < 190)
{
redCount++;
}
else if (pixel.R > 5 && pixel.R < 60)
{
blackCount++;
}
}
}
if (redCount> blackCount)
{
RroB = 'R';
return redCount;
}
else
{
RroB = 'B';
return blackCount;
}
}

/// <summary>
/// 对bitmap进行剪裁
/// </summary>
/// <param name="bitmap">图片</param>
/// <param name="point">剪裁的起点</param>
/// <param name="width">剪裁的宽度</param>
/// <param name="height">剪裁的高度</param>
/// <returns>剪裁后的图片</returns>
public static Bitmap bmpCut(Bitmap bitmap, Bitmap newbmp,int x, int y, int width, int height)
{
Color pixel;
for (int i = 0; i < width; i++)
{
for (int j = 0; j < height; j++)
{
pixel = bitmap.GetPixel(x + i, y + j);
newbmp.SetPixel(i, j, Color.FromArgb(pixel.R, pixel.G, pixel.B));
}
}
return newbmp;
}

public static Bitmap bmpCutSum(Bitmap bitmap, Bitmap newbmp, Point point, int width, int height)
{
//Bitmap newbmp = new Bitmap(width, height);
int x, y;
Color pixel;
for (x = 0; x < width; x++)
{
for (y = 0; y < height; y++)
{
pixel = bitmap.GetPixel(x + point.X, y + point.Y);
newbmp.SetPixel(x , y, Color.FromArgb(pixel.R, pixel.G, pixel.B));
}
}
return newbmp;
}

/// <summary>
/// 阈值设置
/// </summary>
/// <param name="sum"></param>
/// <returns></returns>
public static string bmpSumToAction(int sum, char RorB)
{
if (sum >= 705 && RorB == 'B')
{
return "梅花";
}
if (sum < 705 && RorB == 'B')
{
return "黑桃";
}

if (sum >= 630 && RorB == 'R')
{
return "红桃";
}
if (sum < 630 && RorB == 'R')
{
return "方块";
}
return "未知";
}
}
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ImgCodeToStrTest
{
class Program
{

static List<int> listHeight = new List<int>();
static List<int> listCount = new List<int>();
static List<string> listWord = new List<string>();
static List<string> listHS = new List<string>();


static void Main(string[] args)
{
string name = "8";
string path = @"C:\Users\gx_143\Desktop\img\imgCut\" + name + ".jpg";
string str = ImgCodeToStrHelper.ImgToBase64(path);
string code = ImgCodeToStrHelper.ImgCodeToStr(str);
Bitmap bmp = new Bitmap(path);
JObject jObject = (JObject)JsonConvert.DeserializeObject(code);
int length = jObject["prism_wordsInfo"].Count();
int firstX = int.Parse(jObject["prism_wordsInfo"][0]["pos"][0]["x"].ToString()),
XXX = int.Parse(jObject["prism_wordsInfo"][length-1]["pos"][0]["x"].ToString()),
firstY =0;
for (int i = 0; i < length; i++)
{
string word = jObject["prism_wordsInfo"][i]["word"].ToString();

firstY = int.Parse(jObject["prism_wordsInfo"][i]["pos"][0]["y"].ToString());

//均值计算
listHeight.Add(firstY);
listWord.Add(word);
}

int avgLine = reMaxMin(listHeight) + 80;

Bitmap newBmp = new Bitmap(XXX-firstX, 50);
newBmp = ImgCodeToStrHelper.bmpCut(bmp, newBmp, firstX, avgLine, newBmp.Width, newBmp.Height);
newBmp.Save(@"C:\Users\gx_143\Desktop\img\imgCut\" + name+"-11" + ".jpg");

int count=0,redCount = 0, blackCount = 0, t = 0 ;
char RorB = ' ';
bool falg = false;
Color pixel;
for (int i = 0; i < newBmp.Width; i++)
{
falg = false;
for (int j = 0; j < newBmp.Height; j++)
{
pixel = newBmp.GetPixel(i, j);//获取当前像素的值
if (pixel.R > 165 && pixel.R < 190)
{
redCount++;
falg = true;
}
else if (pixel.R > 5 && pixel.R < 60)
{
blackCount++;
falg = true;
}
}
if (falg==false && redCount + blackCount > 30)
{
if(t % 2 == 0)
{
if (redCount > blackCount)
{
RorB = 'R';
count = redCount;
}
else
{
RorB = 'B';
count = blackCount;
}
string hs = ImgCodeToStrHelper.bmpSumToAction(count, RorB);
listHS.Add(hs);
listCount.Add(count);
}
t++;
falg = false; count = 0; redCount = 0; blackCount = 0;
}
}

for (int i = 0; i < listCount.Count; i++)
{
Console.WriteLine(listWord[i] + "---" + listHS[i] + "---" + listCount[i]);
}

Console.ReadKey();
}

/// <summary>
/// 矫正X轴坐标
/// </summary>
/// <param name="listX"></param>
/// <returns></returns>
//private static List<int> Correct(List<int> listX)
//{
// List<int> arr = new List<int>();
// for (int i = 0; i < listX.Count -1 ; i++)
// {
// arr.Add( listX[i + 1] - listX[i]);
// }
// int difference = reMaxMin(arr);
// for (int i = 1; i < listX.Count; i++)
// {
// //if (listX[i] - listX[i - 1] > difference - 3 || listX[i] - listX[i - 1] < difference + 3)
// {
// listX[i] = listX[i - 1] + difference;
// }
// }
// return listX;
//}

private static int reMaxMin(List<int> list)
{
int min = list.Min();
int max = list.Max();
int sum = list.Sum() - min - max;
return sum / (list.Count - 2);
}
/// <summary>
/// 扣字
/// </summary>
//private static Bitmap fun(Bitmap bmp, string word, int avgLine, int width, int x, int height = 50)
//{
// Bitmap newBmp = new Bitmap(width, height);
// newBmp = ImgCodeToStrHelper.bmpCut(bmp, newBmp, x, avgLine, width, height);
// //newBmp.Save(@"C:\Users\gx_143\Desktop\img\imgCut\" + word +"-" + Guid.NewGuid().ToString() + ".jpg");
// return newBmp;
//}
}
}

可以进行图片的分割,文字的识别!