Archive for WordPress/Blogging

Bulk Image Downloader for Wordpress Users

A tool for downloading images from your Wordpress.com blog to your local machine. It is also an example of how to use XML RPC service in C#.

Executable : WpBulkDownloader-Alpha-Executable.zip
SourceCode : WpBulkDownloader.zip

Contents

  • Introduction
  • Background
  • Software Requirements
  • How to use
  • How it works
  • FAQ

Introduction

This is a tool that helps you to download all of your images that you posted in your blog. This tool is created especially for Wordpress.com users but it will support all other blogging softwares in future. You will definitely need this tool when you want to move your blog from wordpress.com to self-host.

WP Bulk Image Downloader (Alpha) for Wordpress Users

Background

My blog was hosted on Wordpress.com last year. I had too many images uploaded in my free space. When I wanted to move my blog to self-host, I noticed that there is no way to bulk-download all of my images from Wordpress account to my local disk. I didn’t want to copy each and every images manually so I wrote this tool that can scan each and every urls from my blog and create the directory based on the URL. And then, download them into my local harddisk. It’s just 2 hours program that I wrote at that time. So, I’m sure that there won’t be all features that you want in this program. But don’t worry. Just drop a comment in this post. I will add the feature that you want in next release.

Software Requirements

How to use it?

The steps are very simple.

  • Configure your blog in Bulk Image Downlader. Click “Options” and fill your blog URL, user name and password as picture below.

WP Bulk Image Downloader - Options

  • Click “OK” button to save your configuration and close the dialog
  • Click “Get Files” button to get the list of image URLs from your blog. (You may need to wait a few minutes while retrieving the list of images from your blog.)
  • After retrieving the list of Image URL, you can click “Download” button to download the images to your local disk. (You may need to wait a few minutes while processing. )
  • After that, you can check all of your images in “Downloaded Images” directory.

How does it work?

Note: This is for those who like to read the sourcecode and want an explanation about codes. If you are just a normal user, you may skip this section.

Firstly, the program will read the user name, password and blogurl from config file. It will append “xmlrpc.php” which is the standard XML RPC interface for Wordpress at the end of blogurl string. Then, it will invoke getRecentPost() API of wordpress. I used opensource XML-RPC.NET library in this sample. As there is no getPosts() API in xmlrpc.php, we have to use the alternative method (getRecentPost() API) for retrieving the posts from the blog. The max number of posts is set to 1000 in the program. If you have more than 1000 posts in your blog, you probably need to change the default value.

If the authenticating is successful then we will get the list of posts from the blog. So, we have to filter the URL of images from the contents. Initially, I was thinking to filter <img> tag from the content. But there are some cases that we used big image in <A> tag and small images in <img> tag. So, I decided to filter the <img> tag and <a> tag from the contents based on the extensions (*.jpg, *.png, *.gif) by using regular expression. After that, I shows the list of URLS in ListView.

When the user clicks “Download” button, I start downloading the image one by one. (Note: I used C# downloader class which is written by Shailen Sukul in this example. ) Based on the URL, the program will create the directory accordingly. For example, If the image URL is “http://your.wp.com/2009/09/image1″ then the program will create the directories like “09″ folder under “2009″ folder under “/Downloaded Images/” folder. So, you can easily upload all of your images to your new host via FTP.

That’s all about how Bulk Image Downloader works. If you have any question, please let me know.

FAQs

1. Can you make the better UI for this program?

Yes. Of course. I’m thinking to change this Windows Form to WPF version so that you will definitely get the better UI for this program.

2. The form is freeze while downloading the images. Why?

Sorry about this issue. For the time being, all processes are running in single thread so that UI will be freeze while processing. I will separate the UI and logic into different thread in next release.

3. Can I request new feature?

Yes. Of course. This is the main reason why I released it as alpha. Feel free to drop a comment in this post. I will make a list of feature requests and will be added in next version.

October Wrap-up

This is the wrap-up of this blog for October, 2007 [ "October 12 to October 31 ( 20 days )"].

1. Host and Blogging Software

  • My blog is shifted to Dreamhost on 11st October, 2007. Luckily, I got a lot of discounts from them because they were celebrating 10th Birthday at that time.
  • I started using the standalone Wordpress from Wordpress.org. ( The one that I used earlier is Wordpress MU (Wordpress Multi-User). )

2. Plugins

Which plugins are you using on your site?

3. Theme

Yeah. I’m using my modified version of “Unsleepable Widget-friendly” theme for now.

4. AdSense

This might be interesting topic for you all. I have started using the Adsense from the following service. I wanna share some of my experiences… I promise that I’m NOT going to use the most annoying ads in my blog. All ads will be placed on the sitebar or under the comment box . I hope that it would be okay for you. Frankly speaking, I’m not going to blog for money. I have no plan to make money with my blog.. Why ads here? Because as my blog is on self-host, there are some costs for it. I like to cover those things. And also, I would like to run some programming or blogging contests on my blog..

  • Google AdSense : I think Google Ads is the best adsense service on the net. They pay for impression, clicks and actions.
  • AuctionAds : This is also a nice ads service after Google Ads. I start using it last 10 or something.. I got 4703 impressions, 4 clicks and 1 referral. I got free $25 bucks for signing-up with them. I’m not very sure whether this promotion is still available or not. You may try here if you want.
  • Chitika : I think that Chitika is “Pay-per-action” service that didn’t work well from me. So, I have removed it.
  • BidVertiser : I signed-up on that site today. It allows you to sign-up as both advertiser and publisher.

If you are also using Ads on your blog, please share some information with me. Which Service are you using? How many impressions and clicks do you get for a day? How much have you earned? Thanks.

Stats

  • PageViews : 17618 PageViews for 20 days ( it doesn’t include my own visits.)
  • Technorati Rank : 32,510 ( My rank dropped too much this month. My rank was 25,703 on 1st October. :( )
  • Google PageRank : 5 (I got it on 26th January this year. it has been nearly 1 year. I think the PR of my blog should has been dropped this time because this is fashion for now.. a lot of pro-bloggers are shouting about Google PR drops for their blogs.. )
  • Technorati Authority: 182
  • Bandwidth : 3.684 GB

Widget Plugin - How to add the additional text-widgets for your sidebar?

The Text-widget is the most useful widget in Widget plugin. It allows you to place the HTML code or Javascript on your sidebar. In my blog, I have used a lot of text-widgets for showing links, feed count, adsense, license, stats and so on. As you were like me, you may probably need more text-widgets for your sidebar. Unfortunately, there are only 9 text-widgets available in your widget by default. How do we do to get the additional text-widgets more than 9?

The answer is simple. You need to make a few minor changes in the code of widget plugin. Don’t worry if you are not programmer. It is very simple and everybody can do it… I will show the steps how to change and what to change the source code of widget plugin. Actually, there are only 3 lines to change so you just follow all those steps carefully and get it done.. :) Don’t forget to backup your code.

Note: Widget.php is located under wp-includes if you are using Wordpess 2.3. (Why not in plugins folder? Because the widget plugin is natively supported by wordpress started from version 2.3. ) To edit this file, you have to download this file to your local machine and have to upload it back after editing. You can’t use the plugin editor to edit this file.

Steps to follow ~

  1. Download widget.php file to your local machine and open it with your favorite text editor
  2. Find “wp_widget_text_setup” function. Change “9″ to “the number of text widgets you want” in this line “if ( $number > 9 ) $number = 9;”

  3. Find the “wp_widget_text_register” function. Change “9″ to “the number of text widgets you want” in this line “if ( $number > 9 ) $number = 9;” and “for ($i = 1; $i <= 9; $i++)”

     

  4. Find “wp_widget_text_page” function. Change 10 to the number which is one higher than the number of text-widget you want in this line “<?php for ( $i = 1; $i < 10; ++$i )”. (For example, if you want 20 text widgets, set 21 in that line. )

     

Finally, you can upload this file to your host after editing.. (Thanks to “Syntax” for this post. I got those steps from his post in wp.org forum. ). That’s all about adding the extra text-widgets. Let me know if you have any problem with those steps that I mentioned in this post. Thanks.

Reference ~

Links ~

Unsleepable “Widget-friendly” Theme for self-host wordpress bloggers

If you are a fan of Unsleepable theme, you may download the widget-friendly version of that theme here. If you wanna know more about this modified theme, please take a look the FAQ below.

Download : Unsleepable Widget-friendly Theme

Unsleepable Widgetized

What is Unsleepable “Widget-friendly” Theme ?

Unsleepable “Widget-friendly” theme is the modified version of Unsleepable Theme created by Ben Gray for wordpress.org. As this theme is widgetized, you will be able to customize the sidebars of your blog in very simple way. If you are moving your blog (which is using “Unsleepable” theme) from wordpress.com to self-host, you may probably wanna download this theme.

Why did you want to modify this theme?

Actually, there are some differences between the “Unsleepable” theme from wordpress and the original “Unsleepable” theme created by Ben Gray. When I moved my blog to Dreamhost, I downloaded the original theme and started using it for my blog.. Unfortunately, the original theme is not widget-friendly and not like the one that I used in wordpress.com. So, I modified the way I like. :)

What changes did you make?

Here is the list of changes that I made ~

  • Make it “widget-friendly” : This is the main reason why I modify this theme. It helps people to customize the sidebar of their blogs in very easy way.. just drag and drop.. and done!
  • Show the title of blog instead of “Unsleepable” theme : The original image looks good but the name of our blogs is not “Unsleepable”.
  • Make a lit bit wider : According to the stats report of my blog, the most of visitors are 1024×768 resolution so I make this theme a lit bit wider.
  • Remove “Social bookmarking” : As I widgetize this theme, the images for social bookmarking are no longer available.
  • Remove “Live Search”
  • Remove “BottomBlock”
  • Remove “two logos” from footer
  • UPDATED on 20th Oct, 07 : Enabled the comment for page. (The original theme doesn’t show the comment for pages by default. )
  • UPDATED on 20th Oct, 07 : The UI for K2 Option has been removed.

Did Ben Gray, the original author of this theme, know about your modified theme?

Yes. Of course. I have informed him and got his permission to make my modified theme downloadable. (Thanks a lot, Ben.)

What would you like to say about your modified theme?

Well, Thank you so much for reading my blog and downloading this theme. I would like to say “sorry” if my modification is not so good. (I’m not PHP guys and I know nothing about Wordpress APIs. ).

Feel free to let me know if you have any comment or suggestion. If you like this theme, thanks to “Ben”.

SyntaxHighlighter Plug-in: Posting Source Code in Wordpress (.org)

Wordpress.com added new feature that allows you to post the sourcecode on your blog in very easy way. You don’t need to do anything about manual color highlighting for your sourcecode. You don’t need to find the theme which has a stylesheet defined for PRE or CODE tag. You can just paste the sourcecode within [sourcecode language=’css’]…[/sourcecode] and specify the language of your sourcecode. How easy it is!!


using System.Data.Linq;
using System.Data.Linq.Mapping;

[Table(Name = "Customers")]
public class Customer
{
[Column]
public string CustomerID { get; set; }
[Column]
public string City { get; set; }

public override string ToString()
{
return CustomerID + "\t" + City;
}
}

static void Main(string[] args)
{
DataContext db = new DataContext(
@"Data Source=.\sqlexpress;Initial Catalog=Northwind");
db.Log = Console.Out;
var results = from c in db.GetTable<Customer>()
where c.City == "London"
select c;
foreach (var c in results)
Console.WriteLine("{0}\t{1}", c.CustomerID, c.City);

}

The most of tech bloggers including me are very happy with this new feature.

What about for self-host wordpress bloggers? Is there any plug-in for syntax highlighting?

UPDATED: Please check the updated information at the bottom of this post.. Thanks

Of course! Yeah. There are a lot of plug-ins for syntax highlighting. But if you wanna use something looks exactly like the one from wordpress.com then you may probably check-out the plug-in called SyntaxHighlighter that uses javascript syntax highlighting library which is used by wordpress.com to implement that new feature.

Where can I get “SyntaxHighlighter” plug-in?

Download from this link “http://erik.range-it.de/wordpress/plugins/syntaxhighlighter/“. (Of course! it is free.)

How to install and configure “SyntaxHighlighter” plug-in?

  • Extract the zip file (”syntax.zip” for now)
  • Copy all files and folders (syntax.php, [Styles] and [Scripts])
  • Paste them under wordpress/wp-content/plug-ins/
  • Open the browser and Go to Plug-in page (eg: http://localhost/wordpress/wp-admin/plugins.php)
  • Activate the plug-in
  • Go to “Options” tab in the admin panel
  • (There will be new tab called “Syntax” in Options panel.) Go to this tab. You will see a lot of options for syntax highlighting as picture below.

syntax.jpg

  • You can specify the languages of your sourcecode that you are going to post on your blog. For example, if all codes that you post on your blog are written C# or Javascript then check the C# and Javascript checkedboxes in this page.
  • then, click “Update Options” button.
  • finally, you can start posting the sourcecode on your blog.

How to post the sourcecode or How to use this plug-in?

Well. this is very simple.

  • Copy the code that you wanna post and paste them within [sourcecode]…[/sourcecode]
  • Specify the language of your code. (eg: [sourcecode:javascript]…[/sourcecode] )
  • Done!

What is the differences between SyntaxHighlighter plug-in and the one from Wordpress.com?

Firstly, I don’t work for wordpress.com so I’m not sure how they implement this plug-in for wordpress MU. But I believe that both of them are pretty much the same since they are mainly relying on javascript syntaxhighter. I found only two differences as below while I was testing those plug-ins.

1. You can’t specify HTML, XSLT as a language in Wordpress.com.

2. You can’t disable some languages that you are not using in your blog.

Last but not least (Performance)

This link said,

SyntaxHighlighter uses regular expressions to parse the text. It’s not extremely fast, in fact, it’s pretty slow. If you are trying to highlight a few dozens lines of code, you won’t see any problems. Trying to highlight 10kb worth of text will result in JavaScript being aborted because of long execution time.

Other wordpress plug-ins for syntax highlighting

UPDATED: I found the original plugin which is written Matt for Wordpress now. This plugin also called SyntaxHighlighter. Here is a link if you wanna download. As this plugin uses the same tag format like wordpress.com, you don’t need to change anything in your post to highlight the correct style.

Am I going too far from one topic to another?

Even though this post is written as an explanation of why I’m mixing a lot of things in one blog, it will give some interesting points that helps you to decide whether you should blog the dedicated topics only or mixed things.

Introduction

I was having a conversation with one of my friends about our blogs, blogging and etc last night. He gave me one comment that I’m going too far from one topic to another in my blog. I should probably post the dedicated topic about something. It is not good if I’m posting a lot of different topics in one blog because it made my readers to confuse about what they should expect from my blog. For example, some people may like about programming things. Some may like about Jokes. So, those people who like about programming might not wants to see the jokes all the time because they are not coming to my blog for having fun. They wanna get something useful for their technical expertise. The same way might happen for those who likes about Jokes instead of technical things.

But there are some reasons why I do like that.

1. My blog is based on what is happening in my real life.

Does it sound funny? :) but it’s true. My blog is going as same as how my life’s moving. I don’t mean that those are completely the same but almost. For example, if I’m working for ASP.NET 1.1 then the most of posts that I wrote at that time may be about ASP.NET 1.1 only. If I’m working with SmartClient or .NET 2.0 then the most of topics that you read here may probably be about SmartClient or .NET 2.0.

There might be some cases that I may post about some topics that I currently interest (eg: SliverLight, Orcas, LINQ and etc) even I’m not working with those technologies.

Plus, I may express my feeling in my blog (eg: like that) too. ( It make me feel better. u know?)

And it is also possible that you can know whether I’m very busy or not by checking the upcoming posts of my blog. :)
2. My blog is a place where I keep all of my favorite things.

This is the another facts why I don’t launch the dedicated blog. My blog is not a blog about blogging (eg: problogger or john chow or lorelle or etc). My blog is not a blog about technical website (eg: CodeProject). My blog is just a place where I keep all of my favorite things in one place. My favorite things could be Jokes, some pieces of codes, opensouce tools, thoughts, blogging tips. It could be anything. I’m not sure whether you are gonna like them all as like me but I would say that those things are pretty cool. (at least for me. )

3. Time is not enough to manage the multiple blogs.

Time is an issue. Everybody has their own life to serve. So, we have to work for serving our life. Sometimes, I felt very tired when I come back to my home after work. At that day, I don’t even wanna boot my computer and I don’t want to think about technical things. so, it’s sad to say that I’m not able to come up with new post everyday.

While running within very short time, it’s not easy for me to launch the dedicated blogs (eg: blog for Joke, blog for Ajax, blog for blogging and etc)? My time will be over while trying to log-in in many blogs.

Conclusion

Yeah. Those are the reasons why I’m blogging the different topics in one blog. But I believe that it will be more convenience for readers to read the dedicated blog instead of aside blog like mine. Because things that they expect and things that is coming up will be the same. So my conclusion is that the dedicated blog are good for reader but not for blogger. What do you say??