₦airaland Forum

Welcome, Guest: RegisterLoginWith GoogleTrendingRecentNew

Stats: 3,325,052 members, 8,420,072 topics. Date: Thursday, 04 June 2026 at 10:41 AM

Toggle theme

Stack1's Posts

Nairaland ForumStack1's ProfileStack1's Posts

1 2 3 4 5 6 7 8 9 10 11 12 (of 12 pages)

ProgrammingRe: Lets Start A Real Web-deveopment Course Here Html+css+javascript+php+mysql by stack1(op): 12:31am On Aug 01, 2016
Next in the HTML file (opened in notepad for editing) delete the style tag (both start and end tag), then add the following line
inside the head tag/element


<link rel="stylesheet" type="text/css" href="css/index.css" />


What we just pasted/typed is a link element and one of its uses is to link external CSS files to web-pages, the link element as shown is an empty tag and doesn't have a closing tag, also you'll notice it has three attributes

1. rel this simply shows the relationship of the kind of document we are linking to and thus its value stylesheet
2. the type attribute provides the mime-type used in recognizing the type of document, every document type has a unique mime-type, and its usually based on the extension of the file, in this case the extension is (.css), a very comprehensive list of mime-types is here http://www.iana.org/assignments/media-types/media-types.xhtml

3. The href attributeis the attribute that really concerns us the most the href attribute points to the actual file we want to linking to, its value in this case is "css/index.css" , this is because the css folder is a sub-folder of the main project folder where index.html resides, and since we are linking from index.html, we need to instruct the browser to first go into the css folder then link with the index.css file within that folder

If everything up to this point is done correctly and you save the index.html file and refresh your browser, you should see the background of the body change colour, as that is the only CSS declaration we put into the external style sheet which is now linked to our web page
ProgrammingRe: Lets Start A Real Web-deveopment Course Here Html+css+javascript+php+mysql by stack1(op): 12:10am On Aug 01, 2016
We have seen basic CSS usage in previous examples where we had the the CSS style declarations in the STYLE tag, while this method works, it is not usually recommended combining HTML and CSS in the same file as it could lead to difficulty in maintain and managing your web-pages as time goes by (this is why we left the style tags empty in the last example

From Now on we are going to utilize a facility called external style-sheets

With external style-sheets we place our CSS style declarations in a separate file and then link that file to our html web-page.

Now perform these steps
Open up the recently created index.html file for editing

open a new notepad and save as index.css, make sure this file is saved in the CSS sub-directory of the project folder structure we earlier created

the index.css file we just created is our first external stylesheet so lets put some CSS into it, add the following to the index.css file


body {
background-color:#f5f5dc
}



save the changes made to the CSS file.
ProgrammingRe: Lets Start A Real Web-deveopment Course Here Html+css+javascript+php+mysql by stack1(op):
We have already looked at the basis of an HTML file so assuming you have created the index.html file open it in notepad and edit as follows

[code]
<!DOCTYPE html>
<html>
<head>
<title>My Web App</title>

<!-- our normal style tag where our CSS has been going -->
<style>

</style>



</head>
<body>

<div id="header">
<span id="header-text">
Welcome to the Application
</span>
</div>



</body>
</html>

Save and open i your browser, you should see a black line of text saying "Welcome to the Application", also notice that we do not have any CSS declaration within the style tag, we not using the style-tag in this example rather we would be using external style sheets.

Also within the <body> tag/element, there contains only a DIV tag/element (remember DIV is a block element) which surrounds another SPAN tag and the SPAN tag contains the text that's displayed, when an element is contained within another its called a CHILD element so the SPAN is a child of the DIV element and the DIV is termed the parent Element. save and view the page in your browser
ProgrammingRe: Lets Start A Real Web-deveopment Course Here Html+css+javascript+php+mysql by stack1(op): 11:47pm On Jul 31, 2016
hi all, so lets proceed

Now whenever you're working on a web based application, you'll normally have your files/web-pages and other resources like images e.t.c. arranged using a directory structure suitable to the project, you don't just place/save your files in arbitrary locations on your hard-drive.

Most web applications have the need for the user to move between pages and sections or access resources in other locations that are not even part of the project, HTML5 links are one way to provide access to other resources from a web-page.

Lets assume we have the ff folder structure


project_root/ ----
|___css/
|___images/
|___scripts/
|___server/
|___ index.html


So within the project directory we have a CSS folder for external style-sheets (to be explained soon), images, script (JavaScript files), and a server folder to contain other HTML files and also server scripts. Now in the root folder we have an index.html file which would be the start of our web-app

Create a similar folder structure before proceeding
ProgrammingRe: Javascript Frameworks, Libraries & Tools by stack1(m):
in any case sha lemme put my own framework written from scratch by my self its called tigerjs, its a full-fledged library with many advanced modules like an Iterator modelu, an IO module, a utility module, widgets module(s) amd much more.. see it here https://sourceforge.net/projects/tigerjs/

hope u guyz wouldn't mind taking it for a spin, i have actually used it on an already released project and its the only library i needed.
ProgrammingRe: Lets Learn C by stack1(op): 10:20am On Jul 30, 2016
//carefully study the following code, would discuss it a bit later, its nothing complex just a lumped up example of what we have been looking at



#include <stdio.h>
int main(void)
{
int n, m;
n = 30;

while (++n <= 33)
printf("%d|",n );
n = 30;

do{
printf("%d|",n);
}
while (++n <= 33);

printf("\n***\n" );

for (n = 1; n*n < 200; n += 4)
printf("%d\n", n);

printf("\n***\n" );

for (n = 2, m = 6; n < m; n *= 2, m+= 2){
printf("%d %d\n", n, m);
}

printf("\n***\n" );

for (n = 5; n > 0; n--)
{
for (m = 0; m <= n; m++)
printf("=" );
printf("\n" );
}

getchar();
return 0;
}



Please make sure you type and run this code, and yeah i'm sure they'll be questions and some attacks for this grin wink
ProgrammingRe: Lets Learn C by stack1(op): 10:15am On Jul 30, 2016


int main()
{
int j=0
do
{
printf("Value of variable j is: %d", j);
j++;
}while (j <= 8 );

getchar();
return 0;
}



Output:

Value of variable j is: 0
Value of variable j is: 1
Value of variable j is: 2
Value of variable j is: 3
Value of variable j is: 4
Value of variable j is: 5
Value of variable j is: 6
Value of variable j is: 7
Value of variable j is: 8
Value of variable j is: 9


Ok so what is happening here, we have an integer variable j that is initialized to zero, in the do while loop, the statement which prints the value of our integer variable is printed first (in the do section), then the variable is incremented. all this happens before the looping condition
 j <= 8
is checked

This loop continues to run (increasing the value of the integer variable j on each run till the test-condition fails, that's basically the story of the do-while loop
ProgrammingRe: Lets Learn C by stack1(op): 10:03am On Jul 30, 2016
The while and for loops as stated earlier are entry-controlled loops as their conditions for looping is checked once before each run, however there exists another similar looping construct do..while which runs at least once before its looping condition is checked and it is termed an exit-controlled loop

[size=16pt]do while{}[/size]

The do while{} loop executes its statement(s) once before checking its loop-condition, if the loop-condition then still holds true it executes again and again till the condition is no longer true

Form of do-while loop –


do
{
//C- statements

}while(condition test);

ProgrammingRe: Lets Learn C by stack1(op):
// Program to find factorial of a number
// For a positive integer n, factorial = 1*2*3...n

Ok, not too get too mathematical (no be say me sef sabi math like dat), but this example calculates factorial, in summary lets say we have a number 5 the factorial would simply be 1*2*3*4*5, and if w have a number 55 the factorial would be 1*2*3*4*5*....55, ok they are other better ways to calculate factorials and we would still revisit more proper factorial programs later on




#include <stdio.h>
int main()
{
int number = 8; //we would calculate the factorial of 8
int factorial = 1 ;

// loop terminates when number is less than or equal to 0
while (number > 0)
{
factorial = factorial * number;
--number;
}

printf("Factorial= %d", factorial);

getchar();
return 0;
}




This example calculates the factorial of 8, the loop's control-condition simply checks to make sure the value of the number variable is greater than 0 (initially its 8 ).
In the body of the loop we calculate the factorial as thus

on the first run factorial is 1 and number is 8

so
  factorial = factorial * number;  
, evaluates as 1 = 1* 8 which is still 8 and so the number 8 is stored in the factorial
variable, i.e. factorial = 8

The next statement --number, decreases the value of number by one making it 7

On the next run of the loop the control-condition (number > 0) still holds true as number is 7 and thus > 0
so the loop is executed again and
-
  factorial = factorial * number;  
, evaluates as 8 = 8* 7, given 56, and this is stored in factorial.
The statement --number, decreases the value of number by one (again) making it 6.

This process runs again and again updating the factorial variable and decreasing the number on each successfull run until
the condition (number > 0) isn't true any more and the looping stops.

The final value stored in variable factorial is our answer and is printed to the output
ProgrammingRe: Lets Learn C by stack1(op): 9:06am On Jul 30, 2016
while and for loops are termed entry condition loops, this is due to the fact that their condition(s) for looping is checked each time before the loop is executed, the examples seen so far are quite basic, as we proceed we would encounter more complex (and sometime strange) usages of loops.

so lets see some more while loops
ProgrammingRe: Lets Learn C by stack1(op):
lets see some basic examples


//this are incomplete code examples try-out completing them and make sure they run

ex 1
int index = 1;
while (index < 5)
printf("Good morning!\n" );

ex 2
index = 1;
while (--index < 5)
printf("Good morning!\n" );



in the first example we declare a variable index and set its value to 1, then the control-expression index < 5 is evaluated, so far as this expression returns a positive/truthful result the loops body i.e. the printf statement is executed.

in the second example the variables are the same the only difference is the control-expression --index < 5, this statement uses a pre-decrement to decrease the value of the variable index by one each time the loop is run, however this example prints a never ending line
of Good morning's, this is termed infinite looping and is usually an error condition, before i explain while the loop runs infinitely can any one take a stab at the explanation smiley

And also the second example shows a crucial point, whenever you craft loops, make sure there's some condition that would cause the loop to terminate and not just run endlessly, except you actually wanted it to (this could be valid ins some kind of programs)
ProgrammingRe: Lets Learn C by stack1(op): 8:51am On Jul 30, 2016
The while loop is another general purpose loop, and is renowned for its compactness and ease in handling complex loop expressions

the basic form of the while loop is



while ( control-expression )
statement



The control-expression or statement parts could be simple or complex statements
The basic operation of the while is straight forward

-- the loops control-expression is evaluated first and if the result of the evaluation is non-zero/non-false the statement contained in the loop's body is executed, this process is repeated until the control-expression fails
ProgrammingRe: Lets Learn C by stack1(op): 8:42am On Jul 30, 2016
[size=16pt]while[/size] loops
ProgrammingRe: Lets Learn C by stack1(op): 8:40am On Jul 30, 2016
In the last example you'll notice the for loop's body isn't enclosed in braces {} generally if the body of a loop is contained wholly one one line the braces can be excluded
ProgrammingRe: Lets Learn C by stack1(op): 8:34am On Jul 30, 2016
Here we show that more complex expressions can be used for any of the values in a for loop


#include <stdio.h>
int main(void)
{
int x;
int y = 55;
for (x = 1; y <= 75; y = (++x * 5) + 50)
printf("%d \t %d\n", x, y);

getchar();
return 0;
}


This loop prints the values of x and of the algebraic expression ++x * 5 + 50 . The
output looks like this:
1 55
2 60
3 65
4 70
5 75

While we haven't discussed operator in-depth the expression (++x * 5) + 50 should be trivial to comprehend
The variable (x) is first initialized to 1 in the loop's initialization statement. Then in the update statement it is per-incremented by one then multiplied by five, and the result added to 50
ProgrammingRe: Lets Learn C by stack1(op): 8:25am On Jul 30, 2016
The update statement in for loops do not need to be increased/decreased by one, any arbitrary number or expression would do


#include <stdio.h>
int main(void)
{
int n; // count by 13's from 2
for (n = 2; n < 60; n = n + 13)
printf("%d \n", n);

getchar();
return 0;
}


This would increase n by 13 during each cycle, printing the following:
2
15
28
41
54


In the above program, the variable n is initialized with the value 2, and then the loop checks runs only if the value of variable n is less than 60, and then after each run of the loop n is increased by 13, this process continues till the test condition n < 60 fails and the loop is then terminated
ProgrammingRe: Lets Learn C by stack1(op): 9:33am On Jul 29, 2016
dhtml18:
^^^it matters not whether you are a guru or not, just have fun and enjoy the thread, that is why i am here to, to encourage the OP.
dhtml18 grin
ProgrammingRe: Lets Learn C by stack1(op): 11:13pm On Jul 28, 2016
mnairaland:
I wanted to ignore this thread altigether,but decided against it.Why dont u intrioduce operators(like addition etc) and control statements (while,for goto and return ) to us first. If pple are already graspg it as it is then no problem.
am already doind that bro, see the last few post's, yeah i know i shoulld have started with d basics,make una no vex, currently on for loops, and sorry to everyone for not posting anything on-topic for a feew dayz now bn away from my system and i no fit type long post on phone, would continue tommorow (if Nepa coporates that is)
ProgrammingRe: Who Wants To Attend A Hackathon? by stack1(m): 8:52pm On Jul 28, 2016
and so this ict-expo thing ends today and the bloody organizers no even give more info regarding the change of date of the Hackathon, not even a reason, smh for them angry
ProgrammingRe: I Want To Learn Programming. Which Language Should I Start With? by stack1(m): 8:28pm On Jul 28, 2016
Booyakasha:
W3school is just my reference point
its undoubtedly a great reference still downloaded the entire site last week for offline veiwing cuz i lost my previous offline copy, twas quite large tho, a little over 600mb but at least i gat the entire site whenever i need to look somthn up
ProgrammingRe: I Want To Learn Programming. Which Language Should I Start With? by stack1(m):
godofbrowser:
I totally disagree with you. I learnt html, css, javascript, jquery, php and mysql from w3school and I don't regret it.

here is my javascript cgpa calculator.

http://cgpa.emmysweb.com


also, with the help of the same w3schools in understanding php I was able to build a WordPress theme with all necessary function in place http://emmysweb.com


with their help I was able to create beautiful user interface and animations with javascript/jquery and css3 http://emmysweb.ml


so what reasons have u got to discourage others from learning with w3schools? they even have an awesome tryItYourself editor
i hav been a web-dev for years so trust me when i say W3cschools is too soft core,there's just too much they left out of their tutorials, to me.its best for reference (and i still use it for that) but you'll need better tutorials to get the full gist of many web-dev languages u say u built a Cgpa calculator, bro thats basic stuff resarch into writing say a natural language parser in JS then you'll see w3c has only taught you the rudiments and at best let you know the syntax
ProgrammingRe: Lets Start A Real Web-deveopment Course Here Html+css+javascript+php+mysql by stack1(op): 9:00pm On Jul 27, 2016
this evening we look at linking using the <a> tag and how to style links
ProgrammingRe: Which is more awesome to use for 'server-side programming', NodeJS or PHP? by stack1(m): 7:42pm On Jul 27, 2016
KvnqPrezo:
Thanks

What about the <!-- //--> Neccessaryhuh
such is only neccessary in XHTML and other XML type documents, u however do it this way
<![CDATA[

//code goes here

]]>
so the XML parserr can ignore those sections.


using <!-- --> (HTML commennts) is meant to block sccripts from browsers that do not understand javascript which is rare nowadays
ProgrammingRe: Which is more awesome to use for 'server-side programming', NodeJS or PHP? by stack1(m): 5:50pm On Jul 27, 2016
KvnqPrezo:
Don't really know what going on here...
.
Wanna ask which is the valid way to run this code on Html 5

<script language="JavaScript" type="text/JavaScript">
<!--
document.write ("Hello World"wink;
//-->
</script>

Or
<script language="JavaScript">
document.write ("Hello World"wink;
</script>

Help please wanna know which is valid in Html5
the way you formulate your script-tag has nothing to do with HTML5, and also the language attribute isn't neccesary cause browsers by default woyld assume JavaScript, again the way you wrote the type attribute isnt exactly right, it should be type="text/javascript", dont camel-case the word
ProgrammingRe: Who Wants To Attend A Hackathon? by stack1(m): 6:32am On Jul 27, 2016
today was supposed to be the day of the hackathon and i was just leaving home for the venue, na im i get call saying its no longer holding today that they would keep all contestants informed, what the hell is wrong with Nigeria and planning
ProgrammingRe: Lets Learn C by stack1(op): 2:21pm On Jul 26, 2016
the GCC compiler package in the link i pasted would download as a 7z archive so you'll need a tool such as WinRar (http://www.rarlab.com/download.htm) or 7-zip (http://www.7-zip.org/download.html) to extract the contents, after extracting ( i only recommend extracting to the root of your C: drive, any other location should do) you then setup Codeblocks to use the GCC compilers from the Settings->Compilers menu

Then you can directly compile from the build menu
ProgrammingRe: Lets Learn C by stack1(op): 9:48am On Jul 26, 2016
furthest:
please every1 I need a complier..I can't find any online..please help a bro here
bro i pasted the links for both 32bit and 64bit GCC compilers on page 1 and inatructions on setting them upe with code blocks, aanyway here are the links again


if you are on 32bit windows get this file here
https://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win32/Personal%20Builds/dongsheng-daily/6.x/gcc-6-win32_6.1.1-20160715.7z/download

and for 64bit systems get this
https://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win64/Personal%20Builds/dongsheng-daily/6.x/gcc-6-win64_6.1.1-20160715.7z/download
ProgrammingRe: Lets Learn C by stack1(op): 9:44am On Jul 26, 2016
bestiyke:
I don't have a word for u because everyone on Nairaland/programming session knows your character. I still respect you person anyway.
guys can we end this matter
ProgrammingRe: Lets Learn C by stack1(op): 7:55am On Jul 26, 2016
I might or might not be posting much for the next few days, as i got some waka waka to do, please if anyone has got questions up to this point??
ProgrammingRe: Lets Learn C by stack1(op): 7:53am On Jul 26, 2016
bestiyke:
I don't know what you mean. My heart is as clear as crystal. I'm only delighted by your tutorial posts. I don't know when *'dear' became gender sensitive. We Nigerians and our myopic reasoning. Sorry anyway if it is a wrong word.
Myopic?, bro, me just dey catch fun nah. shu, but then again its not a standard way guys address each other for our 9ja
ProgrammingRe: Lets Learn C by stack1(op): 7:51am On Jul 26, 2016
dhtml18:
Oh, you are not even a Nigerian, no wonder. If a man calls me DEAR in the real world, I would have done a 70-moves-kata on his head before he explains himself.
LOL, i thought i was only joking anyway.. smiley cool
ProgrammingRe: Lets Learn C by stack1(op): 3:04am On Jul 26, 2016
By the way my good people them, when learning any form of programming, don't rely only on the source you are learning form, learn to digg deeper on your own (Google is your friend here), how fast and well you'll learn truly depends on how enthusiastic u are and how far you are willing to research further on your own

1 2 3 4 5 6 7 8 9 10 11 12 (of 12 pages)