Tuesday 30 September 2014

Inconvience Ahead

Hi, guys. I am gonna change the layout and the structure of the blog in a couple of days. So, if you are not able to visit my site or cannot find a blog post or it's just plain simple weird showing on your browser. Then, need not worry it will all be fixed in 3-4 days.

I got a really bad review from my sister about the blog design (She already has her own website). So, let me tweak it up a bit.

Sorry for the inconvenience.

Wednesday 24 September 2014

C Language Tutorial Series Part 1

Hi, long time no see. So, here we are on the C language tutorial  part 1. This is a tutorial, a crash course in C and nothing else. I am not gonna detail on how to get C compiler and how to run the compiled code. This tutorial would be based on examples and not much explanation would be given.

Here are a few things to note, before we get started:

NOTE: These things should not be forgot and paid attention to.

TIPS: These things are little tricks that you could use (optional stuff).



YOUR FIRST PROGRAM: (Why is it the Hello World Program???)
Well, let's get started. The first program is:
#include <stdio.h>
int main() {
    printf("Hello World!\n");
    return 0;
}
 Here's the explanation:

1. The statement #include <stdio.h> is used to import the contents of the file stdio.h. This file contains most commonly used functions and variables that we are going to use.

2. The statement int main() { } defines a function named main with the return type int (Integer, a number with no decimal point like 23, -97, etc...). It takes no parameters as indicated by empty round brackets().

NOTE: Return type means that if the system ran this program, then the program upon completion would return an integer.

NOTE: All functions must have 4 components:
1. A return type (if the function does not return anything, then return type is void)
2. A name (The name must not begin with a number or any special character; it can begin with an underscore and the name must not be something that C uses)
3. Parameters (The round brackets can contain parameter that the function requires to run, if the function does not require parameters, then simply keep the brackets empty or write void)
4. The body of the function must be enclosed in curly brackets{} (The brackets should be one before the function block and one after the function block)

TIPS: main can have arguments, then main becomes int main(int argc, char* argv[]). By giving main parameters, it means that the program requires some extra input to run. In that case, argv[0] points to name of the program and the options start from argv[1]. This means that argc becomes 2 if there is only one option, 3 if there are two options and so on.

3. The statement printf("Hello World\n") prints the string "Hello World!" on screen. "\n" stands for new line. It means that the if your do another printf, then the output goes to the next line (Think pressing Enter/Return Key on your keyboard).

4. The statement return 0 is the end of the main function. As defined, main should return an int, so we choose zero (basically, it could be anything you want, but it's standard practice to put zero).

The reason for doing this program as the very first program is that it clearly shows the syntax of the language.

Here's a sample run of the program:



CALCULATOR v1.0:
Well, then now you can print stuff on screen. How about we do a little math. Here is the code:
#include <stdio.h>
int main() {
    float c = 0.0;
    float a, b;
    printf("Enter a number: ");
    scanf("%f", &a);
    printf("Enter another number: ");
    scanf("%f", &b);
    printf("Addition: %0.2f\n", (a+b));
    printf("Subtraction: %0.2f\n", (a-b));
    printf("Multiplication: %0.2f\n", (a*b));
    printf("Division: %0.2f\n", (a/b));
    printf("Remainder(Integer Division): %d\n", ((int)a%(int)b));
    printf("Multiply first number by 23: %0.2f\n", (a*23));
    printf("Multiply number 12 by 13: %d\n", (12*13));
    return 0;
}
 Here's the explanation:

 Everything up to main is the same.

1. The line float c = 0.0 and float a, b declare variables a, b and c. Think of variables as boxes in which you put stuff in. float(Numbers with decimal points like 2.3, -9.87, etc..) here refers to the data-type of the stuff we want to put. As you can see, we can give value to variable at the time of declaration if we want.


NOTE: The standard data types are:
1. char
2. short
3. int
4. long
5. float
6. double


The printf just containing strings are the same as before.

2. The line scanf("%f", &a) is used to get a value from the user (basically the keyboard) and then put that value in a.

3. The printf from line 9-14 are different from what you used earlier. The %0.2f used prints the contents of the calculations done after the comma in the string and writes that to the screen as a float with only 2 digits after the decimal point. The %d is used to print integer values (no decimal points). %c is used to print characters.

NOTE: If you just use %f in printf, then you might get a long list of trailing zeroes.


4. The part ((int)a%(int)b) in line 13, first converts variable a (float) into an integer. The same goes for variable b and then perform integer division (just gives the remainder after dividing).

Here's a sample run of the program:




NOTE: Be careful with the input, you might get a floating point exception (more on that in part 2).

Now, continue to part 2. As always thanks for reading and please comment (if you get any problems or not).

Tuesday 27 May 2014

Puzzle Game in VLC

Yo, now most of us like games. I really do. Most of have VLC Media Player to play videos. But, did you know that you can combine the two.

No, it's no joke. VLC comes with a setting with which you can transform any video into an interactive puzzle game. The steps are pretty simple. So, here is the how-to:
  • Start VLC Player
  • Play any video file
  • Click on Tools
  • Click on Effects and Filters (or you can just press Ctrl + E)
  • Click on Video Effects tab
  • Click on Geometry Tab
 
  • See, that there is tick box for Puzzle Game
  • Tick that Box
  • Press Close
  • Pause the video and play the puzzle.
The puzzle has to be played with the mouse. To play the video, just un-pause the video. As simple as that. Now, you can play a simple puzzle with your favorite movie characters.


Here is a screenshot of me playing puzzle to "42 Ways to Die in Minecraft". I did this on Windows, so if this does not work out for you, then please comment.

Thanks for reading and as always please comment.

Play Tetris on uTorrent

Yep, You read that right. uTorrent is the most populer (as far I know) torrent client, used by thousands of people world wide to download mostly anything from torrent sites.

We are not here to discuss the pros and cons of uTorrent. We are here to play tetris on it.
Yup, it sounds weird but it is true. So, here is the how-to:
  • Start uTorrent
  • Click on Help
  • Click on About
  • Now click inside the About dialog box
  • Press "t" and start playing tetris
    So, now you can play tetris while waiting for your download to complete. A good way to pass the time. Tetris can be played with the arrow keys but you cannot drop tiles with spacebar (so don't press spacebar). I have used Windows, so if this does not work, then please comment.

    As Always, Thanks for reading and please comment.

    Turn your Web Browser into a Calculator

    Hey, there. I know I have been gone a long while now. College. But, I still surfed the net and for you guys found a new neat trick.

    As the title tells you can convert your web browser into a handy calculator. Now, don't go jumping and start finding complex calculations. I mean, dude, it does not go beyond a simple calculator. So, without further ado, here is the how-to (rhymes):
    • Start your web browser
    • Start console (If there are many consoles, just start any one. I used Web Console.)
    • Now, just do your calculations..

    I just tested it out with firefox portable. Now, I am gonna list shortcuts to open the console for the three most commonly used web browsers. Sorry, can't list them all.

    For Firefox, press Ctrl + Alt + K

    For Google Chrome, press Ctrl + Alt + J

    For Opera, press Ctrl + Alt + I

    If you are using the Mac Keyboard, then replace Ctrl with Command.

    As Always, thanks for reading and please comment. If I have made a mistake, then please let me know by commenting below.

    Monday 14 April 2014

    How To Watch Age Restricted Youtube Videos

    Hey, there. How many of you went to Youtube and saw this


    I know, it is very annoying. You know, I just wanna watch one video and don't want the hassle of logging in every time something like this pops up.

    So, the question is HOW DO YOU REMOVE THIS?

    It's basically simple, all you have to do is:
    • Look at the address bar, it is something like
    youtube.com/watch?v=something_here
    • Change that to
    youtube.com/v/something_here
    And now you can watch, most restricted videos. If this does not work for you or I have made some mistake, then please comment.

    NOTE: To pull this off, I used Mozilla Firefox and it worked.

    As always thanks for reading and please comment. 

    Monday 7 April 2014

    Hide Files and Folder from SpotLight Search

    This trick is for Mac users only. Now, guys everyone knows about spotlight. That handy dandy little app on the top right of the screen. This app is basically used to search the system for most of the things.

    So, its basically like a system wide search and you can't hide files (this I have encountered personally). So the question which you should ask or have been asking is: How, do you hide files then. This little how-to is here to help.

    There are a couple of tricks for that and I am gonna list them one-by-one and also let you know which is the more efficient.


    Hide a folder and keep your files in it

    To do this, all you need to do:
    • Make a new folder and add ".noindex" to the folder name.
    If you are gonna use an existing folder, then
    • Highlight the folder
    • Press Enter
    • Now type ".noindex" at the end of the foldername
    Now, shift your files in this folder. This basically hides the folder but this folder still shows up in Finder. If someone starts searching with the exact file name, then it might show up in spotlight.


    Hide Files

    To do this, just do:
    • Highlight the file
    • Right-Click and click Get Info or press Command-I
    • Now go to Name & Extension field
    • Add ".noindex" to the end of the file name
    • Mac might ask you to choose the extension, then choose ".noindex"
    This works, but fails miserably when you have a huge amount of files to hide.


    Hide Files in Library Folder

    This is tricky. Library is a folder but it does not even show up in the Finder. To actually go there do,
    • Start Finder
    • Hold option and click on Go in the menu bar
    • Now, you see Library (usually it does not show up) and click on it
    Once Library comes up, you could hide your files by shifting them here.


    Configure Spotlight

    This is the last option,
    • Click on the Apple Icon
    • Click on System Preferences
    • Under Personal Tab, Click on Spotlight

    • Now click on the Privacy tab






    • Click the plus sign (it's on the lower-left side)
    • Now choose the folder you want to hide
    Or you could just drag and drop the folders in it

    Sorry, but you cannot hide individual files by using this method. 

    Well, these were the methods I could find. So, if your trick is not mentioned here, then please comment and let us all know.

    As Always thanks for reading and please comment.

    Stuff that most try to do