Monday, October 22, 2012

Auto task ftp backup mysql

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

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

@echo off
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>
lcd  <your folder to upload>
cd <your server folder to hold backup>
mput "*.*"

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;

-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);

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


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="//;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

Monday, October 1, 2012

Chrome Web Store: new way to publish Google Apps Script

Apps Script developers that wished to share their work with a larger audience have traditionally turned to the Script Gallery, which allows other users to copy and install the script into their own spreadsheets. While appropriate for custom functions and spreadsheet extensions, it didn't fit well when distributing more complex functionality and apps.

In this blog post we'll be highlighting a newer way to distribute your scripts: deploying them as a web app and publishing them to the Chrome Web Store. Compared to the Script Gallery, the Chrome Web Store has some distinct advantages for developers:

  • Automatic updates - Change your code, do some testing, and publish a new version to update the app for all users instantly.
  • More information - Detailed descriptions, promotional images, ratings, and reviews lead tocompelling listings.
  • Greater discoverability - Visit the Chrome Web Store site to learn about the benefits.

Looking through the Script Gallery we believe there are many scripts that would be a great fit for the Chrome Web Store and would benefit from the advantages listed above. Some aspects of a good candidate script are:

  • Custom UI - Users interact with your script through a custom user interface, not via custom spreadsheet functions or onEdit triggers.
  • Background processing - Your script uses time-based triggers to do work in the background and doesn't require that the Google Spreadsheet is open.
  • Not primarily about Google Spreadsheets - Your script's main focus isn't spreadsheets and you utilize a variety of services to provide separate functionality.

A great example of such a script is Gmail Meter, which was first launched in the Script Gallery but has since been published to Chrome Web Store. Now users can install and run the script without needing to create a spreadsheet, see script code, or set up triggers. It may take a little work to update a spreadsheet-based script to use the web app model, and some common tasks are:

  • Implement doGet() - Instead of showing your custom UI on the spreadsheet with, put the same code into the doGet() method and return the finalUiInstance or HtmlOutput object.
  • Deploy as a web app - Configure your script to run as a web app, which will assign it a unique URL. In most cases you'll want the web app to run as the user so that it can access their services.
  • Remove references to active spreadsheet - When published as a web app there is no active spreadsheet, so if your script needs access to a spreadsheet then you'll need to use SpreadsheetApp.openById() instead. You can use the DocsList service or theDocsListDialog UI widget to help users locate the desired spreadsheet.
  • Handle multiple users - When published as a web app users access the same copy of the script, so you may need to change the way you organize data to avoid conflicts.UserProperties work well for small settings, and when using ScriptDb make the user's login ID or email address part of the objects so that you can filter for them later.

Publishing to the Chrome Web Store only takes a few clicks, and we provide instructions for the process in our documentation. We hope that you are inspired to take your scripts to the next level, and if you have any questions along the way feel free to reach out to us on StackOverflow or Google+.

By Eric Koleda
Subscribe to RSS Feed Follow me on Twitter!