自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

那时那刻

具有生命力的code

  • 博客(87)
  • 资源 (25)
  • 收藏
  • 关注

原创 OpenAI-Translator 实战总结

如何通过ChatGPT接口实现PDF文档翻译任务

2023-08-10 13:26:34 801

原创 JavaScript function expression vs function declaration

在Javascript中创建function有两种方式:function expression 和function declaration。它们的定义分别是:FunctionDeclaration:            FunctionIdentifier(formatParameterListOpt) { FunctionBody}FunctionExpression:    

2015-01-10 18:59:01 860

原创 Integer division by zero

我们对于除数,之前check

2014-11-11 19:23:55 15696

原创 这是函数声明还是变量声明

我相信如下这个问题,写过C++的人或许douyu

2014-10-20 09:28:25 602

翻译 为什么有序数组比无序数组快呢?

来自stackoverflow的题目Why is processing a sorted array faster than an unsorted array?

2014-10-12 14:44:28 1245

原创 为什么C++变量名字和函数名字不能是同一个?

在Java中,函数名字和变量名字yi

2014-10-09 15:57:58 1355

转载 C++11右值引用(Rvalue-reference)

引自知乎的一个问答,作为笔记

2014-09-25 19:27:54 668

原创 关于fork()

Fork()是linux下常用的系统API,通过系统调用创建一个与原来进程几乎完全相同的进程,也就是两个进程可以做完全相同的事情;也可由于参数的不同,或代码不同分支做完全不相同的事情。fork调用的一个奇妙之处就是它仅仅被调用一次,却能够返回两次,它可能有三种不同的返回值:    1)在父进程中,fork返回新创建子进程的进程ID;    2)在子进程中,fork返回0;    3

2014-09-08 14:28:32 534

翻译 HTTP API设计Guide

翻译自https://github.com/richzw/http-api-designTodo list

2014-09-06 19:07:33 496

原创 Javascript中Function declarations 理解

Javascript 中function declaration在ECMA5与ECMA6不同定义之理解。

2014-08-13 14:06:11 1165

转载 ThreadSanitizer AddressSanitizer MemorySanitizer

Thread-sanitizer=======ThreadSanitizer (aka TSan) is a data race detector for C/C++. Data races are one of the most common and hardest to debug types of bugs in concurrent systems. A data race

2014-07-04 19:46:28 2322

原创 yield in Python

To understand what yield does, you must understand what generators are. And before generators come iterables.

2014-06-05 19:39:35 753

转载 MetaClass in Python

Python总是让我们能够看到它的内部是如何实现的,qi

2014-06-05 19:22:51 776

原创 两个数组的元素之和最大的前k项

题目:两个数组,从每个数组中取一个数相加,求最大的前k个和 数组A:1,2,3 数组B:4,5,6 则最大的前2个和:9,8。

2014-05-06 20:10:14 3135

转载 If advanced algorithms and data structures are never used in industry, then why learn them?

Here is one question from Quora. Just record it here...I and people I know have never used any advanced algorithms or data structures in industry and some of us have 20 years of experience in indust

2014-05-06 11:03:44 901

原创 Is Python call-by-value or call-by-reference?

First of all, here are two pieces of codes:

2014-04-20 10:29:35 1768

转载 Static method vs class method in Python

Pyhon中@static method和@class method对于刚接触的人而言,有很多迷茫的地方。随之,

2014-04-14 19:50:47 2957

原创 Single Number题解整理

Q: Given an array of integers, every elementappears three times except for one. Find that single one. 如果是其余元素均出现两次,这个题目很容易解决,我们直接可以用xor,把所有的数异或之后的结果,便是出现一次的数字。但是这个题目其余元素出现的次数是三次,如果数组中的元素都是三个三个出现的,

2014-04-08 20:50:04 522

原创 使用windbg检测内存泄漏

使用windbg检测内存泄漏缘起:作为C++程序员,检测内存泄漏是非常痛苦的事情。尤其是看着程序的内存在一直增长,你却无能为力。此时,windbg可以用来检测内存泄漏。配置windbg:1.      配置symbol文件路径: “SRV*d:\symbols*http://msdl.microsoft.com/download/symbols”.2.      增加测

2014-03-24 16:58:05 7803 3

原创 从游戏中看循环不变量

罐中红球与蓝球问题:假设罐中有红球与蓝球若干,从罐中取球,规则是: while (# of marbles inthe jar > 1) { choose (any) twomarbles from the jar; if (the two marblesare of the same color) { toss them asid

2014-02-28 09:24:08 884

原创 Loop Invariant 循环不变量

循环不变量(loop invariant)是一个不变量,被用来证明循环的特点,更多地,算法使用循环 (usually 正确性)。非正式的说,一个循环不变量是指在循环开始和循环中每一次迭代时永远为真的量,这意味着在循环中和循环结束时循环不变量和循环终止条件必须同时成立。以二分法为例:已知 A[1..n] 是单调递增的数列,求 A 中所有大于或等于target的值中,最小的那一个的序号。int

2014-02-25 14:21:57 2378

原创 socket相关知识

1.      Blocking/Non-blocking   vs  Sync/Async- Blocking I/O means that thecalling system does not return control to the caller until the operation isfinished. As a result, the caller is blocked and

2013-12-20 10:26:36 576

原创 Hash 函数

Hashing                 H(key)= key %MLinear probe                Slot = (home+i)%M                                Homeis index to which the key originally mapped by the hash function       

2013-10-30 09:17:28 556

转载 Polay定理总结

polya定理主要就是解决一类着色问题,或者说是同构计数问题。对Ω的n个目标用m种颜色着色的图象集种类数。定理的内容:Pólya定理:设G={p1,p2,…,pg}是Ω上的一个置换群,C(pk)是置换pk的循环的个数,用M中的颜色对Ω中的元素着色,着色方案数为 l = 1/|G|*[c1(p1)+c1(p2)+c1(p3)+...c1(p[g])]=1/|G|*[m^c(p1)+m

2013-10-02 19:10:29 1750

原创 雾里看花集锦

有的code咋看起来,感觉没啥问题,typedef bitset mybit;int _tmain(int argc, _TCHAR* argv[]){ mybit test_bs; test_bs.set(1, true); myprintf("%s", test_bs.to_string());}void myprintf(...){}上述的code有时候运行没

2013-08-14 22:38:51 777

转载 最大最小堆介绍

最大最小堆1.     定义:最小最大堆是一棵完全二叉树,且其中每个元素有一个key数据成员。树的各层交替为最小层和最大层。根结点在最小层。设x是最小最大堆的任意结点。若x在最小(最大)层上,则x中的元素的key值在以x为根的子树的所有元素中是最小(最大)的。位于最小(最大)层的结点称为最小(最大)结点。2.     特征:(1) 插入一个具有任意key值的元素(2) 删除ke

2013-07-19 09:26:32 1708

原创 Map-reduce 矩阵

来自微博的题目: Map Reduce 矩阵。新的矩阵的值,是原来矩阵附近8个临近节点的均值。python代码实现:# input: element is the key value pair of matrix# type: [row, column, value, totle_row, totle_column]def mapper(elem):

2013-07-11 10:32:57 634

原创 蓄水池算法简介

从N个元素中随机抽取k个元素,但是N不定。每个元素抽取的概率是k/N。先选中前k个,从k+1到最后一个元素,以1/i (i = k+1, k+2, ... N)的概率选中第i个元素,并且随机替换一个原来选中的元素。 1 from random import Random 2 3 def RandomSelect(knum, rand=None): 4 selec

2013-07-04 10:51:29 870

原创 忘我之乘积的解答

Q: Given array a [n], Get array b [n] b [i] = a [0] * a [1] ... a [n-2] * a [n-1] / a [i] Requirements can not be used to divide In addition to traverse the counter with a [N] b [N], do not use

2013-07-04 10:45:11 553

原创 最长公共子字符串 (Longest Common Substring)

问题:字符串 "ABABC", "BABCA" 最长公共子字符串是 "ABC"?solution1: suffix tree建立suffix tree时间复杂度是O(N), 查找公共子字符串的代价是O(m+n), m和n分别是两个字符串的长度。关于suffix tree请参考http://mila.cs.technion.ac.il/~yona/suffix_tree/

2013-06-21 18:14:51 1168

原创 BOP - 1的数目

文章后面的扩展问题:对于二进制,统计1的数目。f(1)  = 1f(10) = 10f(11) = 100…What is f(n)? Analysis:  by different bit    n (binary)                    f(n) (decimal sum by column)

2013-05-21 15:22:11 757

原创 MongoDB 简介

MongoDB是一个介于关系数据库和非关系数据库之间的产品,是非关系数据库当中功能最丰富,最像关系数据库的。他支持的数据结构非常松散,是 类似json的bson格式,因此可以存储比较复杂的数据类型。Mongo最大的特点是他支持的查询语言非常强大,其语法有点类似于面向对象的查询语 言,几乎可以实现类似关系数据库单表查询的绝大部分功能,而且还支持对数据建立索引。基本术语Do

2013-03-29 09:57:27 932

原创 理解JavaScript Closure

援引StackOverflow上的一个帖子:http://stackoverflow.com/questions/12930272/javascript-closures-vs-anonymous-functions关于closure,一个经典的错误实例如下:for(var i = 0; i < 10; i++) { setTimeout(function() {

2013-03-26 19:05:38 819

原创 几个 JavaScript Questions

Javascript 本身就有很多独特的语言特性。由此,相关的问题也很有意思。接下来,我列举几个,并简单分析一下。我是在chrome下测试的。。。var a = 1, b = function a(x) { x && a(--x); };alert(a);Answer: 1.Analyze: functiona() just anonymous f

2013-03-18 19:05:11 760

原创 MongoDB中group() mapReduce() aggregate()之比较

对于SQL而言,如果从users表里查询每个team所有成员的number,查询语句如下:SELECT team, no FROM users GROUP BY team (1)但是对于Mongodb而言,实现这样的功能,则比较复杂。从mongodb2.2之后,有了三个function可以实现这个功能,他们按照产生的顺序,

2013-03-13 19:26:20 9814 2

原创 二分搜索的应用

Binary Search 总所周知,在处理一些实际问题中也有很好的应用。举例如下:问题:一个数组是由一个递减数列左移若干位形成的,比如{4,3,2,1,6,5} 是由{6,5,4,3,2,1}左移两位形成的,在这种数组中查找某一个数。   答案: 二分解决。注意到a[0]5 /** 6 * @func: the binary search fur descendin

2012-12-11 14:47:11 1066

原创 关于C++构造函数抛出异常

The code like this is inherently vulnerable to memory leaks(if the constructor failed)?class Foo{public: Foo() : a(new int), b(new int) {} ~Foo() { delete a;

2012-12-10 15:50:49 538

原创 XOR Linked List

An ordinary doubly linked list stores addresses of the previousand next list items in each list node, requiring two address fields:    ... A       B         C         D         E ...          –>

2012-11-16 11:05:02 851

原创 凑钱问题

Q: 有足够量的2分、5分、1分硬币,请问凑齐1元钱有多少种方法?我们从简单情况开始分析,假如有足够量的1分硬币,请问凑齐1分钱有多少种方法?毫无疑问,答案是1。然后,凑齐2分钱有多少种方法?凑齐n分钱有多少种方法?答案均是1。接下来,假如有足够量的1分硬币和2分硬币,凑齐n分钱有多少种方法?对于1分硬币,凑齐任意n分钱都只有1种方法;那么只用1分钱凑齐n-2分钱,有1种方法;只用1分

2012-11-15 19:46:32 1153

原创 VC++在release下对return的优化

编译环境 VS2008, release模式。今天,对于如下的code进行debug,单步运行。此时index的值是1,我们一般会认为code走到36行,然后退出。但是,实际上,code走到38行,当时我们就凌乱了,难道code中if语句有问题,看了又看。茫然。。。。。。忽然想到,VS在release模式下,对于code有优化。。。看看汇编code吧,果然,VS

2012-09-03 19:27:35 567

轻松搞定XML(PDF)

可延伸标记语言(XML),是现今因特网中储存和传送信息中最有发展希望的程序语言。虽然超 文字标记语言(HTML)是目前建立网页最常使用的程序语言,然而在储存信息的能力上有其限 制。相较之下,XML 具有较大的弹性,允许你使用任何虚拟型态的信息,从简单的单笔数据到 复杂的数据库(因此称为可延伸标记语言)

2010-04-25

C安全编码标准(实现C安全编程的权威指南)

实现C安全编程的权威指南 本书提供了在C编程语言中进行安全编码的指导方针,描述了C语言程序中导致软件潜在风险根源的编码错误,并根据严重性、被利用的可能性以及修补成本设置了优先级。每个指导方针提供了不安全代码的例子以及安全的替代方案. 《CERT C安全编码标准》(The CERT C Secure Coding Standard)提供了在C编程语言中进行安全编码的指导方针。这些指导方针的目标是消除不安全的编码实践以及可能被利用而导致潜在风险的未定义行为。

2010-01-05

编程珠玑(中英文版)

Jon Bently的著作,程序员必选看的书。详细讲述了程序员的基本技能,算法,数据结构,程序中的bug预防。等等

2009-12-29

C语言深度剖析(pdf)

提供了C语言的基本知识,以及其常见的问题,出现bug的地方。学习c语言的很好的材料

2009-12-29

程序员面试攻略-(第2版)

Programming Interviews Exposed: Secrets to Landing Your Next Job, Second Edition。 提供了面试时常见的问题,并有详细的解答。是面试之前很好的资料。

2009-12-29

google黑板报-数学之美

我们将定期刊登 Google 科学家吴军写的《数学之美》系列文章,介绍数学在信息检索和自然语言处理中的主导作用和奇妙应用。

2009-12-23

Linux内核阅读心得

这段时间在看《Linux内核源代码情景分析》,顺便写了一些感悟。读内核源代码是一件很有意思的事。它像一条线,把操作系统,编译原理,C语言,数据结构与算法,计算机体系结构等等计算机的基础课程串起来。

2009-12-23

2009年各大公司笔试题大全

包含各大公司最新的笔试题,百度,华为,EMC,阿郎,网易,迅雷,腾讯等等。

2009-12-23

Effective STL

你已经熟悉了STL。你知道怎么建立容器,迭代它们的内容,添加删除元素和应用常见算法,比如find和sort。但你并不 满足,你不能摆脱STL所提供的超过它们能带来的好处的感觉。应该简单的任务并非那样。应该直截了当的操作确有资 源泄漏或错误行为。应该高效的过程却需要比你希望给它们的更多的时间和内存。是的,你知道怎么使用STL,但你不 确定你在有效地使用它。

2009-09-02

The Linux® Networking Architecture: Design and Implementation of Network Protocols in the Linux Kernel

This book deals with the architecture of the network subsystem in the Linux kernel. The idea for this book was born at the Institute of Telematics at the University of Karlsruhe, Germany, where the Linux kernel has been used in many research projects and its network functionality is modified or enhanced, respectively, in a targeted way. For instance, new services and protocols were developed for the next-generation Internet, and their behavior was studied. In addition, existing protocols, such as the TCP transport protocol, were modified to improve their behavior and adapt them to the new situation in the Internet.

2009-09-02

Understanding the Linux Kernel, 3rd Edition

In order to thoroughly understand what makes Linux tick and why it works so well on a wide variety of systems, you need to delve deep into the heart of the kernel. The kernel handles all interactions between the CPU and the external world, and determines which programs will share processor time, in what order. It manages limited memory so well that hundreds of processes can share the system efficiently, and expertly organizes data transfers so that the CPU isn't kept waiting any longer than necessary for the relatively slow disks.

2009-09-02

加州大学伯克利分校操作系统讲义

加州大学伯克利分校操作系统讲义,pdf版,内容详细,具体介绍了操作系统的基础知识。

2009-08-12

windows核心编程

Microsoft Windows is a complex operating system. It offers so many features and does so much that it's impossible for any one person to fully understand the entire system. This complexity also makes it difficult for someone to decide where to start concentrating the learning effort. Well, I always like to start at the lowest level by gaining a solid understanding of the system's basic building blocks. Once you understand the basics, it's easy to incrementally add any higher-level aspects of the system to your knowledge. So this book focuses on Windows' basic building blocks and the fundamental concepts that you must know when architecting and implementing software targeting the Windows operating system. In short, this book teaches the reader about various Windows features and how to access them via the C and C++ programming languages

2009-08-01

SQL Bible-Alex Kriegel and Boris M

you need to understand and use SQL and its implementations in accordance with the established SQL99 standard. Whether you want to learn database programming from scratch, you’d like to sharpen your SQL skills, or you need to know more about programming for a heterogeneous database environment, this book provides the complete menu. Tutorials and code examples in each chapter make it an indispensable reference for every level of expertise.

2009-08-01

南京大学算法讲义——图伦排序查找

包含了基本算法的讲义,如图论,哈希表,排序,查找等算法。。。。。。

2009-08-01

c++库函数以及文件大全_chm

本书详细描述了c++具体的库函数及其使用实例,丰富的例子等等。。。。

2009-07-30

Windows socket规范及应用

本书适应了Windows、Internet 及计算机网络普及的潮流,介绍了一套在Windows 下网络编程的规范-Windows Sockets。这套规范是Windows 下得到广 泛应用的、开放的、支持多种协议的网络编程接口。

2009-05-04

MySql5权威指南(英文版)

本书入地介绍了MySQL的功能,主要内容包括MySQL、PHP、Apache、Perl等组件的安装与功能简介,mysql等一些重要系统管理工具和用户操作界面的使用,MySQL数据库系统设计的基础知识与用不同语言设计MySQL数据库的过程,以及SQL语法、工具、选项、API应用指南,最大限度地帮助读者更快地学习和掌握MySQL数据库系统的设计和使用

2009-05-04

Exceptional C++--中文版 侯捷译

Exceptional C++以实例的方式告诉你如何进行坚实的 软件工程,本书涵盖了Guru of the week30个条款的补充。GotW是广泛欢迎的国际网站。是一个独立性极高的一系列C++工程问题和解答。

2009-05-01

十分钟学会SQL--SAM

Sams Teach Yourself SQL in 10 Minutes has established itself as the gold standard for introductory SQL books, offering a fast-paced accessible tutorial to the major themes and techniques involved in applying the SQL language.

2009-05-01

NS2手册(中文版)

本书主要是翻译ns2 manual上的内容。涵盖了ns2的各个架构到各个常用模块的使用。范围是相当的广泛,本书是严格按照ns2 manual英文版翻译。

2009-05-01

C++ Standard Library: A Tutorial and Reference

C++ Standard Library provides a set of common classes and interfaces that greatly extend the core C++ language. The library, however, is not self-explanatory. To make full use of its components-and to benefit from their power-you need a resource that does far more than list the classes and their functions.

2008-08-27

C++标准程序库—Nicolai M.Josuttis著

C++标准程序库—Nicolai M.Josuttis著,侯捷等译,本书详细介绍了STL以及C++编程思想。

2008-08-27

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除