Fun at work!

Archive for the ‘How To’s’ Category

How to add a user to sudoers file?

You need root access to add a user to the sudoers file. Enter as root user:

# su -

and put in the root password. Then use this command

# visudo

to make changes on the /etc/sudoers file. It is not recommended to edit the file using text editor.

To add a user, enter the line in appropriate location.

username    ALL=(ALL) ALL

or,

%groupname  ALL=(ALL) ALL
Advertisements

How to fix: “Another MySQL daemon already running with the same unix socket.”

You can see this error when restarting MySQL. The system has detected that MySQL is running when it is not. This is probably due to and hard reboot of the system.

To fix this problem, remove the file /var/lib/mysql/mysql.sock as root user:

# rm /var/lib/mysql/mysql.sock

Then start the MySQL daemon:

# service mysqld start

 or

# /etc/init.d/mysqld start

How to clear SVN client user password saved on the client side?

If you have saved the user authentication on your SVN Tortoise client, and wanted to clear them if you want that everytime you access your server, you need to input your credential, then do the following steps:

  • Right-click your desktop and select TortoiseSVN->Settings
  • Select Saved Data.
  • Click Clear against Authentication Data.

Next time you make action on your SVN repository, you will be asked for the user credentials.

Repost: NetHogs – Monitor Per Process Network Bandwidth Usage in Real Time

NetHogs Command Line Options

Following are the nethogs command line options. Using ‘-d‘ to add a refresh rate and ‘device name‘ to monitor specific given device or devices bandwidth (default is eth0). For example, to set 5 seconds as your refresh rate, then type the command as.

# nethogs -d 5
$ sudo nethogs -d 5

To monitor specific device (eth0) network bandwidth only, use the command as.

# nethogs eth0
$ sudo nethogs eth0

To monitor network bandwidth of both eth0 and eth1 interfaces, type the following command.

# nethogs eth0 eth1
$ sudo nethogs eth0 eth1
Other Options and Usage
-d : delay for refresh rate.
-h : display available commands usage.
-p : sniff in promiscious mode (not recommended).
-t : tracemode.
-V : prints Version info.

NetHogs Interactive Controls

Following are some useful interactive controls (Keyboard Shortcuts) of nethogs program.

-m : Change the units displayed for the bandwidth in units like KB/sec -> KB -> B-> MB.
-r : Sort by magnitude of respectively traffic.
-s : Sort by magnitude of sent traffic.
-q : Hit quit to the shell prompt.

Learn More

How to install marketplace on Eclipse Indigo?

By default, market place in Eclipse Indigo Classic Version is not available.  The steps below will help you install it.

  1. Go to “Help”, then select “Install New Software…”.
  2. In the “Work with:” drop down menu, select ” Indigo – http://download.eclipse.org/releases/indigo “. If not available, add the Eclipse Indigo download site with this URL – “http://download.eclipse.org/releases/indigo
  3. On the category list, expand the “General Purpose Tools”, select “Marketplace Client” and follow the installation procedure.
  4. After finish installation, restart Eclipse and you can find “Eclipse Marketplace…” under the “Help” menu. Done.

Below the screenshot of the “Install New Software” dialog  box.

図1

How to install Apache ANT on Windows 7?

Apache Ant is a Java library and command-line tool that help building software. Here’s how to install Apache ANT on Windows 7.

1. Download the latest ANT zip archive at http://ant.apache.org/.
2. Unzip the package and rename the folder to “ant”.
3. Copy the “ant” folder to the desired location, say at the root of drive D.
4. Run the command prompt as Administrator and set the environmental variables for ANT and JAVA (Note: Set ANT_HOME to the uncompressed ant folder and JAVA_HOME to the Java JDK folder. If JAVA_HOME is incorrectly set, ANT cannot locate the needed tools.jar) as follows:

set ANT_HOME=D:\ant
set JAVA_HOME=D:\Program Files\Java\jdk1.7.0_09
set PATH=%PATH%;%ANT_HOME%\bin

5. Check whether ANT works correctly or not by using the command prompt.

ant -version

6. You’re done if you see the ANT version.

Screenshot of the example:

図1

How to display line numbers in Eclipse IDE?

By default, Eclipse’s editor does not display line numbers. Follow this simple guide to enable “Show line numbers”:

In Eclipse IDE, go to Window>Preference>General>Editors>Text Editors, and check Show line numbers. See screenshot below.

Eclipse Display Line Number

Tag Cloud