Friday, October 30, 2009

Linking and configuring OpenCV with Visual C++ .Net

In my eailer posts I have written how to Link Opencv Library in VC++ visula studio 6 and in Bloodshed's DEVC++. Now we will learn how to Link and configue OpenCV with Visual C++ .Net.

Linking DLLs:

•    To permanantly include necessary dll files, add "C:\Program Files\OpenCV\bin" to PATH by visiting Advanced tab in System of Windows (the locate of directory might be different).
•    One can just copy necessary dll files into project directory with source files.

Customize Global Options:
•    Open the Visual C++ .Net Application. In the menu bar, select Tools->Options
•    In the listing, choose Projects->VC++ Directories.
•    First, select Library files from the "Show Directories for" List Box.
•    Click the Insert New icon, and locate the folder where you have installed opencv.
•    Consider that it is installed in "C:/Program Files/OpenCV".
•    In the Library files list, locate and add:
"C:\Program Files\OpenCV\lib"


•    Now choose Include files in the list box, and locate and add the following directories:
        "C:\Program Files\OpenCV\cv\include"
        "C:\Program Files\OpenCV\cxcore\include"
        "C:\Program Files\OpenCV\otherlibs\highgui"
        "C:\Program Files\OpenCV\cvaux\include"
        "C:\Program Files\OpenCV\otherlibs\_graphics\include



  • Next, choose source files in the list box, and locate and add the following directories:
        "C:\Program Files\OpenCV\cv\src"
        "C:\Program Files\OpenCV\cxcore\src"
        "C:\Program Files\OpenCV\cvaux\src"
        "C:\Program Files\OpenCV\otherlibs\highgui"
        "C:\Program Files\OpenCV\otherlibs\_graphics\src"

Now click OK in the Options dialog.
•    You have successfully configured the global settings.
Create New Project:
•    Within Developer Studio create new application:
•    Select from menu "File"->"New..."->"Projects" tab.
•    Choose "Win32 Application" or "Win32 console application" - the latter is the easier variant and both the sample projects have this type.



Type the project name and choose location
•    Click Ok.. In the Application Wizard, Just click Finish. 

Nokia Codes Tips and Tricks

IMEI number: * # 0 6 #
Software version: * # 0 0 0 0 # or * # 9 9 9 9 # or * # 3 1 1 0 #
Simlock info: * # 9 2 7 0 2 6 8 9 #
NOKIA 3330
*#06#
This will show your warranty details *#92702689#
*3370#
Basically increases the quality of calling sound, but decreases battery length.
#3370#
Deactivates the above
*#0000#
Shows your software version
*#746025625# This shows if your phone will allow sim clock stoppage
*4370#
Half Rate Codec activation. It will automatically restart
#4370#
Half Rate Codec deactivation. It will automatically restart
Restore Factory Settings
To do this simply use this code *#7780#
Manufacturer Info
Date of Manufacturing *#3283#
*3001#12345# (TDMA phones only)

press and hold # Lets you switch between lines

NOKIA5110/5120/ 5130/5190


IMEI number: * # 0 6 #
Software version: * # 0 0 0 0 #
Simlock info: * # 9 2 7 0 2 6 8 9 #
Enhanced Full Rate: * 3 3 7 0 # [ # 3 3 7 0 # off]
Half Rate: * 4 7 2 0 #
Provider lock status: #pw+1234567890+ 1
Network lock status #pw+1234567890+ 2
Provider lock status: #pw+1234567890+ 3
SimCard lock status: #pw+1234567890+ 4
NOKIA 6110/6120/6130/ 6150/6190
IMEI number: * # 0 6 #
Software version: * # 0 0 0 0 #
Simlock info: * # 9 2 7 0 2 6 8 9 #
Enhanced Full Rate: * 3 3 7 0 # [ # 3 3 7 0 # off]

(11) #pw+1234567890+ 4# SIM Card Lock Status. (use the "*" button to obtain the "p,w" Go to Top
and "+" symbols).

(12) *#147# (vodafone) this lets you know who called you last.

(13) *#1471# Last call (Only vodofone).

(14) *#21# Allows you to check the number that "All Calls" are diverted to

(15) *#2640# Displays security code in use.

(16) *#30# Lets you see the private number.

(17) *#43# Allows you to check the "Call Waiting" status of your phone.

(18) *#61# Allows you to check the number that "On No Reply" calls are diverted to.

(19) *#62# Allows you to check the number that "Divert If Unreachable (no service)" calls
are diverted to.

(20) *#67# Allows you to check the number that "On Busy Calls" are diverted to.

(21) *#67705646# Removes operator logo on 3310 & 3330.

Few more codes

(3) *#4720# Activate Half Rate Codec - Your phone uses a lower quality sound but you should gain approx 30%

more Talk Time.

(4) *#4720# Deactivate Half Rate Codec.

(5) *#0000# Displays your phones software version, 1st Line : Software Version, 2nd Line : Software Release

Date, 3rd Line : Compression Type.

(6) *#9999# Phones software version if *#0000# does not work.

(7) *#06# For checking the International Mobile Equipment Identity (IMEI Number).

(8) #pw+1234567890+ 1# Provider Lock Status. (use the "*" button to obtain the "p,w"
and "+" symbols).

(9) #pw+1234567890+ 2# Network Lock Status. (use the "*" button to obtain the "p,w"
and "+" symbols).

(10) #pw+1234567890+ 3# Country Lock Status. (use the "*" button to obtain the "p,w"
and "+" symbols).


This will put your phone into programming mode, and you'll be presented with the programming menu.
2) Select "NAM1"
3) Select "PSID/RSID"
4) Select "P/RSID 1"
Note: Any of the P/RSIDs will work
5) Select "System Type" and set it to Private
6) Select "PSID/RSID" and set it to 1
7) Select "Connected System ID"
Note: Enter your System ID for Cantel, which is 16401 or 16423. If you don't know yours,
ask your local dealer for it.
8) Select "Alpha Tag"
9) Enter a new tag, then press OK
10) Select "Operator Code (SOC)" and set it to 2050
11) Select "Country Code" and set it to 302 for Canada, and 310 for the US.
12) Power down the phone and power it back on again
ISDN Code
To check the ISDN number on your Nokia use this code *#92772689

Set any video as your desktop wallpaper.

This is a pretty simple trickk using which you can set any video as your desktop wallpaper.

Just follow the steps given below:

1.Download VLC Media Player and install it.
http://www.videolan.org/vlc/download-windows.html

2.Run VLC media player,go to Settings->preferences->Interface->Main interfaces,then click on wxWidgets.Remove the tick on "Taskbar" and put a tick on "Systray icon".

FOR Version 9.6+ of VLC -  ,go to Tools->Preferences->Video,then put a tick on "Enable wallpaper mode ".

3.Now go to Video->Output Modules->DirectX.On the bottom right put a tick on advanced options check box.You will now see some options.Put a tick on "Enable Wallpaper Mode ".

FOR Version 9.6+ of VLC :- Just go to Video and check "DirectX Wallpaper".


4.Now,select playlist and put a check or tick on "Repeat current item ".
FOR Version 9.6+ of VLC :- You don't need this step.

5.Press the Save button.Now close the VLC player and run it again(to save the settings permanently).

6.Now play any video you would like to set as Wallpaper.Right click on the video and click on "Wallpaper".The video would be set as your wallpaper!!!!
FOR Version 9.6+ of VLC:-  check "DirectX Wallpaper".


Since you have checked the option "repeat current item ",the selected video will play on continuously.It will start again when finished.VLC player will remain in your system tray.If you wish to remove the wallpaper simply close the player and you will get back your original wallpaper.

Microsoft Windows Run command

On the Microsoft Windows operating system, the Run command is used to directly open an application or document whose path is known. It functions more or less like a single-line command line interface.

Starting with Windows 95, the Run command is accessible through the Start menu and also through the shortcut key. (Windows key + R).

Although the Run command is still present in Windows Vista, it no longer appears directly on the Start menu by default, in favor of the new search box and a shortcut to the Run command in the Accessories sub-menu.

 Here is the list of run commands :-


# Accessibility Controls - access.cpl
# Accessibility Wizard - accwiz
# Add Hardware Wizard - hdwwiz.cpl
# Add/Remove Programs - appwiz.cpl
# Administrative Tools - control admintools
# Automatic Updates - wuaucpl.cpl
# Bluetooth Transfer Wizard - fsquirt
# Calculator - calc
# Certificate Manager - certmgr.msc
# Character Map - charmap
# Check Disk Utility - chkdsk
# Clipboard Viewer - clipbrd
# Command Prompt - cmd
# Component Services - dcomcnfg
# Computer Management - compmgmt.msc
# Control Panel - control
# Date and Time Properties - timedate.cpl
# DDE Shares - ddeshare
# Device Manager - devmgmt.msc
# Direct X Troubleshooter - dxdiag
# Disk Cleanup Utility - cleanmgr
# Disk Defragment - dfrg.msc
# Disk Management - diskmgmt.msc
# Disk Partition Manager - diskpart
# Display Properties - control desktop
# Display Properties - desk.cpl
# Dr. Watson System Troubleshooting Utility - drwtsn32
# Driver Verifier Utility - verifier
# Event Viewer - eventvwr.msc
# Files and Settings Transfer Tool - migwiz
# File Signature Verification Tool - sigverif
# Findfast - findfast.cpl
# Firefox - firefox
# Folders Properties - control folders
# Fonts - control fonts
# Fonts Folder - fonts
# Free Cell Card Game - freecell
# Game Controllers - joy.cpl
# Group Policy Editor (for xp professional) - gpedit.msc
# Hearts Card Game - mshearts
# Help and Support - helpctr
# HyperTerminal - hypertrm
# Iexpress Wizard - iexpress
# Indexing Service - ciadv.msc
# Internet Connection Wizard - icwconn1
# Internet Explorer - iexplore
# Internet Properties - inetcpl.cpl
# Keyboard Properties - control keyboard
# Local Security Settings - secpol.msc
# Local Users and Groups - lusrmgr.msc
# Logs You Out Of Windows - logoff
# Malicious Software Removal Tool - mrt
# Microsoft Chat - winchat
# Microsoft Movie Maker - moviemk
# Microsoft Paint - mspaint
# Microsoft Syncronization Tool - mobsync
# Minesweeper Game - winmine
# Mouse Properties - control mouse
# Mouse Properties - main.cpl
# Netmeeting - conf
# Network Connections - control netconnections
# Network Connections - ncpa.cpl
# Network Setup Wizard - netsetup.cpl
# Notepad notepad
# Object Packager - packager
# ODBC Data Source Administrator - odbccp32.cpl
# On Screen Keyboard - osk
# Outlook Express - msimn
# Paint - pbrush
# Password Properties - password.cpl
# Performance Monitor - perfmon.msc
# Performance Monitor - perfmon
# Phone and Modem Options - telephon.cpl
# Phone Dialer - dialer
# Pinball Game - pinball
# Power Configuration - powercfg.cpl
# Printers and Faxes - control printers
# Printers Folder - printers
# Regional Settings - intl.cpl
# Registry Editor - regedit
# Registry Editor - regedit32
# Remote Access Phonebook - rasphone
# Remote Desktop - mstsc
# Removable Storage - ntmsmgr.msc
# Removable Storage Operator Requests - ntmsoprq.msc
# Resultant Set of Policy (for xp professional) - rsop.msc
# Scanners and Cameras - sticpl.cpl
# Scheduled Tasks - control schedtasks
# Security Center - wscui.cpl
# Services - services.msc

# Shared Folders - fsmgmt.msc
# Shuts Down Windows - shutdown
# Sounds and Audio - mmsys.cpl
# Spider Solitare Card Game - spider
# SQL Client Configuration - cliconfg
# System Configuration Editor - sysedit
# System Configuration Utility - msconfig
# System Information - msinfo32
# System Properties - sysdm.cpl
# Task Manager - taskmgr
# TCP Tester - tcptest
# Telnet Client - telnet
# User Account Management - nusrmgr.cpl
# Utility Manager - utilman
# Windows Address Book - wab
# Windows Address Book Import Utility - wabmig
# Windows Explorer - explorer
# Windows Firewall - firewall.cpl
# Windows Magnifier - magnify
# Windows Management Infrastructure - wmimgmt.msc
# Windows Media Player - wmplayer
# Windows Messenger - msmsgs
# Windows System Security Tool - syskey
# Windows Update Launches - wupdmgr
# Windows Version - winver
# Windows XP Tour Wizard - tourstart
# Wordpad - write

Windows DOS commands VS unix commands

Hi all this is a comparison of DOs commands VS unix commands. As contary to Unix commands Doc commands are not that much famous. But this table will help you to compare the commands and to use them.

DOS Command
UNIX or Bash Command
Action
DIR
ls -l (or use ls -lF)(-a all files)
(df -k Space remaining on filesystem)
List directory contents
DIR *.* /o-d
DIR *.* /v /os
DIR /s
DIR /aa
ls -tr
ls -ls
ls -R
ls -a
List directory contents by reverse time of modification/creation.
List files and size
List directory/sub-directory contents recursively.
List hidden files.
TREE
ls -R
List directory recursivly
CD
cd
Change directory
MKDIR
MD
mkdir
Make a new directory
ASSIGN
ln
Create a file or directory link
RMDIR
RD

rmdir
Remove a directory
CHDIR
pwd
Display directory location
DEL
ERASE
rm -iv
Remove a file
RMDIR /S (NT)
DELTREE (Win 95...)
rm -R
Remove all directories and files below given directory
COPY
cp -piv
Copy a file
XCOPY
cp -R
Copy all file of directory recursivly
RENAME or MOVE
mv -iv
Rename/move a file
TYPE
cat
Dump contents of a file to users screen
MORE
more
Pipe output a single page at a time
HELP or COMMAND /?
man
Online manuals
CLS
clear
ctrl-l
Clear screen
EXIT
EXIT0
exit
exit 0
Exit a shell
FIND
FINDSTR
grep
Look for a word in files given in command line
COMP
diff
Compare two files and show differences. Also see comm, cmp, mgdiff and tkdiff.
FC
diff
Compare two files and show differences. Also see comm, cmp, mgdiff and tkdiff.
SET
set and env
List all environment variables
SET variable=value
echo %variable%
set
export variable=value
echo $variable
Set environment variables
Show environment variables
ECHO text
echo text
Echo text to screen
SET variable
setenv (for C shell) or export VAR=val (for Korn shell. Also VAR=val)
Set environment variables
PATH
PATH %PATH%;C:\DIR
echo $PATH
PATH=$PATH:/dir
Display search path for executables.
Set PATH environment variable.
PROMPT $p$g
export PS1='\h(\u)\W> '
Set user command prompt.
DATE or TIME
date
Show date. (also set date - DOS only)
DOSKEY /h
history
List command history
DOSKEY NAME=command
alias NAME=command
Set command alias
BREAK ON
trap
Trap ctrl-break / Trap signals.
SORT
sort
Sort data alphabetically/numerically
EDLIN
ed
Line mode editor
EDIT filename.txt
pico, gnp, vi, xedit, xemacs,dtpad
Edit a file. The Linux editor which looks most like DOS edit is probably Pico. (Not a recomendation!)
BACKUP files A:\
tar -cvf /dev/fd0 files
mdir, mcopy
doswrite -a file (AIX only)
Save files to floppy.
See Using DOS floppies
RESTORE A:\ files
tar -xvf /dev/fd0 files
mdir, mcopy
dosread -a file (AIX only)
Read files from floppy.
See Using DOS floppies
ATTRIB [+r|-r] [+a|-a] [+s|-s] [path\file] /s
chmod
Change file permissions. DOS: +:set to -:remove r:Read only a:Archive s:System /s:recursively
ATTRIB +h or -h
mv file .file
Change file to a hidden file - rename file with prefix "."
PRINT
lpr
Print a file
CALL
COMMAND /C (DOS), CMD (NT)
source script (cshrc)
. script (bash)
sh script
Execute script from within batch shell.
MEM
free
top
Show free memory on system
TASKLIST (WIN2K, XP)
ps -aux
top
List executable name, process ID number and memory usage of active processes
MSD
lsdev
Show system info (Command borrowed from AIX)
SCANDISK
DEFRAG C:
fsck
debugfs
Check and repair hard drive file system
CHDISK
du -s
Disk usage.
FDISK
fdisk
Tool to partition a hard drive.
SUBST V: C:\directory\path
mount
Mount a drive letter to a folder/directory on your hard drive.
FORMAT
mke2fs
See: fdformat and mformat for floppies
Format drive file system.
VER
uname -a
echo $SHELL
cat /etc/issue
Operating system/shell version
pkzip
tar and zip
Compress and uncompress files/directories. Use tar to create compilation of a directory before compressing. Linux also has compress, gzip
HOSTNAME
hostname
Print host name of computer
PING
ping
Send packets to a network host
TRACERT
traceroute
Show routes and router hops to given network destination.
IPCONFIG (NT)
WINIPCFG (Win 95...)
ifconfig
Display/configure network interface
NBTSTAT (Netbios info: -n, -c)
NBTSTAT -a host-name
NBTSTAT -A IP-address
nslookup host-name
host host-name
Print DNS info for host.
ROUTE PRINT
route -n
Print routing table.
NET HELP START
chkconfig --list |grep on
List services.
NET STARTservice-name
NET STOPservice-name
service service-name start
service service-name stop
Start/stop service/daemon.
NET SHARES
df
Show mounted shares/filesystems.
NET SEND (NT)
smbclient -M MS-Windows-host-name
talk
Send pop-up to a MS/Windows PC
Send message to another Unix/Linux user. See YoLinux tutorial
WIN
startx
Start X-Windows.
REBOOT
shutdown -r now
Reboot system.

Open CV Tutorial sample program and Linking Opencv in VC++

This a very basic program which loads an image and show in a window. Though it is simple it will help you to understand how opencv works, what are different structures used in opencv and to to complie  a simple file.

 So lets under the program.

There are mainly 4 libraies in opencv. which are most used. We are using three here
  1. cv - Main OpenCV functions.
  2. cvaux - Auxiliary (experimental) OpenCV functions.
  3. cxcore - Data structures and linear algebra support.
  4. highgui - GUI functions.
// include the open cv libraries
#include "cv.h"
#include "cxcore.h"
#include "highgui.h"


int main()
{
    IplImage *img=0; // declear an IplImage structure pointer "img"
    img=cvLoadImage("test.jpg",CV_LOAD_IMAGE_UNCHANGED);// load test image to img variable

    cvNamedWindow("image",CV_WINDOW_AUTOSIZE);// create window to image
    cvShowImage("image",img);//show image

    cvWaitKey(0);// wait window to close

    cvDestroyAllWindows();//destroy window
    cvReleaseImage(&img);//release the memory occupied by the image

    return 0;
}

Now let us see how to write your 1st image processing program in VC++. For this:-
  • Open the VC++.Goto file menu in top left. Select new. This will open a new window. Select project tab and select "win32 Consol Application".Write any project name and select the destiantion folder.


  • Now click OK. Then you will be greeted with a second window. Select A "Hello World" application and click the finish button.
  •  Select Project|Settings… option.
  • Select the C/C++ tab and the category Preprocessor 
  • Add the following directories to additional include directories
    C:\Program Files\OpenCV\cv\include
    C:\Program Files\OpenCV\otherlibs\highgui
    C:\Program Files\OpenCV\cxcore\include
  •  Select now the Link Tab, category Input.
  • Add to additional library path the following directories
    C:\Program Files\OpenCV\lib

  • Finally select the category General of the Link tab
  • Add the following libraries to library modules 
    cv.lib highgui.lib cxcore.lib cvaux.lib


  • Setup is valid for the current project .Add all these directories to the global search path
    they will always be active each time you create a new project .
  • Now Compile and Run the program.







Linking OpenCV library in DEVC++

Configuration of Dev-C++

OpenCV - OpenCV is a computer vision library originally developed by Intel. It is free for commercial and research use under the open source BSD license.OpenCV provides cross-platform middle-to-high level API that includes about 300 C functions and a few C++ classes. Also there are constantly improving Python bindings to OpenCV, see interfaces/swig/python and samples/python. OpenCV has no strict dependencies on external libraries, though it can use some (such as libjpeg, ffmpeg, GTK+ etc.).


I found opencv very fast as compared to other image processing libraries namely the tool box provided by MATLAB. But to use it you have to learn how to link it in you favorite IDE. In this post I am posting the linking of opencv library in my favorite IDE DEVC++ by BloodShed. Bloodshed Dev-C++ is distributed under the GNU General Public License. and free for use as compared to Microsoft's VisualC++. Moreover it produces a minimal no of file while compiling. One other feature of DEVc++ is that it is easy to link opencv in it.

For this tutorial I assume that you have installed opencv in C:\ drive of WINDOWS.

[NOTE- For OpenCV 2 or Higher versions see here how to integrate it with DEV C++ ]

In Dev-C++ open the menu "Tools->Compiler options".
In the first tab("Compiler") you need to check the box "Add these commands to the linker command line" and type the following line in the text bow below:
-lhighgui -lcv -lcxcore -lcvaux -lcvcam




Go to the sub-tab "Libraries" in the tab "Directories" and add there C:\Program Files\OpenCV\lib to the paths:



Now switch to the sub-tabs "C Includes" and "C++ Includes" and add this paths:
C:\Program Files\OpenCV\cxcore\include
C:\Program Files\OpenCV\cv\include
C:\Program Files\OpenCV\otherlibs\highgui
C:\Program Files\OpenCV\cvaux\include
C:\Program Files\OpenCV\otherlibs\cvcam\include

Rename the Recycle Bin of Windows

For quite some I have trying to find out ways to rename the Recycle bin seen on the desktop of Windows operating system. I found quite some very interesting methods. So I am listing all these methods step by step. This Windows Registry Hacking works in Windows XP.


  • Method I - Using registry -
  1. Click Start > Run > and type regedit. This will start the Windows Registry Editor.
  2. Now you have to go to the key form where you can rename the recycle bin. The key is HKEY_CURRENT_USER\Software\Microsoft\Windows\ShellNoRoam\MUICache
  3. Click in right panel and select the key named '@C:\WINDOWS\system32\SHELL32.dll,-8964'. Now right click the key and select modify. Change the vale "Recycle Bin" to whatever you want.


  • Method II - Using Resigtry Editor Only Once (easy) -
  1. First step is same as above. You have to lanuch Windows Registry Editor. So Click Start > Run > and type regedit.
  2. Go to the key HKEY_CURRENT_USER/CLSID/645FF040-5081-101B-9F08-00AA002F954E/ShellFolder
  3.  Click in right panel and select the key named 'Attributes'. Now right click the key and select modify. Change the value 40 01 00 20 to 70 01 00 20
  4.  Now you don't have to goto registry any more to rename. Now go to desktop right-click on the recycle bin and choose explore.
  5. . In the left pane of Explorer, select Recycle Bin and press F2 to Rename.
(Click to enlarge)


note:- Be careful while editing registry. An error can make your system unusable. Use at your own risk.

Thursday, October 29, 2009

How to access parallel port in MATLAB

Have you ever wondered how you can use and access parallel port using Matlab. This post give a very easy and basic method of accessing and using Parallel port using Matlab. But first of all lets learn a bit about Parallel port.

Parallel port configuration

A typical Parallel port

This is a typical type of port you usually find in the back of your PC. Other external port such as USB or serial port requires more complex sending and data receiving algorithms. But by using 8 data pins in parallel port you can easily send a byte of data. That's why  Parallel Port is the most commonly used port for interfacing home made projects. Here is a good tutorial about parallel port configurations.

Now lets learn to access Parallel port using Matlab for your project.

You can easily access parallel port in Matlab

paraport=digitalio('parallel','LPT1');

by this u create a digital i/o object


line1=addline(paraport,0:3,'out');

this tells matlab to use first 4 data pins as output pin


pval=[0 0 0 1];

putvalue(paraport,pval);
this sends 1 value 2 pinno- 2.

A nice trick in notepad

Actually this thing i found out in net accidentally ........


Did you know that the flight number of the plane that had hit WTC ...on
9/11 was Q33N ....Open your Notepad in ur computer and type the flight
number i.e Q33N... Increase the Font Size to 72, Change the Font to
Wingdings. U will be amazed by the findings.

File locking using bat program

hi all ....

copy this in a note pad .... rename it to lock.bat .... now u have to put
passwd ...in the place >>>> set/p "pass=>xxxxx" ...... in the below programm...

now what you have to do it run that bat file ... a folder called lock will be created

now ... put what ever you wish to in it ...

then again run the program

....what it does it renames lock folder to

Control Panel.{21EC2020-3AEA-1069-A2DD-08002B303
09D}

but this is the address of control panel .... so when you click it control panel will open

copy this >>>>>>


cls
@ECHO OFF
title Folder Locker
if EXIST "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B303
09D}" goto UNLOCK
if NOT EXIST Locker goto MDLOCKER
:CONFIRM
echo Are you sure u want to Lock the folder(Y/N)
set/p "cho=>"
if %cho%==Y goto LOCK
if %cho%==y goto LOCK
if %cho%==n goto END
if %cho%==N goto END
echo Invalid choice.
goto CONFIRM
:LOCK
ren Locker "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}"
attrib +h +s "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}"
echo Folder locked
goto End
:UNLOCK
echo Enter password to Unlock folder
set/p "pass=>"
if NOT %pass%==type your password here goto FAIL
attrib -h -s "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}"
ren "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}" Locker
echo Folder Unlocked successfully
goto End
:FAIL
echo Invalid password
goto end
:MDLOCKER
md Locker
echo Locker created successfully
goto End
:End

Hide files in image

Here is new trick 4 all of you .... you can hide zipped files in images ... such as .jpg or .jpeg .......

The file will be an image. If some one cilck to open it , it will be shown as image but it will contain the zipped file.

Here it goes:-

  • First zip the file which you want to hide .... using winrar now ... suppose it is test.rarand the image in which you want to hide is img.jpg
  • Now goto command promt
  • Goto destination folder using cd
  • Then type copy /b img.jpg + test.rar img.jpg

  • It is done. This img.jpg contains your test.rar.
  • o extrat it :-open image with winrar and then you will find test.rar .Click on extract button and you are done.

njoy:)

SHUTDOWN Shortcut in windows desktop

  • Navigate to your desktop. On the desktop, right-click and go to New, then to Shortcut (in other words, create a new shortcut).

  • You should now see a pop-up window instructing you to enter a command line path.Use this path in "Type Location of the Item"SHUTDOWN -s -t 01

  • If the C: drive is not your local hard drive, then replace "C" with the correct letter of the hard drive. Click the "Next" button. Name the shortcut and click the "Finish" button.

  • Now whenever you want to shut down, just click on this shortcut and you're done.

Create picture back ground in all drives

Are you getting bored with the usual backgrounds in you drive in Windows. Don't there is a trick which you can do it. You need to Hack the windows. Don't worry it is quite simple :).

Copy the code this and paste it in any drive using notepad .... rename it to desktop.ini


[{BE098140-A513-11D0-A3A4-00C04FD706EC}]
iconarea_image=


iconarea_text=0x00FFFFFF

eg. -

[{BE098140-A513-11D0-A3A4-00C04FD706EC}]
iconarea_image=C:\WINDOWS\Web\Wallpaper\cc.jpg
iconarea_text=0x00FFFFFF

Airtel tune in C program

/* compile n execute the code */
#include< stdio.h >
#include< dos.h >

int main(void)
{
printf("Airtel song --- from http://programing-tutorial.blogspot.com/");
float A,Bb,D,G,F;
A = 440;
G = 780;
Bb = 461;
D = 586;
F = 687;
sound(G);
delay(500);
nosound();
sound(G);
delay(250);
nosound();
sound(G);
delay(250);
nosound();
sound(G);
delay(500);
nosound();
sound(2*D);
delay(500);
nosound();
sound(2*A);
delay(250);
nosound();
sound(2*Bb);
delay(250);
nosound();
sound(2*A);
delay(250);
nosound();
sound(G);
delay(250);
nosound();
sound(F);
delay(500);
nosound();
sound(2*A);
delay(500);
nosound();
sound(G);
delay(250);
nosound();
sound(2*A);
delay(250);
nosound();
sound(G);
delay(250);
nosound();
sound(F);
delay(250);
sound(G);
delay(250);
sound(2*A);
delay(250);
sound(2*Bb);
delay(500);
sound(2*A);
delay(500);
sound(G);
delay(250);
sound(F);
delay(250);
sound(D);
delay(500);
nosound();
//end 1
sound(G);
delay(500);
nosound();
sound(G);
delay(250);
nosound();
sound(G);
delay(250);
nosound();
sound(G);
delay(500);
nosound();
sound(2*D);
delay(500);
nosound();
sound(2*A);
delay(250);
nosound();
sound(2*Bb);
delay(250);
nosound();
sound(2*A);
delay(250);
nosound();
sound(G);
delay(250);
nosound();
sound(F);
delay(500);
nosound();
sound(2*A);
delay(500);
nosound();
sound(G);
delay(250);
nosound();
sound(2*A);
delay(250);
nosound();
sound(G);
delay(250);
nosound();
sound(F);
delay(250);
sound(G);
delay(250);
sound(2*A);
delay(250);
sound(2*Bb);
delay(500);
sound(2*A);
delay(500);
sound(G);
delay(250);
sound(F);
delay(250);
sound(D);
delay(500);
nosound();
//end 2
sound(2*A);
delay(250);
nosound();
sound(G);
delay(250);
nosound();
sound(F);
delay(250);
sound(G);
delay(250);
sound(2*A);
delay(250);
sound(2*Bb);
delay(500);
sound(2*A);
delay(500);
sound(G);
delay(250);
sound(F);
delay(250);
sound(D);
delay(500);
nosound();
sound(2*A);
delay(250);
nosound();
sound(G);
delay(250);
nosound();
sound(F);
delay(250);
sound(G);
delay(250);
sound(2*A);
delay(250);
sound(2*Bb);
delay(500);
sound(2*A);
delay(500);
sound(G);
delay(250);
sound(F);
delay(250);
sound(D);
delay(500);
nosound();
return 0;
}

Block site without any software

I was trying to block few site in my comp ..... and finally
I found out a very simple method to do it ....

Browse to C:\WINDOWS\system32\drivers\etc

Find the file named "HOSTS" .....open it with wordpad

Under "127.0.0.1 localhost" Add "127.0.0.2 www.abc.com" ,
and that site will no longer be access able.

eg:- .....
127.0.0.1 localhost
127.0.0.2 www.abc.com

www.abc.com is now inaccessible able.

figure - click to enlarge

Starwars in windows


hi all .......
Are you getting bored ..... wanna do some thing new ... how about viewing star wars ....
believe me ..... u can see it now ....

connect to Internet

Go to Start -->--> Run
Type
telnet towel.blinkenlights.nl
And hit enter.........

Njoy ......

Wednesday, October 28, 2009

Hacking windows - Rename Start button


You must always wonder that why is the button in the left corner is named start. That what I thought when I saw a pc for the first time in my life. :) When I owned a PC I alwalys thought that is there any method to rename it. Very soon I found out and it was really more easy than i thought.

One of the most famous and talked hack of windows explorer is hacking the start button to rename it. I came to know about this hack in a famous book of 'Ankit Fadia' - Unofficial guide to ethical hacking. But later I found out many other easy methods to do so. so basically there a few methods to .
  1. Popular- The most popular method is to use a hex editor. First, open up the Windows Explorer file and edit the 'start' string if you can find it in the file. Then, you will have to make
    some changes to the system file protection to allow you to run a hacked version of Explorer. After you have made those changes, you have to boot into Safe mode and swap the Explorer.
  2. Ankit Fadiya's way - Open the window in text mode. Open the explorer in using edit command and then find the 'start' string to rename it. In this case you are actually modifying the original explorer file. This is the method given in Ankit Fadiya's book.
  3. Easy way - All the above method is too complicated and has a lot of unnecessary steps. I found a better way to do this. Using my method, you will not have to mess with the system file protection at all, boot into Safe mode, or even be limited to five characters on the Start button.
So let’s get started with the last method:
  1. First, you will need to have a hacking tool- ' Thee Resource Hacker' . If don't have a copy of Resource Hacker, you can download it from http://www.angusj.com/resourcehacker/ . Once you have Resource Hacker , go to the next step.
  2. You will have to open up the Windows Explorer main file, called explorer.exe in Resource hacker. This file is stored in the C:\Windows directory.To open the file up, click the file menu bar item in Resouce Hacker and select Open, then just navigate over to the Windows directory and select explorer.exe.
  3. When explorer.exe is loaded, you should see a bunch of folders on the left side of the
    screen. Expand the String Table folder and then expand the 37 folder and select 1033.
  4. You will not see a bunch of text on the right side of the screen. Locate where it says
    "Start", and replace it with the text that you want to use, say"Hacked”. Make sure that you only enter your text between the quotes.
  5. Next, you will have to click the Compile Script button. See the Figure (click to enlarge).
  6. Now, you have to save the file that you just edited and recompiled. Click the File menu bar item again and this time select Save As. Then save the file with a name other than explorer.exe , say Hackedexplorer.exe.
  7. You are now finished hacking the Explorer file. You can close the Resource Hacker. Now
    you just have to tell Windows to use your new Explorer file the next time you log in.To
    do this, click the Start button and select Run and Type regedit in the box and click OK.
  8. Next, when the Registry Editor is loaded, expand HKEY_LOCAL_MACHINE,
    SOFTWARE, Microsoft,Windows NT, CurrentVersion, and Winlogon.Inside the WinLogon folder, you will have to look for the Shell entry. Right-click it and select Modify.
  9. Type in the name of the file that you saved in Step 6. Here we have used “Hackedexplorer.exe” so that is what we will have replace all of the text with. See the figure-
  10. When you are finished, click OK to save your changes. Close the Registry
    Editor because you are finished with the hack.
  11. Just log off and log back on or restart to see the new changes in effect.
In Case of problem:- If you did not edit the registry correctly, such as specifying the exact correct file as the value for shell, you will not be able to use your computer properly because Explorer will not load.

  • If that is the case, y will need to start up Explorer manually by pressing Ctrl + Alt +Delete to bring up the Task Manager. click the New Task button on the Applications tab and type in regedit. This will launch the Registry Editor again so that you can edit the shell entry again. Make sure that you type in the full correct file name with the extension as the value.
  • If you want to revert to the original Windows Explorer with Start as the text on the Start button, just change this value back to explorer.exe. Then just log off your computer by using the shutdown menu bar item in the Task Manager and you will be back to normal when you log back on.

Sunday, October 11, 2009

Create a simple Album using Java script

When ever I saw fancy picture albums in I always wonder how I can create a simple album using java script. Well when I learned javascript I found it quite simple. You need to know very basic CSS, JAVA script and a bit HTML. So lets learn how to make a very simple album using Java Script. We will learn it in steps.

  1. Create a file in folder. Name it to say 'Album'. Now Create a folder in it and name it say 'images'.
  2. Now create a text file and rename it to 'album.html'
  3. Now open album.html in you favorite text editor. I prefer using Nodepad++ . you can download it from http://sourceforge.net/projects/notepad-plus/files/
  4. Now we will write the code. First add html and head tag.
  5. Add a title tag. eg- <>Album< /title >
  6. Now before the < /head > you have to add the script required.
  7. Add the folllowing script. We will under stand the script in details later. -
< type="text/javascript">
var count=1; //counter
var IMG_NO=8; // set no of images
var imgUrl = new Array(); // image urls array

function init(){

// set image urls
imgUrl[1]="images/img1.jpg"; // your file name
imgUrl[2]="images/img2.jpg";
// and so on for all images ...

// call slideShow function
slideShow();
}

function slideShow() // function to show Images
{

var d=document.getElementById("img1");
d.src=imgUrl[count];
count++;
if(count > IMG_NO)
count=1;
// call the same function in 2 sec
setTimeout("slideShow()",2000);
}

< /script >


  • Now we have to make a area in the page to show image. So we will create a div and in side that we will have to write a <> tag with id='img1'.
  • ID is just like a unique name to a object in the web page. Using this you can access the that element using java script function document.getElementByID(' id');.
  • Note that in the javascript above we are calling the document.getElementByID(' img1'); .
  • In my example see how I have written inside body tag-
< onload="init()">

< class="div1">
< class="img1" id="img1">
< /div >

< /body >

  • I have defined a class if the div as "div1". and a class for the img as "img1".
< type="text/css">
body{
background:#CCCCCC;
}
.div1{
top:70px;
left:202px;
position:absolute;
height:400px;
width:600px;
background:#333333;
border-color:#00FFFF;
border-bottom-width:thick;
}
.img1{
top:5px;
left:5px;
position:absolute;
height:390px;
width:590px;
}

< /style >