Latest Entries »

test_db=# select address from test_table;

58/171-G, RAJAPURAM,\r                                                                                                                                                                                                                                                                                                                                                                                                              +
PALANIAPPA NAGAR,\r                                                                                                                                                                                                                                                                                                                                                                                                                 +
SALEM
TS.No.5823,SANTHANATHAPURAM FOURTH STREET\r                                                                                                                                                                                                                                                                                                                                                                                         +

 

solution
test_db=# update test_table set address= regexp_replace(address, E'[\\n\\r]+’, ‘ ‘, ‘g’);

test_db=# select address from test_table;

58/171-G, RAJAPURAM,

PALANIAPPA NAGAR,

SALEM TS.No.5823,SANTHANATHAPURAM FOURTH STREET

Grant Privileges Postgres

Database:

GRANT ALL PRIVILEGES ON DATABASE DATABASENAME to USER;

Table:

GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA public TO USER;

Id Seq Tables:

GRANT ALL PRIVILEGES  ON ALL SEQUENCES IN SCHEMA public TO USER;

To find number of files in a directory use the following command:

ls | wc -l

To find number for rows in a csv file use the following command:

wc -l filename.csv

grep command syntax

The syntax is:

grep "text string to search” directory-path

OR

grep [option] "text string to search” directory-path

OR

grep -r "text string to search” directory-path

OR

grep -r -H "text string to search” directory-path

OR

egrep -R "word-1|word-2” directory-path

OR

egrep -w -R "word-1|word-2” directory-path

postgres=#SELECT datname, (pg_stat_file(‘base/’||oid||’/PG_VERSION’)).modification AS datcreated
FROM pg_database;

datname | datcreated
——————-+—————————
template1 | 2014-05-06 15:44:37+05:30
template0 | 2014-05-06 15:44:38+05:30
postgres | 2014-05-06 15:44:38+05:30
abc | 2014-07-01 12:58:31+05:30
xyz | 2014-07-03 11:01:38+05:30

Nano

Find  :  ctrl + W

Find and Replace :

Ctrl \
Enter your search term [press return]
Enter your replacement term [press return]
A [to replace all instances]

Select: ALT + M + A
Copy: ALT + 6 (copy as many lines as you like, and they will be pasted in the order you copied them)
Paste: CTRL + U

 

Start the Virtual Box

Goto Setting

Select USB

usb

Tick the Checkbox Enable USB Controller and Enable USB 2.0 (EHCI) Controller

enable_usb_2

When you tick the checkbox in Enable USB 2.0 (EHCI) Controller you will see the following error

usb_error

USB 2.0 is currently enabled for this virtual machine. However, this requires the Oracle VM VirtualBox Extension Pack to be installed.

Please install the Extension Pack from the VirtualBox download site. After this you will be able to re-enable USB 2.0. It will be disabled in the meantime unless you cancel the current settings changes.

How to solve this error:

First check for your virtual box version. And download the Oracle VM VirtualBox Extension Pack for your virtual box version.

Goto File -> Preferences

Select Extensions

extensions

Click the icon and add the file you downloaded. It will ask for installation install it.

install_extensions

 

after_install_extensions

 

After complete the installation you can Tick the Enable USB 2.0 (EHCI) Controller

enable_usb_2

Then add the usb device

add_usb_device

 

Now Start the OS. The USB you added will be detecting automatically

usb_Detected_in_windows

 

Before Shutdown the OS you should Unmount the USB.

 

To get previous month – python

$python
>>> from dateutil.relativedelta import *
>>> import datetime
>>> one_month_ago = datetime.datetime.now() - relativedelta(months=1)
>>> one_month_ago
datetime.datetime(2013, 10, 18, 13, 47, 13, 110467)
>>> previous_month = one_month_ago.strftime("%B") 
>>> previous_month
'October'  

This is sample coding to create two slide show in a same page with different timings

var image1=new Image()
image1.src=”sample/images/black-berry.jpg”
var image2=new Image()
image2.src=”sample/images/i-Mate.jpg”
var image3=new Image()
image3.src=”sample/images/lg.jpg”
var test1=new Image()
test1.src=”sample/images/nokia1.jpg”
var test2=new Image()
test2.src=”sample/images/nokia2.jpg”
var test3=new Image()
test3.src=”sample/images/nokia1.jpg”


//variable that will increment through the images
var step=1
function slideit(){
//if browser does not support the image object, exit.
if (!document.images)
return
document.images.slide.src=eval(“image”+step+”.src”)
if (step<3)
step++
else
step=1
//call function "slideit()" every 2.5 seconds
setTimeout("slideit()",2500)
}
function slideit1(){
//if browser does not support the image object, exit.
if (!document.images)
return
document.images.slideshow.src=eval("test"+step+".src")
if (step<3)
step++
else
step=1
//call function "slideit1()" every 3 seconds
setTimeout("slideit1()",3000)
}
slideit()
slideit1()