Wednesday, January 27, 2016

"I moved it" v.s. "I copied it"

http://www.experts-exchange.com/articles/12515/HOW-TO-Select-the-right-answer-to-I-Moved-It-or-I-Copied-It-in-VMware-vSphere-ESXi.html

I Moved It - should be used only, when you are manually moving a virtual machine between datastores, which includes moving to a new host and different datastore.

I Copied It - should be used when you want to COPY or CLONE a virtual machine, and used on the network at the same time as the original virtual machine.

Now that you have read, and hopefully understand the difference between "I Moved It" or "I Copied It" selections, I'll answer the question raised at the beginning

I've selected Copied, and now all My IP addresses have changed! Why?

As we've seen above, selecting "I Copied It" changes the uuid.bios and uuid.location values, which will force and generate a new MAC address. If you have been using DHCP (Dynamic Host Configuration Protocol) to supply IP Addresses to your computers on your LAN, your virtual machine will receive a new IP Address, after this change.

I hope this article helps you to understand the difference between "I Moved It" or "I Copied It" when you have moved or copied a virtual machine.

Friday, January 8, 2016

Compress on Mac using Terminal

If we right click the folder and then compress. The .zip may not be able to work across platforms (e.g., open it on Windows). We can use the terminal to compress files or folders.

http://coolestguidesontheplanet.com/how-to-compress-and-uncompress-files-and-folders-in-os-x-lion-10-7-using-terminal/

ZIP – Cross Platform

First up is ZIP one of the most commonly used compression techniques used across all platforms
To compress
zip -r archive_name.zip folder_to_compress
To extract
unzip archive_name.zip
If you want to make a zip without those invisible Mac resource files such as “_MACOSX” or “._Filename” and .ds store files, use the “-X” option in the command so:
zip -r -X archive_name.zip folder_to_compress

TAR.GZ – Cross Platform

Second up is TAR, an old favourite on Unix/Linux – you add the GZ for the compression – compresses tighter than zip
To compress
tar -zcvf archive_name.tar.gz folder_to_compress
To extract
tar -zxvf archive_name.tar.gz

TAR.BZ2 – Cross Platform

A variation on TAR GZ but with better compression than both tar.gz and zip.
To compress
tar -jcvf archive_name.tar.bz2 folder_to_compress
To extract
tar -jxvf archive_name.tar.bz2

GZ

Without the tar
To extract


gunzip archivename.gz

Thursday, January 7, 2016

Turn off ASLR

http://askubuntu.com/questions/318315/how-can-i-temporarily-disable-aslr-address-space-layout-randomization

According to an article How Effective is ASLR on Linux Systems?, you can configure ASLR in Linux using the /proc/sys/kernel/randomize_va_space interface.
The following values are supported:
  • 0 – No randomization. Everything is static.
  • 1 – Conservative randomization. Shared libraries, stack, mmap(), VDSO and heap are randomized.
  • 2 – Full randomization. In addition to elements listed in the previous point, memory managed through brk() is also randomized.
So, to disable it, run
echo 0 | sudo tee /proc/sys/kernel/randomize_va_space
and to enable it again, run
echo 2 | sudo tee /proc/sys/kernel/randomize_va_space
This won't survive a reboot, so you'll have to configure this in sysctl. Add a file /etc/sysctl.d/01-disable-aslr.conf containing:
kernel.randomize_va_space = 0
should permanently disable this.

http://www.2cto.com/os/201212/178306.html

If you use VIM or VI to change the value, it will have following error message:

 "/proc/sys/kernel/randomize_va_space" E667: Fsync failed
 Press ENTER or type command to continue

 Why:U cannot edit the  /proc files with  vi  . if u want 
 to change its value u can  echo to that file  like 
 echo "20000000" >   /proc/sys/kernel
======================================
 # echo 0 >/proc/sys/kernel/randomize_va_space 
 # more /proc/sys/kernel/randomize_va_space 
 0
=====================================

Wednesday, December 23, 2015

Move SVN repository from one server to anther

http://www.petefreitag.com/item/665.cfm

Step 1: Backup your old Repository
The first thing you need when moving from one server to another is a dump of your subversion repository. Hopefully you are already creating dump's with a backup script, but if not here's how you can create a subversion dump file:

svnadmin dump /path/to/repository > repo_name.svn_dump

The dump file contains all the revisions you have ever made to your svn repository, so it will probably be quite large (it even includes files you may have deleted in a previous revision).

Step 2: Create the new Repository Now, simply transfer the dump file on to your new subversion server, and create an empty repository:

svnadmin create /path/to/repository

Step 3: Import your old repository into the new one Next import your dump file:

svnadmin load /path/to/repository < repo_name.svn_dump

You may want to force subversion to use the same UUID for the new repository as the old repository. To do this add --force-uuid to your svnadmin load command. In my case I wanted to do this. If you have already loaded your repository, there is a way to set the UUID at a later date, check the docs. That's it, you now have a replica of your old repository on your new server.


HOW TO RELOCATE YOUR LOCAL COPY:
$ svn switch --relocate svn+ssh://username1@server1/home/username1/repos/file svn+ssh://username2@server2/home/username2/repos/file

Friday, June 19, 2015

What is the booting process for x86 machines

http://www.dewassoc.com/kbase/hard_drives/master_boot_record.htm

Thursday, January 22, 2015

Install latex on Mac Part 2

Do not install latex using
sudo port install texlive-latex-extra
sudo port install texlive +full

Download MacTex.pkg and install it.

But download it from here: http://www.ctan.org/tex-archive/systems/mac/mactex/
Not here: http://www.tug.org/mactex/
Because it is fast for the first link.


After install it, the pdflatex is installed under /usr/texbin/pdflatex

While the port install the latex under /opt/local/bin/pdflatex
libararies /opt/local/share/texmf-texlive/

If we install both, just delete the pdflatex command from /opt/local/bin, then the system will use the pdflatex under /usr/textbin/


Wednesday, December 3, 2014

How does Cache work

1. instruction cache
2. data cache: L1, L2, L3
3. TLB

Data cache:
http://en.wikipedia.org/wiki/CPU_cache

Example:
The original Pentium 4 processor had a four-way set associative L1 data cache of 8 KB in size, with 64-byte cache blocks. Hence, there are 8 KB / 64 = 128 cache blocks. The number of sets is equal to the number of cache blocks divided by the number of ways of associativity, what leads to 128 / 4 = 32 sets, and hence 25 = 32 different indices. There are 26 = 64 possible offsets. Since the CPU address is 32 bits wide, this implies 21 + 5 + 6 = 32, and hence 21 bits for the tag field.
The original Pentium 4 processor also had an eight-way set associative L2 integrated cache 256 KB in size, with 128-byte cache blocks. This implies 17 + 8 + 7 = 32, and hence 17 bits for the tag field.[3]