一天时间用OpenFire打造自己的IM聊天工具
Openfire
采用Java开发,开源的实时协作(RTC)服务器基于XMPP(Jabber)协议。Openfire安装和使用都非常简单,并利用Web进行管理。单台服务器可支持上万并发用户。
好友界面
功能界面
聊天界面
服务端可以用本服务器测试,地址:www.ithtw.com。如果想自己搭可在本博客其它XMPP文章找到相关搭建资料。
实现了用户注册,登录,添加好友,聊天核心功能。可正常聊天!
核心通讯代码:
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
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
|
package com.lee.xqq.control; import java.io.ByteArrayInputStream; import java.util.ArrayList; import java.util.Collection; import java.util.Iterator; import java.util.List; import org.jivesoftware.smack.Connection; import org.jivesoftware.smack.ConnectionConfiguration; import org.jivesoftware.smack.ConnectionCreationListener; import org.jivesoftware.smack.ConnectionListener; import org.jivesoftware.smack.PacketCollector; import org.jivesoftware.smack.PacketListener; import org.jivesoftware.smack.Roster; import org.jivesoftware.smack.RosterEntry; import org.jivesoftware.smack.RosterGroup; import org.jivesoftware.smack.SmackConfiguration; import org.jivesoftware.smack.XMPPConnection; import org.jivesoftware.smack.XMPPException; import org.jivesoftware.smack.filter.AndFilter; import org.jivesoftware.smack.filter.PacketFilter; import org.jivesoftware.smack.filter.PacketIDFilter; import org.jivesoftware.smack.filter.PacketTypeFilter; import org.jivesoftware.smack.packet.IQ; import org.jivesoftware.smack.packet.Message; import org.jivesoftware.smack.packet.Packet; import org.jivesoftware.smack.packet.Presence; import org.jivesoftware.smack.packet.Presence.Type; import org.jivesoftware.smack.packet.Registration; import org.jivesoftware.smack.provider.PrivacyProvider; import org.jivesoftware.smack.provider.ProviderManager; import org.jivesoftware.smack.util.StringUtils; import org.jivesoftware.smackx.Form; import org.jivesoftware.smackx.GroupChatInvitation; import org.jivesoftware.smackx.PrivateDataManager; import org.jivesoftware.smackx.ReportedData; import org.jivesoftware.smackx.ReportedData.Row; import org.jivesoftware.smackx.bytestreams.socks5.provider.BytestreamsProvider; import org.jivesoftware.smackx.packet.ChatStateExtension; import org.jivesoftware.smackx.packet.LastActivity; import org.jivesoftware.smackx.packet.OfflineMessageInfo; import org.jivesoftware.smackx.packet.OfflineMessageRequest; import org.jivesoftware.smackx.packet.SharedGroupsInfo; import org.jivesoftware.smackx.packet.VCard; import org.jivesoftware.smackx.provider.AdHocCommandDataProvider; import org.jivesoftware.smackx.provider.DataFormProvider; import org.jivesoftware.smackx.provider.DelayInformationProvider; import org.jivesoftware.smackx.provider.DiscoverInfoProvider; import org.jivesoftware.smackx.provider.DiscoverItemsProvider; import org.jivesoftware.smackx.provider.MUCAdminProvider; import org.jivesoftware.smackx.provider.MUCOwnerProvider; import org.jivesoftware.smackx.provider.MUCUserProvider; import org.jivesoftware.smackx.provider.MessageEventProvider; import org.jivesoftware.smackx.provider.MultipleAddressesProvider; import org.jivesoftware.smackx.provider.RosterExchangeProvider; import org.jivesoftware.smackx.provider.StreamInitiationProvider; import org.jivesoftware.smackx.provider.VCardProvider; import org.jivesoftware.smackx.provider.XHTMLExtensionProvider; import org.jivesoftware.smackx.search.UserSearch; import org.jivesoftware.smackx.search.UserSearchManager; import android.graphics.drawable.BitmapDrawable; import android.graphics.drawable.Drawable; import com.lee.xqq.ChatActivity; import com.lee.xqq.MainActivity; import com.lee.xqq.SplashActivity; import com.lee.xqq.base.BroadSender; import com.lee.xqq.base.MLog; import com.lee.xqq.item.XUserItem; import com.lee.xqq.net.HttpResult; import com.lee.xqq.net.HttpUtil; import com.lee.xqq.util.CachedThreadPool; /** * 所有的数据控制,逻辑可以在这里实现 * */ public class DataUtils implements ConnectionListener, ConnectionCreationListener, PacketListener { private static DataUtils instance; private Connection connection; private static String host; private static int port; private String user; private DataUtils() { } public void setHost(String host, int port) { DataUtils.host = host; DataUtils.port = port; } public static DataUtils getInstance() { if (instance == null ) instance = new DataUtils(); return instance; } public Connection getConnection() { return connection; } public String getUser() { return user; } public void requestBaidu() { CachedThreadPool.execute( new Runnable() { @Override public void run() { // TODO Auto-generated method stub HttpUtil httpUtil = HttpUtil.requestText( HttpResult result = httpUtil.getResponse(); if (result.getCode() == 200 ) { // 向界面发送接收广播 } } }); } public void initXMPP() { CachedThreadPool.execute( new Runnable() { @Override public void run() { // TODO Auto-generated method stub connectXmppServer(); } }); } private void connectXmppServer() { ConnectionConfiguration config = new ConnectionConfiguration(host, port); /** 是否启用安全验证 */ config.setSASLAuthenticationEnabled( false ); config.setReconnectionAllowed( true ); // 断线重连 /** 是否启用调试 */ // config.setDebuggerEnabled(true); /** 创建connection链接 */ try { Connection.addConnectionCreationListener( this ); configure(ProviderManager.getInstance()); connection = new XMPPConnection(config); /** 建立连接 */ connection.connect(); connection.addConnectionListener( this ); PacketTypeFilter filter = new PacketTypeFilter(Packet. class ); connection.addPacketListener( this , filter); } catch (XMPPException e) { e.printStackTrace(); MLog.makeText( "服务器连接失败" ); } } /** * Android读不到/META-INF下的配置文件,需要手工配置。 * * @param pm */ private void configure(ProviderManager pm) { // Private Data Storage pm.addIQProvider( "query" , "jabber:iq:private" , new PrivateDataManager.PrivateDataIQProvider()); // Time try { pm.addIQProvider( "query" , "jabber:iq:time" , Class.forName( "org.jivesoftware.smackx.packet.Time" )); } catch (ClassNotFoundException e) { e.printStackTrace(); } // Roster Exchange pm.addExtensionProvider( "x" , "jabber:x:roster" , new RosterExchangeProvider()); // Message Events pm.addExtensionProvider( "x" , "jabber:x:event" , new MessageEventProvider()); // Chat State pm.addExtensionProvider( "active" , new ChatStateExtension.Provider()); pm.addExtensionProvider( "composing" , new ChatStateExtension.Provider()); pm.addExtensionProvider( "paused" , new ChatStateExtension.Provider()); pm.addExtensionProvider( "inactive" , new ChatStateExtension.Provider()); pm.addExtensionProvider( "gone" , new ChatStateExtension.Provider()); // XHTML new XHTMLExtensionProvider()); // Group Chat Invitations pm.addExtensionProvider( "x" , "jabber:x:conference" , new GroupChatInvitation.Provider()); // Service Discovery # Items new DiscoverItemsProvider()); // Service Discovery # Info new DiscoverInfoProvider()); // Data Forms pm.addExtensionProvider( "x" , "jabber:x:data" , new DataFormProvider()); // MUC User new MUCUserProvider()); // MUC Admin new MUCAdminProvider()); // MUC Owner new MUCOwnerProvider()); // Delayed Delivery pm.addExtensionProvider( "x" , "jabber:x:delay" , new DelayInformationProvider()); // Version try { pm.addIQProvider( "query" , "jabber:iq:version" , Class.forName( "org.jivesoftware.smackx.packet.Version" )); } catch (ClassNotFoundException e) { // Not sure what's happening here. e.printStackTrace(); } // VCard pm.addIQProvider( "vCard" , "vcard-temp" , new VCardProvider()); // Offline Message Requests new OfflineMessageRequest.Provider()); // Offline Message Indicator pm.addExtensionProvider( "offline" , new OfflineMessageInfo.Provider()); // Last Activity pm.addIQProvider( "query" , "jabber:iq:last" , new LastActivity.Provider()); // User Search pm.addIQProvider( "query" , "jabber:iq:search" , new UserSearch.Provider()); // SharedGroupsInfo pm.addIQProvider( "sharedgroup" , new SharedGroupsInfo.Provider()); // JEP-33: Extended Stanza Addressing pm.addExtensionProvider( "addresses" , new MultipleAddressesProvider()); // FileTransfer new StreamInitiationProvider()); new BytestreamsProvider()); // Privacy pm.addIQProvider( "query" , "jabber:iq:privacy" , new PrivacyProvider()); new AdHocCommandDataProvider()); pm.addExtensionProvider( "malformed-action" , new AdHocCommandDataProvider.MalformedActionError()); pm.addExtensionProvider( "bad-locale" , new AdHocCommandDataProvider.BadLocaleError()); pm.addExtensionProvider( "bad-payload" , new AdHocCommandDataProvider.BadPayloadError()); pm.addExtensionProvider( "bad-sessionid" , new AdHocCommandDataProvider.BadSessionIDError()); pm.addExtensionProvider( "session-expired" , new AdHocCommandDataProvider.SessionExpiredError()); } public boolean register(String account, String password) { Registration reg = new Registration(); reg.setType(IQ.Type.SET); reg.setTo(connection.getServiceName()); reg.setUsername(account); // 注意这里createAccount注册时,参数是username,不是jid,是“@”前面的部分。 reg.setPassword(password); reg.addAttribute( "android" , "geolo_createUser_android" ); // 这边addAttribute不能为空,否则出错。所以做个标志是android手机创建的吧!!!!! PacketFilter filter = new AndFilter( new PacketIDFilter( reg.getPacketID()), new PacketTypeFilter(IQ. class )); PacketCollector collector = connection.createPacketCollector(filter); connection.sendPacket(reg); IQ result = (IQ) collector.nextResult(SmackConfiguration .getPacketReplyTimeout()); if (result == null ) { MLog.makeText( "连接超时" ); } else if (result.getType() == IQ.Type.RESULT) { MLog.makeText( "注册成功" ); return true ; } else { MLog.makeText(result.getError().toString()); } return false ; } public boolean login(String userName, String userPwd) { try { connection.login(userName, userPwd); user = userName + "@" + connection.getServiceName(); return true ; } catch (Exception e) { e.printStackTrace(); } MLog.makeText( "登录失败" ); return false ; } public void changePassword(String pwd) { try { connection.getAccountManager().changePassword(pwd); } catch (Exception e) { e.printStackTrace(); } } /** * 更改用户状态 */ public void setPresence( int code) { Presence presence = null ; switch (code) { case 0 : presence = new Presence(Presence.Type.available); connection.sendPacket(presence); MLog.makeText( "设置在线" ); break ; case 1 : presence = new Presence(Presence.Type.available); presence.setMode(Presence.Mode.chat); connection.sendPacket(presence); MLog.makeText( "设置Q我吧" ); break ; case 2 : presence = new Presence(Presence.Type.available); presence.setMode(Presence.Mode.dnd); connection.sendPacket(presence); MLog.makeText( "设置忙碌" ); break ; case 3 : presence = new Presence(Presence.Type.available); presence.setMode(Presence.Mode.away); connection.sendPacket(presence); MLog.makeText( "设置离开" ); break ; case 4 : Roster roster = connection.getRoster(); Collection<RosterEntry> entries = roster.getEntries(); for (RosterEntry entry : entries) { presence = new Presence(Presence.Type.unavailable); presence.setPacketID(Packet.ID_NOT_AVAILABLE); presence.setFrom(connection.getUser()); presence.setTo(entry.getUser()); connection.sendPacket(presence); } // 向同一用户的其他客户端发送隐身状态 presence = new Presence(Presence.Type.unavailable); presence.setPacketID(Packet.ID_NOT_AVAILABLE); presence.setFrom(connection.getUser()); presence.setTo(StringUtils.parseBareAddress(connection.getUser())); connection.sendPacket(presence); MLog.makeText( "设置隐身" ); break ; case 5 : presence = new Presence(Presence.Type.unavailable); connection.sendPacket(presence); MLog.makeText( "设置离线" ); break ; default : break ; } } public void logoutAccount() { try { connection.getAccountManager().deleteAccount(); } catch (Exception e) { e.printStackTrace(); } } public Collection<RosterGroup> getGroups() { return connection.getRoster().getGroups(); } public List<RosterEntry> getEntriesByGroup(String groupName) { List<RosterEntry> Entrieslist = new ArrayList<RosterEntry>(); RosterGroup rosterGroup = connection.getRoster().getGroup(groupName); Collection<RosterEntry> rosterEntry = rosterGroup.getEntries(); Iterator<RosterEntry> i = rosterEntry.iterator(); while (i.hasNext()) { Entrieslist.add(i.next()); } return Entrieslist; } public Drawable getUserImage(String user) { ByteArrayInputStream bais = null ; try { VCard vcard = new VCard(); // 加入这句代码,解决No VCard for ProviderManager.getInstance().addIQProvider( "vCard" , "vcard-temp" , new org.jivesoftware.smackx.provider.VCardProvider()); if (user == "" || user == null || user.trim().length() <= 0 ) { return null ; } vcard.load(connection, user + "@" + connection.getServiceName()); if (vcard == null || vcard.getAvatar() == null ) return null ; bais = new ByteArrayInputStream(vcard.getAvatar()); BitmapDrawable drawable = new BitmapDrawable(bais); bais.close(); return drawable; } catch (Exception e) { e.printStackTrace(); } return null ; } public List<RosterEntry> getAllEntries() { List<RosterEntry> Entrieslist = new ArrayList<RosterEntry>(); Collection<RosterEntry> rosterEntry = connection.getRoster() .getEntries(); Iterator<RosterEntry> i = rosterEntry.iterator(); while (i.hasNext()) { Entrieslist.add(i.next()); } return Entrieslist; } public boolean addGroup(String groupName) { try { connection.getRoster().createGroup(groupName); MLog.makeText( "创建成功" ); return true ; } catch (Exception e) { e.printStackTrace(); } return false ; } /** * 添加好友 无分组 * * @param userName * @param name * @return */ public boolean addUser(String userName, String name) { try { String account = userName + "@" + connection.getServiceName(); connection.getRoster().createEntry(account, name, null ); return true ; } catch (Exception e) { e.printStackTrace(); } return false ; } public boolean addUserWithName(String userName, String name, Presence.Type type) { return addUserWithName(userName, name, XMsgConst.X_DEFAULT_GROUP, type); } /** * 添加好友 有分组 * * @param userName * @param name * @param groupName * @return */ public boolean addUserWithName(String userName, String name, String groupName, Presence.Type type) { try { Presence subscription = new Presence(type); subscription.setTo(userName); userName += "@" + connection.getServiceName(); connection.sendPacket(subscription); if (type == Type.subscribed) connection.getRoster().createEntry(userName, name, new String[] { groupName }); return true ; } catch (Exception e) { e.printStackTrace(); return false ; } } public boolean removeUser(String userName) { try { RosterEntry entry = null ; if (userName.contains( "@" )) entry = connection.getRoster().getEntry(userName); else entry = connection.getRoster().getEntry( userName + "@" + connection.getServiceName()); if (entry == null ) entry = connection.getRoster().getEntry(userName); connection.getRoster().removeEntry(entry); return true ; } catch (Exception e) { e.printStackTrace(); } return false ; } public List<XUserItem> searchUsers(String userName) { List<XUserItem> results = new ArrayList<XUserItem>(); try { UserSearchManager usm = new UserSearchManager(connection); String serverDomain = "search." + connection.getServiceName(); Form searchForm = usm.getSearchForm(serverDomain); Form answerForm = searchForm.createAnswerForm(); answerForm.setAnswer( "Username" , true ); answerForm.setAnswer( "search" , userName); ReportedData data = usm.getSearchResults(answerForm, serverDomain); Iterator<Row> it = data.getRows(); Row row = null ; XUserItem user = null ; while (it.hasNext()) { row = it.next(); String uName = row.getValues( "Username" ).next().toString(); String Name = row.getValues( "Name" ).next().toString(); String Email = row.getValues( "Email" ).next().toString(); user = new XUserItem(uName, Name, Email); results.add(user); } return results; } catch (XMPPException e) { // TODO Auto-generated catch block e.printStackTrace(); } return results; } public void sendMessage(String toJID, String message) { // TODO Auto-generated method stub final Message newMessage = new Message(toJID, Message.Type.chat); newMessage.setBody(message); connection.sendPacket(newMessage); } @Override public void connectionClosed() { // TODO Auto-generated method stub MLog.makeText( "连接已关闭" ); } @Override public void connectionClosedOnError(Exception arg0) { // TODO Auto-generated method stub MLog.makeText( "连接关闭异常" ); arg0.printStackTrace(); } @Override public void reconnectingIn( int arg0) { // TODO Auto-generated method stub MLog.makeText( "reconnectingIn:" + arg0); } @Override public void reconnectionFailed(Exception arg0) { // TODO Auto-generated method stub MLog.makeText( "连接失败" ); arg0.printStackTrace(); } @Override public void reconnectionSuccessful() { // TODO Auto-generated method stub MLog.makeText( "重连成功" ); } @Override public void connectionCreated(Connection arg0) { // TODO Auto-generated method stub BroadSender.sendBroadcast(SplashActivity. class ); } @Override public void processPacket(Packet packet) { // TODO Auto-generated method stub if (packet instanceof Message) { Message msg = (Message) packet; CacheUtils.getInstance().addMessage(msg); BroadSender.sendBroadcast(ChatActivity. class , "action" , XMsgConst.X_PACKET_TYPE_MESSAGE); } else if (packet instanceof Presence) { Presence presence = (Presence) packet; String from = presence.getFrom(); // 发送方 String to = presence.getTo(); // 接收方 Type type = presence.getType(); int typeValue = 0 ; if (type.equals(Presence.Type.subscribe)) { // 好友申请 typeValue = XMsgConst.X_PRESENCE_SUBSCRIBE; } else if (type.equals(Presence.Type.subscribed)) { // 同意添加好友 typeValue = XMsgConst.X_PRESENCE_SUBSCRIBED; } else if (type.equals(Presence.Type.unsubscribe)) { // 拒绝添加好友 typeValue = XMsgConst.X_PRESENCE_UNSUBSCRIBE; } else if (type.equals(Presence.Type.unsubscribed)) { // 删除好友 typeValue = XMsgConst.X_PRESENCE_UNSUBSCRIBED; } else if (type.equals(Presence.Type.unavailable)) { // 好友下线 typeValue = XMsgConst.X_PRESENCE_UNAVAILABLE; from = processFrom(from); CacheUtils.getInstance().putPresence(from, presence); } else { // 好友上线 typeValue = XMsgConst.X_PRESENCE_ONLINE; from = processFrom(from); CacheUtils.getInstance().putPresence(from, presence); } String[] params = new String[] { "action" , XMsgConst.X_PACKET_TYPE_PRESENCE, "type" , String.valueOf(typeValue), "from" , from, "to" , to }; BroadSender.sendBroadcast(MainActivity. class , params); } } /** * 去掉多余的服务器字符串 * * @param from * @return */ private String processFrom(String from) { int endPos = from.lastIndexOf( "/" ); if (endPos != - 1 ) from = from.substring( 0 , endPos); return from; } } |
- 本文固定链接: http://www.ithtw.com/636.html
- 转载请注明: leehom 2015年01月07日 于 IT十万个为什么 发表
一天时间用OpenFire打造自己的IM聊天工具的更多相关文章
- 华为云Stack首席架构师:打造“称手”的数字化工具,答好政企IT数字化转型这道必选题
摘要:数字化转型是一号位工程,数字化的工具本身就是企业的核心竞争力. 本文分享自华为云社区<华为云Stack首席架构师:打造"称手"的数字化工具,答好政企IT数字化转型这道必 ...
- 从零开始打造个人专属命令行工具集——yargs完全指南
前言 使用命令行程序对程序员来说很常见,就算是前端工程师或者开发gui的,也需要使用命令行来编译程序或者打包程序 熟练使用命令行工具能极大的提高开发效率,linux自带的命令行工具都非常的有用,但是这 ...
- 【腾讯敏捷转型No.6】如何打造称手的敏捷工具
通常情况下,大家对于敏捷的感受就是:大家一起来开站立晨会啦!然后一大早,大家拿着早餐,围成一个圈,听一个人在讲话. 在很多公司,决定采用敏捷之后,都会从晨会开始,因为很多人觉得敏捷其它模块都很难学习, ...
- ios swift 打造自己的http请求工具
在ios开发中,网络请求是不可以少的,说到网络请求可能用的最多的就是第三方的比人比较有名的AFNetworking.Alamofire等,原生的用的少.今天就用ios提供的原生方法来打造属于自己的一个 ...
- 微坑---微信小程序ios上时间字符串转换为时间戳时,在开发工具上和安卓手机上运行成功
给定一个时间字符串 var time="2017-02-27 16:42:53" js有三种转换为时间戳的方法:1.var timestamp = Date.parse(time ...
- JAVA-Socket通信 打造属于自己的聊天室(服务端)
我们每天都在使用着微信.QQ等聊天软件,但不知你是否有想过这些聊天软件是如何实现的?是否想过要制作一个属于自己的聊天室? 本篇博客将带你打造一个简单的属于自己的聊天室,将cmd作为聊天窗口,可通过内网 ...
- openfire搭建spackweb在线即时聊天
1.首先去openFire官网下载openFire以及spackweb,以下地址可以2样东西一次打包下载.http://download.csdn.net/detail/a315157973/8048 ...
- python打造批量关键词排名查询工具
自己做站点的时候,都看看收录和关键词排名什么的,所以打造的这个批量关键词查询工具. #encoding:utf-8 import urllib,re,random,time,sys,StringIO, ...
- 打造Worktile敏捷开发管理工具的思与惑
从2019年初,我们团队准备开发一款适合研发团队使用的敏捷开发管理工具,那时候我们也在思考,到底什么样的工具才算是优秀的研发管理工具,研发管理的场景.方法和流派有很多,市面上关于研发管理工具的产品也是 ...
随机推荐
- 转:获取GridView中RowCommand的当前索引行
获取GridView中RowCommand的当前索引行 前台添加一模版列,里面添加一个LinkButton 前台 (如果在后台代码中用e.CommandArgument取值的话前台代码就必须在按钮中设 ...
- python+selenium面试题
selenium中如何判断元素是否存在? selenium中没有提供原生的方法判断元素是否存在,一般我们可以通过定位元素+异常捕获的方式判断. # 判断元素是否存在 try: dr.find_elem ...
- Python序列化、date、random、os模块
知识点一:序列化与反序列化(json和pickple) 01 什么是序列化/反序列化 序列化就是将内存中的数据结构转换成一种中间格式存储到硬盘或者基于网络传输 发序列化就是硬盘中或者网络中 ...
- Codecraft-18 and Codeforces Round #458 (Div. 1 + Div. 2, combined)
我真的是太菜了 A. Perfect Squares time limit per test 1 second memory limit per test 256 megabytes input st ...
- 2017ICPC北京 J:Pangu and Stones
#1636 : Pangu and Stones 时间限制:1000ms 单点时限:1000ms 内存限制:256MB 描述 In Chinese mythology, Pangu is the fi ...
- 清除Jquery动画的队列
当我们在写页面效果时,有时希望当鼠标放到某个元素上,这时会有动态的效果,当鼠标移出时效果会消失.但实际中,如果快速的用鼠标指向元素并移出,反复几次.即便鼠标不再指向这个元素,但这个元素会不停的重复着动 ...
- 微软工具Sysinternals Suite
工具:Sysinternals Suite 一个可以看进程的工具.
- 图标字体iconfont的使用
什么是iconfont? iconfont就是字面上的意思,叫做"字体图标",将一套图标集以字体文件的形式封装,并通过 CSS 的 @font-face 作为 Web Font 调 ...
- JAVA接口与抽象类区别
接口 1.接口可以继承多个接口,extends 接口1,接口2,接口3 2.接口的成员变量默认是public static abstract,必须初始化的: 3.接口只能有抽象方法,继承接口的类必须实 ...
- kmp-模板-hd-1711
p数组记录的是当该位置上失配的时候,跳到第几个进行继续匹配: /* 题意:给两个数串,求模板串第一此出现在源串中的位置,开头的位置:没有输出-1: 算法:kmp 先对字符串进行自匹配: 然后串间匹配: ...