Monday, October 22, 2012

Auto task ftp backup mysql

This guide helps you backup mysql db via FTP with a schedule.
1. Requirements
-WinRAR
-FTP client (command lines)

2. Create batch file (for example mysql_backup.bat) with following code

@echo off
setlocal
For /f "tokens=2-4 delims=/ " %%a in ('date /t') do (set mydate=%%c%%a%%b)
"<your mysql folder>\bin\mysqldump.exe" -u <mysqluser> --password=<mysqlpassword> yourdb > "<your mysql backup folder>\yourdb%mydate%.sql"
"<your WinRAR folder>\WinRAR.exe" a -r -inul<your mysql backup folder>\yourdb%mydate%.rar <your mysql backup folder>\yourdb%mydate%.sql
del <your mysql backup folder>\yourdb%mydate%.sql
copy <your mysql backup folder>\yourdb%mydate%.rar <your folder to upload>
ftp -v -i -s:ftpscript.txt
del <your folder to upload>\tmcrm%mydate%.rar


3. Create ftp script file (ftpscript.txt)

open <your server>
<username>
<password>
lcd  <your folder to upload>
cd <your server folder to hold backup>
binary
mput "*.*"
disconnect
bye

4. Create Windows' task schedule for this mysql_backup.bat

End ./.

Friday, October 19, 2012

Export MSSQL 2012 and Import to old version

A. Export from MSSQL 2012
1. On Microsoft SQL Server Management Studio of SQL Server 2012. Right click on the database that you want to backup and select Tasks >> Generate Scripts.
2. On tab Introduction of Generate and Publish Scripts screen, click Next.
3. On tab Choose Objects of Generate and Publish Scripts screen, select Script entire database and all database objects, then click Next.
4. On tab Set Scripting Options, click Advanced button
5. On Advanced Scripting Options screen:
  -set Script for Server Version to old version which you want (e.g. SQL Server 2008 R2);
  -set Types of data to script to Schema and data
  -in Table/View options: select types of scripts which you want
6. After selecting advanced options, then file name to save and click Next
7. Wait for finishing

B. Import to old version (e.g. MSSQL 2008 R2)
- Open SQL Server Management Studio >>  open the sql file and run to import
- In the case large file, you can run command:
SQLCMD -E -i input.sql -o output.txt
-Or run command below, if you want to import to existing DB
SQLCMD -E -d db -i input.sql -o output.txt



Saturday, October 13, 2012

CSS img shadow and change border on hover

For example, you have html a tag as the following:
<a class= 'aclass' href='aurl' title='short text' target='_blank'><img src='imgurl' style='width:160px;  height:160px;' class='ish' alt='short text' title='short text' /></a>

Let try the css below:

.aclass img
{
margin: 3px 4px 5px 4px;
border: 1px solid #C0C0C0;
}

.ish
{
-moz-box-shadow: 2px 2px 4px rgba(0, 0, 0, .75);
-webkit-box-shadow: 2px 2px 4px rgba(0, 0, 0, .75);
-goog-ms-box-shadow: 2px 2px 4px rgba(0, 0, 0, .75);
box-shadow: 2px 2px 4px rgba(0, 0, 0, .75);
filter:progid:DXImageTransform.Microsoft.Shadow(color='#000000', Direction=120, Strength=5);
}

img.ish:hover
{
border: 1px solid green;
}


Wednesday, October 10, 2012

IIS 7.5: Enable Parent Paths

Why need?
Classic ASP Parent Paths let developers use relative addresses that contain ".." in the paths to files or folders. For example, the following code excerpt illustrates an ASP page that maps a parent path:
<%
Response.Write Server.MapPath("../example.asp")
%>

The above code will fire 500 error ==> so need to enable parent path

Steps:

1.  Once logged into your server, open IIS Manager.  You can do this by clicking your Windows Start button and entering "inetmgr" into the search box.  Then press enter.

2.  On the Connections pane, expand the server node and select your site from underneath "Sites."




3.  On the Features view, double-click "ASP."




4.  Change "Enable Parent Paths" to "True."




5.  Under the Actions page, click "Apply."

MS SQL 2012: Some important configurations


I. Change security authentication mode
  1. In SQL Server Management Studio Object Explorer, right-click the server, and then click Properties.
  2. On the Security page, under Server authentication, select the new server authentication mode, and then click OK.
  3. In the SQL Server Management Studio dialog box, click OK to acknowledge the requirement to restart SQL Server.
  4. In Object Explorer, right-click your server, and then click Restart. If SQL Server Agent is running, it must also be restarted.
II. Enable the sa login
  1. In Object Explorer, expand Security, expand Logins, right-click sa, and then click Properties.
  2. On the General page, you might have to create and confirm a password for the login.
  3. On the Status page, in the Login section, click Enabled, and then click OK.
III. Change memory
  1. In SQL Server Management Studio Object Explorer, right-click the server, and then click Properties.
  2. On the Memory page, set Minimum & Maximum server memory
  3. In Object Explorer, right-click your server, and then click Restart. If SQL Server Agent is running, it must also be restarted.
IV. Change IP & port to connect
  1. Open SQL Server Configuration Manager
  2. Under SQL Server Network Configuration >> Protocols for MSSQLSERVER >> right side >> right click on TCP/IP >> select Properties >> tab IP Address
  3. Select an IP option (e.g. IP2) >> change IP Address value to the IP which you want to use for connection >> Change TCP Port to the port which you want >> select Enable = Yes
  4. Restart MS SQL Server
V. Change auto growth
By default DB will have auto growth is 10% for its data file and log file. It may cause disk space problem when your DB increase data. To change, let do below steps:
  1. Right click on the DB >> select Properties >> select Files
  2. Click on ... button (see the following picture) then change the auto growth number.





Tuesday, October 9, 2012

Webmaster: guidelines for rich snippets


Traditional, text-only, search result snippets aim to summarize the content of a page in our search results. Rich snippets (shown below) allow webmasters to help us provide even better summaries using structured data markup that they can add to their pages. Today we're introducing a set of guidelines to help you implement high quality structured data markup for rich snippets.



Once you've correctly added structured data markup to you site, rich snippets are generated algorithmically based on that markup. If the markup on a page offers an accurate description of the page's content, is up-to-date, and is visible and easily discoverable on your page and by users, our algorithms are more likely to decide to show a rich snippet in Google’s search results.

Alternatively, if the rich snippets markup on a page is spammy, misleading, or otherwise abusive, our algorithms are much more likely to ignore the markup and render a text-only snippet. Keep in mind that, while rich snippets are generated algorithmically, we do reserve the right to take manual action (e.g., disable rich snippets for a specific site) in cases where we see actions that hurt the experience for our users.

To illustrate these guidelines with some examples:

  • If your page is about a band, make sure you mark up concerts being performed by that band, not by related bands or bands in the same town.
  • If you sell products through your site, make sure reviews on each page are about that page's product and not the store itself.
  • If your site provides song lyrics, make sure reviews are about the quality of the lyrics, not the quality of the song itself.

In addition to the general rich snippets quality guidelines we're publishing today, you'll find usage guidelines for specific types of rich snippets in our Help Center. As always, if you have any questions or feedback, please tell us in the Webmaster Help Forum.

Posted by Jeremy Lubin, Consumer Experience Specialist, & Pierre Far, Webmaster Trends Analyst

Friday, October 5, 2012

Joomla 2.5: add google gadget

A. Add to a position on the Joomla website
1. Goto Google Gadgets For Your Webpage.
2. Click "Add to your webpage" button.
3. Click "Get the code" button you will see the script to run the gadget.
4. Create a Custom HTML module on your Joomla site. Remember to clean up Prohibited Elements in Editor - TinyMCE plugin.
5. Copy and paste the code from step 3 into the source of the Custom HTML module

B. Add to an article of Joomla
1. Do same 3 steps as mentined in A
2. Copy and paste to source HTML of the article

C. Add Google sites gadget to Joomla site
1. Add the gadget to your Google sites
2. In FireFox, select the area which contains the gadget >> then right click >> View Selection Source
3. Find <iframe> tag in the source HTML and copy its content. For example, I add Google Maps gadget into my Google sites and get its iframe as the following:


<iframe class="map_embed" frameborder="0" height="500" scrolling="no" src="//maps.google.com/maps/ms?z=16&amp;ie=UTF8&amp;msa=0&amp;msid=204746671798990797697.0004a78f5b3a13d5f4a43&amp;output=embed&amp;output=embed" title="BABY &amp; KIDS FASHION" width="100%"></iframe>

4. Copy and paste to source HTML of an article or Custom HTML module
Subscribe to RSS Feed Follow me on Twitter!