Subscribe for email updates

Get all updates to your inbox to stay tune.

Curve tracing programs - Draw sin(x) curve using Graphics programming in C

Learn how to draw curve tracing graphics programs in c language

Graphics programming in C

Learn how to write basic and advanced graphics programming in c language

Curve tracing programs - Draw Cos(x) curve using Graphics programming in C

Learn how to draw curve tracing graphics programs in c language

Make file tutorial

A step by step guide to learn how to write make file in Linux with examples

Wednesday, February 29, 2012

playing with colors in C graphics


Hello all, Lets play with colors in c Graphics. In this example, lines are shown in different colors. The number of colors is limited by the graphic mode which is detected by the initgraph(). read "C graphics" for basic c graphic program.  To check the maximum colors a graphic mode supports, use getmaxcolor() function. In current system, the graphic mode supports 15 colors. Use setcolor() to change the color of the next drawing object. In this example, after setting the color, the line is drawn in that color.

The programs output is shown below.

Monday, February 27, 2012

First C graphic program - Draw a line


Hello all, Lets start with simple c graphics program. first thing is to go through the basic skelton of a c graphic program. Usually c program runs in a text mode. To run graphic program, we need to change the screen mode from text mode to graphics mode. initgraph() function does this job. All graphic functions are defined in graphics.h header file. I will not be going though all the details about graphic modes, however all details about devices and modes are clearly documented in turboc help index. please refer for more details.
For all our programs, we will leave to initgraph, the job of selecting graphic device and supported mode automatically. All the driver files are located in "c:\tc\BGI\" directory by default after Installing turbo C++.

Thursday, February 23, 2012

Simple two person chat by hacking pseudo terminals in Linux

Hello Linux users,
have you ever tried to communicate with colleague without using gtalk,lotusnotes, yahoo messenger,communicator or any other fancy chats. ?
Have you ever tried to communicate through putty ?
For a while assume that you are working in a environment where all fancy chats are disabled and no official communicator. what did you do?  well, if you have answer its good. otherwise here is a hack for linux users.

All you need is you and your friend need access to the same linux machine. I think it is quite natural in work place.lets see how you can chat with your friend using this hack.

Yes it is possible see a two person chat by hacking the pseudo terminals. The steps are shown below.

Wednesday, February 22, 2012

Setup Turbo C++ Lab for testing

Hello there,
Lets start the C Graphics series with setting up your Turbo C++ lab for testing the programs. Turbo c++ compiler is a widely used compiler before the current fancy GUI compilers. It is not longer used to develop large applications. However for c programming language practice purpose, it is still being used in engineering class labs and personal computers. Our focus is to provide program and technique which can be used in another fancy compilers as well.

all you require is

Pseudo terminal hack in Linux

Hello all,
Lets see interesting demo on posting message into pseudo terminals of another user. There may be cases where there are multiple user logged in a linux machine as a root and you want to convey some message to a user. For example, may be you require to kill a process which is owned by a terminal and you want to convey that to the terminal owner before you process. Or think about any practical use case which you might come across. You are not sure where the user is located or working from. He may be in office or at home. It is quite difficult to identify using the ip address from where he is logged in. Since the login user name is root, it is also difficult to find out who is he. Here i am trying to post a hack, please use it for ethical purpose only. since this causes inconvenience to the users logged in that machine..

First, check how many users are logged in. "who" command lists the users logged in. There are 3 users are logged in.


Currently for demo purpose I connected 3 sessions from the same machine to remote host. so it is showing same ip address in the list. ( in real case, the ip list may vary, as sending message to your terminal doesnt make sense, isnt it ? )

Friday, February 17, 2012

How to find machine architecture in Linux ?

Run the following command to get the hardware or machine architecture( 32bit or 64bit).
uname, arch and getconf commands can be used for this purpose.

The output of these command is 64bit machine is shown here.

linux # uname -m
x86_64

linux # arch
x86_64

linux # getconf -a | grep LONG_BIT
LONG_BIT 64

The same command output shown in 32bit machine.

Thursday, February 16, 2012

which rpm package file belongs to ?

How to find which rpm package owns a file?

To know this, run the following command.

rpm -qf [full path of the file]

For example:
[root]# rpm -qf /usr/lib64/libpthread.so
glibc-devel-2.12-1.47.el6.x86_64

Wednesday, February 15, 2012

Boeing Trip last weekend - My first Java script Album


I had been to Boeing Future flights Trip. It was awesome to watch flights assembling. Amazing really. sharing that experience here. Along with this I would like post this as album. This is written using java script and css. I will be posting how to create own album in your blogger soon. Click the Images below to see the effect.


where is size_t defined ?

Many functions uses size_t to make consistence in referring size. size_t is defined in the following header. ( These headers details are taken from RHEL  )


32bit i686 architecture:
/usr/lib/gcc/i686-redhat-linux/4.4.4/include/stddef.h
#define __SIZE_TYPE__ long unsigned int
typedef __SIZE_TYPE__ size_t;


64bit x86 architecture:
/usr/lib/gcc/x86_64-redhat-linux/4.4.5/include/stddef.h
#define __SIZE_TYPE__ long unsigned int

Monday, February 13, 2012

C Graphics Programming - Promotion video (Random Bouncing balls with random colours)

Hello Readers,
I hope you are eager to see the kinds of posts that ncooltips presents in this series. I am still working on the content. For now I would like to present a promotion video. This video shows "Random Bouncing balls with random colours using C Graphics in Windows Turbo C++". Hope you like it.


Please leave some comments behind.

Saturday, February 11, 2012

C-Graphics Programming Series Introduction


Hello Readers..
'N'Cooltips introduces a new series which covers Graphics programming in C. This series covers various topics of C-Graphics starting from Basics to Advanced. Soon we present interesting C-Graphics programs in this series. The image in this post is a sample Graphics output generated by C program in Windows. I hope really you enjoy reading this series.

To understand and to get depth of the programs, We except Reader should know the Basics of C program. Since Graphics is a such a topic, It requires basic mathematics to draw objects (rectangle,circle, etc). But as we go more in detail to generate animations, writing simple Games - expectations from the user may vary. This requires some advanced mathematics concepts like Curve tracing, x-Y plane, Tita plane , Co-ordinate system ( cartesian and Polar). As said, though it is complex, we will try to present complete program in readable manner so that you really no need to worry about the internals. But having these knowledge really adds value to explore more programs yourself. Lets not make the introduction complex - DOT.

Visit the C-Graphics page for examples. Or click here

Please leave your comments behind.

Link text move effect in web pages using Java script and CSS


I was trying to create a page for C-Graphics , the new series which I will be publishing soon.I thought that lets try to create some animated link in that page, I tried link text move effect using java script and css. I am providing that details here, may be useful for you to create good looking web pages with animated links

The effect is shown on the following link. To see the effect - place mouse over the link.




nCoolTips




The java script code is shown below. and It is given with example html file. Hope you like it.
<!-- text move effect presented by www.ncooltips.com -->
<html>
<head>
<style type="text/css">
p
{
position:absolute;
}
</style>

<script type="text/javascript">
i=0;
k=0;
t=0;

function movepos2()
{

if( t == 1 ) {
   document.getElementById("manu").style.left=k+"px";
   k++;
   }
}


function movepos()
{

 var i=0;
 t=1;
 k=10;

 for(i=0;i<20;i++) {
 setTimeout("movepos2()",i*20);
 }
}

function resetpos()
{
 k=0;
 t=0;
 document.getElementById("manu").style.left="10px";
}
</script>
</head>

<a href="_black"><p id="manu" onmouseover="movepos()" onmouseout="resetpos()">Linux Cool Tips</p></a>
</body>
</html>

Friday, February 10, 2012

Evening walk at Renton landing ( and CSS )



CSS (cascading style sheet)  is awesome, one can tweak web page and its element as per the wish. I love it. Here I tried to use css to show the album. Now it looks nice :-) (W58WN2KCZQXC)

These pictures captured by Praveen on an evening walk towards renton landing. That was a fully sunny day.

Thursday, February 2, 2012

Syntax Highlighters - richer code snippets in post


I have been looking for some enhancements in my postings, One of them is the code high lighter.It adds good look to post which contains code snippet. It is really cool using these code highlighters.

Thanks for the 'Syntax highlighter'. Here is the sample code snippet.


Let me know if you need the usage. I can help , of course google always.. :-)

Wednesday, February 1, 2012

Power of Proc-8: Details of a process current status

Have you ever tried these without using gdb and ps in Linux ..
1. How many threads a process has ?
2. is any one tracing the process ?
3. what is current Process state ?

Here we go. Before going into details, The all commands are experimented on Linux version 2.6.32 x86_64 and RHEL61.

Proc file system provides all information about a process current state. These details can be seen by looking at the file "/proc/[pid]/status".
Most of these details provided here can also be seen in "ps" command output and also using gdb.