Count the number of Duplicates

Count the number of Duplicates Write a function that will return the count of distinct case-insensitive alphabetic characters and numeric digits that occur more than once in the input string.The input string can be assumed to contain only alphanumeric characters, including digits, uppercase and lowercase alphabets. Example "abcde" -> 0 # no characters repeats more than once "aabbcde" -> 2 # 'a' and 'b' "aabbcdeB" -> 2 # 'a' and 'b' "indivisibility" -> 1 # 'i' "Indivisibilities" -> 2 # 'i' and 's' "aa11" -> 2 # 'a' and '1' 解题思路 函数功能:计算字符串中重复的字符有多少个。我们只要先判断字符是否重复,然后再计算有多少个字符重复。 ...

2017-05-14 · 1 分钟 · 374 字

C# Base64 加密及解密

今天准备采集一个网站,在分析他的数据的接口的时候,发现提交及返回的数据都是经过 js 加密的。然后我就开始把 js 转成 C# 的代码,运行后发现返回的数据不一样,我就在想他是不是 Base64 过的,然后就解开了… ...

2017-04-10 · 1 分钟 · 276 字

ASP.NET MVC 使用动态类型传递数据

问题起因 在 Controller 中定义动态类型的对象传递给视图,报错无法找到成员。 Controller: public ActionResult Index() { ViewBag.User = new { name = "何湘辉", age = 20 }; return View(); } 视图: 姓名:@ViewBag.User.name 年龄:@ViewBag.User.age 按道理来说,这样写是没问题的,但是运行后却说Model中不存在‘name’。 ...

2017-04-09 · 2 分钟 · 758 字

Django 使用 order_by() 对数据进行排序操作

在Django的开发中经常需要用到order_by()函数对数据进行排序操作,比如按id、创建时间升/降序。 升序 News.objects.all().order_by("createtime") 降序 News.objects.all().order_by("-createtime") 明天就要上课了 这是一篇过去很久的文章,其中的信息可能已经有所发展或是发生改变。 ...

2017-02-20 · 1 分钟 · 99 字

ASP.NET + jQuery + AJAX 实现用户登录

用户登录在网站中是不可或缺的功能,常见的方法就是使用Form表单将数据提交给后台,后台对帐号密码进行验证从而实现了用户登录。 随着技术的发展,一些网站开始使用 AJAX 的方式进行登录,登录成功后只会刷新局部,从而提升了用户体验。在本文中,将使用ASP.NET和jQuery来实现登录功能。 ...

2017-02-09 · 3 分钟 · 1428 字