In this project, we developed a tool which can help detect failures in a virtualized environment. Besides detecting failures, it could also provide useful information regarding, for example, whether certain resiliency policy worked as it was desired to. Thus, it can help the corresponding engineer to better prioritize their time (for example, after some failure, the resiliency policy worked perfectly (i.e., no impact), then the corresponding engineer might not need to fix the bugs that caused the failure immediately, if he/she happened to have other tasks at hand.)
QPS is an “add-on” scheduling algorithm for input-queued crossbar switches. It builds upon “simple” Queue-Proportional Sampling, and achieves $O(1)$ time complexity per port. It can boost the performance (throughput or delay or both) of a large amount of existing switching scheduling algorithms (e.g., iSLIP, SERENA).
ForestStream is a novel measurement algorithm suite which combined streaming algorithm techniques and graph sampling techniques. Unlike traditional graph sampling techniques, ForestStream can unbiasedly sampling certain portion of trees from a graph forest, thus is able to achieve much higher accuracy than traditional graph sampling techniques.
In this post, we will deal with the following XOR problem. Given $l$ consecutive nonnegative integers which start from $s$, i.e., $s, s+1, \cdots, s + l - 1$, you are asked to get the XOR of them, i.e., $XOR_{x\in [s+l-1]\setminus [s-1]}x$, where $[s]={1,2,\cdots,s}$. An algorithm with complexity $O(l\log (s + l))$ is straightforward: XOR these numbers one by one (see the following pseudo-code).
def XOR(s, l):
x = 0
for s in xrange(s, s + l):
x ^= s # note, for general case, you have to implement your own XOR for long-bit integers
return x
Now, let’s see a logarithmic solution, i.e., an algorithm with complexity $O(\log (s + l))$.
As we know, XOR of multiple single-bit variable (i.e., $0$ or $1$) equals $1$ if the number of $1$’s is odd, otherwise $0$. Now, we decompose the XOR of $[s+l-1]\setminus [s-1]$ by bits, for the $i^{th}$ bit, we only need count how many 1’s. It appears that we still need $O(l)$ time to do the counting. However, the consecutiveness of these numbers make the appearance of $1$’s and $0$’s periodic. For example, for the $3^{rd}$ bit (from the lowest bit), roughly speaking the pattern is as follows.
\[\cdots,0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,\cdots\]Of course, you need pay a little attention to the beginning and ending parts, since $l$ might not divide $2^3$.
Generally,
The following pseudo-code shows how to XOR the $i^{th}$ bit. Clearly, it can be done in $O(\log(s + l))$, as there are at most $\log (s + l)$ bits, therefore, this algorithm can calculate the XOR in $O(\log^2(s+l))$ time. Note that, before calculating the XOR bit-by-bit, you should first get these bits and after finishing the XOR, you should assemble these bits into a decimal number. Clearly, these two operations can be done in $O(\log(s+l))$.
# base = 2 ** i
# bit is the value of the i-th bit
# r[i] is the i-th bit for the result
if base == 1:
r[i] = ((l - bit) / 2 + bit) % 2
else:
period = 2 * base
preamble_len = period - bit * base - s % base
preamble = min(l, preamble_len)
if bit == 0:
preamble = max(0, preamble - (base - s % base))
padding = 0
if l > preamble_len:
padding_len = (l - preamble_len) % period
padding = padding_len - base if padding_len > base else 0
r[i] = (preamble + padding) % 2
Fastpass is a Datacenter network framework proposed by Jonathan Perry, et al.. Its authors published its codes, however, I encountered some issues while installing it on Ubuntu 16.04. Here is Long’s vagrant VM for building Fastpass.
Issue 1: gcc version issue
error:
include/linux/compiler-gcc.h:86:30: fatal error: linux/compiler-gcc5.h: No such file or directory
solution: before make -j22
adding
echo "#include <linux/compiler-gcc4.h>" > include/linux/compiler-gcc5.h
Issue 2: Berkeley DB issue
error:
E: Unable to locate package libdb6.0-dev
E: Couldn't find any package by glob 'libdb6.0-dev'
E: Couldn't find any package by regex 'libdb6.0-dev'
libdb6.0-dev
for Ubuntu 16.04 (I only found libdb6.0-dev
for Ubuntu 14.04)libdb6.0-dev
with libdb-dev
(if you still see the similar error, then you might need add the source to your /etc/apt/source/lsit
)As one of the most popular modern version control tools, git
is getting more and more popular. As a result, Github becomes a necessary part of programmers’ daily life. In this post, we will introduce some tricks to help programmers play with Github. These tricks are extremely useful, when you are dealing with multiple Github accounts (e.g., one for company codes, one for personal codes).
The first trick is to avoid entering password while pushing local repositories to remote or pulling/fetching private remote repositories.
$ ssh-keygen -t rsa -b 4096
Generally, we will see outputs as follows.
Generating public/private rsa key pair.
Enter file in which to save the key (/home/mininet/.ssh/id_rsa): git_key_example
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in git_key_example.
Your public key has been saved in git_key_example.pub.
The key fingerprint is:
38:44:30:a8:a4:6f:eb:c1:66:12:bb:28:dd:bd:7c:29 mininet@mininet-vm
The key's randomart image is:
+--[ RSA 4096]----+
| .o.. |
| .. o |
|o. . |
|o . . |
|.. o S |
| +o . |
|oo=o . . |
|o=o...E o |
|+.. o+ |
+-----------------+
During the above process, you will be asked to
git_key_example
as the file name.). If you only enter the file name, the key pair would be stored in current directory. If you want to store your key in somewhere else, you can add the full path of your file.git push
.).After the above process, you will find the key pair in the directory you enter. In the above example (assume current directory is /home/mininet/.ssh/
), you will find the following two new files:
Prepare (get the content of public key):
$ cat git_key_example.pub
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDEKiWm5RBjQJOsNmGi6GQNAqhoovXA/qVm1i+nyZ0j18kQkCaeTSdGDUs9UiV9ts7vG4MLHucRLI4dh5hvOH3gr0W7MhB8JubOptKJWtjGaw4f1Vb3xxdKGJ7igHA/ud2N5omkJIptyKXrvybLkqnkLcGgxttvqheOGczzC2g0MIa7MxqhlALkdj0QVyjrtbqltB+k0+lAqyeLRJGrWqmRZ8FlPn1KslpWKq+LFAuKNg24YF7HxbGubdVVeGsKTOowrDBN5IGdEJvlqwZsVUvGnx1oznJzpfdw80KCcm1vFmMU6E3oo3OLfgjhRvcfl5DV+OznTPPr3KbybNSAUIr5lR00LkBhKH0nxiHcERi9/E6/95/fVovY8vV38wPLXBCq/jkmQmtUFHQ86C/1f0bgAAano56Ovd2p7ur5x2pe+sCUxwcQQ3kYOpesqQhCvpkIA6kDGznsGiY1418sCj8D7na1MoifvzsPfpAbO8zAO0YtITEfaaiBum9i4GbzMTl4AzuLIff03XhPRHlew/9McG6DlKm04A96QmRbUZQHzdUyivOSpG7HCFBrYmiEga1EPV8WRRU8SJu0hftV0Upk2T46KASygvo5A0wZ6YUWytHhY8Sdtrx56y4mOtol3RkQtR/vUGCjxIbtl3Lw1J3xoxQkxynesUM8bopBgkwxiQ== mininet@mininet-vm
Open the browser and go to github.com
, then
Log in
Find “SSH and GPG keys” in “Personal settings”
“New SSH key”
Paste the content of your public key.
ssh-agent
$ eval "$(ssh-agent -s)"
$ ssh-add /path/to/your_ssh_key
To avoid to enter the above commands every time after you restart your computer, you can add them in your bash configuration file (e.g., ~/.bashrc
for Ubuntu, ~/.bash_profile
for OS X).
Assume you have two github account, for ease of presentation, we refer to them as A and B.
Edit ~/.ssh/config
and add the following sentences at the end of the file:
Host github_A
HostName github.com
User git
IdentityFile path/to/ssh-private-key-for-A
Host github_B
HostName github.com
User git
IdentityFile path/to/ssh-private-key-for-B
Change github.com
to the corresponding host name you configured above. Suppose the remote repository associated with account A is git@github.com:A/example.git
:
$ git remote add remote_A git@github_A:xlong88/publications.git
$ ...
$ git push remote_A master
Similar for B.
PDF has become one of the most popular file type used on our electronic devices. However, the management of PDF files is not an easy task, especially when you have too many PDF files. For example, as a undergraduate/graduate student, you might obtain bunch of lectures in PDF format for a certain course (say Calulus). After you have taken this course for a long while, we encountered some concepts in Calculus, but you did not remember the details behind them. However, you are $100%$ sure that they must be in certain lectures (but you are not sure which lectures they locate in). At this time, you might want a tool to combining these lectures into a single file such that you can easily locate them.
In this post, we introduce a simple tool that can provide you a user-friendly GUI to combine multiple PDF files into a single one.
Remarks: In the future, to support drag and drop, we might switch to Java.
git clone -b gui https://github.com/lgong30/pdfMerge
cd pdfMerge
pip install -r requirements.txt
(Note that, if you get permission denied errors, please add a sudo
before pip
)sudo chmod +x window.py
./window.py
If ever played with GIT, then you might encountered a tedious situation, where you need create a .gitignore
file for every repository even if many of your repositories share the same .gitignore
file. Some of you might have stored these .gitignore
files for various projects, however, the manual copy and paste are still tedious. Are there any tools that can help us “play against” .gitignore
easier? In this post, we will introduce you one of such tools.
Please refer to the corresponding “official site” of Sublime Text or Sublime-Gitignore.
Of course, the template provided in Sublime-Gitignore might not satisfy your requirements. Then, you can customize the templates. Before that, you need another sublime text plugin (at least for sublime text 3), that is PackageResourceViewer.
Sublime-Gitignore
(HOWTO: please refer to the “official site” of PackageResourceViewer)Sublime-Gitignore
(i.e., the sub-directory boilerplates
under the root directory of package Sublime-Gitignore
).gitignore
templateIf you are using BasicTex on your Mac, you might get frustrated when you get errors on missing packages, especially when the latex source using too many packages that you did not install on your Mac. Is there any tools that could help you automatically install those missing packages. YES! texliveonfly provides you such capability. However, you might want this feature to be integrated into your text editor such as Sublime Text.
In this post, we help you design a sublime text plugin for supporting texliveonfly
.
Press cmd+shift+f
(unfortunately, current version needs you start your sublime text with the privilege of a superuser, in the future, we will try to figure out how to avoid this)
git clone https://github.com/lgong30/TexliveOnTheFly ~/Library/Application\ Support/Sublime\ Text\ 3/Packages/TexliveOnTheFly