Sunday, December 14, 2008

Graphical problem in IE 8 Beta version

There is some graphical problem i have faced in Internet Explorer 8 Beta version. I do not why this problem is occuring. Bu i have noticed that when i scroll or making some quick page up/down this problem occurs. I am giving a snapshot of its version and the problem:



Version:





Problem:


Saturday, November 29, 2008

No xaml designer in vs2008 Team System

I have faced the problem after installing vs2008 team system, there was no xaml design view & no graphical toolbox. I have repaired & reinstalled but problem was still occurring.....

Finally i got the solution from a forum. I m gonna make it clear

1. Close vs2008 team system if it is open.
2. Go to: start menu>all programs>Microsoft Visual Studio 2008> Visual Studio Tools> Visual Studio 2008 Command Prompt.
3. Write on the command prompt: devenv/resetskippkgs
4. Then open a wpf solution & right click a .xaml file and select open with, u will appear a dialog. U should set windows presentation foundation designer as default designer.

Now everything is right.

Monday, November 24, 2008

Sending Mail using your gmail account

c# source code u can use it and can develop ur own mail sender

System.Net.Mail.MailMessage mail = new System.Net.Mail.MailMessage();

System.Net.NetworkCredential cred = new System.Net.NetworkCredential("yourid@gmail.com", "yourpwd");

mail.To.Add("acme@acme.com");
mail.Subject = "subject";

mail.From = new System.Net.Mail.MailAddress("yourid@gmail.com");
mail.IsBodyHtml = true;
mail.Body = "message";

System.Net.Mail.SmtpClient smtp = new System.Net.Mail.SmtpClient("smtp.gmail.com");
smtp.UseDefaultCredentials = false;
smtp.EnableSsl = true;
smtp.Credentials = cred;
smtp.Port = 587;
smtp.Send(mail);

Saturday, November 15, 2008

Dmitri Gaskin 12yrs genius...

Dmitri Gaskin is a very talented boy of only 12yrs.....follow this link and see this little boy is presenting on JQUERY infront of google employee.....

http://www.youtube.com/watch?v=8mwKq7_JlS8

Wednesday, August 27, 2008

Multilingual Compressed Database

Multilingual compressed database is a one of the most striking feature for multilingual web page or software developers. I have worked on multilingual compressed database.

Compressed database means the maximum effort to reduce data redundancy. For example if I consider a student database then I must have to ensure that in the whole database each word only exist for onetime.

We will use the index of word in the database table. Using the index we can find out the word in the data dictionary. Data Dictionary contain several word category. Data dictionary is maintained to handle the word used on other table. Almost in every database contain Noun type data or numerical or alphanumerical data. So if we map the Noun type data based on category and put them only one time in a database i.e. we want to use the word id instead of name such as Md Nazmul kibria. If we place in the name column of a table the id 012 of Md Nazmul Kibria we can save storage. Another thin is that in a database there may same name or same name segment for several user. For example in a student database contain 1000 data; in this thousand data the name Islam repeats in 50 data. So if I insert Islam in 50 different row of a table it is reduntant approach. Instead saving 50 data if I use the index id of Islam (015) it is more space saving approach. If I have 3 or 4 different languages used to represent this student database in 3 or 4 different languages; in this case data dictionary and using word index is much efficient approach in saving time and space in the database.

I will post later on this topic in detail with some examples.



Tuesday, August 19, 2008

Skin color segmentation process

Detection of skin color in color images is a very popular and useful technique for face detection. Many techniques exists have reported for locating skin color regions in the input image. While the input color image is typically in the RGB format, these techniques usually use color components in the color space, such as the HSV or YIQ formats. That is because RGB components are subject to the lighting conditions thus the face detection may fail if the lighting condition changes. Among many color spaces, this project used YCbCr components since it is one of existing Matlab functions thus would save the computation time. In the YCbCr color space, the luminance information is contained in Y component; and, the chrominance information is in Cb and Cr. Therefore, the luminance information can be easily de-embedded. The RGB components were converted to the YCbCr components using the following formula given by



Threshold value is chosen by the following equation given by






Our proposed skin color segmentation is described below:
Two rules to segment skin color pixels from inputted RGB image:

R1: R>G>B
R2: R-G>=45


If both R1 and R2 are true then the pixel is considered as skin color pixel. We put a black pixel for the skin color pixels and put white pixel for non-skin color pixels.

Comparison with two system:




Algorithms of our proposed Edge detection

Algorithm 1:


For i=1 to (Width-1)
For j=1 to (Height -1)
Set(i,j)th pixel as White Color;


For i=1 to (Width-1)
For j=1 to (Height -1)
{
diff:=Abs( Difference between Red component of (i, j)th and (i+1, j+1)th pixel )
+ Abs( Difference between Green component of (i, j)th and (i+1, j+1)th pixel)
+ Abs( Difference between Blue component of (i, j)th and (i+1, j+1)th pixel);

IF diff > threshold
Set (i,j)th pixel as Black Color;
Continue;
End IF


diff:=Abs( Difference between Red component of (i, j)th and (i+1, j-1)th pixel)
+ Abs( Difference between Green component of (i, j)th and (i+1, j-1)th pixel)
+ Abs( Difference between Blue component of (i, j)th and (i+1, j-1)th pixel);

IF diff > threshold
Set (i,j)th pixel as Black Color;
Continue;
End IF

diff:=Abs( Difference between Red component of (i, j)th and (i-1, j-1)th pixel )
+ Abs( Difference between Green component of (i, j)th and (i-1, j-1)th pixel)
+ Abs( Difference between Blue component of (i, j)th and (i-1, j-1)th pixel);

IF diff > threshold
Set (i,j)th pixel as Black Color;
Continue;
End IF

diff:=Abs( Difference between Red component of (i, j)th and (i-1, j+1)th pixel )
+ Abs( Difference between Green component of (i, j)th and (i-1, j+1)th pixel)
+ Abs( Difference between Blue component of (i, j)th and (i-1, j+1)th pixel);

IF diff > threshold
Set (i,j)th pixel as Black Color;
Continue;
End IF




diff:=Abs( Difference between Red component of (i, j)th and (i+1, j)th pixel)
+ Abs( Difference between Green component of (i, j)th and (i+1, j)th pixel)
+ Abs( Difference between Blue component of (i, j)th and (i+1, j)th pixel);

IF diff > threshold
Set (i,j)th pixel as Black Color;
Continue;
End IF


diff:=Abs( Difference between Red component of (i, j)th and (i, j-1)th pixel)
+ Abs( Difference between Green component of (i, j)th and (i, j-1)th pixel)
+ Abs( Difference between Blue component of (i, j)th and (i, j-1)th pixel);

IF diff > threshold
Set (i,j)th pixel as Black Color;
Continue;
End IF

diff:=Abs( Difference between Red component of (i, j)th and (i-1, j)th pixel )
+ Abs( Difference between Green component of (i, j)th and (i-1, j)th pixel)
+ Abs( Difference between Blue component of (i, j)th and (i-1, j)th pixel);

IF diff > threshold
Set (i,j)th pixel as Black Color;
Continue;
End IF

diff:=Abs( Difference between Red component of (i, j)th and (i, j+1)th pixel )
+ Abs( Difference between Green component of (i, j)th and (i, j+1)th pixel)
+ Abs( Difference between Blue component of (i, j)th and (i, j+1)th pixel);

IF diff > threshold
Set (i,j)th pixel as Black Color;
Continue;
End IF



}


Algorithm 2:



For i=1 to (Width-1)
For j=1 to (Height -1)
Set(i,j)th pixel as White Color;


For i=1 to (Width-1)
For j=1 to (Height -1)
{
diff:=Abs( Difference between Red component of (i, j)th and (i+1, j+1)th pixel )
+ Abs( Difference between Blue component of (i, j)th and (i+1, j+1)th pixel);

IF diff > threshold
Set (i,j)th pixel as Black Color;
Continue;
End IF

diff:=Abs( Difference between Red component of (i, j)th and (i-1, j+1)th pixel )
+ Abs( Difference between Blue component of (i, j)th and (i-1, j+1)th pixel);

IF diff > threshold
Set (i,j)th pixel as Black Color;
Continue;
End IF

}

Monday, August 18, 2008

New approache to detect edge.......


This is an experimental approach to detect edge......we are very happy to get good edges from our derived formula....

This edge detectin is one the approaches of our contribution to image processing...hopefully I am going to organise all my works and making available in internet.....

C# sample code for edge detection function....

Bitmap b;
b = (Bitmap)pictureBox1.Image;
int n, m;
n = b.Height;
m = b.Width;
int cc = 0, total = 0;
Bitmap B1 = new Bitmap(m, n);
for (int i = 0; i < m; i++)
for (int j = 0; j < n; j++)
{
B1.SetPixel(i, j, Color.White);
}




for (int i = 1; i < m - 1; i++)
for (int j = 1; j < n - 1; j++)
{
total = Math.Abs(b.GetPixel(i + 1, j + 1).B - b.GetPixel(i, j).B) + Math.Abs(b.GetPixel(i + 1, j + 1).R - b.GetPixel(i, j).R);
if (total > val)
{ B1.SetPixel(i, j, Color.Black); continue; }


total = Math.Abs(b.GetPixel(i - 1, j + 1).B - b.GetPixel(i, j).B) + Math.Abs(b.GetPixel(i - 1, j + 1).R - b.GetPixel(i, j).R);
if (total > val)
{ B1.SetPixel(i, j, Color.Black); continue; }


}

pictureBox4.Image = new Bitmap(B1);

Sunday, August 17, 2008

Face extraction from an image



Automatically face extraction from an image is essential for many advance application developers or intelligent robot developers. I have worked on face extraction. Think some important tips to be write on blogg. Three basic steps required:

1. Skin Color Segmentation
2. Extract Connected components
3. Extract faces



1. Skin color segmentation
Two vital rules for skin color segmentation:

R1: R>G>B
R2: R-G>=45

When Both R1 and R2 are true, the pixel is considered as skin color pixel. Where R, G, B are red, green and blue components of a pixel.

2. Extract Connected components
We put skin color pixel as black and non skin color pixel as white color. Then after skin color segmentatin operatoin we will find out an image of black and white color. Now will find out the black connected components. Because through this method we can extract multiple faces from an group photo. Each large components are probable face area.

3. Extract faces
Now cut faces from original image using each connected component.

Saturday, May 10, 2008

Comuter graphics 2D transformation


#include " stdio.h "
#include " conio.h "
#include " math.h "
#include " graphics.h "
#include " stdlib.h "
#include " ctype.h "

void intgraph();
void display_cordinate(char bg_color,char line_color);
int Create_poly(int poly[][2]);
void fill_poly(int poly[][2],int points,char line_color,char fill_color);
void Identity(float Matrix[3][3]);
void Translate_to_Relative(int poly[][2],int points,int Xdis,int Ydis);

int instance=0;
int current=-1;


void main()
{
int poly[10][10][2],i,points[10],Xdis[10],Ydis[10];
float Sx,Sy,Matrix[10][3][3],temp,Cos,Sin;
char ch;
intgraph();

setfillstyle(8,RED);
points[current]=Create_poly(poly[current+1]);
display_cordinate(DARKGRAY,WHITE);
fill_poly(poly[current],points[current],BLUE,YELLOW);

Identity(Matrix[current]);
getch();
Xdis[current]=0-poly[current][0][0];
Ydis[current]=0-poly[current][0][1];

Translate_to_Relative(poly[current],points[current],Xdis[current],Ydis[current]);

Menu:
restorecrtmode();
do
{
clrscr();
instance=0;
printf("\t\t0. Instance transformation\n");
printf("\t\t1. Scaling\n");
printf("\t\t2. Translation\n");
printf("\t\t3. Rotation\n");
printf("\t\t4. Reflection [ X axis ]\n");
printf("\t\t5. Reflection [ Y axis ]\n");
printf("\t\t6. Reflection [ X=Y axis ]\n");
printf("\t\t7. Draw \n");
printf("\t\t8. New input set\n");
printf("\t\t9. EXIT \n");


printf("\n\nChoice: ");
ch=getche();
}while((ch < '0')||(ch > '9'));

switch(ch)
{
case '0':
//printf("Available instances are:");
instance=1;
goto babu;
case '1':
printf("\n\tScaling Ratio: ");
printf("\n\tSx: ");
scanf("%f",&Sx);
printf("\n\tSy: ");
scanf("%f",&Sy);
for(i=0;i<3;i++)
{
Matrix[current][i][0]=Matrix[current][i][0]*Sx;
Matrix[current][i][1]=Matrix[current][i][1]*Sy;
}
goto Menu;

case '2':
printf("\n\tTranslation : ");
printf("\n\tTx: ");
scanf("%f",&Sx);
printf("\n\tTy: ");
scanf("%f",&Sy);

Matrix[current][2][0]=Matrix[current][2][0]+Sx;
Matrix[current][2][1]=Matrix[current][2][1]+Sy;

goto Menu;

case '3':
printf("\nRotation Angle [in Degree]: ");
scanf("%f",&Sx);

Sx=(Sx*3.14159265358)/180.0;
Cos=cos(Sx);
Sin=sin(Sx);
for(i=0;i<=2;i++)
{
temp=Matrix[current][i][0]*Cos-Matrix[current][i][1]*Sin;
Matrix[current][i][1]=Matrix[current][i][0]*Sin+Matrix[current][i][1]*Cos;
Matrix[current][i][0]=temp;
}
goto Menu;

case '4':
Matrix[current][1][1]=Matrix[current][1][1]*-1;
printf("\t\tCompleted");
getch();

goto Menu;

case '5':
Matrix[current][0][0]=Matrix[current][0][0]*-1;
printf("\t\tCompleted");
getch();

goto Menu;

case '6':
Matrix[current][0][1]=1;
Matrix[current][1][1]=1;
printf("\t\tCompleted");
getch();
goto Menu;

case '7':
if(!instance)
{int j =current;
for(i=0;i<=points[j];i++)
{
temp=poly[j][i][0]*Matrix[j][0][0]+poly[j][i][1]*Matrix[j][1][0]+Matrix[j][2][0];
poly[j][i][1]=poly[j][i][0]*Matrix[j][0][1]+poly[j][i][1]*Matrix[j][1][1]+Matrix[j][2][1];
poly[j][i][0]=temp;
}

}

goto babu;

case '8':
points[current]=Create_poly(poly[current+1]);
Identity(Matrix[current]);
Xdis[current]=0-poly[current][0][0];
Ydis[current]=0-poly[current][0][1];
Translate_to_Relative(poly[current],points[current],Xdis[current],Ydis[current]);
goto Menu;

case '9':
getch();
exit(0);

}
babu:
setgraphmode(2);
display_cordinate(DARKGRAY,WHITE);

if(instance)
{
for(int u=0;u<=current;u++)
{
Translate_to_Relative(poly[u],points[u],-Xdis[u],-Ydis[u]);
fill_poly(poly[u],points[u],BLUE,YELLOW);
//getch();
//printf("1");
}
instance=0;
}
else
{ Translate_to_Relative(poly[current],points[current],-Xdis[current],-Ydis[current]);
fill_poly(poly[current],points[current],BLUE,YELLOW);
}
getch();
restorecrtmode();
do
{
clrscr();
printf("\n\tDo you Want to Switch to MENU [Y|N]:- ");
ch=toupper(getche());
}while( (ch!='Y') && (ch!='N') );
if(ch=='Y')
{
//Identity(Matrix[current]);
Xdis[current]=0-poly[current][0][0];
Ydis[current]=0-poly[current][0][1];

Translate_to_Relative(poly[current],points[current],Xdis[current],Ydis[current]);
goto Menu;
}
closegraph();
}

void intgraph()
{
int g=DETECT,d;
initgraph(&g,&d,"e:\\tc\\bgi");
}

void fill_poly(int poly1[][2],int points,char line_color,char fill_color)
{
int pol[20],i;
char str[2];
int fac=5;
for(i=0;i<=points;i++)
{
pol[i*2]=320+fac*poly1[i][0];
pol[i*2+1]=240-fac*poly1[i][1];
}
pol[i*2]=320+fac*poly1[0][0];
pol[i*2+1]=240-fac*poly1[0][1];

setcolor(line_color);
if(points>2)
setfillstyle(1,fill_color);
fillpoly(points,pol);


}

void Identity(float Matrix[3][3])
{
int i,j;
for(i=0;i<=2;i++)
{
for(j=0;j<=2;j++)
{
if(i==j)
Matrix[i][j]=1;
else
Matrix[i][j]=0;
}
}
}
int Create_poly(int poly[][2])
{
//printf("%d %d\n\n",getmaxx(),getmaxy());//640 480
current++;
int total_point;
printf("No of vertices: ");
scanf("%d",&total_point);

for(int i=0;i < total_point;i++)
{
printf("Co-ordinate [%d]: ",i+1);
scanf("%d %d",&poly[i][0],&poly[i][1]);

}

return total_point;
}

void display_cordinate(char bg_color,char line_color)
{
int i;
setbkcolor(bg_color);
setcolor(line_color);
for(i=0;i<=640;i+=5)
{
line(i,0,i,480);
}

for(i=0;i<=480;i+=5)
{
line(0,i,640,i);
}

rectangle(0,0,639,479);

setcolor(RED);
line(0,240,640,240);
line(320,0 ,320,480);
}

void Translate_to_Relative(int poly[][2],int points,int Xdis,int Ydis)
{
int i;
for(i=0;i<=points;i++)
{
poly[i][0]=poly[i][0]+Xdis;
poly[i][1]=poly[i][1]-Ydis;
}
}

Thursday, April 10, 2008

JS code to disable right click and refresh button

document.onmousedown="if (event.button==2) return false";
document.oncontextmenu=new Function("return false");//disable right click

document.onkeydown = showDown;

function showDown(evt)
{
evt = (evt)? evt : ((event)? event : null);
if (evt) {
if (event.keycode == 8 && (event.srcElement.type!= "text" && event.srcElement.type!= "textarea" && event.srcElement.type!= "password")) {
// When backspace is pressed but not in form element
cancelKey(evt);
}
else if (event.keycode == 116) {
// When F5 is pressed
alert("asdfasfdasd");
cancelKey(evt);
}
else if (event.keycode == 122) {
// When F11 is pressed
cancelKey(evt);
}
else if (event.ctrlKey && (event.keycode == 78 ¦¦ event.keycode == 82)) {
// When ctrl is pressed with R or N
cancelKey(evt);
}
else if (event.altKey && event.keycode==37 ) {
// stop Alt left cursor
return false;
}
}
}

function cancelKey(evt) {
if (evt.preventDefault) {
evt.preventDefault();
return false;
}
else {
evt.keycode = 0;
evt.returnValue = false;
}
}

Javascript code to assaign comma into number/currency

This js fuction can convert currency to commified number. To assaign comma in between number this function is very helpful.



function commify(str)
{
var Num = str
var newNum = "";
var newNum2 = "";
var count = 0;

//check for decimal number
if (Num.indexOf('.') != -1){ //number ends with a decimal point
if (Num.indexOf('.') == Num.length-1){
Num += "00";
}
if (Num.indexOf('.') == Num.length-2){ //number ends with a single digit
Num += "0";
}

var a = Num.split(".");
Num = a[0]; //the part we will commify
var end = a[1] //the decimal place we will ignore and add back later
}
else {var end = "00";}

//this loop actually adds the commas
for (var k = Num.length-1; k >= 0; k--){
var oneChar = Num.charAt(k);
if (count == 3){
newNum += ",";
newNum += oneChar;
count = 1;
continue;
}
else {
newNum += oneChar;
count ++;
}
} //but now the string is reversed!

//re-reverse the string
for (var k = newNum.length-1; k >= 0; k--){
var oneChar = newNum.charAt(k);
newNum2 += oneChar;
}

// add dollar sign and decimal ending from above
newNum2 = newNum2 + "." + end;
return newNum2;
}

Javascript code for Converting english number to word

This function can convert english number to word like 59 to Fifty Nine. Also can handle fractional part. If one can use only zeros after point he must need to give only two zero like 2.00.



var th = ['','Thousand','Million', 'Billion','Trillion'];
var dg = ['Zero','One','Two','Three','Four', 'Five','Six','Seven','Eight','Nine'];
var tn = ['Ten','Eleven','Twelve','Thirteen', 'Fourteen','Fifteen','Sixteen', 'Seventeen','Eighteen','Nineteen'];
var tw = ['Twenty','Thirty','Forty','Fifty', 'Sixty','Seventy','Eighty','Ninety'];
function toWords(s)
{s = s.replace(/[\, ]/g,'');
var len=s.length;
var babu="";
if(len>2 && s.charAt(len-1)=='0'&& s.charAt(len-2)=='0' && s.charAt(len-3)=='.')
{
//alert(s);
for(var i=0;i 15)
return 'too big';
var n = s.split('');
var str = '';
var sk = 0;
for (var i=0; i < x; i++)
{if ((x-i)%3==2)
{if (n[i] == '1')
{str += tn[Number(n[i+1])] + ' '; i++; sk=1;
}
else if (n[i]!=0) {str += tw[n[i]-2] + ' ';sk=1;}}
else if (n[i]!=0) {str += dg[n[i]] +' ';
if ((x-i)%3==0) str += 'Hundred ';sk=1;}
if ((x-i)%3==1) {if (sk) str += th[(x-i-1)/3] + ' ';sk=0;}}
if (x != s.length)
{var y = s.length; str += 'point ';
for (var i=x+1; i< y; i++)
str += dg[n[i]] +' ';
}
return str.replace(/\s+/g,' ');
}

Javascript code for table height

document.getElementById("your_table_id").offsetHeight

Wednesday, April 2, 2008

Some necessary JavaScript Code

JS code for List Box(multiple selecet) item add,delete,duplicate check


function list_box_add()
{
//'serial_list' is the name of list box
//'serial_number' is a comboBox
//the selected value of comboBox are adding to the list

/**********duplication check block***********/
for (i =0;i=0)
document.form1.serial_list.remove(document.forms["form1"].serial_list.selectedIndex);
else
alert('No Item Selected');

//alert(document.forms["form1"].serial_list.options[1]);
//document.forms["myForm"].state.options[1];
//document.write(document.forms['form1'].serial_list.selectedIndex);
}


JS code for delete row of table

function deleteRow(id)
{
var row = id.parentNode.parentNode.rowIndex;
var tbody = document.getElementById("table_id").tBodies[0].deleteRow(row);
//'table_id' is the id of the table
}

//calling function should call like this[ onclick="deleteRow(this)"] into button tag
JS code for trim string

function triim(st,d)//st string & d=1 for killing space inside the string

//d=0 & d=1 both kill leading & trailing space

{

var len = st.length;

var str="";

var i;

var first=0,last=len;

for(i=0;i=0;i--)

{ if(st.charAt(i)!=' ')

{ last=i;

break;

}

}

for(i=first;i<=last;i++) { if(d==1 && st.charAt(i)==' ') {} else str+=st.charAt(i); } return str; }
JS code to add new row in table

function add_row(){
var tbody = document.getElementById("table_id").getElementsByTagName("tbody")[0];
var row = document.createElement("TR");
var cell1 = document.createElement("TD");
cell1.innerHTML = "babu"; //can use some HTML

//var cell2 = document.createElement("TD");
//cell2.innerHTML = "babu"; //can use some HTML

/****** as required cell can b added*********/
row.appendChild(cell1);
//row.appendChild(cell2);
tbody.appendChild(row);
}


PC Magazine Tips and Solutions

PC World: Latest Technology News

PCWorld.com - Most Popular Downloads of the Week