Ubuntu下格式化U盘

2013年10月29日 21:00

1. 先卸载  sudo umount /media/kitt/KINGSTON

2. 查看U盘序号  sudo fdisk -l  如/dev/sdc

3. FAT32格式  sudo mkfs.vfat -F 32 /dev/sdc 

ext4格式  sudo mkfs.ext4 /dev/sdc, 也可ext3,ext2

NTFS格式  sudo apt-get install ntfsprogs   sudo mkfs.ntfs /dev/sdc

For TCP, no. You can only have one application listening on a single port at one time.

Now if you had 2 network cards, you could have one application listen on the first IP and the second one on the second IP using the same port number.

For UDP (Multicasts), multiple applications can subscribe to the same port.

http://www.cnblogs.com/kym/archive/2012/05/14/2498728.html

这篇文章谈到需要pyc文件时只要import就好了, Python是先编译后解释的语言。

http://blog.csdn.net/sislcb/article/details/4002414

这篇文章谈到用py_compile模块把.py文件编译成.pyc文件

 

 

Ubuntu关闭swap分区

2013年10月17日 11:07

 1.暂时关闭SWAP,重启后恢复
    swapoff   -a


2. 永久关闭SWAP
    vim /etc/fstab
   # swap was on /dev/sda11 during installation
   #UUID=0a55fdb5-a9d8-4215-80f7-f42f75644f69 none  swap    sw      0       0
  注释掉SWAP分区项,即可


3. 查看SWAP分区大小
    cat /proc/meminfo
      SwapTotal:             0 kB
      SwapFree:              0 kB
  如果上面二项目都为0,说明没有swap分区;如果不为0,则说明有此分区

1. 设备-->安装增强功能(Host + D)
2. 在Ubuntu命令行中,cd /media/VBOXADDITIONS_4.2.16_86992,然后sudo sh ./VBoxLinuxAdditions.run
3. 关闭Ubuntu,重启VirtualBox

鼠标可以在host和guest之间切换了,剪贴板可以共用了,guest Ubuntu全屏后(Host + F)支持双屏幕。

jQuery delay()

2013年10月10日 17:58

    If there's an object whose id = "svg1" && type = "image/svg+xml" in html, jQuery can be used like this to access its elements:

继续阅读

Word Break (C++)

2013年10月08日 23:15

要首先挑dict里面长的string进行匹配,不然容易超时。对unordered_set不太熟,就用vector<string>排序了一下dict. 对于sort,自己写个比较函数也行,注意要是static,否则会报错,显示cmp的参数不对。因为这是在class里,有一个隐含的this参数,而sort的比较函数是默认没有这个参数的,这一点还是宋大牛指出的。

static bool cmp(string const &a, string const &b) {return a.length() > b.length();}
sort(sorted_dict.begin(), sorted_dict.end(), cmp);

继续阅读

http://blog.csdn.net/chenyiming_1990/article/details/9476181

Pow(x, n) (C++)

2013年9月24日 01:06

Implement pow(x, n). 一上来就超时了,看了“水中的鱼”的解体报告才知道用二分。

继续阅读

Same Tree (C++, Python)

2013年9月24日 01:03

Given two binary trees, write a function to check if they are equal or not. Two binary trees are considered equal if they are structurally identical and the nodes have the same value.

 

继续阅读

Maximum Depth of Binary Tree (C++)

2013年9月24日 00:59

Given a binary tree, find its maximum depth. The maximum depth is the number of nodes along the longest path from the root node down to the farthest leaf node.

继续阅读

广BFS(一层一层走): http://blog.csdn.net/raphealguo/article/details/7523411   节点是某种状态,边是节点与节点间的某种规则。适合: 给定初始状态跟目标状态,要求从初始状态到目标状态的最短路径。节点的子节点数量不多,树的层次不深。在树的层次较深&子节点数较多的情况下,消耗内存十分严重。

继续阅读