Tuesday, July 21, 2009

I've Moved

I know you've all been wonder where I've been and what I've been doing.

Over the past few months, I've been investigating WordPress as a blogging platform and have implemented it as the engine behind a financial news website. I've developed a couple of plugins and widgets for it, and there's some pretty good stuff that the WordPress folk are still putting in.

In other news, to get my blog running on the WordPress engine, I've taken up a commercial hosting package and so am no longer blogging here. You can access my new blog at: http://www.nitinkatkam.com/blog

Tuesday, April 28, 2009

WordPress: Disable Canonical URL Redirection Plugin

If you've got WordPress redirecting the browser to a URL, only to cause Apache (or whatever you are running as a web server) to redirect back to the original URL, you've got to disable the canonical URL redirection in WordPress. You can do this by saving the following to a PHP file in the plugins directory and activating it via WordPress.

<?php
/*
Plugin Name: Disable Canonical URL Redirection
Description: Disables the "Canonical URL Redirect" features of WordPress 2.3 and above.
Version: 1.0
Author: Mark Jaquith
Author URI: http://markjaquith.com/
*/

remove_filter('template_redirect', 'redirect_canonical');
?>

Changing my WordPress blog domain

The WordPress guys and my co-worker who made some mods on it made it difficult to move our blog from the staging environment to the production environment. As the domain name is different, I had to fix up the post GUID links using string replacement in the PHP file, as I didn't want to change the database on the live site (our PHP files are version controlled, but the data on the DB server is not). I did have to change the URL in the options table in the DB for 2 rows 'cos WordPress would always redirect me to the staging environment's domain name.

After getting the blog all patched up, I finally did a Google search to figure out how other WordPress bloggers moved their blogs, which brought me to this article:
http://codex.wordpress.org/Changing_The_Site_URL

CSS: Center Aligning Text Vertically - Method 3

Another approach to vertically centering text is to change the display property of the container to table-cell and add the vertical-align property with the value middle. This method does not work with MS Internet Explorer.

Example

div#header {
vertical-align: middle;
display: table-cell;
height: 200px;
background-color: yellow;
}

<div>
My text
</div>

CSS: Center Aligning Text Vertically - Method 2

You can center text vertically by using absolute positioning on the child element and setting the top property to 50%. You might have to adjust the margin-top attribute to get the text exactly in the center.

Example

div#header {
position: relative;
height: 200px;
}

div#header span {
position: absolute;
top: 50%;
margin-top: -10px;
}


<div id="header">
<span>My text</span>
</div>

CSS: Center Aligning Text Vertically

The easiest way to center text vertically using CSS is to set the line-height to the same size as the container's height.

Example

//Add this to your STYLE tag or external CSS file
div#header {

height: 100px;
line-height: 100px;
}

<div id="header">
My text
</div>


UPDATE: Also see

Saturday, April 25, 2009

Multi-lingual Email Address

Multi-lingual email addresses, or Email Address Internationalization (EAI) as it is more commonly known, has been around for a while. Netaka, a Canadian firm, has been providing an email service for the Chinese community that supports the use of Chinese characters in the email address.

The Internet Engineering Task Force (IETF) has also assigned a committee to oversee the internationalized email effort and the result has been the RFC4952, which in combination with RFC3490 for Internationalizing Domain Names in Applications (IDNA) defines a standard for supporting email addresses with international character sets.

The effort for internationalizing email addresses has been fairly recent, so it will be a while before email servers start supporting other charactersets.

Yahoo! Geocities Pulling Down Shutters

Yahoo! will stop providing the Geocities free web hosting service later this year. What started off in 1994, providing free web hosting communities, was started off by Beverly Hills Internet. In it's original form, Geocities consisted of several virtual 'cities' that represented a category (Eg. Cape Canaveral was for Science & Silicon Valley was for Technology (?) ).

It was acquired by Yahoo in 1999. After a change in the Terms of Service, indicating that all content would be owned by Yahoo!, Geocities grew fairly unpopular and this caused Yahoo! to reverse it's decision on content ownership. Geocities also sold information about it's users to marketing firms which led to a litigation.

Judge of The Pirate Bay case

A recent blog article reveals that the judge who presided over The Pirate Bay hearing was, in fact, a part of two intellectual property protection organizations. As if that wasn't bad enough, he was also a part of the organization acting as the plaintiff i.e. the guys suing The Pirate Bay. If that isn't a mis-trial, I don't know what is. Get more of the juicy details here.

Tuesday, April 21, 2009

Torrent Sites Shut down After Pirate Bay Verdict

Following the court verdict against The Pirate Bay, several other torrent search and tracking sites have shut down to avoid becoming the target of legal lawsuits. Among them are: Nordicbits, Powerbits, Piratebits, MP3nerds, and Wolfbits. Nordicbits has a page here indicating the shutdown, while the others simply disappeared into thin air.

Monday, April 20, 2009

Why Are Software Development Estimates In-accurate?

I came across an article on CodeOfDoom.com about why estimations are inaccurate. The article starts with the question - Who made the estimate? If it's the new guy, he hadn't a clue of the team's efficiency, the skeletons in the closet (flaws in the existing system), and the requirements. If it's the upper management, the estimates made are either based on a dissimilar project or to please a higher-up guy. If it's marketing, they are in the business of selling the client an estimate and that's what makes it worse - you can't change your estimate, based on what you learn the further down the path you go, because what was sold to the client was the original estimate!

Often, we spend time doing things we didn't originally estimate for, such as lack of documentation, inadequate hardware and things we normally tend to overlook. Then, there's something that can be described as an act of God - illnesses, family emergencies and stuff of the sort.

Having put all of the above aside, dealing with the problem involves padding estimates, keeping management informed about resource and information requirements, and limiting changes to the scope or time frame and avoiding unrealistic time frames.

Finally, what you can do to keep work moving at the intended pace is to follow a couple of simple scrum practices (daily sprints, daily standup meets) and dealing with difficult people.

Google Torrent Search

In another protest against the court ruling against The Pirate Bay, a supporter used Google's Custom Search to provide a torrent search. This is simply another voice that says, "Is assisting users to find torrents any different from a search engine?"

Oracle buys Sun Microsystems

Oracle acquired Sun Microsystems for $9.50 per share, which works out to about $7.4 billion. There is a lot of speculation over how Oracle's acquisition affects Java and MySQL. This also puts the Solaris & Sparc brands under the Oracle umbrella.

Replicating data from MS SQL Server to MySQL

I managed to replicate data from MS SQL Server to MySQL using an SQL Server Agent job.

I tried to use a trigger to directly insert data into MySQL via a trigger, but that just didn't work. For more info, see my earlier post.

My approach was to create another table, which was exactly the same as the original table on MS SQL Server, except for the identity property which I left disabled. I then created a trigger that would copy rows from the original table to the copy like this:
CREATE TRIGGER [dbo].[trgMyTable]
ON [dbo].[mytable]
AFTER INSERT
AS
BEGIN
INSERT INTO mytable_repli (qid, qname) SELECT qid, qname FROM inserted;
END

I tested it by inserting a row into mytable, and sure enough, it appeared in mytable_repli.

I then installed the MySQL ODBC driver 5.1.5 from the MySQL website.

I then configured a System DSN by going to Administrative Tools - Data Sources - Add. Select the MySQL ODBC 5.1 Driver and click Finish. In the dialog box that pops up, enter a data source name (you will need to remember this for later; I'm calling this Nitin), server name (localhost for me, as I'm running XAMPP on the same computer), user name, password, and database name.

The next step was to add a Linked Server using the Wizard in Server Management Studio: Server Objects - Linked Servers... right-click and select New Linked Server. I selected the Microsoft OLE DB Provider for ODBC Drivers, entered the Data source from the System DSN setup earlier (mine is called Nitin). I entered Nitin for the Linked server and Product name, and clicked Ok.

An optional step is to go to Server Objects - Linked Servers - Providers and go to properties for MSDASQL to check the "Nested queries", "Level zero only", "Allow inprocess", and "Supports Like operator" option.

Finally, I created an SQL Server Agent Job. You have to start the SQL Server Agent if it is not running (right-click and select Start), and create a new Job (right-click on SQL Server Agent - Jobs, and select New Job). Enter a name for the job, and click on the Steps page (left of the dialog box). Click the New button, type in a Step name, select the Database in which the SQL Server table is located and write a T-SQL script to copy the values across to the MySQL table like this:
declare @maxid int;

select @maxid = max(qid) from mytable_repli;

insert into Nitin...qtable(qname)
select qname from mytable_repli
where qid <= @maxid;

delete from mytable_repli
where qid <= @maxid;

In the above T-SQL, note that qtable is the name of my database table on the MySQL server and I'm accessing it with the name Nitin defined earlier in the Linked Server setup.

Click Ok for the Job Step Properties dialog box and go to the Schedules page of the Job Properties dialog box. Click New and define how frequently you want the replication to occur (about once every 15 minutes should seem reasonable, unless you need it to occur more frequently).

If you do not configure a schedule, you need to run the job manually (do this by right-clicking on the job and selecting Start Job At Step). You might also want to do this via the trigger created earlier using sp_start_job - this will cause the row to appear immediately in MySQL. To do this, add the following line below the insert statement in your trigger (replace 'mytable_repli_job' with the name you've specified when creating the SQL Server Agent job):
EXEC msdb.dbo.sp_start_job @job_name='mytable_repli_job';

Attempt: Replicating data from MS SQL Server to MySQL

I took my first stab at getting MS SQL Server to push some data to MySQL. My approach I tried was to use an INSERT trigger that inserts data into a MySQL table using the Linked Server feature in MS SQL Server.

I did some reading on Linked Servers and read that it only supports OLE DB drivers and since the only OLE DB drivers I could find were either old or commercial, I decided to use the MySQL ODBC driver and use the OLE DB to ODBC Linked Server option. Everything went well for the most part - I was able to create the linked server, I could select and insert data into the MySQL table from within SQL Server. The part that did not work is when I created a trigger on MS SQL Server and tried to insert the data into MySQL from within the trigger. The problem is that the ODBC driver for MySQL doesn't support distributed transactions (via MS DTC).

I'm thinking perhaps I might have to perform the publisher-subscriber replication instead.

Sunday, April 19, 2009

Comic: Spammers Are A Lower Life Form


Spammers are low life form, particularly the ones who sneak links into blog comment posts. Spam bots can be stopped by the Captcha, but not human spammers :-(

Ubuntu 9.04 Releasing On Thursday

Ubuntu 9.04 (Jaunty Jackalope) is releasing on Thursday. The availability of the Release Candidate last Thursday was a taste of things to come.

Jaunty Jackalope features out-of-the-box support for Wacom digital tablets, reduced bootup time, the 2.6.28 kernel featuring stable Ext4 filesystem support and updated packages of all included software.

MockupScreens Sent Me A Free License

MockupScreens just sent me a free license to try out their software. You can use it to create mockups for your software before you begin development. If you would like to order a license, it costs under $90 for a single user license.

MockupScreens is Vista-compatible and you can find screenshots of it here:
http://mockupscreens.com/index.php?page=Screen-Prototypes

Protest Against Sentence To The Pirate Bay


Hundreds of youngsters protested the sentence by the Stockholm court to the founders of The Pirate Bay.

Bezeq Intl Seeds Torrents Locally

Bezeq International, an Israeli Internet Service Provider, is finding ways to both satisfy customers' torrent needs and improve network performance while proving both aren't necessarily exclusive. Their approach is to seed torrents on their own network by modifying torrent files downloaded by subscribers, adding a tracker containing the seeds to it.

With the recent turn of events in the Pirate Bay case, this could become controversial.