`
文章列表

Single Number II

Given an array of integers, every element appears three times except for one. Find that single one. Note: Your algorithm should have a linear runtime complexity. Could you implement it without using extra memory? 用one, two, three标记当前数出现一次、两次、三次。每处理一个数时分别计算与、异或、非,当前数字出现三个时前两个变量为1, 第3个变量为0;从而清除该数字;最后 ...
http://oj.leetcode.com/problems/median-of-two-sorted-arrays/ There are two sorted arrays A and B of size m and n respectively. Find the median of the two sorted arrays. The overall run time complexity should be O(log (m+n)). 思路: (1)时间复杂度O(log(m+n)),联想到递归法; (2)问题形式化为:查找两个数组的第K大小的数findKth(A, m, B, n, ...

Two-Sum

问题: Given an array of integers, find two numbers such that they add up to a specific target number. The function twoSum should return indices of the two numbers such that they add up to the target, where index1 must be less than index2. Please note that your returned answers (both index1 and index2) ...
sudo apt-get install texlive sudo apt-get install texmaker // gui editor sudo apt-get install latex-cjk-all // for chinese (1) vim test.tex \documentclass{article} \begin{document} hello world \end{document} (2) latex test.tex // 编译 (3) xdvi test.dvi &a ...

Git Wiki

Create Git repository on server At home of user 'git'. git@server:~$ mkdir myproject.git git@server:~$ cd myproject.git git@server:~/myproject.git$ git init --bare #Create repository on server. Create a master branch for the server. At home of user 'git'. git@server:~$ mkdir init ...

Emacs mit-scheme

http://www.gnu.org/software/mit-scheme/documentation/mit-scheme-user/Unix-Installation.html#Unix-Installation 1. Download mit-scheme i386 9.1 2. @/mit-scheme/src $ ./configure $ make compile-microcode $ make install over 3. M-x run-scheme
Eclipse -> Help -> Install New Software. 添上地址: http://dl.google.com/eclipse/inst/d2wbpro/latest/3.7
参考资料:http://progit.org/book/zh/ 一、安装Git sudo apt-get install git 使用git --version查看版本,我的是1.7.0.4 基本配置 用户信息 git config --global user.name "yourname" git config --global user.email "youremail" 文本编辑器 git config --global core.editor emacs 差异分析工具 git config --global merge.tool vimd ...
原文链接:http://www.ruanyifeng.com/blog/2011/09/curl.html curl网站开发指南 作者: 阮一峰 日期: 2011年9月 4日 我一向以为,curl只是一个编程用的函数库。 最近才发现,这个命令本身,就是一个无比有用的网站开发工具,请看我整理的它的用法。 =================================== curl网站开发指南 阮一峰 整理 curl是一种命令行工具,作用是发出网络请求,然后得到和提取数据,显示在"标准输出"(stdout)上面。 它支持多种协议,下面举例讲解如何将它用于网站开发。 一、查看 ...

my rails wiki

    博客分类:
  • Ruby
1. rails server 出现下面的错误 Could not find a JavaScript runtime. See https://github.com/sstephenson/execjs for a list of available runtimes. (ExecJS::RuntimeUnavailable) 解决方法:在系统里面安装一个js的运行环境。注意有的源是不行的(sigh!)。 下面是经我测试可以的办法: sudo apt-get install python-software-properties sudo add-apt-repository ppa:c ...
原文链接:http://hi.baidu.com/mcspring/blog/item/40c8aeec47575d2a27979168.html Gem介绍: Gem是一个管理Ruby库和程序的标准包,它通过Ruby Gem(如 http://rubygems.org/ )源来查找、安装、升级和卸载软件包,非常的便捷。 Ruby 1.9.2版本默认已安装Ruby Gem,如果你使用其它发行版本,请参考“如何安装Ruby Gem”。 Ruby gem包的安装方式: 所有的gem包,会被安装到 /[Ruby root]/lib/ruby/gems/[ver]/ 目录下,这其中包括了Cache、 ...
网上有很多的版本,下面是我的试验成功的安装过程。使用ubuntu10.04。 还是使用新立得的apt-get 命令行工具来安装吧,自己编译安装总是有各种各样的错(也反应了linux功底不足)。参考《Web开发敏捷之道》(Agile Web Development with Rails)。安装过程如下: 第一步:安装必需的依赖库 sudo apt-get install build-essential libopenssl-ruby libfcgi-dev sudo apt-get install ruby irbrubygems ruby 1.8-dev sudo apt-get ins ...

my emacs wiki

 
1. emacs有规律的乱码 转: 每次在进入emacs下面,使用shell-mode来进行命令行操作,乱码显示总让人头疼不已,不过,现在终于找到方法解决了。 1).方法一,改配置文件.emacs: (setq ansi-color-for-comint-mode t), 不过在我的emacs里面试了一下并不成功。 2). 方法二, 键入操作: M-x ansi-term,这个就没有问题。 这篇文章是一篇不错的有关emacs配置的Q&A:http://myknobby.spaces.live.com/Blog/cns!1pZiBfdrlJdyNTdFGqyf_9Ig!109.entry,推荐。 ...
这个话题曾经给身边的很多朋友说过同样的话题,这里整理以下。 如果你是一个门外汉,你会 .NET 或是 Java 或是 PHP … 你对 Ruby on Rails 感兴趣,想学习,开怎么开始? 如果你有以上语言两年以上的工作经验,按照我指的路子,最慢1个月就能学会 Ruby on Rails,这个方案曾经经过好几个人证实。 以下步骤请一步一步来,切勿心急跳过,最好连我上面的链接都不要提前点击! 安装 Linux 或 Mac, 开发工具使用 Windows -> E-TextEditor, Linux -> Sublime Text, Mac -> TextMate 当然 ...
在Windows系统下用VNC Viewer去连接Linux系统的VNC Server,双方都可ping通,但是VNC Viewer连接不上,显示connection refused (10061), 用下面的方法解决: system-config-securitylevel 查看系统的安全级别,选择信任Telnet,然后就可以连接成功。
Global site tag (gtag.js) - Google Analytics