About Sayeed

Sayeed Choudhury

Sayeed Choudhury is a software developer at Merchant Marketing Group, a digital marketing agency based in Southampton.

About | Contact | Newsletter

My Location

Blog Categories

Musings about technology & life

@sayeedchoudhury

Insert or Paste formatted source code into a Word Document

21 Apr, 2013
Updated
22 Dec, 2012
Created

How often were you required to paste some sort of source code into a word document and realized that how difficult it is to keep the correct formatting and indentation?

Well there are a lot of ways you could use to achieve the desired output. However, there is a simple way to achieve this which works for me always. So here’s the trick.

Continue Reading →

C# Anagram Checker

24 Apr, 2013
Updated
22 Dec, 2012
Created

A while ago, during an interview I was asked to write a function that takes two strings and returns true when the strings are anagrams of each other and otherwise returns false.

Now there are numerous ways to check for anagrams. Perhaps the most commonly used and simplest approach is to sort the individual characters of each string in some collection and compare them. If both sorted collections are equal, we can say that the second string is an anagram of the first string (often referred to as the subject).

An Example

Let us consider an example. The strings “Debit Card” and “Bad Credit” are anagrams of each other. Based on our approach mentioned above, we can arrange the characters in “Debit Card” alphabetically into a character array. The resulting array will be [‘a’, ‘b’, ‘c’, ‘d’, ‘d’, ‘e’, ‘i’, ‘r’, ‘t’]. Similarly, lets take the characters of the string “Bad Credit” into a character array. The array will be [‘b’, ‘a’, ‘d’, ‘c’, ‘r’, ‘e’, ‘d’, ‘i’, ‘t’]. If we arrange this second array in alphabetical order, we get [‘a’, ‘b’, ‘c’, ‘d’, ‘d’, ‘e’, ‘i’, ‘r’, ‘t’]. Comparing the two arrays we find that they are identical and hence we can conclude that “Bad Credit” is an anagram of “Debit Card”.

Continue Reading →

Send email using Gmail from PHP with ‘fsockopen’

21 Apr, 2013
Updated
22 Dec, 2012
Created

There are loads of wordpress plugins available which will help to to implement a contact form using gmail or other similar smtp hosts. But what if you want to have a custom functionality that requires you to send email from your blog.

While setting up this blog, I faced the problem of getting my contact form working with my gmail account. The theme that I am using, uses the PHP mail function to send emails. The problem with the inbuilt PHP mail function is that it doesn’t have any SMTP authentication mechanism. Moreover most of the email providers use SSL/TLS for connecting to the smtp server which is not supported in PHP mail.

Well, here’s a simple solution that allows you to send email using gmail without the need for any special permissions from you hosting provider.

Continue Reading →

Newer Posts