Making HTML Pages

I have given you the source code for some basic HTML i have written but have not specified how to make them, in the sense, where to type them and how to save them and how to open them. 

So for HTML you do not need any sort of compiler that you need for stuff like C, C++ or Java for that matter. 

A Notepad will do. 

How a notepad.?

All you have to do is copy and paste the code i have given in the other blog posts and ‘Save as’ … <filename>.html
That is just save it with a ‘.html’ filetype.

So if you want your file to be named ‘testpage’ then save the page as, ‘testpage.html’

Hope i was clear enough

For linux users, you can use Gedit. or Kedit, which ever you have. 

Why not High-End Softwares

People usually go for high-end softwares for making webpages. Softwares such as Adobe Dreamweaver. But for learners it is recommended that only notepad be used. Reason for this is, when you learn, you need to learn the real thing. High-end softwares can do a lot of work for you and they do correct mistakes themselves if you will. So that pulls you back on your road to learn HTML properly. 

P.S: If you want something a little more powerful than notepad on windows i suggest you download notepad++. Its opensource so you can download it for free on the internet. Search Google. I assume that most linux users will be satisfied with G-edit or K-edit.

 Thanks for reading.

Comments and doubts are welcome. 

Tc. Joys. See ya

Using Forms in HTML (Sample Webpage #1)

This is a Simple web page created using forms made mainly for you to copy and paste it and play around with the tags so that you can learn a bit more about HTML. Be bold to delete, edit and replace stuff in this code. Thats the way to go.

This is a form to take info about people participating in an interview. This could be used as an online registration form or anything you want it to be called.

Try it out!..

<html>

<head>
<title>Off Campus Entry Form</title>
</head>
<body>
<h1>
Off Campus Entry Form
</h1>

<form name=”input” action=”index.html” method=”get”>
Name: <br />
First name: <input type=”text” name=”firstname” /><br />
Last name: <input type=”text” name=”lastname” /><br />
<br/>
Gender: <br />
<input type=”radio” name=”sex” value=”male” /> Male<br />
<input type=”radio” name=”sex” value=”female” /> Female<br />
<br/>
Email id: <input type=”text” name=”email” /><br />
<br/>
Languages Known:<br/>
<input type=”checkbox” name=”lang” value=”C” /> C<br />
<input type=”checkbox” name=”lang” value=”C++” /> C++<br />
<input type=”checkbox” name=”lang” value=”java” /> Java<br />
<input type=”checkbox” name=”lang” value=”.net” /> .Net<br />
<br/>
Field:<br/>
<input type=”radio” name=”field” value=”arts” /> Arts and Science<br />
<input type=”radio” name=”field” value=”engg” /> Engineering<br />
<br/>

Qualification:<br/>
<input type=”radio” name=”qualification” value=”ug” /> Under Graduate<br />
<input type=”radio” name=”qualification” value=”pg” /> Post Graduate<br />
<br/>

<input type=”submit” value=”Submit” />
</form>
</body>

</html>

Post your doubts.

Thank you.

Joys

Simple Web Page

Here’s the code for a simple web page i created to start off with. Though this is really really basic and when i say really its REALLY basic. This would help in understanding what each tag does. Take a trip around w3schools.com HTML tutorial and come back here and you can play around with the tags and see what each one does.

<html>
<head>
<title>
J Cafe
</title>
<style type=”text/css”>
body {
background-color: #d2b48c;
margin-left: 20%;
margin-right: 20%;
border: 1px dotted gray;
padding: 10px 10px 10px 10px;
font-family: sans-serif;
}
</style>

</head>

<body>
<h1>
Welcome to J Cafe
</h1>

<p>
You’re in for a real treat…. Take a look at our exquisite menu..
</p>

<h2>
THE MENU
</h2>

<h3>
House Blend, 80 /-
</h3>
<p>
A smooth blend of coffee from mexico and Bolivia
</p>

<h3>
Mocha Cafe Latte, 75
</h3>
<p>
Expresso, Steamed milk and Chocolate Syrup
</p>

<h3>
Cappuccino, 70
</h3>
<p>
A mixture of Expresso, steamed milk and milk foam
</p>

</body>
</html>

Post your doubts. Will answer them if i can. As soon as possible. Thank You.

Learning HTML

As a part of my course work, I’m supposed to learn HTML, XML and Javascript. So you can be expecting some posts about that too here.

Learning HTML would be the easiest thing i guess. Log on to w3schools.com and you will have everything you need to get going. In about one hour or so. You will have learnt enough to make your own website. The site also allows you to test out the things that you have learnt side by side, with some workspaces. This would be one way to go about it. This is how i first learnt it few years back and i’m going through it again.

So anyways. There are plenty of good books out there which you can use to learn too. A particular one that I am using now as a reference is this book called “Head First – HTML (with CSS & XHTML) written by Elisabeth and Eric Freeman, published by O’Reilly Publishers. This would be a good read if you want to take a dive into HTML. It will get you starting in no time and to add more. The book is awesome. You can read it as though you were reading a story book but really you would be learning a lot too.

Tc

Joys 

String Tokenizer Using C

This was an Exercise for Me.

We were asked to perform this in Linux Environment.

Here’s the Code

#include<stdio.h>
#include<string.h>
int main()
{
char s[100],t,constant[10],alpha[10];
//char key[11][20]={“while”,”do”,”if”,”for”,”int”,”char”,”float”,”double”,”default”,”else”,”return”};
int l=0,i,q,k,j;
printf(“\nEnter any valid statement in C\n”);
scanf(“%s”,s);
printf(“\n\nToken\t\t\t\t\tCategory\n”);
l=strlen(s);
for(i=0;i<l;i++)
{
t=s[i];
if(s[i]==’#’)
{
printf(“\n%s\t\tHeader File”,s);
break;
}
else if(isalnum(t))
{
if(isdigit(t))
{
q=i;
k=0;
for(j=q;j<l;j++)
{
if(!isalnum(s[j]))
break;
constant[k]=s[j];
i=j;
k++;
}
constant[k]=”;
printf(“\n%s\t\t\t\tNumeric Constant”,constant);
}
else
{
q=i;
k=0;
for(j=q;j<l;j++)
{
if(!isalnum(s[j]))
break;
alpha[k]=s[j];
i=j;
k++;
}
alpha[k]=”;
if(strcmp(alpha,”main”)==0)
{
printf(“\n%s()\t\t\t\tMain Function”,alpha);
i++;
i++;
}
else if(strcmp(alpha,”printf”)==0 || strcmp(alpha,”scanf”)==0)
{
if(strcmp(alpha,”printf”)==0)
{
printf(“\n%s()\t\t\t\tprintf Function”,alpha);
}
else
{
printf(“\n%s()\t\t\t\tscanf Function”,alpha);
}
i++;
i++;
printf(“\n”);
while(s[i]!=’)’)
{
printf(“%c”,s[i-1]);
i++;
}
printf(“%c%c\t\t\t\tFormatted String”,s[i-1],s[i]);
//i++;
//printf(“\n While \t %c”,s[i]);
}
else if(strcmp(alpha,”while”)==0||strcmp(alpha,”do”)==0||strcmp(alpha,”if”)==0||strcmp(alpha,”for”)==0||strcmp(alpha,”int”)==0||strcmp(alpha,”char”)==0||strcmp(alpha,”float”)==0||strcmp(alpha,”double”)==0||strcmp(alpha,”default”)==0||strcmp(alpha,”else”)==0||strcmp(alpha,”return”)==0||strcmp(alpha,”case”)==0||strcmp(alpha,”switch”)==0)
{
printf(“\n%s\t\t\t\tKeyword”,alpha);
}
else
{
printf(“\n%s\t\t\t\tIdentifier”,alpha);
}
/*else
{
for(j=0;j<11;j++)
{
if(strcmp(s[j],alpha)==0)
flag=1;
}
if(flag==1)
{
printf(“\n%s——–>Keyword”,alpha);
}
else
{
printf(“\n%s——–>Identifier”,alpha);
}
flag=0;
}
else if(strcmp(alpha,”scanf”)==0)
{
printf(“\n%s()——>scanf Function”,alpha);
i++;
i++;
printf(“\n”);
while(s[i]!=’)’)
{
printf(“%c”,s[i-1]);
i++;
}
printf(“%c%c——–>Formatted String”,s[i-1],s[i]);
}*/
//printf(“\n%s——>ALPHA”,alpha);
}
}
else if(s[i]==’+’||s[i]==’-‘||s[i]==’>’||s[i]=='<‘||s[i]==’!’||s[i]==’&’||s[i]==’*’||s[i]==’/’||s[i]==’^’||s[i]==’%’||s[i]==’|’||s[i]==’=’)
{
if(t==’=’&&s[i+1]==’=’)
{
printf(“\n%c%c\t\t\t\tConditional Operators”,t,s[i+1]);
i++;
}
else if(t==’=’)
printf(“\n%c\t\t\t\tAssignment operator”,t);
else if(t==’+’&&s[i+1]==’+’)
{
printf(“\n%c%c\t\t\t\tIncrement Operator”,t,s[i+1]);
i++;
}
else if(t==’-‘&&s[i+1]==’-‘)
{
printf(“\n%c%c\t\t\t\tDecrement Operator\n”,t,s[i+1]);
i++;
}
else if(s[i+1]==’&’||(t==’!’&&s[i+1]==’=’)||s[i+1]==’|’)
{
printf(“\n%c%c\t\t\t\tLogigal Operator\n”,t,s[i+1]);
i++;
}
else
printf(“\n%c\t\t\t\tOperator”,t);
}
else
{
printf(“\n%c\t\t\t\tSpecial Character”,s[i]);
}
}
printf(“\n\n”);
return 0;
}

*****************************

Try this code. Post your comments

This code should scan out just about anything.

Please post if u find a better way to execute it too.

Since output is pretty dynamic. I did not post any output.

Tc.

#include<stdio.h>

#include<string.h>

int main()

{

char s[100],t,constant[10],alpha[10];

//char key[11][20]={“while”,”do”,”if”,”for”,”int”,”char”,”float”,”double”,”default”,”else”,”return”};

int l=0,i,q,k,j;

printf(“\nEnter any valid statement in C\n”);

scanf(“%s”,s);

printf(“\n\nToken\t\t\t\t\tCategory\n”);

l=strlen(s);

for(i=0;i<l;i++)

{

t=s[i];

if(s[i]==’#’)

{

printf(“\n%s\t\tHeader File”,s);

break;

}

else if(isalnum(t))

{

if(isdigit(t))

{

q=i;

k=0;

for(j=q;j<l;j++)

{

if(!isalnum(s[j]))

break;

constant[k]=s[j];

i=j;

k++;

}

constant[k]=”;

printf(“\n%s\t\t\t\tNumeric Constant”,constant);

}

else

{

q=i;

k=0;

for(j=q;j<l;j++)

{

if(!isalnum(s[j]))

break;

alpha[k]=s[j];

i=j;

k++;

}

alpha[k]=”;

if(strcmp(alpha,”main”)==0)

{

printf(“\n%s()\t\t\t\tMain Function”,alpha);

i++;

i++;

}

else if(strcmp(alpha,”printf”)==0 || strcmp(alpha,”scanf”)==0)

{

if(strcmp(alpha,”printf”)==0)

{

printf(“\n%s()\t\t\t\tprintf Function”,alpha);

}

else

{

printf(“\n%s()\t\t\t\tscanf Function”,alpha);

}

i++;

i++;

printf(“\n”);

while(s[i]!=’)’)

{

printf(“%c”,s[i-1]);

i++;

}

printf(“%c%c\t\t\t\tFormatted String”,s[i-1],s[i]);

//i++;

//printf(“\n While \t %c”,s[i]);

}

else if(strcmp(alpha,”while”)==0||strcmp(alpha,”do”)==0||strcmp(alpha,”if”)==0||strcmp(alpha,”for”)==0||strcmp(alpha,”int”)==0||strcmp(alpha,”char”)==0||strcmp(alpha,”float”)==0||strcmp(alpha,”double”)==0||strcmp(alpha,”default”)==0||strcmp(alpha,”else”)==0||strcmp(alpha,”return”)==0||strcmp(alpha,”case”)==0||strcmp(alpha,”switch”)==0)

{

printf(“\n%s\t\t\t\tKeyword”,alpha);

}

else

{

printf(“\n%s\t\t\t\tIdentifier”,alpha);

}

/*else

{

for(j=0;j<11;j++)

{

if(strcmp(s[j],alpha)==0)

flag=1;

}

if(flag==1)

{

printf(“\n%s——–>Keyword”,alpha);

}

else

{

printf(“\n%s——–>Identifier”,alpha);

}

flag=0;

}

else if(strcmp(alpha,”scanf”)==0)

{

printf(“\n%s()——>scanf Function”,alpha);

i++;

i++;

printf(“\n”);

while(s[i]!=’)’)

{

printf(“%c”,s[i-1]);

i++;

}

printf(“%c%c——–>Formatted String”,s[i-1],s[i]);

}*/

//printf(“\n%s——>ALPHA”,alpha);

}

}

else if(s[i]==’+’||s[i]==’-‘||s[i]==’>’||s[i]=='<‘||s[i]==’!’||s[i]==’&’||s[i]==’*’||s[i]==’/’||s[i]==’^’||s[i]==’%’||s[i]==’|’||s[i]==’=’)

{

if(t==’=’&&s[i+1]==’=’)

{

printf(“\n%c%c\t\t\t\tConditional Operators”,t,s[i+1]);

i++;

}

else if(t==’=’)

printf(“\n%c\t\t\t\tAssignment operator”,t);

else if(t==’+’&&s[i+1]==’+’)

{

printf(“\n%c%c\t\t\t\tIncrement Operator”,t,s[i+1]);

i++;

}

else if(t==’-‘&&s[i+1]==’-‘)

{

printf(“\n%c%c\t\t\t\tDecrement Operator\n”,t,s[i+1]);

i++;

}

else if(s[i+1]==’&’||(t==’!’&&s[i+1]==’=’)||s[i+1]==’|’)

{

printf(“\n%c%c\t\t\t\tLogigal Operator\n”,t,s[i+1]);

i++;

}

else

printf(“\n%c\t\t\t\tOperator”,t);

}

else

{

printf(“\n%c\t\t\t\tSpecial Character”,s[i]);

}

}

printf(“\n\n”);

return 0;

}

*

BPSK Simulation in MATLAB

Actually flicked the program from somewhere in a forum.

Took some time to understand it first. Few months back.

Now i’ve coded it better with some tweaks. So that you understand it sooner than me. 🙂

 

Here’s the code, I’ve copied and changed it to Italics, copy, paste, save and run.
Post your doubts in the comments 

clear all;
close all;

f = 2; %frequency of sine wave
fs = 100; %sampling period of the sine wave
t = 0:1/fs:1; %splitting time into segments of 1/fs
%setting the phase shifts for the different BPSK signals
p1 = 0;
p2 = pi;
%getting the number bits to be modulated
N = input(‘enter the number of bits to be modulated: N = ‘);
%generating the random signal
bit_stream=round(rand(1,N));
%allocating the dynamic variables
time = [];
digital_signal = [];
PSK = [];
carrier_signal = [];

%GENERATING THE SIGNALS
for ii = 1:1:N
%the original digital signal is
if bit_stream(ii) == 0
bit = zeros(1,length(t));
else
bit = ones(1,length(t));
end
% bit0 = (bit_stream(ii)==0)*zeros(1,length(t));
% bit1 = (bit_stream(ii)==1)*ones(1,length(t));
digital_signal = [digital_signal bit];

%Generating the BPSK signal
if bit_stream(ii) == 0
bit = sin(2*pi*f*t+p1);
else
bit = sin(2*pi*f*t+p2);
end
PSK = [PSK bit];

%Generating the carrier wave
carrier = sin(2*f*t*pi);
carrier_signal = [carrier_signal carrier];

time = [time t];
t = t + 1;

end

subplot(3,1,1);
plot(time,digital_signal,’r’);
grid on;
axis([0 time(end) -0.5 1.5]);

subplot(3,1,2);
plot(time,PSK);
grid on;
% axis([0 time(end) -2 2]);
axis tight;

subplot(3,1,3);
plot(time,carrier_signal);
grid on;
axis tight;

 

 

The output should look something like this … 
Image