Sunday, November 27, 2011

Reset Joomla administrator password?

Joomla's admin username can be easily changed with a simple MySQL query.  Open mysql console and execute the following query


UPDATE `jos_users` SET `password` = MD5( 'new_password' ) WHERE `jos_users`.`username` = "admin"

Thursday, August 25, 2011

Windows Shortcut Keys

Below is a listing of all the major Windows shortcut keys
Shortcut KeysDescription
Alt + TabSwitch between open applications.
Alt + Shift + TabSwitch backwards between open applications.
Alt + double-clickDisplay the properties of the object you double-click on. For example, doing this on a file would display its properties.
Ctrl + TabSwitches between program groups or document windows in applications that support this feature.
Ctrl + Shift + TabSame as above but backwards.
Alt + Print ScreenCreate a screen shot only for the program you are currently in.
Ctrl + Print ScreenCreates a screen shot of the entire screen
Ctrl + Alt + DelReboot the computer and brings up the Windows task manager.
Ctrl + Shift + EscImmediately bring up the Windows task manager.
Ctrl + EscBring up the Windows Start menu. In Windows 3.x this would bring up the Task Manager.
Alt + EscSwitch Between open applications on taskbar.
F1Activates help for current open application.
F2Renames selected Icon.
F3Starts find from desktop.
F4Opens the drive selection when browsing.
F5Refresh Contents to where you were on the page.
Ctrl + F5Refreshes page to the beginning of the page.
F10Activates menu bar.
Shift + F10Simulates right-click on selected item.
F4Select a different location to browse in the Windows Explorer toolbar.
Alt + F4Closes Current open program.
Ctrl + F4Closes Window in Program.
F6Move cursor to different Windows Explorer pane.
Alt + Space barDrops down the window control menu.
Ctrl + (the '+' key on the keypad)Automatically adjust the widths of all the columns in Windows explorer
Alt + EnterOpens properties window of selected icon or program.
Alt + Space barOpen the control menu for the current window open.
Shift + Del Delete programs/files without throwing them into the recycle bin.
Holding ShiftBoot Safe Mode or by pass system files as the computer is booting.
Holding ShiftWhen putting in an audio CD, will prevent CD Player from playing.
EnterActivates the highlighted program.
Alt + Down arrowDisplay all available options on drop down menu.
* (on the keypad)Expands all folders on the currently selected folder or drive in Windows Explorer.
+ (on the keypad)Expands only the currently selected folder in Windows Explorer.
- (on the keypad)Collapses the currently selected folder in Windows Explorer.

Friday, May 6, 2011

Ubuntu Linux: How do I install .deb packages?

dpkg is a tool to install, build, remove and manage packages. dpkg itself is controlled entirely via command line parameters. For example -i use to install .deb file.

How do I install .deb file?

To install package called package.deb type the following command:
Go to directory where package.deb is kept. For example if it is in /tmp directory:

$ cd /tmp

Type the following command:

$ sudo dpkg -i package.deb

Wednesday, February 2, 2011

VI Editor Tips

The VI editor is a screen-based editor used by Linux/Unix users. The VI editor has powerful features to aid programmers.  VI has two modes insertion mode and command mode.  The editor begins in command mode. Insertion mode begins upon entering an insertion or pressing 'i' in keyboard. [ESC] returns the editor to command mode.

Following tips may be helpful for programmers / content writers.
Execute the command from VI Editor command mode. (press Esc, If Insert mode)


Insert space/character between 2 adjacent characters

Example 1
'LinuxFor' becomes 'Linux For' (Sentence Case)

:%s/\([a-z]\)\([A-Z]\)/\1 \2/g

Example 2
'Kerala government' becomes 'Kerala Governemnt'

:%s/\([a-z]\) \([A-Z]\)/\1 \U\2/g


Removes all lines starts with a word/patterrn.

Removes all lines begin with 'Ele'

:g/^Ele.*$/d

Removes all lines end with 'are'

:g/$*.are/d

Removes blank lines

:g/^$/d

Make First Letter Capital

:%s/^./\U&/

Monday, January 3, 2011

Find out a file which contains specific string

To find out a file which contains specific string, execute the following command from shell


# find /var/www/html/mysite-iname '*php' | xargs grep 'about' -s1

Here, searchesfor file which contains string 'about' .

Saturday, December 18, 2010

Compress and split large files under linux

One of the common problems we used to face is transferring large files from Linux through mediums that doesn't support large files, especially when it comes to more than 4 GB files, usually that is a virtual machine hard disk, or backup file.

To compress and split files under linux, this command can be used:


$ tar -cvj big-file.dvi | split -b 650M -d - "small-file.tar.bz."

This command will compress and split the "big-file.dvi" to many files with size 650MB for each, giving it the name "small-file.tar.bz.0, small-files.tar.bz.1, etc...."

To join the files together again, this command can be used:

$ cat small-file.tar.bz.* > big-file.tar.bz

and to extract the output file :

$ tar -xvj large-file.tar.bz

Sunday, November 14, 2010

rsync - The Linux Backup Command

rsync stands for remote sync.

rsync is used to perform the backup operation in UNIX / Linux.

rsync utility is used to synchronize the files and directories from one location to another in an effective way. Backup location could be on local server or on remote server.

Important features of rsync

  • Speed: First time, rsync replicates the whole content between the source and destination directories. Next time, rsync transfers only the changed blocks or bytes to the destination location, which makes the transfer really fast.
  • Security: rsync allows encryption of data using ssh protocol during transfer.
  • Less Bandwidth: rsync uses compression and decompression of data block by block at the sending and receiving end respectively. So the bandwidth used by rsync will be always less compared to other file transfer protocols.
  • Privileges: No special privileges are required to install and execute rsync

Syntax

$ rsync options source destination

Source and destination could be either local or remote. In case of remote, specify the login name, remote server name and location.

Example . Synchronize Two Directories in a Local Server

To sync two directories in a local computer, use the following rsync -zvr command.

$ rsync -zvr /opt/lampp/htdocs/site1/ /backup1/site1bkp
building file list ... done
sva.xml
svB.xml
.
sent 26385 bytes received 1098 bytes 54966.00 bytes/sec
total size is 44867 speedup is 1.63
$

In the above rsync example:

  • -z is to enable compression
  • -v verbose
  • -r indicates recursive