Friday, November 26, 2010

Hack-Alert !


       We all know that there are in-numerous ways of hacking and most of us know only as much as a drop in the ocean. Finding out our own possible way is a different thing.
      Anyways, lets add a drop to our knowledge to keep safe from a hack that can be performed from the system we are working on. Strange! But easily possible. When no one is safe on the internet, how can it be that someone can't fool us on the very host we are working on.
OK, so lets get on to the way. One of the hack recipe we should always be aware and beware of!
     Prevention:- Let's know the prevention measure first! Knowing this would be enough to save ourselves from the hack. The question is:- While logging in to our favorite email or any other website, how many of us actually take trouble to read the URL of the web-page? Well, a few of us do but most of us don't! We should make sure that the URL we are going to is a genuine URL and not a 'faked' one. This will prevent us from being a victim. Because the hacker here makes a log-in web-page that looks exactly the same as the email or some other website's log-in page; we log in entering our id and password and when the form is submitted, the secret data actually goes into the hackers intended file and then redirects the us to the original web-page giving an idea that we entered the form incorrectly.
     Cure:- Another way is to check. If we notice that we have entered a correct/incorrect id/password and the log-in fails without displaying errors in the wrong field(s), then probably our data is no more secret and we must change the id/password in the very next log-in.
     Such coding can be easily done using any of the scripting languages. The main (bad) idea is just to steal the data from input fields and put it elsewhere misguiding the victim.
     So we must make sure that we are always alert, while logging in, especially when we go to a browsing center. I came to know about this threat (phishing scam) in an amazing workshop given by Sunny Vaghela, but yesterday only I understood its working, when I created it successfully using PHP.

Thursday, November 25, 2010

The Cartoon Week



Everyone this week, is having a great time on facebook putting on their favorite cartoon characters as their display picture. So I'd like to take this post to share some of the the all time famous and favorite Disney Characters that I created using the Microsoft Paint application. It is actually quite simple to create these characters using the paint application using the existing tools, especially when you have the draw-curve tool.

Starting with the mickey mouse.



 
Mickey  Mouse
 
Goofy
 
Little Donald
Daisy
Uncle Scrooge
Launchpad McQuack
Ducktails: Huey

Tuesday, November 16, 2010

File Read/Write through C/C++


A few of my friends keep asking me about working with C/C++ , and consider me to have a good command over the language ( C++ ). However, this is not completely true, even though I am practicing it for past 5 years, there are still is a lot of thing to be known. 
The First and foremost thing to be comfortable with any language is to get used to working on its IDE (Integrated Development Environment), just like we learn how to float before we learn to swim. For C++ , the Turbo C++ IDE is quite common, and very good for practicing.
And of course practicing it regularly is the most important aspect of learning. One may read hundreds of books remember thousands of things, but that is different from actually practicing it.
So coming to the point. There was a problem to be solved using C language, in a test conducted by a renowned IT Company. The problem statement was:
"Write a Program in C, which should
  1. Read a text file, say "input.txt"
  2. Cut of the extra white spaces.
  3. Write it again to another file, say "output.txt". "
It was to be solved within 15-20 minutes, and most of the aspirants including me could not complete the task. After that my friend and I found a correct solution to the problem.
To solve the problem it may be divided into three parts, and the complete solution can be obtained by putting them together.


PART I: To read a file.
Firstly, make use of FILE structure that acts as a link between your program and the operating system.
(A FILE structure can store the details of the file being used.)
Then declare two FILE structure pointer variables as you need to open 2 files(one for input and the other for output. A FILE pointer variable can store the address of the structure FILE which is found in header file "stdio.h". And to open the file(s) ( input and output ) function fopen("filename","mode") can be used. It returns File pointer variable ). Syntax:  FILE *p; p=fopen("abc.txt","rt");

PART II: Get characters from the opened file.
To get a character from the text file, the function fgetc() can used. ( Its details can be known by taking the cursor to fgetc() in Turbo C++ IDE and pressing Ctrl+F1.)
And once character ch=fgetc() is fetched, logical statements can be used to decide whether the character is to be kept in the output file or not. Then comes the next part that is writing it to another file.

PART III: Write in the output file character by character.
For this the file which the same FILE structure pointer (a new one) can be used and the function fputc() can be used to write the character.

After combining all these parts, the program required is ready!


# include "stdio.h"
# include "stdlib.h"
void main()
{
    FILE *input,*output;
    char ch;
    input = fopen("input.txt","rt");
    output = fopen("output.txt","wt");
    if(input ==NULL)
    {
        printf("file can not open.");
        exit(1);
    }
    int count=0;
    do
    {
        ch=fgetc(input);
        if(ch==' ')
        {   count++;
            if(count==1)
             { fputc(ch,sec);
             }
        }
        else
        {
          fputc(ch,output);
          count=0;
        }
    }while(ch !=EOF);
    fclose(input);
    fclose(output);
}

Sunday, November 14, 2010

Knowledge is a waste, if not put into practice.


Aloha!!

There is a beautiful sentence: "To know is to live". Knowing is living. If we do not live all that which we know, all that we know just remains as knowledge. It is when we put this knowledge into practice, we make actual living. So truly, Knowledge is a waste, if not put into practice. I made these words to be a part of this blog post as an apology for being unjust to it. For not continuing to post a single blog for months. For not spending time that I should have spent here. 
Today I realized my fault, so I came back to put a small effort to correct that.


To continue a  good habit, needs a consistent effort. The time to start that effort is now. So just as a new beginning to the blog I would like to jot down some great quotations I recently read and heard about, that prepared me to write this blog.

The First one is: "If you live each day as if it was your last, someday you'll most certainly be right." ; which I read from an article based on Steve Jobs' Commencement addressing speech(2005) for the Stanford University.

The second one, I heard of today in an awesome interactive session held in my college. It was : "Every day is a new learning.". Correctly said, "If we didn't learn anything today, we did not grow. And if we did not grow, we are just the same as we were yesterday. We did not live today!". So each and every day there has to be something that we learn so that we can tell ourselves that we are today something better than what we were yesterday, and continue the process lifelong. Also, I heard about a very good book by Stephen Covey called "7 habits of highly effective people.", hoping to read that soon.  

For everyday of life there is something to be learned. And today, with the help of my friend who is a wonderful blogger, I learned to successfully add a side button ( as a link for Facebook and Twitter) to my blog.

So with a desire to continue this journey of learning, I end this note with a self-assurance to continue this blog with 'knowledge put into practice stuffs', as soon as possible.

Adios!