Nishanth's Blog | Engineering the web !

ChartDirector font problem with chinese/japanese/korean fonts

by Nishanth 12. May 2009 00:11

I was working on a web app which supported 20+ languages across the world. One report which we developed was using ChartDirector (http://www.advsofteng.com/gallery.html) in verdana font. After development we found that ChartDirector is not displaying chinese/japanese/korean characters. it was displaying  junk boxes instead. On Investigation, it was found that the issue was with  Verdana as Verdana does not support Unicode characters for japanese, chinese , korean etc. I searched in the net for a solution and found in the ChartDirector forum that the tech support of ChartDirector is advising people to use a font called "MingLiU" (which I don't think is free). I didn't like the idea of installing seperate fonts for each locale that we support. Just then I thought why don't we use a common unicode font which is available with Windows. This thought took me to "Arial Unicode MS" which is the best bet for displaying all unicode characters and it was free with Windows XP/ Windows 2003. I replaced verdana with "Arial Unicode MS" in the code and it worked perfectly!!!

sample code:     bc.xAxis().setLabelStyle("Arial Unicode MS", 9);

 

 

Javascript for replacing n th character in a string

by Nishanth 2. April 2009 04:41
   
Javascript for replacing n th character in a string:
 
 
function RepalceCharacter(sourceString,stringTobeReplaced,index)
{
    var re = new RegExp('^(.{'+ --index +'}).(.*)$','');
    return sourceString.replace(re,'$1'+stringTobeReplaced+'$2');
};
 
//Test code 
alert( RepalceCharacter('nishanth','XSSSSX',3) ); 

Regular expression Validator against multiline textbox carriage return issue

by Nishanth 5. March 2009 02:32
I was trying to validate a multipline asp text box that can have a maximum of 150 word characters but any number of white space, carriage returns or tabs and special characters.
I tried several regex but all were failing when there was a carriage return(Newline / Enterkey ) on the multiline textbox. Then I found this expression which validated the newlines in the multiline textbox: "[\s\S]{0,150}" . The basics!!  Try this out , this works!!

Currently rated 5.0 by 4 people

  • Currently 5/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags:

Function in javascript to copy text area to client machine's clipboard

by Nishanth 26. January 2009 18:35

Here  is a small JS snippet to copy text in a div to the client machine's  clipboard.

function CopyToClipBoard()

{

var div = document.getElementById('divLink');

div.contentEditable = true; //very important.

var range = document.body.createControlRange();

range.addElement(document.getElementById('divLink'));

range.select();

range.execCommand("Copy");

range.remove(0);

range.select();

alert("The results have been copied to the clipboard.");

div.contentEditable = false; 

return false;

}

Currently rated 3.0 by 4 people

  • Currently 3/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags:

Providing write permission to a file in Plesk

by Nishanth 10. December 2008 04:00

Today I uploaded a new module to one of my sites hosted with a third party hosting provider(www.2gbhosting.com). This module reads from and writes to an XML file but once I uploaded the code to the server, I found that the application was not able to write to the XML file. The reason, as I guessed was .NET Security Laughing. By default, all files are assigned read only permission for the ASP.NET worker process. So we need to give write permission on the XML file to the ASP.NET worker process.

2gbhosting uses Plesk(version 8.4.0) and I am describing here the steps required in this scenario to fix this issue in Plesk.

Steps:

1. Login to Plesk.-> File Manager -> Browse to the File -> Click on the Lock icon on the right side of the file.

2. You will reach "Setting up Access permissions" page .

3. Click on "Plesk IIS WP User (IWAM_plesk(default))" user.

4. On the right side, check in allow column against Write permission. 

5. Click on OK and you are done. 

Happy coding and hosting!!!

 

http://www.ajaxload.info/ - Cool site for custom ajax Indicators

by Nishanth 9. December 2008 23:35

I stumbled upon this site http://www.ajaxload.info/ which allows you to create custom Ajax indicators. 

The concept itself is really cool. I can create the indicators using colors matching my site.

Check it out here: http://www.ajaxload.info/  

Currently rated 5.0 by 1 people

  • Currently 5/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags: , , ,

General Tech | Ajax

All Good Websites

Powered by BlogEngine.NET 1.4.5.0
Theme by Mads Kristensen

About Me

Nishanth Nair  

 A die hard fan of Rise of Nations... I write few softwares for McAfee Inc. for a living. 

Contact : Nish@NishanthNair.com 

 

Tag cloud

The World This Second

free counters