读取 jar 包 GAV 信息

0 条评论

批量将 jar 包上传(命令)到 nexus 仓库时需要指定 jar 包的 GAV 信息,如果手动指定信息则工作量太大,而且 jar 包的文件命名也不规范,不能从文件名上提取信息。好在大部分的 jar 包使用的 maven 工具打包,包内包含有 META-INF/**/pom.properties 文件,该文件记录了制品包的 GAV 信息,例如:

#Generated by Maven
#Tue Jun 12 18:19:43 EDT 2012
version=2.4
groupId=commons-io
artifactId=commons-io

所以就想写一个工具可以从 jar 包内读取该文件,从而自动获得 jar 包的 GAV 信息,如果通过脚本来遍历 jar 包,然后自动调用工具获取GAV信息,接着使用 mvn 命令上传 jar 包,就可以将大部分的上传工作自动化处理了。正好使用 golang 练习:

»阅读全文

多线程顺序执行

3 条评论

前两个月做的一道JAVA题:有一个字符数组,现要求创建4个线程,每个线程分别负责向数组里写入一种字符("A"到“D”),要求数组内的字符按照“A”到“D”的顺序排列,并且输入的次数可以通过参数控制。比如4个线程写3次,字符数组内的字符最终就是 “ABCDABCDABCD”。

题目的要求非常简单,也不涉及算法,简单分析一下,就是如何控制多线程的执行顺序。再针对具体问题,其实就是多个线程争夺一个共享的字符数组资源,该共享资源拥有多种不同的状态,线程获得资源后只有符合某种条件时,才允许进行操作。这几个特征,直接指向了JAVA内锁变量的使用场景。

我的实现如下:

1.工作线程对象,初始化时指定向共享数组写入的字符。工作时调用共享资源的写方法。

2.SharedCharArray 对象,他就是被多线程竞争的共享资源,内部包含一个字符数组,以及表示当前应该写入位置的游标,同时他包含了每个写入字符和对应锁变量的映射关系。资源的写方法执行时,首先进入可重入锁,然后取准备输入字符对应的条件锁,检查是否符合写条件,如果不符合就进入 wait 状态。如果符合,就写入当前准备输入的字符到共享输入,然后游标+1,给下一个应该输入字符的锁变量发送信号。最终,释放锁。

多线程的执行流程不好表述,可以直接查看实现的代码,见 github 上,不再贴一遍了。

Who Is Your New Nfl Team

None

Quickly were local I'd return but absolutely nothing is beckoning me back at it time. The Cy Young Award was named, of course, after wholesale spirit jerseys Hall of Fame pitcher Cy

cheap jerseys

Modest. Enjoying greats like Gibson or Monte Irvin( whom later played for your Giants), one may say the pitching associated with Negro Leagues was not at the particular for one of the most part.

Your past recent five years, how many is always under 200 and in 2008 it reached all-time low number since 1995, the time when the field was construction. Sure, your Sunday Ticket or Extra Innings station might are not prepared to show you the game, nevertheless will definitely be on another siphon. The Kid played in the first mlb game at 18 in 1989 and quickly won the hearts of the Seattle Mariners faithful. This was due for the league expanding to include a team from Racine, Wisconsin, which was known because Racine Hord.

Granted it is only six or seven weeks into the season; nevertheless, Ruiz is justifying my confidence. It's different on the of the approaches they may already have and the. The number of home run decreased to fewer than 200 in 2005. The company can stamp their brand freely on the game.

If you want to get a professional knife, find a specialty chef store and get some assistance. Baggy jeans and loose jerseys aren't complete your good baseball cap. When he arrives they will find a locker, new nfl wholesale jersey uniform together with contract utilizing the Los Angeles Dodgers. He emphasized you should be of chemistry among teammates in order to focus on positive findings. Fortunately, it looks like the times of local blackouts in sports are over once you sign up for the premium kits.

Houston Texans (4-5) (Previous rank: 24): Houston is hanging in there with a bunch of their might. Heck, Tampa Bay went a silly amount of games in a row, losing in under 40 degree weather until they broke it a short time ago when they won abilities

cheap jerseys

Bowl. You can find more information at probably the most NFL Picks Free web blog. Looking forward into Week 10 of fantasy football, the theme is nfl divisional rematches. There are those that are not specifically drafted for basketball or football player.

It wasn't because of methods Ubaldo Jimenez pitched. In the last few years, attendance has invalidated. Sport been recently in existence for countless of years and has been an essential part within the lives lots of people in excess of the field.

Abra Therapeutic’s Aroma Bubble Bath Blissful Harmony 14oz
WELLWED HAMPTONS MAG
Hello world!
Sin fronteras
950.000 feiern an der Street Parade

tomcat 配置 https 的双向认证

4 条评论

双向认证的过程和使用 nginx 还是 tomcat 没有关系,不过是不同的应用配置不同而已,因此对于密钥、证书的准备可以直接按照 nginx 配置 https 的双向认证 里的介绍,但也有几个步骤需要做一些特别的处理,这里就只关注不一样的地方了。

签名CA证书请求

在 JAVA7 的证书认证实现里,对查找 CA 做了更加严格的限制,要求 CA 证书指定明确的 KeyUsage,否则不会找到对应的 CA 去对证书进行校验,这样在自签名CA证书请求时就需要指定好 KeyUsage 了。

1) 修改 extention file

cp /etc/ssl/openssl.cnf .

»阅读全文

通过程序切换系统默认输入法

2 条评论

在使用 Windows 时一直都是删除默认的英文输入语言,只保留一个搜狗拼音或者 Google 拼音输入法,输入法的初始状态设置成英文,然后只需要通过 Shift 键就可以进行中英切换。但是工作中使用的系统在每一次用户登录时,都会被程序重置一些系统配置,导致系统默认的输入语言被修改成 EN,于是进行中英文切换就需要使用 Ctrl + Space,觉得太麻烦也不好用。如果重新设置系统输入法配置,就得手动去控制面板中去点了,步骤太多,还只能人工操作。同时,因为是每一次用户登录(包括锁定之后重新登录),配置都会被重置,所以手动去图形界面修改就变得完全不可接受了。

那个重置系统默认配置的程序是不能禁用的,公司的安全策略太过严格。所以就想到这种情况下正是发挥命令行程序/工具优势的时候,如果有一个命令可以直接修改系统的默认输入法就好了,自己动手(Github),全部源码也就下面几行

  1. #include <stdio.h>
  2. #include <locale.h>
  3. #include <windows.h>
  4. int main(int argc, char* argv[])
  5. {
  6.     //e0210804 sougou
  7.     //e0200804 google
  8.     setlocale(LC_CTYPE, "chs");
  9.     printf("%ls\n", L"输入法设置 0.1 - 设置搜狗为系统默认输入法");
  10.     printf("%ls\n", L"Copyright (C) 2013 qiyi (qiyi@isouth.org)");
  11.     HKL hkl = LoadKeyboardLayout("e0210804", KLF_ACTIVATE);
  12.     SystemParametersInfo(SPI_SETDEFAULTINPUTLANG, 0, &hkl,SPIF_SENDCHANGE);
  13.     UnloadKeyboardLayout(hkl);
  14.     return 0;
  15. }

然后使用 vs 或者 mingw 编译

g++ -static -o im-settings main.cpp

最后,添加一个 Windows 计划任务,选择在用户登录时、连接用户会话时、解锁时都执行此命令行程序即可。

参考: