- 博客(179)
- 资源 (1)
- 收藏
- 关注
原创 python函数中的可变默认值
In [27]: def f(a=[]): ...: a.append(5) ...: print(a) ...:In [28]: P = f()[5]In [29]: L = f()[5, 5]函数多次调用竟然使用的用一个参数对象,请注意。
2022-05-11 15:20:39
235
原创 argsort()函数
a=[6,4,5]b=a.argsort() #[1,2,0] 意思是:a[1]<=a[2]<=a[0]解释如下:数组a排序后为a1=[4,5,6]。a.argsort返回数组a1中的元素在原数组a中的索引。如何返回数组a中的元素在a1中的索引? # [2,0,1] 根据索引可以判断数组a中元素的大小关系c=a.argsort().argsort()=b.argsort()数组b排序后为b1=[0,1,2],代表的是数组a中元素的索引。b1.argsort...
2021-02-03 16:15:33
491
转载 UTF-8编码如何识别单字节和双字节字符?
Recently I've faced an issue regarding character encoding, while I was digging into character set and character encoding this doubt came to my mind.UTF-8 encoding is most popular because of its backward compatibility with ASCII.Since UTF-8 is variable leng
2021-01-21 13:41:29
791
转载 JS中的prototype
转载自:<a href='https://blog.youkuaiyun.com/qq_42497250/article/details/92845285'>原文</a>其实所有的OO语言都有这一机制。即多个实例如何共享方法。JS中的每个instance都有一个属性proto指向prototype,而方法都定义在prototype中,通过这种机制实现方法共享。例如: function Person(name){ this.name...
2020-07-06 13:31:52
159
转载 Linux 软件安装到 /usr,/usr/local/ 还是 /opt 目录区别
Linux 的软件安装目录是也是有讲究的,理解这一点,在对系统管理是有益的/usr:系统级的目录,可以理解为C:/Windows/,/usr/lib理解为C:/Windows/System32。/usr/local:用户级的程序目录,可以理解为C:/Progrem Files/。用户自己编译的软件默认会安装到这个目录下。/opt:用户级的程序目录,可以理解为D:/Software,opt有...
2020-01-07 10:15:40
225
转载 OceanBase能取代Oracle吗
推荐两篇文章:1)http://www.ha97.com/5766.html2)http://www.sohu.com/a/152030438_151779
2019-10-21 11:27:27
3013
转载 oracle某个字段有重复数据,如何删除多余数据只保留1条
Oracle删除重复数据只留一条查询及删除重复记录的SQL语句1、查找表中多余的重复记录,重复记录是根据单个字段(Id)来判断select*from表whereIdin(selectIdfrom表groupbyIdhavingcount(Id)>1)2、删除表中多余的重复记录,重复记录是根据单个字段(Id)来判断,只留有rowid最小的记...
2019-08-30 09:33:10
6397
原创 MQTT笔记2_安全
1)客户端的认证(authentication)与信息加密: 举例:比如用mobile app控制一个drone。 a) 不允许未经认证的客户来控制无人机; b)已认证的客户发送的信息不被入侵者篡改;2)采用Transport还是应用层来实现1)根证书密钥文件:ca.key openssl genrsa -out ca.key 2...
2019-08-21 08:59:29
221
转载 MQTT笔记1
Topic:A topic is a named logical channel and it is also referred to as a channel or subject. The broker will send publishers only the messages published to topics to which they are subscribed.Th...
2019-05-05 14:47:56
237
转载 Passing Data Between Two Fragments hosted by same activity
背景:等同于前文中的利用Fragment argument1) 将date信息从CrimeFragment传送到DatePickerFragmentStep1: 在DatePickerFragment中添加newInstance方法public static DatePickerFragment newInstance(Date date) { Bundle args...
2019-04-16 17:33:17
184
转载 Passing Data Between Fragments which belong to different activities
Step1: 在CrimeActivity中利用intent传送所需信息public static Intent newIntent(Context packageContext, UUID crimeId) { Intent intent = new Intent(packageContext, CrimeActivity.class); intent.putExtra...
2019-04-16 16:17:08
151
转载 Android Layout设计
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { /* Now that CrimeListFragment’s view is set up, hook up the view to the fragment. Modify ...
2019-04-12 14:38:31
176
转载 Passing Data Between Activities
Creating an activity typically involves touching at least three files: the Java class file, an XML layout,and the application manifest.Intent是一个重要概念An intent is an object that a component can use...
2019-03-28 10:25:02
166
转载 安卓开发之添加资源
Step1: 添加相应的资源文件(例如strings.xml)<string name="true_button">True</string><string name="false_button">False</string>Step2:修改相应的Layout文件(注意布局文件中对资源文件的引用[@string/true_button])...
2019-03-26 09:54:20
412
转载 EventLoop
1)EventExecutorGroup: The EventExecutorGroup is responsible for providing the EventExecutor's to use via its next() method.2)AbstractEventExecutorGroup: Abstract base class for EventExecutorGroup ...
2019-03-18 17:42:52
140
转载 2018世界一线城市排名
Alpha++:伦敦、纽约Alpha+:香港、北京、新加坡、上海、悉尼、巴黎、迪拜、东京Alpha:米兰、芝加哥、莫斯科、多伦多、圣保罗、法兰克福、洛杉矶、马德里、墨西哥城、吉隆坡、首尔、雅加达、孟买、迈阿密、布鲁塞尔、台北、广州、布宜诺斯艾利斯、苏黎世、华沙、伊斯坦布尔、曼谷、墨尔本Alpha-:阿姆斯特丹、斯德哥尔摩、旧金山、新德里、圣地亚哥、约翰内斯堡、都柏林、维也纳、蒙特利尔、...
2019-03-05 14:17:02
7218
1
原创 集合类的自定义判等与比较
1)IComparer and Comparer:Comparers are used to switch in custom ordering logic for sorted dictionaries and collections.Note that a comparer is useless to the unsorted dictionaries such as Dic...
2019-02-28 15:10:47
186
原创 ToArray,CopyTo,List (IEnumerable<T> collection)
public class Stu{ public string Name{get;set;}}void Main(){List<Stu> list=new List<Stu>();list.Add(new Stu{Name="bert"});list.Add(new Stu{Name="david"});Stu[] r=new Stu[2];lis...
2019-02-27 09:23:35
392
转载 委托->匿名方法->Lambda表达式
1.委托:static void Main(){string[] names = { "Rodney", "Jack", "Jill" };string match = Array.Find (names, ContainsA);Console.WriteLine (match); // Jack}static bool ContainsA (string name) {retu...
2019-02-25 14:47:11
164
原创 Covariant(协变) vs Contravariant(逆变)
public delegate TResult Func<in T, out TResult>(T arg);public interface IReadOnlyList<out T> : IEnumerable<T>, IEnumerable 任何能用父类做为输入参数的地方,当然也能用子类作为替换,这叫逆变(Contravariant)。任何返回...
2019-02-25 10:09:05
752
转载 关于 Equals与==
Albahari在书中已经说的非常好了,现在摘录如下:== and != The subtleties with == and != arise because they are operators, and so are statically resolved (in fact, they are implemented as static functions). So, when yo...
2019-02-21 11:31:13
300
转载 Convert vs Cast
Convert采用的是银行的舍入原则,而不是Cast的截取原则。Convert的四舍六入五留双规则:为了避免四舍五入规则造成的结果偏高,误差偏大的现象出现,一般采用四舍六入五留双规则(Banker's Rounding)。 四舍六入五留双应该改为: 四舍六入逢五无后则留双,这样描述更容易理解和记住.四舍六入五留双规则的具体方法是:(一)当尾数小于或等于4时,直接将尾数舍去。例...
2019-02-20 14:52:42
307
转载 Custom numeric format strings
string Multiplier="Multiplier:{0:#,}";Console.WriteLine (string.Format (Multiplier, 1000000));string LiteralChar = "LiteralChar={0:\\#000}";Console.WriteLine (string.Format (LiteralChar, 50));stri...
2019-02-20 09:54:57
149
转载 Standard numeric format strings
string General = "General={0:G}";Console.WriteLine (string.Format (General, 0.00001));string FixedPoint="FixedPoint={0:F2}";Console.WriteLine (string.Format (FixedPoint, 2345.678));string WithGrou...
2019-02-20 09:16:06
194
转载 Yoshua Bengio建议的机器学习路线图
1.阅读深度学习论文和教程,从介绍性的文字开始,逐渐提高难度。记录阅读心得,定期总结所学知识。2.把学到的算法自己实现一下,从零开始,保证你理解了其中的数学。别光照着论文里看到的伪代码复制一遍,实现一些变种。3.用真实数据来测试这些算法,可以参加Kaggle竞赛。通过接触数据,你能学到很多;4.把你整个过程中的心得和结果写在博客上,跟领域内的专家联系,问问他们是否愿意接收你在他们的项目
2017-08-18 10:23:31
307
原创 如何考虑BLL层和DAL层的日志
DAL层日志: DAL层与数据库交互,日志记录的目的是:1)发生异常时通过日志查找原始信息。便于快速定位原因。2)对于一些复杂的事务可以通过对日志的分析来发现错误的具体位置。BLL层日志: BLL层与UI交互,虽然UI已经对用户输入进行了一些过滤与纠正,但是在BLL层仍然需要对用户输入进行严格的控制,并且记录相对重要的信息。 仔细体会BLL层与DAL层日志
2017-02-27 15:30:57
578
原创 2016/9书籍总结
最近3个月阅读的书籍:1)JavaScript and JQuery : Interactive Front-End Web Development 浅显易懂,是学习JQuery的好书。2)Programming Razor: Razor包含一套描述标记+代码的语义,一个用来解析语义的API。从而理解这一类的动态网页是如何生成的。感觉Razor的解析器非常强大,这
2016-09-01 15:21:49
580
转载 2013年人气最高的JavaScript框架排名
http://www.html5online.com.cn/articles/2014020601.html本文概述本文介绍2013年人气急速上升,2014年必须知道的javascript框架排名。本文所介绍的排名为Google根据全世界2013年的搜索关键词所做出的统计结果。MVC框架JavaScript的MVC框架中人气最高的为以下四个。AngularJSB
2016-08-18 17:11:31
801
原创 JavaScript笔记_1
JS中的数组:1. Array literalvar colors;colors=[ 'white', 'black', 'red' ];2. Array objectvar colors=new Array('white', 'black'
2016-08-03 14:52:07
379
原创 Hibernate笔记_object state
作为一款功能强大的ORM工具,Hibernate应该具有哪些功能?1)对象在Hibernate中的状态:transient and persistent。transient: never persistent, not associated with any Sessionpersistent: associated with a unique Sessiondetached: p
2016-06-16 17:31:54
501
转载 Fake Objects
Spring的创始人Rod Johnson关于伪对象:Fake Objects: objects in appearance, but which don’t exhibit some of the characteristics of objects:identity, state, and behavior。Let’s look at some common fake object
2016-05-31 11:11:36
450
原创 深入理解Interpreter模式
1)Interpreter模式是一个能给人留下深刻印象的模式。The Interpreter pattern describes how to define a grammar for simple languages, represent sentences in the language, and interpret these sentences.GoF书中的这句话是点睛之笔。1
2016-05-25 10:07:04
1042
原创 Stateful Session Bean VS Entity Bean
作为一名更熟悉 .NET的人员来讲对于Bean比较陌生,但认真思考J2EE中讲到的各种规范.NET也应该具备,因为这毕竟是企业级开发共有的要求。1.理解Stateful Session Bean 比较好的一篇文章是http://www.jguru.com/faq/view.jsp?EID=917。方便起见原文拷贝在此以便学习。 Richard Monson-Haefel
2016-05-23 15:10:17
352
原创 关于软件重用的思考
微观上遵循这样的路径:Inheritance->object composition->Generic;Pattern: 通过模式的重用解决各种各样的问题。宏观上: 1) 基于容器Container方式: 例如Servlet Container. 系统开发商已经构建了对象之间的关系,这些关系是设计的核心。应用开发人员在使用时采用继承的方
2016-05-05 17:33:02
957
6
原创 企业级开发中的异常处理与日志
1)首先从Presentation, Business, DAO层的角度来看 1.1)异常处理Presentation: 表示层需要捕捉异常以便对用户进行适当的提示。例如转账操作中的余额不足等;Business:面向过程的开发业务逻辑可以理解为经典的数据结构+算法。面向对象的业务逻辑可以理解为一个复杂模型中的一个动作,在产生异常时需要尽可能的保持原始信息以便分析。DAO:记录数
2016-03-02 11:45:58
1228
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人