golang 以 dom 方式解析 xml

0 条评论

直到 golang 1.2,标准库的 encoding/xml 包里依然没有出现 xml dom 解析相关的支持,网上搜索了一圈,倒是一早就有开源项目提供了第三方库(code.google.com/p/godom)。godom 项目实现了大部分的 dom 规范常用接口,够一般场景使用的了,可惜下载源码下来尝试 build 居然失败,原来项目已经两年多没有维护,而 golang 在快速演进过程中废弃了一些内置结构的支持,并且部分功能包的位置也发生了变化。

别无他法,官方的指望不上,只能修正 godom 工程的代码,费了些时间,将原本代码里已经被废弃的 vector 替换成 slice,此外修改了几个 xml 包的导入位置,终于 build 成功,开源项目就是好,clone了原作者的工程到 https://bitbucket.org/qiyi/godom/ , 支持 golang 1.2。

使用时先 go get bitbucket.org/qiyi/godom,示例代码,接口使用和 JAVA 类似:

godom-1

宏碁读做 Hóngjī

12 条评论

宏碁读作 Hóngqí 还是 Hóngjī 的问题已经在网络上引起很多的争议了,我搜索了一下,综合知乎上的一些已有讨论,目前已有的看法分别是:

认为是 Hóngqí 的人主要有以下证据或者推论:

  • 在中国大陆的词典、输入法中 "碁" 只有唯一的读音是 qí。
  • 在中国台湾,虽然 "碁" 可以读 jī 或者 qí, 但是读作 qí 时通 "棋", 和 Acer 创始人爱棋符合。
  • 在部分活动中,部分媒体将其读作 qí。

认为 Hóngjī 的人主要有以下证据或者推论:

  • 没有注意到 "碁" 的写法,误认作 "基",因此读成 jī。
  • 在中国台湾,"碁" 读 jī 时有根基的意思,含义上说的通。
  • 在中国的很多媒体、台湾的很多媒体包括一些官方活动中,部分内部人士都读作 jī。

看讨论以及搜集到的资料,两种观点都有一定道理,不过这个字到底应该怎么读合适?我直接发送邮件给 Acer 官方询问了这个问题,得到的答复如下,所以 宏碁读做 Hóngjī

spell-acer-1

acer 官方邮件回复

读取 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