生成短链(网址) ShortUrlLink
建表
CREATE TABLE [dbo].[ShortUrl](
[Id] [int] IDENTITY(,) NOT NULL,
[LongUrl] [nvarchar]() NOT NULL,
[BaseUri] [int] NOT NULL,
[ShortToken] [nvarchar]() NOT NULL,
[Hits] [int] NOT NULL,
[Creator] [nvarchar]() NULL,
[CreateTime] [datetime] NOT NULL,
[LastUpdateTime] [datetime] NULL,
[LastOperator] [nvarchar]() NULL,
[Enable] [bit] NOT NULL,
[IsDelete] [bit] NOT NULL
) ON [PRIMARY] GO EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'长链地址' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'ShortUrl', @level2type=N'COLUMN',@level2name=N'LongUrl'
GO EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'短链域名对应数值' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'ShortUrl', @level2type=N'COLUMN',@level2name=N'BaseUri'
GO EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'短链末尾编码串' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'ShortUrl', @level2type=N'COLUMN',@level2name=N'ShortToken'
GO EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'url点击量' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'ShortUrl', @level2type=N'COLUMN',@level2name=N'Hits'
GO EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'创建人' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'ShortUrl', @level2type=N'COLUMN',@level2name=N'Creator'
GO EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'创建时间' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'ShortUrl', @level2type=N'COLUMN',@level2name=N'CreateTime'
GO EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'最近更新时间' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'ShortUrl', @level2type=N'COLUMN',@level2name=N'LastUpdateTime'
GO EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'更新操作人' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'ShortUrl', @level2type=N'COLUMN',@level2name=N'LastOperator'
GO EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'是否启用' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'ShortUrl', @level2type=N'COLUMN',@level2name=N'Enable'
GO EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'是否删除' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'ShortUrl', @level2type=N'COLUMN',@level2name=N'IsDelete'
GO ALTER TABLE [dbo].[ShortUrl] ADD CONSTRAINT [DF_ShortUrl_IsDelete] DEFAULT (()) FOR [IsDelete]
GO
CREATE TABLE [dbo].[ShortUrlStat](
[Id] [int] IDENTITY(,) NOT NULL,
[UrlId] [int] NOT NULL,
[ShortUrl] [nvarchar]() NOT NULL,
[UrlRefferer] [nvarchar]() NOT NULL,
[UserAgent] [nvarchar]() NOT NULL,
[UserHostAddress] [nvarchar]() NOT NULL,
[UserLanguage] [nvarchar]() NOT NULL,
[Browser] [nvarchar]() NOT NULL,
[MajorVersion] [int] NOT NULL,
[IsMobile] [bit] NOT NULL,
[CreateTime] [datetime] NOT NULL
) ON [PRIMARY] GO EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'状态记录所对应的长链的id' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'ShortUrlStat', @level2type=N'COLUMN',@level2name=N'UrlId'
GO EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'短链地址' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'ShortUrlStat', @level2type=N'COLUMN',@level2name=N'ShortUrl'
GO EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'获取Url链接当前客户端的主机部分' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'ShortUrlStat', @level2type=N'COLUMN',@level2name=N'UrlRefferer'
GO EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'获取客户端完整的用户代理字符串' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'ShortUrlStat', @level2type=N'COLUMN',@level2name=N'UserAgent'
GO EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'获取客户端ip的主机地址' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'ShortUrlStat', @level2type=N'COLUMN',@level2name=N'UserHostAddress'
GO EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'获取客户端语言首选项' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'ShortUrlStat', @level2type=N'COLUMN',@level2name=N'UserLanguage'
GO EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'获取浏览器请求标头中发送的浏览器字符串' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'ShortUrlStat', @level2type=N'COLUMN',@level2name=N'Browser'
GO EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'获取浏览器主版本号' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'ShortUrlStat', @level2type=N'COLUMN',@level2name=N'MajorVersion'
GO EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'获取浏览器是否已标识为移动设备' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'ShortUrlStat', @level2type=N'COLUMN',@level2name=N'IsMobile'
GO EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'创建时间' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'ShortUrlStat', @level2type=N'COLUMN',@level2name=N'CreateTime'
GO
@model IEnumerable<ShortUrl.ShortUrlModels>
@{
ViewBag.Title = "Index";
} <h2>Index</h2>
<a href="@Url.Action("AddDetail", "ShortUrl")">新增</a>
@if (Model != null && Model.Any())
{
<table>
<thead>
<tr>
<th style="text-align: center">
序号
</th>
<th style="text-align: center">短链</th>
</tr>
</thead>
<tbody>
@foreach (var item in Model)
{
<tr>
<td>@item.Id</td>
<td><a href="@Url.Action("ReirectToken", "ShortUrl", new { id =item.Id})" target="_blank">@item.BaseShortUrl</a></td>
</tr>
}
</tbody>
</table>
}
@using ShortUrl
@model ShortUrl.ShortUrlModels
@{
ViewBag.Title = "AddShortUrl";
}
<script src="@Url.Content("~/Scripts/jquery-1.8..min.js")"></script>
<h2>AddShortUrl</h2> <table style="width: 99%; margin: 5px auto;">
<tbody>
<tr>
<td>长链</td>
<td>
<input type="text" value="@Model.LongUrl" id="longurl"/>
</td>
</tr>
<tr>
<td>短网址后缀</td>
<td>
@Html.DropDownListFor(m => m.BaseUri, new KvSelectList(Model.ShortUrl))
</td>
</tr>
<tr>
<td>
<input type="button" value="保存" class="sBtn" id="btnSave" style="margin-left: 45%"/>
</td>
</tr>
</tbody>
</table> <script type="text/javascript">
function necessaryinput() {
//if ($("#longurl").val() == '' || $("#longurl").val() == undefined || $("#longurl").val().match(/(http[s]?|ftp):\/\/([\w-]+\.)+[\w-]+(\/[\w- .\/?%&=]*)?/) == null) {
// alert("请输入合法的长链地址");
// return false;
//}
if ($("#longurl").val() == '' || $("#longurl").val() == undefined) {
alert("请输入长链地址");
return false;
}
return true;
}
var model = {};
$("#btnSave").click(function () {
model.LongUrl = $.trim($("#longurl").val());
model.BaseUri = $.trim($("#BaseUri").val()); if (confirm("你确定保存吗?")) {
if (necessaryinput()) {
$.ajax({
url: '@Url.Action("Add", "ShortUrl")',
type: 'post',
dataType: 'json',
contentType: 'application/json',
data: JSON.stringify(model),
success: function (result) {
if (result.DoFlag) {
alert(result.DoResult);
window.location.href = '@Url.Action("Index", "ShortUrl")';
} else {
alert(result.DoResult);
}
}
});
}
} })
</script>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Web;
using System.Web.Mvc;
using ShortUrl.Models;
using ShortUrlDbEntity;
using ShortUrlUtility; namespace ShortUrl.Controllers
{
public class ShortUrlController : Controller
{
//
// GET: /ShortUrl/
MVCDemoEntities db = new MVCDemoEntities();
public ActionResult Index()
{
List<ShortUrlModels> shortUrlList = new List<ShortUrlModels>();
shortUrlList.AddRange(db.ShortUrl.OrderByDescending(x => x.Hits).ThenByDescending(x => x.LastUpdateTime).Select(t => new ShortUrlModels()
{
Id=t.Id,
LongUrl = t.LongUrl,
BaseUri = t.BaseUri,
ShortToken = t.ShortToken,
Hits = t.Hits,
CreateTime = t.CreateTime, }));
return View(shortUrlList);
} //短链跳转
public ActionResult ReirectToken(int id)
{
if (id == )
return RedirectToAction("UrlNotFound", "ShortUrl");
else
{
var shortUrlRecord = db.ShortUrl.FirstOrDefault(t => t.Id == id);
if (shortUrlRecord == null)
return RedirectToAction("UrlNotFound", "ShortUrl");
else
{
ShortUrlModels shortUrlModel = new ShortUrlModels();
shortUrlModel = Mapper.GetMapper.Map<ShortUrlDbEntity.ShortUrl, ShortUrlModels>(shortUrlRecord); ShortUrlStatModels stats = new ShortUrlStatModels(Request);
stats.UrlId = id;
stats.ShortUrl = shortUrlModel.BaseShortUrl;
stats.CreateTime = DateTime.Now;
var dbstats = Mapper.GetMapper.Map<ShortUrlStatModels, ShortUrlStat>(stats);
db.ShortUrlStat.Add(dbstats);
db.SaveChanges();
shortUrlRecord.Hits++;
shortUrlRecord.LastUpdateTime = DateTime.Now;
db.SaveChanges(); return Redirect(shortUrlModel.LongUrl);
}
}
} public ActionResult UrlNotFound()
{
return View();
} public ActionResult AddDetail(ShortUrlModels model)
{
ShortUrlModels shortmodels=new ShortUrlModels();
return View("AddDetail", shortmodels);
} //添加url model.LongUrl = HttpUtility.UrlDecode(model.LongUrl) ?? "";
public JsonResult Add(ShortUrlModels model) { try {
if (string.IsNullOrEmpty(model.LongUrl))
return Json(new { DoResult = "请输入Url地址" }, JsonRequestBehavior.AllowGet);
else
{
if (CheckLongUrlExists(model.LongUrl))
{
if (!HasHttPProtocol(model.LongUrl))
model.LongUrl = "http://" + model.LongUrl; var existingUrl = db.ShortUrl.FirstOrDefault(u => Equals(u.LongUrl.ToLower(), model.LongUrl.ToLower()));
if (existingUrl == null)
{
ShortUrlModels shortUrl = new ShortUrlModels()
{
LongUrl = model.LongUrl,
BaseUri = model.BaseUri,
Hits = ,
CreateTime = DateTime.Now,
LastUpdateTime = DateTime.Now,
Enable = true,
//ShortToken = GenerateRandomShortUrl()
//ShortToken = GenerateRandomString(6)
ShortToken = Guid.NewGuid().ToString().Substring(, )
}; var shortUrlDb = Mapper.GetMapper.Map<ShortUrlModels, ShortUrlDbEntity.ShortUrl>(shortUrl);
db.ShortUrl.Add(shortUrlDb);
db.SaveChanges();
var result = new {DoResult = "新增成功", DoFlag = true};
return Json(result, JsonRequestBehavior.AllowGet);
}
else
{
var result = new {DoResult = "新增失败,Url已被添加过", DoFlag = false};
return Json(result, JsonRequestBehavior.AllowGet);
}
}
else
{
var result = new { DoResult = "Url地址不存在或已失效,请填写正确的地址", DoFlag = false };
return Json(result, JsonRequestBehavior.AllowGet);
} }
}
catch (Exception ex)
{
return Json(new { DoResult = "新增异常", DoFlag = false }, JsonRequestBehavior.AllowGet);
}
} //校验url开头带不带http
private bool HasHttPProtocol(string url)
{
url = url.ToLower();
if (url.Length > )
{
if (url.StartsWith(Constants.Protocol.HTTP) || url.StartsWith(Constants.Protocol.HTTPS))
return true;
else
return false;
}
else
return false;
} //生成随机的6位串
public string GenerateRandomShortUrl()
{
string number = "";
int j;
Random random = new Random(); for (int i = ; i < ; i++)
{
j = random.Next(, );
if (j < )
j += ;
else
j += ;
number = number + char.ConvertFromUtf32(j);
}
return number;
} //生成随机的串(方法二)
public static string GenerateRandomString(short len = )
{
string rand = string.Empty;
while (rand.Length < len)
{
rand += GetCleanRandString();
}
return rand.Substring(, len);
}
private static string GetCleanRandString()
{
char[] AmbiguousChars = { 'l', '', '.' };
return string.Join(string.Empty, System.IO.Path.GetRandomFileName().ToLower().Split(AmbiguousChars));
} //removed 'I', 'l', '1', 'O' and '0'
const string chars = "23456789abcdefghjkmnopqrstuvwxyzABCDEFGHIJKLMNPQRSTUVWXYZ";
private readonly int theBase = chars.Length;
public string Encode(int value)
{
var hash = "";
if (value > )
{
var remainder = value % theBase;
hash += chars[remainder];
value = value / theBase;
}
hash += chars[value];
return hash;
} public int Decode(string hash)
{
var result = ;
for (var i = hash.Length - ; i >= ; i--)
{
result += (chars.IndexOf(hash[i]) * (int)(Math.Pow(theBase, i)));
}
return result;
} //检测url有没有过期
public bool CheckLongUrlExists(string url)
{ if (!HasHttPProtocol(url))
url = Constants.Protocol.HTTP + url;
try
{
//Creating the HttpWebRequest
HttpWebRequest request = WebRequest.Create(url) as HttpWebRequest;
//Setting the Request method HEAD, you can also use GET too.
request.Method = "HEAD";
//Getting the Web Response.
HttpWebResponse response = request.GetResponse() as HttpWebResponse;
//Returns TRUE if the Status code == 200
return (response.StatusCode == HttpStatusCode.OK);
}
catch
{
return false;
}
} }
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web; namespace ShortUrl
{ public class ShortUrlModels
{
public int Id { get; set; }
public string LongUrl { get; set; }
public int BaseUri { get; set; }
public string ShortToken { get; set; }
public int Hits { get; set; }
public string Creator { get; set; }
public DateTime CreateTime { get; set; }
public DateTime LastUpdateTime { get; set; }
public string LastOperator { get; set; }
public bool Enable { get; set; }
public bool IsDelete { get; set; } private Dictionary<int, string> _shortUrl;
public Dictionary<int, string> ShortUrl {
get
{
_shortUrl= new Dictionary<int, string>()
{
{,"t.cn"},
{,"dwz.cn"},
{,"qq.cn.hn"},
{,"jd.cn.hn"},
{,"tb.cn.hn"},
{,"sina.lt"},
{,"tinyurl.com"},
{,"qr.net"},
{,"goo.gl"},
{,"is.gd"},
{,"j.mp"},
{,"bit.ly"}
};
return _shortUrl;
}
set { _shortUrl = value; }
} public string BaseShortUrl
{
get { return "http://" + ShortUrl[BaseUri]+"/"+ShortToken; }
} } }
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web; namespace ShortUrl.Models
{
public class ShortUrlStatModels
{
public int Id { get; set; }
//短链的Id
public int UrlId { get; set; }
//短链地址
public string ShortUrl { get; set; }
//获取Url链接当前客户端的主机部分
public string UrlRefferer { get; set; }
//获取客户端完整的用户代理字符串
public string UserAgent { get; set; }
//获取客户端ip的主机地址
public string UserHostAddress { get; set; }
//获取客户端语言首选项
public string UserLanguage { get; set; }
//获取浏览器请求标头中发送的浏览器字符串
public string Browser { get; set; }
//获取浏览器主版本号
public int MajorVersion { get; set; }
//获取浏览器是否已标识为移动设备
public bool IsMobile { get; set; }
//创建时间
public DateTime CreateTime { get; set; } public ShortUrlStatModels(HttpRequestBase request)
{
if (string.IsNullOrEmpty(request.UrlReferrer.Host))
UrlRefferer = Constants.UNKNOWN;
else
UrlRefferer = request.UrlReferrer.Host; if (string.IsNullOrEmpty(request.UserAgent))
UserAgent = Constants.UNKNOWN;
else
UserAgent = request.UserAgent; if (string.IsNullOrEmpty(request.UserHostAddress))
UserHostAddress = Constants.UNKNOWN;
else
UserHostAddress = request.UserHostAddress; if (string.IsNullOrEmpty(request.UserLanguages[]))
UserLanguage = Constants.UNKNOWN;
else
UserLanguage = request.UserLanguages[]; if (string.IsNullOrEmpty(request.Browser.Browser))
Browser = Constants.UNKNOWN;
else
Browser = request.Browser.Browser; MajorVersion = request.Browser.MajorVersion;
IsMobile = request.Browser.IsMobileDevice;
}
} }
生成随机串其它参考:
/// <summary>
/// 短网址应用 ,例如QQ微博的url.cn http://url.cn/2hytQx
/// </summary>
/// <param name="url"></param>
/// <returns></returns>
public static string[] ShortUrl(string url)
{
//可以自定义生成MD5加密字符传前的混合KEY
string key = "fooo_2016";
//要使用生成URL的字符
string[] chars = new string[]{
"a","b","c","d","e","f","g","h" ,"i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z",
"","","","","","","","","","",
"A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T" ,"U","V","W","X","Y","Z"
}; //对传入网址进行MD5加密
string hex = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(key + url, "md5");
string[] resUrl = new string[];
for (int i = ; i < ; i++)
{
//把加密字符按照8位一组16进制与0x3FFFFFFF进行位与运算
int hexint = 0x3FFFFFFF & Convert.ToInt32("0x" + hex.Substring(i * , ), );
string outChars = string.Empty;
for (int j = ; j < ; j++)
{
//把得到的值与0x0000003D进行位与运算,取得字符数组chars索引
int index = 0x0000003D & hexint;
//把取得的字符相加
outChars += chars[index];
//每次循环按位右移5位
hexint = hexint >> ;
}
//把字符串存入对应索引的输出数组
resUrl[i] = outChars;
}
return resUrl;
}
protected void Button1_Click(object sender, EventArgs e)
{
string[] Shor = ShortUrl(this.TextBox1.Text); // Response.Write( ); //得到值fAVfui
//ShortUrl(http://www.jb51.net)[1]; //得到值3ayQry
//ShortUrl(http://www.jb51.net)[2]; //得到值UZzyUr
//ShortUrl(http://www.jb51.net)[3]; //得到值36rQZn for (int i = ; i < Shor.Length; i++)
{
Response.Write("<br/>" + i + ">>" + Shor[i]);
}
}
// url + (url.EndsWith("?") ? "" : "?" //string host = txtWebUrl.Text.Trim().TrimEnd('/').ToLower();
url = (host.StartsWith("http") || host.StartsWith("https"))? host:"http://" + host;
生成短链(网址) ShortUrlLink的更多相关文章
- 短网址(t.cn、url.cn)生成,网址缩短接口API
简要说明 短网址api接口有很多格式,不同的接口生成的短网址格式也不同,比如常见的t.cn.url.cn.w.url.cn等格式.总而言之短网址接口就是用来将一个冗长的链接缩短成10个字符以内的短链接 ...
- php生成短网址的思路与方法
生成短网址的思路以及使用php生成短网址的实现方法. 生成短网址的思路:如果把短网址还原了,你知道是个什么样子的吗?比如:http://www.jbxue.com/sitejs-17300-1.htm ...
- PHP调用百度api生成短网址&根据短网址恢复长网址
接口api文档地址:http://dwz.cn/#/apidoc?_k=i9ev5p 代码demo header("Content-type: text/html; charset=utf- ...
- php 生成短网址 代码
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8&quo ...
- C#:生成短网址
/// <summary> /// 短网址应用 ,例如QQ微博的url.cn http://url.cn/2hytQx /// </summary> /// <param ...
- 仿微博php生成短网址
html code <!DOCTYPE html> <html lang="en"> <head> <meta charset=" ...
- PHP 自动生成导航网址的最佳方法 v20130826
经常制作开发不同的网站的后台,写过很多种不同的后台导航写法. 最终积累了这种最写法,算是最好的吧.附上截图和代码如下(PHP+HTML) <?php $linkArr = array( 'ind ...
- 【异常】微博生成短链异常{"request":"/2/short_url/shorten.json","error_code":"10014","error":"Insufficient app permissions!"}
一.之前的调用方式 这种方式用了大约有一年时间,之前没有问题,但是2019-8-28号突然不行了,可能是由于微博对该接口的调用做了限制.不允许通过传递source参数的方式进行请求 该接口微博API文 ...
- 短网址url接口api,url短链接(t.cn、url.cn)生成
简要说明 短网址api接口有很多格式,不同的接口生成的短网址格式也不同,比如常见的t.cn.url.cn.w.url.cn等格式.总而言之短网址接口就是用来将一个冗长的链接缩短成10个字符以内的短链接 ...
随机推荐
- Eclipse 工程Clear与build的作用
由于eclipse的编译是基于时间戳的判断机制的.因此当你按build all的时候有些eclipse认为时间戳没有改变的类不会被编译.因此你可以先clean一下再编译.这个时候eclipse会将所有 ...
- redis安装及基础操作(1)
============================================================= 编译安装 0.环境 Linux:centos6.5 redis:3.0.5 ...
- 【转】在Android布局中使用include和merge标签
内容转自:http://fengweipeng1208.blog.163.com/blog/static/21277318020138229754135/ 在我们开发android布局时,经常会有很多 ...
- 【Linux】Linux 目录结构
博客已转移,请借一步说话 .http://www.weixuehao.com/archives/492 初学Linux,首先需要弄清Linux 标准目录结构 / root --- 启动Linux时使用 ...
- [转]新型智慧城市总体架构 华为 新ICT 一云二网三平台
本文转自:http://www.jpsycn.com/hangyexinwen/20160801142354.html “十三五”规划提出,充分运用现代信息技术和大数据,建设一批新型示范性智慧城市.日 ...
- [转] cordova-plugin-x-toast
本文转自:https://www.npmjs.com/package/cordova-plugin-x-toast cordova plugin add https://github.com/Eddy ...
- 设计模式(java) 单例模式 单例类
·单例类 单实例类,就是这个类只能创建一个对象,保证了对象实例的唯一性. 1.单例模式( Singleton Pattern) 是一个比较简单的模式, 其定义如下:Ensure a class has ...
- Java 对象和类
1.对象 object 对象是可被感知的一个实体,有唯一的名称.有一组表现对象的状态属性和对象内在具有的行为能力.比如张三这个人,他有姓名.职业.眼睛等具体状态属性,能实施说.跑.吃等方法.对象,在j ...
- windows 7 语言切换 Vistalizator
Try Vistalizator - this tool allows you to change display language in Windows editions other than (o ...
- AC日记——行程长度编码 openjudge 1.7 32
32:行程长度编码 总时间限制: 1000ms 内存限制: 65536kB 描述 在数据压缩中,一个常用的途径是行程长度压缩.对于一个待压缩的字符串而言,我们可以依次记录每个字符及重复的次数.这种 ...