gregg@server:/opt/de$ echo $SHELL
/bin/bash
Monday, January 31, 2011
mysqldump no data , mysqldump a table with data
1, Dump whole DB schema
$ mysqldump --no-data -u mysqluser -pMysql_DB_PW api > api.mysql
2, Dump a table data from DB
$ mysqldump -u mysqluser -pMysql_DB_PW api_DB a_table > db_table.mysql
$ mysqldump --no-data -u mysqluser -pMysql_DB_PW api > api.mysql
2, Dump a table data from DB
$ mysqldump -u mysqluser -pMysql_DB_PW api_DB a_table > db_table.mysql
Monday, January 24, 2011
enable htaccess
Need to update #AllowOverride None to AllowOverride AuthConfig
<Directory "/var/www/html">
Options Indexes FollowSymLinks
#AllowOverride None
AllowOverride AuthConfig
Order allow,deny
Allow from all
</Directory>
<Directory "/var/www/html">
Options Indexes FollowSymLinks
#AllowOverride None
AllowOverride AuthConfig
Order allow,deny
Allow from all
</Directory>
Sunday, January 23, 2011
mysql regular express
Tel phone number 555-555-5555
SELECT * FROM phone WHERE pnumber REGEXP '[0-9]{3}-[0-9]{3}-[0-9]{4}';
CAS number
SELECT * FROM products WHERE cas REGEXP '[0-9]{2,7}-[0-9]{1,2}-[0-9]{1}';
SELECT * FROM phone WHERE pnumber REGEXP '[0-9]{3}-[0-9]{3}-[0-9]{4}';
CAS number
SELECT * FROM products WHERE cas REGEXP '[0-9]{2,7}-[0-9]{1,2}-[0-9]{1}';
Friday, January 21, 2011
sudo: no valid sudoers sources found, quitting - ubuntu
Issue:
When I tried to add a new user into sudoer file /etc/sudoers, I need to chmod sudoers
chmod +w /etc/sudoers
Then, system gave this error:
sudo: /etc/sudoers is mode 0640, should be 0440
sudo: no valid sudoers sources found, quitting
Solution:
Enter Ubuntu recovery mode to change /etc/sudoers to 0440
When I tried to add a new user into sudoer file /etc/sudoers, I need to chmod sudoers
chmod +w /etc/sudoers
Then, system gave this error:
sudo: /etc/sudoers is mode 0640, should be 0440
sudo: no valid sudoers sources found, quitting
Solution:
Enter Ubuntu recovery mode to change /etc/sudoers to 0440
Thursday, January 20, 2011
how to embed google map in website
Recently, I just added gmap to my customer's website
http://northbeachhealth.com/contact.php
Here are instructions:
1, get a free google api key
Here is the page to get key
http://code.google.com/apis/maps/signup.html
2, find longitude and latitude of the address
A, enter your address in gmap
http://maps.google.com/maps?oe=utf-8&client=firefox-a&rlz=1R1GGLL_en___US406&q=367+Bay+St.,+Suite+B+San+Francisco,+Ca.+94133&um=1&ie=UTF-8&hq=&hnear=367+Bay+St,+San+Francisco,+CA+94133&gl=us&ei=Vpw4TdHXN8TflgfYmLmHBw&sa=X&oi=geocode_result&ct=title&resnum=1&ved=0CBMQ8gEwAA
B, click the 'link' on the right top of the map, you will see
'Paste link in email or IM' and
'Paste HTML to embed in website'
Copy the code in 'Paste HTML to embed in website'.
You will find 'll=37.805672,-122.413083', they are longitude and latitude of the address
3, add these code into your html page head part.
Go to the page http://northbeachhealth.com/contact.php
right click the page and get source code from line 8 - line 40
<script src="http://maps.google.com/maps?file=api&v=2&sensor=false&key=ABQIAAAAwRhSY6F_2jelV6V3hr36IRQXzaJo3hs4ignG9MPTCEQrUyb-4RTCJR_RLSFtILRbBVU3WW33j5ikTw"
type="text/javascript"></script>
<script type="text/javascript">
function createMarker(point,html,what)
{
var marker = new GMarker(point,{id:what, name:"chemmol", description:"chemalog"});
GEvent.addListener(marker, "click", function()
{
marker.openInfoWindowHtml(html);
});
return marker;
}
function initialize()
{
if (GBrowserIsCompatible())
{
var map = new GMap2(document.getElementById("map_canvas"));
map.setCenter(new GLatLng(37.805672,-122.413083), 16);
var bz_point = new GLatLng(37.805672,-122.413083);
var marker = createMarker(bz_point,'<div style="width:240px">BinZhi Acupuncture Clinic <p>',"this")
map.addOverlay(marker);
map.openInfoWindow(map.getCenter(), document.createTextNode("BinZhi Acupuncture Clinic"));
map.setUIToDefault();
}
}
</script>
4, in your html page body
copy
<div id="map_canvas" style="width: 400px; height: 500px"></div>
http://northbeachhealth.com/contact.php
Here are instructions:
1, get a free google api key
Here is the page to get key
http://code.google.com/apis/maps/signup.html
2, find longitude and latitude of the address
A, enter your address in gmap
http://maps.google.com/maps?oe=utf-8&client=firefox-a&rlz=1R1GGLL_en___US406&q=367+Bay+St.,+Suite+B+San+Francisco,+Ca.+94133&um=1&ie=UTF-8&hq=&hnear=367+Bay+St,+San+Francisco,+CA+94133&gl=us&ei=Vpw4TdHXN8TflgfYmLmHBw&sa=X&oi=geocode_result&ct=title&resnum=1&ved=0CBMQ8gEwAA
B, click the 'link' on the right top of the map, you will see
'Paste link in email or IM' and
'Paste HTML to embed in website'
Copy the code in 'Paste HTML to embed in website'.
You will find 'll=37.805672,-122.413083', they are longitude and latitude of the address
View Larger Map
3, add these code into your html page head part.
Go to the page http://northbeachhealth.com/contact.php
right click the page and get source code from line 8 - line 40
<script src="http://maps.google.com/maps?file=api&v=2&sensor=false&key=ABQIAAAAwRhSY6F_2jelV6V3hr36IRQXzaJo3hs4ignG9MPTCEQrUyb-4RTCJR_RLSFtILRbBVU3WW33j5ikTw"
type="text/javascript"></script>
<script type="text/javascript">
function createMarker(point,html,what)
{
var marker = new GMarker(point,{id:what, name:"chemmol", description:"chemalog"});
GEvent.addListener(marker, "click", function()
{
marker.openInfoWindowHtml(html);
});
return marker;
}
function initialize()
{
if (GBrowserIsCompatible())
{
var map = new GMap2(document.getElementById("map_canvas"));
map.setCenter(new GLatLng(37.805672,-122.413083), 16);
var bz_point = new GLatLng(37.805672,-122.413083);
var marker = createMarker(bz_point,'<div style="width:240px">BinZhi Acupuncture Clinic <p>',"this")
map.addOverlay(marker);
map.openInfoWindow(map.getCenter(), document.createTextNode("BinZhi Acupuncture Clinic"));
map.setUIToDefault();
}
}
</script>
4, in your html page body
copy
<div id="map_canvas" style="width: 400px; height: 500px"></div>
Subscribe to:
Posts (Atom)
-
Step 1, New a project rails new demo Step 2, Update Gemfile add paperclip, mysql2 gem, enable JavaScript runtime gem 'mysql2' ...
-
When trying to access transmission from web-browswer i got the message : 403: Forbidden Unauthorized IP Address. Either disable the IP ad...