Backup your WordPress site using Dropbox !

WordPress is undoubtedly the most used blogging engine. Like many others I too use WordPress (for this blog). WordPress itself is a very secure and stable platform, but, there are literally thousands & thousands of third party themes and plugins available to further extend WordPress and this is where sometimes problems arise and data gets lost, sites get hacked etc.

How often do you back up your WordPress blog?
Weekly ? Monthly? Never ? Do you even have a backup plan ? No ?
Because I want you to make one today. And I can help you with that :) and believe me its very very easy !

One of the best methods I have found for backing up your data is by using the WordPress Backup to Dropbox plugin. If you have never heard of Dropbox, don’t worry read this.

WordPress Backup to Dropbox

WordPress Backup to Dropbox is a free plugin that allows you to backup your WordPress website on a regular basis. The plugin’s simple interface lets you setup your backup cycle in minutes giving you peace of mind that your precious blog posts, media files and template changes are backed up.

In order to use the plugin you will need a Dropbox account. Dropbox is a free service that lets you bring your photos, docs, and videos anywhere and share them easily.

How to use WordPress Backup to Dropbox ?
Automatically Backup WordPress Sites to Dropbox : This article has a step by step detailed explanation on how to setup the plugin and how to get started with your first backup. Here is a list of faq’s for this plugin.

Why to use WordPress Backup to Dropbox ?

  • It’s Free
  • Automatic : Just choose a day, time and how often you wish your backup to be performed and kick back and wait for your backup to be dropped in your Dropbox!
  • It’s Open source ( Github ) and has excellent Support ( WordPress / Github )

Are there any similar alternatives ?
Yes there are plenty of other plugins that do this job, below are few of them…

and the list goes on and on…

I don’t like Dropbox, can I backup to SkyDrive or Google Drive instead ?
Yes, there a few plugins that offer similarly functionality to back up your site to Microsoft’s SkyDrive, Google Drive or Amazon S3. I have not tried them though, the most popular I could find are…

I love Dropbox, so I was excited when I found this plugin – testing it out, I found it extremely easy to use. Im going to be moving my sites over to this plugin and Dropbox as my backup solution from now on.

How to Pimp my Visual Studio – Change style / font / colors and more..

I recently bumped into this very-awesome site called : Studio Styles. Here is a link to what exactly it’s all about. It basically allows you to change your VS color scheme.

You can browse through the various color schemes submitted by other users and download it. You can even submit/create your own VS color scheme. Once downloaded the installation is pretty straight forward, you just need to import the settings you have downloaded using Visual Studio > Tools > Import and Export Settings.... Read faq for more info.

So, here’s what I created :)
Download this color scheme. (* Uses Droid Sans Mono font)

Preview :

This setting works great with DROID SANS MONO font. You can download and install the font (DROID SANS MONO) from here.

Hope this helps :)

How to change connection string of a dbml file ( LINQ 2 SQL ) dynamically using app.config.

Linq 2 Sql : INQ to SQL is an ORM (object relational mapping) implementation, which allows you to model a relational database using .NET classes. You can then query the database using LINQ, as well as update/insert/delete data from it. LINQ to SQL fully supports transactions, views, and stored procedures.


I wanted my Linq 2 Sql’s connection string to be defined outside by compiled code, so that I could easily change between connection strings without having to recompile my code. There are many ways discussed on blogs, few of them are as listed below :

but none of them are as effective and easy to maintain as this one.


So, here is how you do it.

Step 1 : Set the connection property of your .dbml file to “none”.

Step 2 : Create a new separate partial class with the same name as that of the existing partial class for the .dbml file. And set the connectionString property by using the parameterless constructor.

public partial class DataClassesDataContext  
public DataClassesDataContext() : base(ConfigurationManager.ConnectionStrings["Dev-connString"].ConnectionString)  

Step 3 : Almost Done ! Lastly you need to define your connectionString in your app.config file, as shown below.

<?xml version="1.0" encoding="utf-8"?>  


connectionString="Data Source=yasser-home;Initial Catalog=pp;Persist Security Info=True;User ID=sa;Password=gogole"  
providerName="System.Data.SqlClient" />



You can now easily change the connectionString from the app.config file without having to re-compile your code, which would be the case otherwise.

Why did I create a seperate partial class ? Can’t I edit the existing Dbml.designer.cs file ?

Don’t modify Dbml.designer.cs file manually, because it will be rewritten when you add/edit/delete a table, stored proc etc.

Hope this helps :)


How to manually deploy a CLR Stored procedure to SQL Server Mangement Studio

Before we start this article, I have listed a few related post which you would like to check out…

There are many reasons why you would manually want to deploy a CLR stored procedure to SQL Server Management Studio. There are two parts to deploying any CLR Stored Procedure

  • Part I : Deploying Assembly
  • Part II : Deploying CLR Stored Procedure

1. Deploying Assembly

Once your CLR stored procedure is ready, build the project(Shift + F6). You should get the following in your output window(Ctrl + W, O).

Compile complete -- 0 errors, 1 warnings

CLR Stored Procedures -> C:\Yasser\MyClrDemo\bin\Debug\MyClrDemo.dll  

This is the path where your assembly is located, use this path to CREATE ASSEMBLY as follows, remember to set the PERMISSION_SET to ‘SAFE’

CREATE ASSEMBLY HelloWorldAssembly from 'C:\Yasser\MyClrDemo\bin\Debug\MyClrDemo.dll'


2. Deploying CLR Stored Procedure

Now that we have our assembly created(HelloWorldAssembly), next step is to create a stored procedure which uses this assembly.

Now consider we have the following CLR Stored procedure

public class HelloWorldClass  
public static void HelloWorldMethod()  
SqlContext.Pipe.Send("Hello world!\n");  

So keeping the above classname, stored proc name and assembly name in mind below is how your ‘create procedure’ should be like.



EXTERNAL NAME HelloWorldAssembly.HelloWorldClass.HelloWorldMethod

Hope this helps :)

Further Reading :

How to return data records from a CLR Stored Procedure

Before reading this article I recommend you please go through the previous two article, where I have already discussed what/why/how to use CLR Stored Procedures.

Lets get started on this one !

Below is a sample code where first I am fetching all products with price is less than 200$ using the

string commandText = "SELECT * FROM Products WHERE PRICE < " + price.ToString();

Using this result-set I am sending back only the following columns as a result-set

– Product Name (as string)

– Price (with a little formatting by adding a ‘$’ symbol to the price eg: $23)

CLR Stored Procedure C# Code

public partial class StoredProcedures  
    public static void GetProductsByPrice(int price)  
        SqlConnection connection = new SqlConnection("context connection=true");  

        string commandText = "SELECT * FROM Products WHERE PRICE < " + price.ToString();

        SqlCommand command = new SqlCommand(commandText, connection);  
        SqlDataReader reader = command.ExecuteReader();

        // Create the record and specify the metadata for the columns.  
        SqlDataRecord record = new SqlDataRecord(  
        new SqlMetaData("Product Name", SqlDbType.NVarChar, 100, 1033, SqlCompareOptions.None),  
        new SqlMetaData("Price", SqlDbType.NVarChar, 100, 1033, SqlCompareOptions.None));

        // Mark the begining of the result-set.  

        while (reader.Read())  
            // Set values for each column in the row.  
            record.SetString(0, reader["ProductName"].ToString());  
            record.SetString(1, "$" +reader["Price"].ToString());

            // Send the row back to the client.  

        // Mark the end of the result-set.  


How to pass parameters to CLR Stored Procedures using C#

This article is in continuation to my previous article : How to create a CLR Stored Procedure using C# and Visual Studio where I have discussed on how to write your first CLR Stored procedure and what/why/how to use CLR stored procedure, how to deploy and lots more.

Now coming back to this post. In this article I will show you how to pass an input parameter to the CLR stored procedure. For the example I am using a Product table and the input parameter is an integer value.

So, below is how the CLR stored procedure should look like

public partial class StoredProcedures  
    public static void GetProductsByPrice(int price)  
        SqlConnection connection = new SqlConnection("context connection=true");  

        string commandText = "SELECT * FROM Products WHERE PRICE < " + price.ToString();

        SqlCommand command = new SqlCommand(commandText, connection);  
        SqlDataReader reader = command.ExecuteReader();


now build and deploy your CLR stored procedure. And test your stored procedure as shown below

USE [ProductsDB]  
EXEC [dbo].[GetProductsByPrice]  
@price = 200  

Is there any Markdown editor like stackoverflow for WordPress ?

Short answer : WP – Markdown

I was kind of addicted to stackoverflow’s markdown editor and I was wondering if there is a plugin in WordPress that does the same job.

Enter WP – Markdown !!

This plug-in allows you to write posts (of any post type) using the Markdown syntax. The plug-in converts the Markdown into HTML prior to saving the post. When editing a post, the plug-in converts it back into Markdown syntax.

The plug-in also allows you to enable Markdown in comments and BBPress forums. In these instances the plug-in adds a toolbar, and preview of the processed Markdown with Prettify syntax highlighter applied (similiar to that used in the Stack Exchange websites such as WordPress Stack Exchange).

WP-Markdown stores the processed HTML, so deactivating the plug-in will not affect your posts, comments or bbPress forums.

Screen 1 : Markdown for Add / Edit Post
enter image description here

Screen 2 : Settings
enter image description here

Screen 3 : Markdown for Comments
enter image description here

How to clear cache in Firefox – Using shortcut key to clear cache in Firefox.

I always use Firefox to debug websites, as IMHO it has the best F12 developer tools.

How to clear cache in Firefox – Is there any shortcut key ?

Well, Yes there is ! Pressing Ctrl + Shift + Del in Firefox will pop up a window like the one shown below, where you can check/uncheck the items you want to remove.

firefox clear cache using shortcut key

As seen in the above screenshot, cache is one of the option present as a checkbox, you can check it, select the time range and remove it by clicking on the “Clear Now” button.

Hope this helps :)