Palindrome Generator | Published My Library on GitHub

Palindrome Generator

Palindrome Generator is a Library written in JAVA. Currently, it is the fastest palindrome generator library available. It generates next palindrome within O(l/2) where l = length of the palindrome string. Also it generates the next palindrome from a given starting string, in the same time i.e. O(l/2). It does not bound you with the set of alphabet. You can provide an alphabet which JAVA String class accepts.

Palindrome Generator Documentation

Here you can see complete documentation.

Palindrome Generator Sample Usage

Here you can find sample usage of Palindrome Generator library.

* This is how you generate 100 palindrome strings from alphabet
* {0,1,2,3,4,5,6,7,8,9} after string "100"
public static void main(String[] args) {
Palindrome palindrome = new Palindrome("0123456789", "100");
for (int i = 0; i < 100; i++) {


Palindrome Generator GitHub Page

Here is the official GitHub page link.

Palindrome Generator GitHub Repository

Here is the GitHub repository link of master branch.

Palindrome Generator Releases on GitHub

Here you can download jar directly from GitHub.

Image Resize without losing Aspect Ratio | C#.NET


In this post you will find out how to resize an image in C#.NET without losing its aspect ratio and quality.

How the image resize program works:

It iterates all the images in defined folder and converts them into all the resolutions defined in the code which are:
Height x Width
550 x 500
350 x 500
225 x 200
170 x 148

Here is the main image resize function:

public static Image FixedSize(Image imgPhoto, int Height, int Width, bool needToFill)
int sourceWidth = imgPhoto.Width;
int sourceHeight = imgPhoto.Height;
int sourceX = 0;
int sourceY = 0;
int destX = 0;
int destY = 0;

float nPercent = 0;
float nPercentW = 0;
float nPercentH = 0;

nPercentW = ((float)Width / (float)sourceWidth);
nPercentH = ((float)Height / (float)sourceHeight);
if (!needToFill)
if (nPercentH < nPercentW)
nPercent = nPercentH;
nPercent = nPercentW;
if (nPercentH > nPercentW)
nPercent = nPercentH;
destX = (int)Math.Round((Width -
(sourceWidth * nPercent)) / 2);
nPercent = nPercentW;
destY = (int)Math.Round((Height -
(sourceHeight * nPercent)) / 2);

if (nPercent > 1)
nPercent = 1;

int destWidth = (int)Math.Round(sourceWidth * nPercent);
int destHeight = (int)Math.Round(sourceHeight * nPercent);

Bitmap bmPhoto = new Bitmap(
destWidth <= Width ? destWidth : Width,
destHeight < Height ? destHeight : Height,

Graphics grPhoto = System.Drawing.Graphics.FromImage(bmPhoto);
grPhoto.InterpolationMode = InterpolationMode.Default;
grPhoto.CompositingQuality = CompositingQuality.HighQuality;
grPhoto.SmoothingMode = SmoothingMode.HighQuality;

new System.Drawing.Rectangle(destX, destY, destWidth, destHeight),
new System.Drawing.Rectangle(sourceX, sourceY, sourceWidth, sourceHeight),

return bmPhoto;

How filled attribute works:

It does crop the image but it keeps the aspect ratio as is. To match the given new resolution. Try the code yourself.

Here you can find the complete project code.

How To Host An ASP.NET Website From Your Computer

Yesterday i had to host an ASP.NET website on my computer. What i did to host an ASP.NET website from my computer is written below in detail.

Things you need to host an ASP.NET website from your computer:

  1. Web-server installed on your machine. Running on some valid port (80 is recommended).
  2. Firewall Exception to allow HTTP connections.
  3. A URL pointing to your system.
  4. A DNS service to point a URL to your system. A dynamic IP is not a problem 🙂

Procedure to host an ASP.NET website from your computer:

1. Install Internet Information System (IIS 7.5) on Your computer to host an ASP.NET website. You can follow the tutorial to install Internet Information system on your computer. What i did is, i checked all the features relevant to IIS to install them.

2. Add Firewall Exception to allow HTTP requests. Make sure both World Wide Web Services (HTTP) and Web Management Service (HTTP) are added in exception list. See the following Image:

3. Get a URL pointing to your computer. To do this you need a DNS service. I used a free DNS service freedns.

  1. Make an account.
  2. If you have a dynamic IP, then click on Dynamic DNS from main menu.
  3. Click Dynamic DNS Clients to download FreeDNS update Windows client, here is the direct link, and install it.
  4. Register a domain or sub-domain. I had to test my application so i just registered a sub-domain.
  5. Click on Subdomains and add a sub-domain. I registered Where is a public domain and this public domain allows any user to register a sub-domain. Destination shows your computer public IP where the sub-domain will be pointing. See following image for details: sub-domain register with a free dns service
  6. Note: Adding domain or sub-domain takes time so it may happen that sub-domain may not work initially. Wait for some time (around 1 hour) and it would be working.
  7. Tip: some times even after waiting your sub-domain may not work. In that case shutdown FreeDNS update application, delete sub-domain and register the sub-domain again.
  8. Run FreeDNS update application and in settings tab provide your credentials and get domain list. This application will update your domain or sub-domain settings whenever your IP address is changed.FreeDNS update application
  9. Test your hosted domain. Goto http://localhost:80/, Goto and Goto all will show same screen.
  10. Note: If http://localhost:80/ doesn’t show page written “IIS7” like in above image, then your IIS server is not working properly you may need a restart to make it functional.
4. Host your website, now you can host any website on your computer with IIS. Like i hosted my test website on it.

Note: Hosting a website on your system is not secure by default.

You can ask questions and write suggestions to improve this post in your comments.