建表

CREATE TABLE [dbo].[ShortUrl](
    [Id] [,) 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] [,) 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=.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)
        {
            )
                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.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();

            ; i < ; i++)
            {
                j = random.Next(, );
                )
                    j += ;
                else
                    j += ;
                number = number + char.ConvertFromUtf32(j);
            }
            return number;
        }

        //生成随机的串(方法二)
        )
        {
            string rand = string.Empty;
            while (rand.Length < len)
            {
                rand += GetCleanRandString();
            }
            , len);
        }
        private static string GetCleanRandString()
        {
            ', '.' };
            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 = "";
            )
            {
                var remainder = value % theBase;
                hash += chars[remainder];
                value = value / theBase;
            }
            hash += chars[value];
            return hash;
        }

        public int Decode(string hash)
        {
            ;
            ; 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;

            ]))
                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");
        ];
        ; i < ; i++)
        {
            //把加密字符按照8位一组16进制与0x3FFFFFFF进行位与运算
            , ), );
            string outChars = string.Empty;
            ; 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

        ; i < Shor.Length; i++)
        {
            Response.Write("<br/>" + i + ">>" + Shor[i]);
        }
    }

生成短链(网址) ShortUrlLink的更多相关文章

  1. php生成短网址的思路与方法

    生成短网址的思路以及使用php生成短网址的实现方法. 生成短网址的思路:如果把短网址还原了,你知道是个什么样子的吗?比如:http://www.jbxue.com/sitejs-17300-1.htm ...

  2. C#:生成短网址

    /// <summary> /// 短网址应用 ,例如QQ微博的url.cn http://url.cn/2hytQx /// </summary> /// <param ...

  3. 仿微博php生成短网址

    html code <!DOCTYPE html> <html lang="en"> <head> <meta charset=" ...

  4. PHP 自动生成导航网址的最佳方法 v20130826

    经常制作开发不同的网站的后台,写过很多种不同的后台导航写法. 最终积累了这种最写法,算是最好的吧.附上截图和代码如下(PHP+HTML) <?php $linkArr = array( 'ind ...

  5. 动态生成WebService的客户端

    给定了WebService地址和调用接口后动态的生成DLL,第二次再请求时会先判断DLL是否存在,以提高执行效率 核心代码下: /// <summary> /// 动态生成WebServi ...

  6. PHP 生成PDF

    一个项目中需要用到网页生成PDF,就是将整个网页生成一个PDF文件, 以前也用过HTML2PDF,只能生成一些简单的HTML代码,复杂的HTML + css 生成的效果惨不忍睹, 百度了一下,发现有个 ...

  7. mongodb:短网址项目

    短网址项目概述 1.短网址项目,是将给定的长网址,转换成短网址. 如 新浪 http://t.cn/zQd5NPw ,其中zQd5NPw就是短网址 前段页面如下

  8. C#如何实现url短地址?C#短网址压缩算法与短网址原理入门

    c# url短地址压缩算法与短网址原理的例子,详细介绍了短网址的映射算法,将长网址md5生成32位签名串,分为4段,每段8个字节,然后生成短网址,具体见文本实例. 短网址映射算法: 将长网址md5生成 ...

  9. Vagrant 基础全面解析

    这篇 Vagrant 入门文章将带你创建一个 Vagrant 项目,这个过程将会用到 Vagrant 所提供的主要基本特性.如果想了解 Vagrant 能为你带来哪些好处,可以阅读 Vagrant 官 ...

随机推荐

  1. WP8.1 C#代码 添加/获取Grid.ColumnDefinitions/RowDefinitions

    WP8.1: ColumnDefinitions和RowDefinitions的道理是相同的,语法顺序是一样的,只不过是将ColumnDefinitions换成RowDefinitions而已 获取并 ...

  2. android 布局学习

    各种layout用到的一些重要属性 第一类:属性值为true或false android:layout_centerHrizontal 水平居中 android:layout_centerVertic ...

  3. 实战使用Axure设计App,使用WebStorm开发(6) – 迈向后端

    系列文章 实战使用Axure设计App,使用WebStorm开发(1) – 用Axure描述需求  实战使用Axure设计App,使用WebStorm开发(2) – 创建 Ionic 项目   实战使 ...

  4. 单机搭建Android开发环境(五)

    前文介绍了Android系统开发环境的搭建,本文将简单介绍Android应用开发环境的搭建. 基于Android Studio搭建应用开发环境,相比使用Eclipse简单得多.Android Stud ...

  5. 【JavaEE企业应用实战学习记录】struts配置文件详细解析

    <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE struts PUBLIC "-/ ...

  6. Unity3d优化

    检测方式: 一,Unity3D 渲染统计窗口 Game视窗的Stats去查看渲染统计的信息: 1.FPS fps其实就是 frames per second,也就是每一秒游戏执行的帧数,这个数值越小, ...

  7. 考虑与Maya结合

    今天改进了Hessian各块的计算代码,减少了一些内存操作.下一步准备把模拟平台与Maya结合,这样就可以利用Maya丰富的变形算法了. 这一步需要考虑以下问题: 1.把场景设置为某一帧.这一点可以用 ...

  8. linux 下Time_wait过多问题解决

    linux 下Time_wait过多问题解决 net.ipv4.tcp_syncookies = 1表示开启SYN Cookies.当出现SYN等待队列溢出时,启用cookies来处理,可防范少量SY ...

  9. 约瑟夫环问题-循环链表VS数组

    2013-08-18 21:27:50 循环链表.数组解决约瑟夫环问题的比较 注意几点: 循环链表的建立不难,在删除循环链表中元素时,用pCur->next != pCur判断结束: 每一轮计数 ...

  10. golang入门--一个简单的http client

    看完<Go Web 编程>的前两章就可以开始写代码了. import ( "fmt" "io/ioutil" "log" &qu ...