??xml version="1.0" encoding="utf-8" standalone="yes"?>亚洲永久精品大片,亚洲精品国精品久久99热一,超碰在线电影http://www.aygfsteel.com/zhanghu198901/archive/2012/08/16/385636.htmlzhanghu198901zhanghu198901Thu, 16 Aug 2012 14:34:00 GMThttp://www.aygfsteel.com/zhanghu198901/archive/2012/08/16/385636.htmlhttp://www.aygfsteel.com/zhanghu198901/comments/385636.htmlhttp://www.aygfsteel.com/zhanghu198901/archive/2012/08/16/385636.html#Feedback0http://www.aygfsteel.com/zhanghu198901/comments/commentRss/385636.htmlhttp://www.aygfsteel.com/zhanghu198901/services/trackbacks/385636.html在网上会有很多关于struts2l合autocomplet插g的实例,但是不怎么完整Q让人感觉不清楚Q刚刚在公司做了一个关于这个的目Q页面也用到了这个插Ӟ所以把详细的步骤和注意事项贴出来和大家分nQ废话不多说Q脓铁代码:本文代码下蝲地址Q?a style="color: #ff9900; text-decoration: none; ">http://download.csdn.net/detail/harderxin/4504612

一、我的资源中有autcomplet的json实例和autocomplet的源代码Q也是copy|上的,大家可以免费下蝲Q下载地址Q?a style="color: #220000; text-decoration: none; ">http://download.csdn.net/detail/harderxin/4504288

二、开始我们的案例旅程

  1、编写页面index.jsp

    <body>
        自动提示Q?br />        <!-- autocomplete防止一些浏览器的自动提C完成功?nbsp;-->
        <input type="text" name="content" id="content" autocomplete="off" onkeyup="value=value.replace(/[^\a-\z\A-\Z0-9\u4E00-\u9FA5]/g,'')"/>
        <input type="button" id="button" name="button" value="提交" onclick="" />
        <br />
        <p>
        </p>

    </body>

  昄效果如下Q?/span>

    



 



zhanghu198901 2012-08-16 22:34 发表评论
]]>
正则表达式学?-元字W的使用http://www.aygfsteel.com/zhanghu198901/archive/2012/08/12/385337.htmlzhanghu198901zhanghu198901Sun, 12 Aug 2012 15:00:00 GMThttp://www.aygfsteel.com/zhanghu198901/archive/2012/08/12/385337.htmlhttp://www.aygfsteel.com/zhanghu198901/comments/385337.htmlhttp://www.aygfsteel.com/zhanghu198901/archive/2012/08/12/385337.html#Feedback2http://www.aygfsteel.com/zhanghu198901/comments/commentRss/385337.htmlhttp://www.aygfsteel.com/zhanghu198901/services/trackbacks/385337.htmlPSQ在所有例子中正则表达式匹配结果包含在源文本中的【和】之_有的例子会用java来实玎ͼ如果是java本n正则表达式的用法Q会在相应的地方说明。所有java例子都在JDK1.6.0_13下测试通过?/span>

 

一、对Ҏ字符q行转义

         元字W是一些在正则表达式里有着Ҏ含义的字W。因为元字符在正则表辑ּ里有着Ҏ的含义,所以这些字W就无法用来代表它们本n。在元字W前面加上一个反斜杠可以对它进行{义,q样得到的{义序列将匚w那个字符本n而不是它Ҏ的元字符含义。如Q如果想要匹配[和]Q就必须对它q行转义Q\[和\]?/span>

         对元字符转义需要用到斜杠\字符Q这意味着\字符本向也是一个元字符Q要匚w\字符本nQ必{义成\\。如匚wwindows文g路径?/span>

 

二、匹配空白字W?/span>

         元字W大致可以分ZU:一U是用来匚w文本的(?Q,另一U是正则表达式的语法所要求的(如[和]Q?/span>

         在进行正则表辑ּ搜烦的时候,我们l常会遇到需要对原始文本中里的非打印I白字符q行匚w的情c比如说Q我们可能需要把所有的制表W找出来Q或者我们需要把换行W找出来Q这cdW很难被直接输入C个正则表辑ּ里,q时我们可以使用如下列出的特D元字符来输入它们:

         \b     回退Qƈ删除Q一个字W(Backspace键)

         \f      换页W?/span>

         \n     换行W?/span>

         \r      回RW?/span>

         \t      制表W(Tab键)

         \v      垂直制表W?/span>

 

         来看一个例子,把文件中的空白行LQ?/span>

文本Q?/span>

8 5 4 1 6 3  2 7 9

7 6 2 9 5 8  3 4 1

9 3 1 4 2 7  8 5 6

 

6 9 3 8 7 5  1 2 4

5 1 8 3 4 2  6 9 7

2 4 7 6 1 9  5 3 8

 

3 26  7 8 4 9 1 5                                                       

4 8 9 5 3 1  7 6 2

1 7 5 2 9 6  4 8 3

正则表达式:\r\n\r\n

分析Q\r\n匚w一个回?换行l合Qwindows操作pȝ中把它作为文本行的结束标{。用正则表辑ּ\r\n\r\nq行的搜索将匚w两个q箋的行标{,而这正好是空白行?/span>

         注意QUnix和Linux操作pȝ中只使用一个换行符来结束一个文本行Q换句话_在Unix或Linuxpȝ中匹配空白行只用\n\n卛_Q不需要加上\r。同旉用于windows和Unix/Linux的正则表辑ּ应该包括一个可先的\r和一个必d配的\nQ即\r?\n\r?\nQ这会在后面的文章中讲到?/span>

         Java代码如下Q?/span>

    public static void matchBlankLine() throws Exception{
        BufferedReader br 
= new BufferedReader(new FileReader(new File("E:/九宫?txt")));
        StringBuilder sb 
= new StringBuilder();
        
char[] cbuf = new char[1024];
        
int len = 0;
        
while(br.ready() && (len = br.read(cbuf)) > 0){
            br.read(cbuf);
            sb.append(cbuf, 
0, len);
        }
        String reg 
= "\r\n\r\n";
        System.out.println(
"原内容:\n" + sb.toString());
        System.out.println(
"处理后:-----------------------------");
        System.out.println(sb.toString().replaceAll(reg, 
"\r\n"));
    }

q行l果如下Q?/span>

原内容:

8 5 4  1 6 3 2 7 9

7 6 2  9 5 8 3 4 1

9 3 1  4 2 7 8 5 6

 

6 9 3  8 7 5 1 2 4

5 1 8  3 4 2 6 9 7

2 4 7  6 1 9 5 3 8

 

3 2 6  7 8 4 9 1 5

4 8 9  5 3 1 7 6 2

1 7 5  2 9 6 4 8 3

处理后:-----------------------------

8 5 4  1 6 3 2 7 9

7 6 2  9 5 8 3 4 1

9 3 1  4 2 7 8 5 6

6 9 3  8 7 5 1 2 4

5 1 8  3 4 2 6 9 7

2 4 7  6 1 9 5 3 8

3 2 6  7 8 4 9 1 5

4 8 9  5 3 1 7 6 2

1 7 5  2 9 6 4 8 3


三、匹配特定的字符cd

         字符集合Q匹配多个字W中的某一个)是最常见的匹配Ş式,而一些常用的字符集合可以用特D元字符来代ѝ这些元字符匚w的是某一cd的字W(cd字符Q,cd字符q不是必不可的Q因为可以通过逐一列D有关字符或通过定义一个字W区间来匚w某一cdW,但是使用它们构造出来的正则表达式简明易懂,在实际应用中很常用?/span>

 

         1、匹配数字与非数?/span>

         \d     M一个数字,{h于[0-9]或[0123456789]

         \D     M一个非数字Q等价于[^0-9]或[^0123456789]

 

         2、匹配字母和数字与非字母和数?/span>

         字母QA-Z不区分大写Q、数字、下划线是一U常用的字符集合Q可用如下类元字W:

         \w    M一个字母(不区分大写Q、数字、下划线Q等价于[0-9a-zA-Z_]

         \W    M一个非字母数字和下划线Q等价于[^0-9a-zA-Z_]

 

         3、匹配空白字W与非空白字W?/span>

         \s      M一下空白字W,{h于[\f\n\r\t\v]

         \S      M一下空白字W,{h于[^\f\n\r\t\v]

         注意Q退格元字符\b没有不在\s的范围之内?/span>

 

         4、匹配十六进制或八进制数?/span>

         十六q制Q用前缀\x来给出,如:\x0A对应于ASCII字符10Q换行符Q,其效果等价于\n?/span>

         八进Ӟ用前~\0来给出,数值本w可以是两位或三位数字,如:\011对应于ASCII字符9Q制表符Q,其效果等价于\t?/span>

        

四、用POSIX字符c?/span>

         POSIX字符cL很多正则表达式实现都支持的一U简写Ş式。Java也支持它Q但JavaScript不支持。POSIX字符如下所C:

[:alnum:]  M一个字母或数字Q等价于[a-zA-Z0-9]

[:alpha:]   M一个字母,{h于[a-zA-Z]

[:blank:]   I格或制表符Q等价于[\t]

[:cntrl:]     ASCII控制字符QASCII 0?1Q再加上ASCII 127Q?/span>

[:digit:]     M一个数字,{h于[0-9]

[:graph:]  M一个可打印字符Q但不包括空?/span>

[:lower:]   M一个小写字母,{h于[a-z]

[:print:]    M一个可打印字符

[:punct:]   既不属于[:alnum:]和[:cntrl:]的Q何一个字W?/span>

[:space:]  M一个空白字W,包括I格Q等价于[^\f\n\r\t\v]

[:upper:]  M一个大写字母,{h于[A-Z]

[:xdigit:]   M一个十六进制数字,{h于[a-fA-F0-9]

 

         POSIX字符和之前见q的元字W不太一P我们来看一个前面利用正则表辑ּ来匹配网中的颜色的例子Q?/span>

文本Q?lt;span style="background-color:#3636FF;height:30px;width:60px;">试</span>

正则表达式:#[[:xdigit:]] [[:xdigit:]] [[:xdigit:]] [[:xdigit:]] [[:xdigit:]] [[:xdigit:]]

l果Q?lt;span style="background-color:?3636FF?height:30px;width:60px;">试</span>

注意Q这里用的模式以[[开头、以]]l束Q这是用POSIX字符cL必须的,POSIX字符必须括在[:?]之间Q外层[和]字符用来定义一个集合,内层的[和]字符是POSIX字符cLw的l成部分?/span>

在java中的POSIX字符表示有所不同Q不是包括在[:?]之间Q而是以\p开_包括在{和}之间Q且大小写有区别Q同时增加了\p{ASCII}Q如下所C:

\p{Alnum}         字母数字字符Q[\p{Alpha}\p{Digit}]

\p{Alpha}          字母字符Q[\p{Lower}\p{Upper}]

\p{ASCII}           所?ASCIIQ[\x00-\x7F]

\p{Blank}           I格或制表符Q[ \t]

\p{Cntrl}            控制字符Q[\x00-\x1F\x7F]

\p{Digit}            十进制数字:[0-9]

\p{Graph}          可见字符Q[\p{Alnum}\p{Punct}]

\p{Lower}          写字母字符Q[a-z]

\p{Print}            可打印字W:[\p{Graph}\x20]

\p{Punct}          标点W号Q?"#$%&'()*+,-./:;<=>?@[\]^_`{|}~

\p{Space}          I白字符Q[ \t\n\x0B\f\r]

\p{Upper}          大写字母字符Q[A-Z]

\p{XDigit}          十六q制数字Q[0-9a-fA-F]



zhanghu198901 2012-08-12 23:00 发表评论
]]>
正则表达式学?--重复匚whttp://www.aygfsteel.com/zhanghu198901/archive/2012/08/12/385338.htmlzhanghu198901zhanghu198901Sun, 12 Aug 2012 15:00:00 GMThttp://www.aygfsteel.com/zhanghu198901/archive/2012/08/12/385338.htmlhttp://www.aygfsteel.com/zhanghu198901/comments/385338.htmlhttp://www.aygfsteel.com/zhanghu198901/archive/2012/08/12/385338.html#Feedback1http://www.aygfsteel.com/zhanghu198901/comments/commentRss/385338.htmlhttp://www.aygfsteel.com/zhanghu198901/services/trackbacks/385338.htmlPSQ在所有例子中正则表达式匹配结果包含在源文本中的【和】之_有的例子会用java来实玎ͼ如果是java本n正则表达式的用法Q会在相应的地方说明。所有java例子都在JDK1.6.0_13下测试通过?/span>

 

一、有多少个匹?/span>

         前面几篇讲的都是匚w一个字W,但是一个字W或字符集合要匹配多ơ,应该怎么做呢Q比如要匚w一个电子邮件地址Q用之前说到的方法,可能有h会写出像\w@\w\.\wq样的正则表辑ּQ但q个只能匚w到像a@b.cq样的地址Q明显是不正的Q接下来来看看如何匚w电子邮g地址?/span>

         首先要知道电子邮件地址的组成:以字母数字或下划U开头的一l字W,后面跟@W号Q再后面是域名,即用户名@域名地址。不q这也跟具体的邮服务提供商有关Q有的在用户名中也允?字符?/span>

 

1、匹配一个或多个字符

         要想匚w同一个字W(或字W集合)的多ơ重复,只要单地l这个字W(或字W集合)加上一?字符作ؓ后缀可以了?匚w一个或多个字符Q至一个)。如Qa匚wa本nQa+匹配一个或多个q箋出现的aQ[0-9]+匚w多个q箋的数字?/span>

         注意Q在l一个字W集合加?后缀的时候,必须?攑֜字符集合的外面,否则׃是重复匹配了。如[0-9+]q样pC数字或+号了Q虽然语法上正确Q但不是我们惌的了?/span>

文本QHello, mhmyqn@qq.com or mhmyqn@126.com is my email.

正则表达式:\w+@(\w+\.)+\w+

l果QHello, 【mhmyqn@qq.com?or 【mhmyqn@126.com?is my email.

分析Q\w+可以匚w一个或多个字符Q而子表达?\w+\.)+可匹配像xxxx.edu.q样的字W串Q而最后不会是.字符l尾Q所以后面还会有一个\w+。像mhmyqn@xxxx.edu.cnq样的邮件地址也会匚w到?/span>

 

2、匹配零个或多个字符

         匚w零个或多个字W用元W?Q它的用法和+完全一P只要把它攑֜一下字W或字符集合的后面,可以匹配该字符Q或字符集合Q连l出现零ơ或多次。如正则表达式ab*c可以匚wac、abc、abbbbbc{?/span>

 

3、匹配零个或一个字W?/span>

         匚w零个或一个字W用元字符?。像上一说到的匚w一个空白行使用正则表达式\r\n\r\nQ但在Unix和Linux中不需要\rQ就可以使用元字W?Q\r?\n\r?\nq样既可匚wwindows中的I白行,也可匚wUnix和Linux中的I白行。下面来看一个匹配http或https协议的URL的例子:

文本QThe URL is http://www.mikan.com, to connect securely use https://www.mikan.cominstead.

正则表达式:https?://(\w+\.)+\w+

l果QThe URL is 【http://www.mikan.com? to connect securely use 【https://www.mikan.com?instead.

分析Q这个模式以https?开_表示?之前的一个字W可以有Q也可以没有Q所以它能匹配http或httpsQ后面部分和前一个例子一栗?/span>

 

二、匹配的重复ơ数

         正则表达式里???解决了很多问题,但是Q?/span>

         1Q??匚w的字W个数没有上限。我们无法ؓ它们匹配的字符个数讑֮一个最大倹{?/span>

         2Q???臛_匚w一个或零个字符。我们无法ؓ它们匹配的字符个数另行讑֮一个最倹{?/span>

         3Q如果只使用*?Q我们无法把它们匹配的字符个数讑֮Z个精的数字?/span>

         正则表达式里提供了一个用来设定重复次数的语法Q重复次数要用{和}字符来给出,把数值写在它们中间?/span>

        

         1、ؓ重复匚wơ数讑֮一个精?/span>

         如果想ؓ重复匚wơ数讑֮一个精的|把那个数字写在{和}之间卛_。如{4}表示它前面的那个字符Q或字符集合Q必d原始文本中连l重复出?ơ才是一个匹配,如果只出C3ơ,也不是一个匹配?/span>

         如前面几中说到的匹配页面中颜色的例子,可以用重复ơ数来匹配:#[[:xdigit:]]{6}?[0-9a-fA-F]{6}QPOSIX字符在java中是#\\p{XDigit}{6}?/span>

        

         2、ؓ重复匚wơ数讑֮一个区?/span>

         {}语法q可以用来ؓ重复匚wơ数讑֮一个区_也就是ؓ重复匚wơ数讑֮一个最值和最大倹{这U区间必M{n, m}q样的Ş式给出,其中n>=m>=0。如查日期格式是否正(不检查日期的有效性)的正则表辑ּQ如日期2012-08-12?012-8-12Q:\d{4}-\d{1,2}-\d{1,2}?/span>

        

         3、匹配至重复多次

         {}语法的最后一U用法是l出一个最的重复ơ数Q但不必l出最大重复次敎ͼQ如{3,}表示臛_重复3ơ。注意:{3,}中一定要有逗号Q而且逗号后不能有I格。否则会出错?/span>

         来看一个例子,使用正则表达式把所有金额大?100的金额找出来Q?/span>

文本Q?/span>

$25.36

$125.36

$205.0

$2500.44

$44.30

正则表达式:$\d{3,}\.\d{2}

l果Q?/span>

$25.36

?125.36?/span>

?205.0?/span>

?2500.44?/span>

$44.30

 

         +??可以表示成重复次敎ͼ

         +{h于{1,}

         *{h于{0,}

         ?{h于{0,1}

 

三、防止过度匹?/span>

         ?只能匚w零个或一个字W,{n}和{n,m}也有匚w重复ơ数的上限,但是??、{n,}都没有上限|q样有时会导致过度匹配的现象?/span>

         来看匚w一个html标签的例?/span>

文本Q?/span>

Yesterday is <b>history</b>,tomorrow is a <B>mystery</B>, but today is a <b>gift</b>.

正则表达式:<[Bb]>.*</[Bb]>

l果Q?/span>

Yesterday is ?lt;b>history</b>,tomorrow is a <B>mystery</B>, but today is a <b>gift</b>?

分析Q?lt;[Bb]>匚w<b>标签Q不区分大小写)Q?lt;/[Bb]>匚w</b>标签Q不区分大小写)。但l果却不是预期的那样有三个,W一?lt;/b>标签之后Q一直到最后一?lt;/b>之间的东西全部匹配出来了?/span>

         Z么会q样呢?因ؓ*?都是贪婪型的元字W,它们在匹配时的行为模式是多多益善Q它们会可能从一D|本的开头一直匹配到q段文本的末,而不是从q段文本的开头匹配到到W一个匹配时为止?/span>

         当不需要这U贪婪行为时Q可以用这些元字符的懒惰型版本。懒惰意思是匚w可能少的字W,与贪婪型相反。懒惰型元字W只需要给贪婪型元字符加上一?后缀卛_。下面是贪婪型元字符的对应懒惰型版本Q?/span>

         *       *?

         +       +?

         {n,}   {n,}?

         所以上面的例子中,正则表达式只需要改?lt;[Bb]>.*?</[Bb]>卛_Q结果如下:

<b>history</b>

<B>mystery</B>

<b>gift</b>

 

四、ȝ

         正则表达式的真下威力体现在重复次数匹配方面。这里介l了+??几种元字W的用法Q如果要_的确定匹配次敎ͼ使用{}。元字符分贪婪型和懒惰型两种Q在需要防止过度匹配的场合下,请用懒惰型元字W来构造正则表辑ּ



zhanghu198901 2012-08-12 23:00 发表评论
]]>
开发经理(技术型Q需要做的第一件事?/title><link>http://www.aygfsteel.com/zhanghu198901/archive/2012/08/12/385336.html</link><dc:creator>zhanghu198901</dc:creator><author>zhanghu198901</author><pubDate>Sun, 12 Aug 2012 14:58:00 GMT</pubDate><guid>http://www.aygfsteel.com/zhanghu198901/archive/2012/08/12/385336.html</guid><wfw:comment>http://www.aygfsteel.com/zhanghu198901/comments/385336.html</wfw:comment><comments>http://www.aygfsteel.com/zhanghu198901/archive/2012/08/12/385336.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.aygfsteel.com/zhanghu198901/comments/commentRss/385336.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/zhanghu198901/services/trackbacks/385336.html</trackback:ping><description><![CDATA[<p style="color: #333333; font-family: Arial; line-height: 25px; text-align: left; background-color: #ffffff; "><span style="font-family: Calibri; ">    </span>Ҏ我近些年?span style="font-family: Calibri; ">IT</span>行业的摸爬滚打,发现作ؓ一个合格的开发经理需要做的第一件事情是Q规范?/p><p style="color: #333333; font-family: Arial; line-height: 25px; text-align: left; background-color: #ffffff; "><span style="font-family: Calibri; ">1</span>、规范代?/p><p style="color: #333333; font-family: Arial; line-height: 25px; text-align: left; background-color: #ffffff; "><span style="font-family: Calibri; ">    </span>每个公司都有自己的规范文档,但是很少有同学按照规范标准来写自q代码。这样导致代码风格多元化、代码逻辑可爱化,更有甚者,会有自己的代码都看不懂。ؓ什么?原因很简单,虽然写了规范文档Q做了规范培训,但是没有强制的执行和跟踪?/p><p style="color: #333333; font-family: Arial; line-height: 25px; text-align: left; background-color: #ffffff; "><span style="font-family: Calibri; ">    </span>我认ZZ个合格的开发经理,需要做如下三g事情。第一步,写代码规范文档,做培训。第二步Q按照规范生成开发模版,规定手下的所有开发h员的开发工具中导入此模版。第三步Q反复核查开发h员的代码Q?span style="font-family: Calibri; ">3-6</span>个月Q,直到规范成ؓ一U习惯?/p><p style="color: #333333; font-family: Arial; line-height: 25px; text-align: left; background-color: #ffffff; "><span style="font-family: Calibri; ">2</span>、规范文?/p><p style="color: #333333; font-family: Arial; line-height: 25px; text-align: left; background-color: #ffffff; "><span style="font-family: Calibri; ">    </span>文档在中?span style="font-family: Calibri; ">IT</span>公司几乎不受太大的重视?/p><p style="color: #333333; font-family: Arial; line-height: 25px; text-align: left; background-color: #ffffff; "><span style="font-family: Calibri; ">    </span>在项目型的公司,要么是没有文档Q要么就是文档泛滥(要知道,有很多文档是做给<span style="font-family: Calibri; ">QA</span>看的Q其实都是垃圾)Q我有时候就惻Iq样有意义吗Q文档的目的是开发h员的辅助工具Q尤其对于刚入职公司的新言Q不会有几个“好心?#8221;的老员工去帮助新员工讲解项目架构和原理的,q来了就是靠自己摸烦Q那么文档对于新人就昑־ؓ重要了。所以,要么徏立一个好的培训机Ӟ要么写好文档,如果两者都做的很好为最佟?/p><p style="color: #333333; font-family: Arial; line-height: 25px; text-align: left; background-color: #ffffff; "><span style="font-family: Calibri; ">    </span>在互联网公司Q对于一些生命周期短暂的项目不写文档我同意Q毕竟需要时间成本。但是这L目代码规范一定严|量_到数据库字段的规范。因U类型的目开发h员一般ؓ<span style="font-family: Calibri; ">1</span>人,如果此hdQ后来h员交接时Q能够更快的看懂Ҏ的代码,以节省时间。此外,对于核心目Q一定需要一套完整的<span style="font-family: Calibri; ">API</span>文档Q以供各目l之间的互通,减少不必要的沟通?/p><p style="color: #333333; font-family: Arial; line-height: 25px; text-align: left; background-color: #ffffff; "><span style="font-family: Calibri; ">    </span>ȝQ正是因为没有合理的规范Q某个模块的开发h员离职,会消耗公司的巨大l护成本。如果能够做C上两点规范,怿能够l公司带来更多的效能?/p><img src ="http://www.aygfsteel.com/zhanghu198901/aggbug/385336.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/zhanghu198901/" target="_blank">zhanghu198901</a> 2012-08-12 22:58 <a href="http://www.aygfsteel.com/zhanghu198901/archive/2012/08/12/385336.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>修改 mysql root 密码http://www.aygfsteel.com/zhanghu198901/archive/2012/07/21/383667.htmlzhanghu198901zhanghu198901Sat, 21 Jul 2012 14:16:00 GMThttp://www.aygfsteel.com/zhanghu198901/archive/2012/07/21/383667.htmlhttp://www.aygfsteel.com/zhanghu198901/comments/383667.htmlhttp://www.aygfsteel.com/zhanghu198901/archive/2012/07/21/383667.html#Feedback0http://www.aygfsteel.com/zhanghu198901/comments/commentRss/383667.htmlhttp://www.aygfsteel.com/zhanghu198901/services/trackbacks/383667.html 如果 mysql 是刚安装Q?那么 root 的密码默认ؓI?可以使用以下Ҏ修改密码Q?/p>

 

Java代码  收藏代码
  1. mysqladmin -u root password PASSWORD  

 

  如果 root 有密码, 那么使用以下命o修改Q?/p>

 

Java代码  收藏代码
  1. mysqladmin -u root -p'oldpassword' password newpass  

 

  另外q可以通过d sql 控制台后修改Q?/p>

 

Sql代码  收藏代码
  1. update user set password=PASSWORD("NEWPASSWORD") where User='root';  
  2. flush privileges;  


zhanghu198901 2012-07-21 22:16 发表评论
]]>
android push notification serfice android中的push机制http://www.aygfsteel.com/zhanghu198901/archive/2012/07/21/383665.htmlzhanghu198901zhanghu198901Sat, 21 Jul 2012 14:15:00 GMThttp://www.aygfsteel.com/zhanghu198901/archive/2012/07/21/383665.htmlhttp://www.aygfsteel.com/zhanghu198901/comments/383665.htmlhttp://www.aygfsteel.com/zhanghu198901/archive/2012/07/21/383665.html#Feedback1http://www.aygfsteel.com/zhanghu198901/comments/commentRss/383665.htmlhttp://www.aygfsteel.com/zhanghu198901/services/trackbacks/383665.htmlAPNS 是什?

APNS (Android Push Notification Service) 是一U在 android 上轻村֮?push notification 的功能的解决Ҏ. 只需甌一?API Key, l过单的步骤卛_实现 push notification 的功?

特点:

  • 快速集?提供一U比C2DM更加快捷的用方?避免各种限制.
  • 无需架设服务?通过使用"云服?,减少额外服务器负?
  • 可以同时推送消息到|站面,android 手机
  • 耗电?占用量?
  •  

    http://zen-mobi.com/get_api_key.php获取apikey

    如何?Android 应用中?Notification Q?/h2>

    a) 在应用中d APNS 功能

    1. 下蝲 libaray: com_apns.jar
    2. com_apns.jard到工E?/li>

      在工E上右键打开“属?#8221;,选择 “Java Build Path”, ?Libraries 中选择 “Add External JARs”, 选择下蝲?com_apns.jar.

    3. 接收 push notification
    4. 使用BroadcastReceiver接收pȝq播:  public class MyBroadcastReceiver extends BroadcastReceiver { 	@Override 	public void onReceive(Context context, Intent intent) { 	     if (intent.getAction().equals(APNService.ON_NOTIFICATION)) { 			String str = intent.getStringExtra("data"); 			//todo, 处理收到的消?		 }  	} } 
    5. 启动 Push Notification Service
    6. 发送Intent 启动服务Q将 chanel Id 以及 此设备的标识 (chanel中唯一表示此设备的字符? 传递过?       Intent intent = new Intent(APNService.START);     intent.putExtra("ch", chanel);     intent.putExtra("devId", devId);     startService(intent); 
      Notes Chanel Id 在申?API 后,d开发者页面会看到. devId: chanel 内设备标?要在chanel内保持唯一.
    7. 配置 AndroidManifest.xml
    8. ... <application android:icon="@drawable/icon"  	   ...  	 <service android:name="com.apns.APNSService" android:label="APNS">          <intent-filter>              <action android:name="com.apns.APNService.START" />              <action android:name="com.apns.APNService.STOP" />              <category android:name="android.intent.category.DEFAULT"/>          </intent-filter> 	 </service> 	 <receiver android:name="MyBroadcastReceiver"> 	      <intent-filter> 	          <action android:name="com.apnsd.APNService.NOTIFICATION" /> 	      </intent-filter> 	 </receiver>	 </application>	 <uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> ... 


    b) 发?Notification 到设?/span>

    通过 rest 接口发?Notification:
    http://www.push-notification.org/handlers/apns_v1.php?ch=YourChannelId&devId=xxxxx&msg =hello world&random=0123&hash=HashCode

    ch:Channel Id devId:接收讑֤ Id msg:消息 random:随机?hash:md5(ch + devId + msg + random + apiKey)



    zhanghu198901 2012-07-21 22:15 发表评论
    ]]>
    android中置调用指定览?/title><link>http://www.aygfsteel.com/zhanghu198901/archive/2012/07/21/383666.html</link><dc:creator>zhanghu198901</dc:creator><author>zhanghu198901</author><pubDate>Sat, 21 Jul 2012 14:15:00 GMT</pubDate><guid>http://www.aygfsteel.com/zhanghu198901/archive/2012/07/21/383666.html</guid><wfw:comment>http://www.aygfsteel.com/zhanghu198901/comments/383666.html</wfw:comment><comments>http://www.aygfsteel.com/zhanghu198901/archive/2012/07/21/383666.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.aygfsteel.com/zhanghu198901/comments/commentRss/383666.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/zhanghu198901/services/trackbacks/383666.html</trackback:ping><description><![CDATA[<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; ">默认?a target="_blank" style="color: #333333; text-decoration: none; ">览?/a>都列用户选择?/p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; ">Java代码</p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; ">Uri u = Uri.parse(url);</p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; ">Intent it = new Intent(Intent.ACTION_VIEW, url); TestActivity.this.startActivity(it);</p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; "> </p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; ">Uri u = Uri.parse(url);</p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; ">Intent it = new Intent(Intent.ACTION_VIEW, url); TestActivity.this.startActivity(it);</p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; ">指定览器的</p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; ">Java代码</p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; ">Uri u = Uri.parse(url);</p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; ">it.setData(u);</p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; ">it.setAction( Intent.ACTION_VIEW);</p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; ">it.setClassName("com.android.browser","com.android.browser.BrowserActivity");</p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; ">TestActivity.this.startActivity(it);</p><img src ="http://www.aygfsteel.com/zhanghu198901/aggbug/383666.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/zhanghu198901/" target="_blank">zhanghu198901</a> 2012-07-21 22:15 <a href="http://www.aygfsteel.com/zhanghu198901/archive/2012/07/21/383666.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Java 多线E编E?/title><link>http://www.aygfsteel.com/zhanghu198901/archive/2012/07/18/383446.html</link><dc:creator>zhanghu198901</dc:creator><author>zhanghu198901</author><pubDate>Wed, 18 Jul 2012 13:35:00 GMT</pubDate><guid>http://www.aygfsteel.com/zhanghu198901/archive/2012/07/18/383446.html</guid><wfw:comment>http://www.aygfsteel.com/zhanghu198901/comments/383446.html</wfw:comment><comments>http://www.aygfsteel.com/zhanghu198901/archive/2012/07/18/383446.html#Feedback</comments><slash:comments>2</slash:comments><wfw:commentRss>http://www.aygfsteel.com/zhanghu198901/comments/commentRss/383446.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/zhanghu198901/services/trackbacks/383446.html</trackback:ping><description><![CDATA[<span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; ">1) E序: 指o+数据的byte 序列, ? qq.exe </span><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /><span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; ">2) q程: 正在q行的程? 是程序动态的执行q程(q行于主存储? </span><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /><span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; ">3) U程: 在进E内? q发q程的过E?Ҏ) </span><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /><span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; ">4) q发: q程是ƈ发运行的, OS 时间划分ؓ很多旉片段, 可?nbsp;</span><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /><span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; ">均匀分配l正在运行的E序, 微观上进E走走停? 宏观上都在运?nbsp;</span><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /><span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; ">q种都运行的现象? q发, 但是不是l对意义上的"同时"</span> <img src ="http://www.aygfsteel.com/zhanghu198901/aggbug/383446.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/zhanghu198901/" target="_blank">zhanghu198901</a> 2012-07-18 21:35 <a href="http://www.aygfsteel.com/zhanghu198901/archive/2012/07/18/383446.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss> <footer> <div class="friendship-link"> <a href="http://www.aygfsteel.com/" title="狠狠久久亚洲欧美专区_中文字幕亚洲综合久久202_国产精品亚洲第五区在线_日本免费网站视频">狠狠久久亚洲欧美专区_中文字幕亚洲综合久久202_国产精品亚洲第五区在线_日本免费网站视频</a> </div> </footer> վ֩ģ壺 <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">ˮ</a>| <a href="http://" target="_blank">ʷ</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">ϳ</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">ʯɽ</a>| <a href="http://" target="_blank">ʩ</a>| <a href="http://" target="_blank">ԭ</a>| <a href="http://" target="_blank">人</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">̳</a>| <a href="http://" target="_blank">Ǽ</a>| <a href="http://" target="_blank">ٲ</a>| <a href="http://" target="_blank">̩</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">ڽ</a>| <a href="http://" target="_blank">ƽ</a>| <a href="http://" target="_blank">ں</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">̶</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">˲</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">½</a>| <a href="http://" target="_blank">ݶ</a>| <a href="http://" target="_blank"></a>| <script> (function(){ var bp = document.createElement('script'); var curProtocol = window.location.protocol.split(':')[0]; if (curProtocol === 'https') { bp.src = 'https://zz.bdstatic.com/linksubmit/push.js'; } else { bp.src = 'http://push.zhanzhang.baidu.com/push.js'; } var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(bp, s); })(); </script> </body>