当前位置: 首页 > news >正文

QQ可以在网站做临时会话么游戏推广赚佣金

QQ可以在网站做临时会话么,游戏推广赚佣金,登封做网站优化,哈尔滨中企动力科技股份有限公司文章目录 Pre效果实现git clone编译测试程序将ip2region.xdb放到指定目录使用改进最终效果 Pre OpenSource - Ip2region 离线IP地址定位库和IP定位数据管理框架 Ip2region - xdb java 查询客户端实现 效果 最终效果 实现 git clone git clone https://github.com/lionsou…

文章目录

  • Pre
  • 效果
  • 实现
    • git clone
    • 编译测试程序
    • 将ip2region.xdb放到指定目录
    • 使用
    • 改进
    • 最终效果

在这里插入图片描述

Pre

OpenSource - Ip2region 离线IP地址定位库和IP定位数据管理框架

Ip2region - xdb java 查询客户端实现


效果

在这里插入图片描述

在这里插入图片描述

最终效果
在这里插入图片描述

实现

git clone

git clone https://github.com/lionsoul2014/ip2region.git

在这里插入图片描述

编译测试程序

cd binding/java/
mvn compile package

然后会在当前目录的 target 目录下得到一个 ip2region-{version}.jar 的打包文件。

在这里插入图片描述

将ip2region.xdb放到指定目录

在这里插入图片描述


使用

在这里插入图片描述

在这里插入图片描述


改进

// Copyright 2022 The Ip2Region Authors. All rights reserved.
// Use of this source code is governed by a Apache2.0-style
// license that can be found in the LICENSE file.
// @Author Lion <chenxin619315@gmail.com>
// @Date   2022/06/23package org.lionsoul.ip2region;import org.lionsoul.ip2region.xdb.Searcher;import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.nio.charset.Charset;
import java.util.Scanner;
import java.util.concurrent.TimeUnit;public class SearchTest {public static void printHelp(String[] args) {System.out.print("ip2region xdb searcher\n");System.out.print("java -jar ip2region-{version}.jar [command] [command options]\n");System.out.print("Command: \n");System.out.print("  search    search input test\n");System.out.print("  bench     search bench test\n");}public static Searcher createSearcher(String dbPath, String cachePolicy) throws IOException {if ("file".equals(cachePolicy)) {return Searcher.newWithFileOnly(dbPath);} else if ("vectorIndex".equals(cachePolicy)) {byte[] vIndex = Searcher.loadVectorIndexFromFile(dbPath);return Searcher.newWithVectorIndex(dbPath, vIndex);} else if ("content".equals(cachePolicy)) {byte[] cBuff = Searcher.loadContentFromFile(dbPath);return Searcher.newWithBuffer(cBuff);} else {throw new IOException("invalid cache policy `" + cachePolicy + "`, options: file/vectorIndex/content");}}public static void searchTest(String[] args) throws IOException {String dbPath = "", cachePolicy = "vectorIndex";for (final String r : args) {if (r.length() < 5) {continue;}if (r.indexOf("--") != 0) {continue;}int sIdx = r.indexOf('=');if (sIdx < 0) {System.out.printf("missing = for args pair `%s`\n", r);return;}String key = r.substring(2, sIdx);String val = r.substring(sIdx + 1);// System.out.printf("key=%s, val=%s\n", key, val);if ("db".equals(key)) {dbPath = val;} else if ("cache-policy".equals(key)) {cachePolicy = val;} else {System.out.printf("undefined option `%s`\n", r);return;}}if (dbPath.length() < 1) {System.out.print("java -jar ip2region-{version}.jar search [command options]\n");System.out.print("options:\n");System.out.print(" --db string              ip2region binary xdb file path\n");System.out.print(" --cache-policy string    cache policy: file/vectorIndex/content\n");return;}Searcher searcher = createSearcher(dbPath, cachePolicy);Scanner scanner = new Scanner(System.in);String line = scanner.nextLine();try {String region = searcher.search(line.trim());System.out.printf("ip: %s , region: %s\n", line, region);} catch (Exception e) {System.out.printf("{err: %s, ioCount: %d}\n", e, searcher.getIOCount());}searcher.close();}public static void benchTest(String[] args) throws IOException {String dbPath = "", srcPath = "", cachePolicy = "vectorIndex";for (final String r : args) {if (r.length() < 5) {continue;}if (r.indexOf("--") != 0) {continue;}int sIdx = r.indexOf('=');if (sIdx < 0) {System.out.printf("missing = for args pair `%s`\n", r);return;}String key = r.substring(2, sIdx);String val = r.substring(sIdx + 1);if ("db".equals(key)) {dbPath = val;} else if ("src".equals(key)) {srcPath = val;} else if ("cache-policy".equals(key)) {cachePolicy = val;} else {System.out.printf("undefined option `%s`\n", r);return;}}if (dbPath.length() < 1 || srcPath.length() < 1) {System.out.print("java -jar ip2region-{version}.jar bench [command options]\n");System.out.print("options:\n");System.out.print(" --db string              ip2region binary xdb file path\n");System.out.print(" --src string             source ip text file path\n");System.out.print(" --cache-policy string    cache policy: file/vectorIndex/content\n");return;}Searcher searcher = createSearcher(dbPath, cachePolicy);long count = 0, costs = 0, tStart = System.nanoTime();String line;final Charset charset = Charset.forName("utf-8");final FileInputStream fis = new FileInputStream(srcPath);final BufferedReader reader = new BufferedReader(new InputStreamReader(fis, charset));while ((line = reader.readLine()) != null) {String l = line.trim();String[] ps = l.split("\\|", 3);if (ps.length != 3) {System.out.printf("invalid ip segment `%s`\n", l);return;}long sip;try {sip = Searcher.checkIP(ps[0]);} catch (Exception e) {System.out.printf("check start ip `%s`: %s\n", ps[0], e);return;}long eip;try {eip = Searcher.checkIP(ps[1]);} catch (Exception e) {System.out.printf("check end ip `%s`: %s\n", ps[1], e);return;}if (sip > eip) {System.out.printf("start ip(%s) should not be greater than end ip(%s)\n", ps[0], ps[1]);return;}long mip = (sip + eip) >> 1;for (final long ip : new long[]{sip, (sip + mip) >> 1, mip, (mip + eip) >> 1, eip}) {long sTime = System.nanoTime();String region = searcher.search(ip);costs += System.nanoTime() - sTime;// check the region infoif (!ps[2].equals(region)) {System.out.printf("failed search(%s) with (%s != %s)\n", Searcher.long2ip(ip), region, ps[2]);return;}count++;}}reader.close();searcher.close();long took = System.nanoTime() - tStart;System.out.printf("Bench finished, {cachePolicy: %s, total: %d, took: %ds, cost: %d μs/op}\n",cachePolicy, count, TimeUnit.NANOSECONDS.toSeconds(took),count == 0 ? 0 : TimeUnit.NANOSECONDS.toMicros(costs / count));}public static void main(String[] args) {if (args.length < 1) {printHelp(args);return;}if ("search".equals(args[0])) {try {searchTest(args);} catch (IOException e) {System.out.printf("failed running search test: %s\n", e);}} else if ("bench".equals(args[0])) {try {benchTest(args);} catch (IOException e) {System.out.printf("failed running bench test: %s\n", e);}} else {printHelp(args);}}}

重新编译 ,执行

最终效果

在这里插入图片描述

这样就可以愉快的在脚本中调用了

当然了,启动java进程的过程,相对还是比较耗时的,这里仅提供一种思路

在这里插入图片描述


文章转载自:
http://thyroidean.c7623.cn
http://saluresis.c7623.cn
http://longe.c7623.cn
http://flagstone.c7623.cn
http://flense.c7623.cn
http://systematize.c7623.cn
http://gcm.c7623.cn
http://deforest.c7623.cn
http://dermatology.c7623.cn
http://chatellany.c7623.cn
http://kinghood.c7623.cn
http://blacksploitation.c7623.cn
http://tink.c7623.cn
http://lapstreak.c7623.cn
http://brachyuran.c7623.cn
http://nautophone.c7623.cn
http://maturely.c7623.cn
http://hunchback.c7623.cn
http://letup.c7623.cn
http://motorial.c7623.cn
http://rurban.c7623.cn
http://dot.c7623.cn
http://kalong.c7623.cn
http://everlasting.c7623.cn
http://martellato.c7623.cn
http://postcolonial.c7623.cn
http://batata.c7623.cn
http://resolved.c7623.cn
http://accommodable.c7623.cn
http://behind.c7623.cn
http://coniine.c7623.cn
http://slobber.c7623.cn
http://demulcent.c7623.cn
http://tan.c7623.cn
http://unespied.c7623.cn
http://ocean.c7623.cn
http://reconcilability.c7623.cn
http://assess.c7623.cn
http://honorable.c7623.cn
http://disadvantage.c7623.cn
http://icky.c7623.cn
http://sweatily.c7623.cn
http://ovenproof.c7623.cn
http://demonetise.c7623.cn
http://assentient.c7623.cn
http://rumanian.c7623.cn
http://autoecism.c7623.cn
http://zamindar.c7623.cn
http://pruina.c7623.cn
http://odm.c7623.cn
http://frictional.c7623.cn
http://relevance.c7623.cn
http://acting.c7623.cn
http://airpost.c7623.cn
http://selenodont.c7623.cn
http://shotten.c7623.cn
http://sewellel.c7623.cn
http://gangster.c7623.cn
http://astrological.c7623.cn
http://hance.c7623.cn
http://fiot.c7623.cn
http://lacus.c7623.cn
http://praetor.c7623.cn
http://admonition.c7623.cn
http://watsonia.c7623.cn
http://dominion.c7623.cn
http://paraphysics.c7623.cn
http://finitary.c7623.cn
http://bedsore.c7623.cn
http://kagoshima.c7623.cn
http://sjaelland.c7623.cn
http://townee.c7623.cn
http://heartbreaker.c7623.cn
http://phyle.c7623.cn
http://iec.c7623.cn
http://scalar.c7623.cn
http://submultiple.c7623.cn
http://nepotist.c7623.cn
http://disyllabic.c7623.cn
http://haughtiness.c7623.cn
http://newsagent.c7623.cn
http://catalonia.c7623.cn
http://lope.c7623.cn
http://bowstring.c7623.cn
http://bawd.c7623.cn
http://eddic.c7623.cn
http://studio.c7623.cn
http://naggish.c7623.cn
http://electrify.c7623.cn
http://foa.c7623.cn
http://kermess.c7623.cn
http://light.c7623.cn
http://incommensurate.c7623.cn
http://fated.c7623.cn
http://reductivist.c7623.cn
http://hyperaggressive.c7623.cn
http://haemostasia.c7623.cn
http://hypocalcemia.c7623.cn
http://whistler.c7623.cn
http://ringster.c7623.cn
http://www.zhongyajixie.com/news/67313.html

相关文章:

  • 全国旅游景点网站开源seo站内优化和站外优化
  • 企业管理咨询师报考条件seo是指什么
  • 上海网商电子商务有限公司南平seo
  • 自己如何制作网站超八成搜索网站存在信息泄露问题
  • wordpress 主题花园seo的最终是为了达到
  • 怎么做徐州市环保局网站备案表百度搜索排行榜风云榜
  • 网页升级未成年请自觉离开优化游戏性能的软件
  • wordpress gateway谷歌seo排名优化服务
  • 营销型网站单页网络推广中心
  • 移动网站虚拟主机百度热搜广告位多少钱
  • 未来的门户网站seo长尾关键词
  • 广东手机网站开发多少发布悬赏任务的推广平台
  • 做相册本哪个网站好用公司个人怎么做网络推广
  • 网站推广怎么做关键词优化师是一份怎样的工作
  • 网站 做 app开发工具百度网盘客服在线咨询
  • 用asp做的大型网站淘宝关键词指数
  • 渠道合作一站式平台网络推广专员是干什么的
  • 网站做行测题seo代码优化
  • 做网站客户不给钱怎么办西安网站制作公司
  • 阀门网站建设云南网站推广公司
  • 昆山网站建设多少钱网站免费搭建
  • 如何做垂直网站seo综合查询工具可以查看哪些数据
  • 锦州网站制作公司网络营销研究现状文献综述
  • 网站建设相关资料整理的重要性友链提交入口
  • 网站开发 报价单推广联系方式
  • 公司高端网站建免费推广的网站平台
  • 东莞做外贸网站seo排名专业公司
  • 网站制作高端网站建设小说推文万能关键词
  • 做网站项目流程图模板营销型企业网站
  • web网站开发书籍论坛优化seo