Monthly Archives: October 2012

Power Function In C

Power function in C come with pow(a, b);
available in double and float mode

float       powf( float base, float exp );
double      pow( double base, double exp );
long double powl( long double base, long double exp );

in order to get integer representation, you need to cast the double / float value into integer by simple casting

int(variable)

all you need to do to use this pow function is to add
#include <math.h>
to your program

 

Deductive Reasoning

Deductive reasoning uses the law of logic to link together true statements to arrive at conclusion. Definition is true statement, so it is used in proof. a proof is valid argument that establishes the truth of a statement.

direct proof is proof that start with the given statement that use the law of logic to arrive at the statement to be proved.
indirect proof or proof by contradiction is proof that starts with the negation of the statement to be proved and use the law of logic to show that it is false. when the negation of statement is false, the statement must be true, if we can show that the negation of the statement to be proved is false, then the statement must be true.

Inductive Reasoning

Inductive reasoning usually called generalization, we given by some examples and try to make generalization from those examples to arrive at our conclusion.

For example you can write the number of factor of each number from 1 to 25. And you will only find that only the quadratic number that has odd number of factor. (4 has 3 factors, 9 has 3 factors, 16 has 5 factors, 25 has 3 factor). Then you extend your sample to 1000 for example, and find the same observation, you then conclude that only quadratic number will have odd number of factor.

in Geometry this inductive reasoning has some weakness :

1. Measurement in geometry can not be done precisely, result is only approximate
2. Each sample should be took care carefully, we need to examine every possibility from the sample
3. We do not give / can not give explanation why conclusion are true, the result comes from our observation through samples

but however, this inductive reasoning is a powerful tool in discovering and making conjecture.

the result of inductive reasoning is called conjecture, it is true conclusion that we draw but we can not give any explanation why the conclusion is true, the result in only probably true.

counterexample is any sample that we can use to prove that generalization taken by inductive reasoning is false

Create favicon and display favicon on browser

Favicon or favorite icon is small icon 16 x 16 pixel icon that is used as an icon for your website. This icon will be displayed in each your browser tab, to represent your website. This small icon file has .ico extention. If you want to put favicon on your website, you need to place it on your root folder of your website.

Thera some ways to create this favicon:

1. You can edit your own image use image editor such as photoshop or paint, or microsoft offfice viewer and make sure your edited image is 16 x 16 pixel
2. You then save it to favicon.ico
3. upload to your root folder of website.

1. you may use favicon generator http://www.favicon.cc/ here to create or draw your favicon
2. I prefer to use my own image and edit it using favicon generator
3. after you finish the process, download the favicon.ico and upload it to your root folder of website.

here is the example on chrome

create favicon and display favicon on browser
favicon on google chrome

here is the example on firefox

create favicon and display favicon on browser
favicon on firefox

To make your browser to display your favicon, you just need to restart the browser,
but if the favicon still not appear you can try to open it on your browser for example http://caleudum.com/favicon.ico after it display the favicon, you can then restart the browser and see the result.

you can  go here to create your favicon

How to install gcc on windows 7

Installing gcc on windows 7 could be done easily by downloading Dev-C++ or devcpp. Dev-C++ or devcpp is featured Integrated Development Environment (IDE) for the C/C++ programming language. It uses Mingw port of GCC (GNU Compiler Collection) as it’s compiler. Dev-C++ can also be used in combination with Cygwin or any other GCC based compiler.

you can use this devcpp to compile and run your C or C++ program, but if you want to experience manual compilation using cmd and gcc, you need to modify you windows path, so that you can run gcc command everywhere on you command prompt. Just follow these steps

1. Download Dev-C++
2. Install Dev-C++, for easy process just do the “next” and “next”, you don’t need to configure the installation location
3. After you finish the installation you need to modify windows path to do this first you need to click the start button on windows 7.
4. Right click on “Computer” (above control panel) Menu choose properties
5. Choose advanced system setting (located right above the screen). System properties window will appear.
6. Choose advanced on tab menu, and click environment variables.
7.  On user varibles click new
for variable name write PATH
for variable value write C:\Dev-Cpp\bin;

change windows path
change windows path

8. Now you can compile your program anywhere using command prompt
just run gcc programname.c -o programname

to download DevCpp you can go
here

C Programming : Getting Started

1. Writing Hello World, Open you notepad and write this line

#include<stdio.h>
main(){
printf(“hello world\n”);
}

2. Save it and name the program with .c as extension.
for example hello.c

3. Compile the program using compiler, you can use and install gcc, after installation complete open command prompt and enter command below

gcc hello.c -o hello

4. The compiler will compile the program and result some file
hello.c and hello.exe

5. Now you can run the program by typing hello or hello.exe and hit enter

C program consist of function and variables .
Function contains statements that specify computing operations to be done,
Variables store values used during the computation
Main is special function, your program begins executing at the beginning of the main
Function arguments are list of values provided when calling the function, as a method to communicate data between function