Saturday, July 31, 2010

Remove Write Protection On USB Storage Devices

The problem here is unable to copy files into USB drive such as flash drives, memory card and Ipod. When your USB flash drive, or memory card is write-protected, you will receive the following error message:
  •     Cannot copy files and folders, drive is write protected
  •     Cannot format the drive, drive is write protected
  •     The disk is write protected
  •     Remove write protection or use another disk
  •     Media is write protected

This may caused by virus or malware script which modified the registry to make any drive write protect when connected to the computer,
or your system administrator disabled your usb storage devices for security reason.

You can remove write protection from your usb flash drive or memory card using the below method:

Important: Modifying registry can cause you computer to stop functioning properly, so follow the procedures carefully. Follow the procedures below at your own risk.

1. Open Start Menu > Run, type regedit and press Enter, this will open
the registry editor.


2. Navigate to the following path:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\StorageDevicePolicies

3 If the registry key StorageDevicePolicies does not exist, you will need to create it manually. If exists then proceed to Instruction no. 5

4. to create it manually right click on the Control folder as shown on the image below and click New > Key  then input StorageDevicePolicies as the folder name. Inside StorageDevicePolicies create DWORD value and name it to WriteProtect

Click the images to Enlarge



5. Double click the key WriteProtect in the right window and set the value to 0 in the Value Data Box and press OK button

6. Restart your computer and your Done.

7. Try copying files into your USB drives. :)



Want to Earn Money Online?  Register through the banner below. Enjoy!



or Visit my Trusted PTC List and Guidelines to avoid being scammed!!!

Monday, July 26, 2010

C++ Definition & Brief History

What is C++?

C++ is an "object oriented" programming language created by Bjarne Stroustrup and released in 1985. It implements "data abstraction" using a concept called "classes", along with other features to allow object-oriented programming. Parts of the C++ program are easily reusable and extensible; existing code is easily modifiable without actually having to change the code. C++ adds a concept called "operator overloading" not seen in the earlier OOP languages and it makes the creation of libraries much cleaner.

C++ maintains aspects of the C programming language, yet has features which simplify memory management. Additionally, some of the features of C++ allow low-level access to memory but also contain high level features.

C++ could be considered a superset of C. C programs will run in C++ compilers. C uses structured programming concepts and techniques while C++ uses object oriented programming and classes which focus on data





Your Ad Here



A Brief History

C++ was written by Bjarne Stroustrup at Bell Labs during 1983-1985. C++ is an extension of C. Prior to 1983, Bjarne Stroustrup added features to C and formed what he called "C with Classes". He had combined the Simula's use of classes and object-oriented features with the power and efficiency of C. The term C++ was first used in 1983.


C++ was developed significantly after its first release. In particular, "ARM C++" added exceptions and templates, and ISO C++ added RTTI, namespaces, and a standard library.

C++ was designed for the UNIX system environment. With C++ programmers could improve the quality of code they produced and reusable code was easier to write.

Bjarne Stroustrup had studied in the doctoral program at the Computing Laboratory at Cambridge University prior to joining Bell Labs. Now, Bell Labs no longer has that name since part of Bell Labs became AT&T Labs. The other half became Lucent Bell labs.

Prior to C++, C was a programming language developed at Bell Labs circa 1969-1973. The UNIX operating system was also being developed at Bell Labs at the same time. C was originally developed for and implemented on the UNIX operating system, on a PDP-11 computer by Dennis Ritchie. He extended the B language by adding types in 1971. He called this NB for New B. Ritchie credited some of his inspiration from theAlgol68 language. Ritchie restructured the language and rewrote the compiler and gave his new language the name "C" in 1972. 90% of UNIX was then written in C. The committee that wrote the 1989 ANSI Standard for C had started work on the C Standard project in 1983 after having been established by ANSI in that year. There were quite a number of versions of C at that time and a new Standard was necessary.

C is portable, not tied to any particular hardware or operating system. C combines the elements of high-level languages with the functionality of assembly language and has occasionally been referred to as a middle-level computer language. C makes it easy to adapt software for one type of computer to another.

C was a direct descendant of the language B. The language B was developed by Ken Thompson in 1970 for the new UNIX OS. B was a descendant of the language BCPL designed by Martin Richards, a Cambridge University student visiting MIT.

C++ Compilers

Disclaimer

The information provided on this page comes without any warranty whatsoever. Use it at your own risk. Just because a program, book, document or service is listed here or has a good review does not mean that I endorse or approve of the program or of any of its contents. All the other standard disclaimers also apply.

Microsoft Visual C++ 2010 Express New
The free Microsoft Visual C++ 2010 Express, along with the rest of the Microsoft Visual Studio 2010 Express suite of programs, is available free of charge directly from Microsoft. The software includes an integrated development environment (IDE) that allows you to create programs for the .NET framework (including .NET Framework 4) as well as native Windows (Win32) programs. The new version of the C++ compiler included in this package has some language features from the upcoming C++0x standard such as lambda expressions (to support function objects), rvalue references, auto (now with a different meaning from its C version and earlier C++ standards), static_assert (testing assertions at compile time), nullptr and decltype. Note that this free version lacks some of the features provided in the full (commercial) Microsoft Studio 2010, such as MFC, ATL, the Windows resource editor, a macro assembler, etc. (I'm not sure if the other major new feature of the 2010 release, the inclusion of parallel programming libraries and tools, is in the Express edition or not.)
AMD x86 Open64 Compiler Suite
This is a version of the Open64 compiler suite that has been tuned for AMD processors (and has additional bug fixes). The C/C++ compiler conforms to the ANSI C99 and ISO C++ 98 standards, supports inter-language calling (since it has a Fortran compiler available as well), x86 32 bit and 64 bit code generation, vector and scalar SSE/SSE2/SSE3 code generation, OpenMP 2.5 for shared memory models, MPICH2 for distributed and shared memory models, IEEE 754 floating point support, an optimizer that supports a huge variety of optimizations (global, loop-nest, inter-procedural analysis, feedback-directed, etc), etc. It comes with an optimized AMD Core Math Library and documentation. This compiler suite requires Linux.
Free Microsoft Visual C++ 2008 Express
Microsoft Visual C++ 2008 Express is currently available for download, free of charge, from Microsoft's site. It allows you to create programs for the .NET framework as well as native Win32 programs. It comes with an optimizing C++ compiler, linker, debugger, static libraries (including the Standard C++ Library and STL), and Microsoft SQL Server 2005 Express Edition. You can also get either the MSDN Express Library or the full MSDN Libary if you wish. The MSDN Express Library provides documentation for both the IDE as well as the .NET framework classes. The full MSDN library, designed primarily for the full version of Visual Studio also includes information about the Win32 API. Incidentally, if you wish to create native Win32 programs, you may need to download the Microsoft Windows Platform SDK separately and install it. It requires Windows XP, 2003, Vista (or their x64 versions). Note that unlike the commercial Visual Studio Professional 2008, it does not have MFC, ATL, a Win32 resource editor, a macro assembler, source code control integration, etc.
Apple Xcode for Mac OS X
Xcode is Apple's integrated development environment which includes a syntax-highlighting editor, a build control system, a debugger, the GNU C compiler (gcc), an interface builder, AppleScript Studio, Java development support, WebObjects development tools, etc. You need to be an Apple Developer Connection (ADC) member to get the tools, but it appears that online membership is free.
Open Source Watcom / OpenWatcom C/C++ Compiler
The Watcom C/C++ compiler (now OpenWatcom C/C++ compiler) is now open source and free. This compiler, which generates code for Win32, Windows 3.1 (Win16), OS/2, Netware NLM, MSDOS (16 bit and 32 bit protected mode), etc, was a highly coveted compiler some years back (until Sybase terminated it). The compiler also includes the rather well-known STLport.
Digital Mars C/C++ Compiler (Symantec C++ Replacement)
Digital Mars C/C++ is a drop-in replacement for the Symantec C++ compiler, with support for compiling programs for Win32, Windows 3.1, MSDOS, and 32-bit extended MSDOS. If the target machine does not have a floating point processor (pre-Pentium machines), you can link the floating point emulation into your program. The compiler supports the C++ definition found in The Annotated C++ Reference Manual (ARM) and the enhanced language features of AT&T version 3.0, including templates, nested classes, nested types, exception handling, and runtime type identification.
UPS Debugger (C Interpreter)
This is actually a graphical source level debugger for X Window, but it contains a built in C interpreter which can handle single or multiple source files. You can use it to build a byte-code executable and execute the interpreter on that executable. If you need an interpreter to debug or prototype programs, or to just learn the language, check this out. It supports the following platforms: Solaris, SunOS, Linux, FreeBSD, BSD/OS, and possibly other Unices.
The BDS C Compiler
Remember the old (famous) BDS C compiler for 8080/Z80 CP/M systems? It is now in the public domain, complete with assembly language source code. The package is the retail version of the compiler, with a linker and user manual. Before you scoff at this, remember that it can be used to generate 8080/8085/Z80 code for embedded systems with a little bit of work (ie, write your own routines to replace any runtime library code that access the operating system functions).
Bloodshed Dev-C++ C++ Compiler
This is a Win32 integrated development environment that includes the egcs C++ compiler and GNU debugger from the Mingw32 environment together with an editor and other facilities to make program development using the Mingw32 gcc compiler easier on a Windows platform. It also includes an installer for your applications.
Intel C++ Compiler for Linux Non-Commercial Version
The Intel C++ compiler has a non-commercial version for Linux which you may use to develop your programs for non-commercial purposes (read their licence for more information). The optimizing ANSI C/C++ compiler supports all Intel 32 bit processors and the 64 bit Itanium processor.
PCC - Portable C Compiler
PCC is based on the original Portable C Compiler by S C Johnson. The goal of the project is to write a small, fast C compiler that can compile C99 source code. The compiler is a two-pass compiler that runs on OpenBSD and NetBSD.
DeSmet C
DeSmet C will be familiar to those who programmed in C in the 1980s. It is an MSDOS C compiler. It has been released under the GNU GPL, and comes with manuals, an editor, and a third party optimizer.
Sun Studio Compilers and Tools
Sun Studio Compilers and Tools for Linux and Solaris OS on Sparc and x86/x64 platforms includes command line tools as well as a NetBeans-based IDE for developing, compiling and debugging C, C++ and Fortran programs. It also includes performance analysis tools. You have to join the Sun Developer Network (SDN) to get access to the free compilers. As far as I can tell, joining the SDN is free.
Open64 Compiler Tools
Open64 comprises optimizing compilers for C, C++, and Fortran 90/95 for Intel Itanium systems running Linux. The compiler is the successor to the SGI Pro64 compiler suite, now released under the GNU GPL.
Apple's Macintosh Programmer's Workshop (C and C++ compilers)
Yep, you're right. This is Apple's own Macintosh Programmer's Workshop. The C/C++ compilers, debuggers, tools, etc, in this workshop are all downloadable from their web site, free! They're the same those you get from their Developer CD. Full documentation about the compilers as well as documentation about programming for the Macintosh in general can be found online. You get the SC/SCpp (68k), which are ANSI compliant C and C++ compilers that generates 680x0 code; as well as MrC/MrCpp which generates C/C++ code for the PowerPC. You also get two assemblers (one for the 68k and one for the PowerPC), the shell, linkers, a Make tool, resource manipulation and analysis tools, file comparison tools, editor, three debuggers, etc. If you want to be on the cutting edge, you can also download the absolutely latest compilers which are still under testing (but having the latest bug fixes and C++ support). CodeWarrior plugin compilers appear to be available from the site as well. (Note - this tool set is for Mac OS 7.X/8.X/9.X program development.)
Tiny C Compiler - Smallest Linux C Compiler
This small Linux and Windows C compiler generates optimized x86 native binaries. It purportedly compiles, assembles and links several times faster than GCC. The compiler is currently moving towards ISO C99 compliance. It also includes an optional bounds checker. It also handles C script files (just add the shebang line "#!/usr/local/bin/tcc -run" to the first line of your C source code file on Linux to have it executed directly. TCC is distributed under the GNU General Public License.
Portable Object Compiler
This is a set of Objective C class libraries and a compiler that translates your Objective C code to plain C code. It works on Windows, Linux, OS/2, Macintosh, etc.
Mingw32 C & C++ Compilers
This system comes with the GNU C/C++ compiler, which you can use to generate Win32 executables. It has its own which is in the public domain. Applications generated using this system are supposed to be faster than those generated by the Cygwin32 system (see elsewhere on this page), and they are free from the encumberances of the GNU license. Like other systems based on the GNU tools, Mingw32 comes with complete with various programming tools, such as a program maintainence program (ie, make), text processing tools (sed, grep), lexical analyser generator (flex), parser generator (bison), etc. It also comes with a resource compiler, allowing you to compile your Windows resources.
GNU C/C++ Compiler
This is the GNU C compiler page, from which you can get links to binaries and source code for the GNU C Compiler. You can also use our links on this page for the most commonly requested binary versions (MSDOS and Win32).
Pelles C Compiler
This is another Windows-hosted C compiler that is based on LCC. It contains a C compiler, linker, resource compiler, message compiler, a make utility, etc. It compiles code for both Windows and Pocket PC.
Compaq C Compiler
Linux/Alpha users can now download and use Compaq's optimising C compiler freely by simply filling a form and agreeing to their license agreement. The compiler may be used to generate any sort of program, commercial or otherwise. The compiler includes a math library and a debugger (ladebug) ported from True64 Unix. It comes with the usual man pages as well as a Language Reference Manual and a Programmer's Guide.
Ch Embeddable C/C++ Interpreter (Standard Edition)
Ch is a C/C++ interpreter that supports the ISO 1990 C Standard (C90), major features in C99 (complex numbers, variable length arrays or VLAs, type generic functions, long long data type, etc), classes in C++, and extensions to the C language like nested functions, string type, etc. It can be embedded in other applications and hardware and used as a scripting language. Your C/C++ code is interpreted directly with no compilation to intermediate code. Since it supports Linux, Windows, MacOS X, Solaris and HP-UX, it means that your code should be portable to any of those platforms once you write it for this compiler. The standard edition is free for personal, academic and commercial use. You need to register to download the package.
DJGPP C and C++ Compilers
This is a development system based on the well-known GNU C/C++ compiler. It generates 32 bit MSDOS executables that is Windows 95 long-filename-aware. It is a very complete system with IDEs, graphics libraries, lexical analyser generators (flex), parser generators (bison), text processing utilities (like grep, sed), a program maintainence utility (ie, make), a dos extender, and so on. The compiler, utilities and libraries come with source code.
Cilk ANSI C Based Compiler
Cilk is an ANSI C-based language that can be used for multi-threaded parallel programming. It "is especially effective for exploiting dynamic, highly asynchronous parallelism in data-parallel or message-passing style". Their website mentions that Cilk has already been used to develop three world-class chess programs, StarTech, Socrates and Cilkchess.
Sphinx C-- Compiler
This MSDOS compiler is a sort of hybrid C compiler and assembler that allows you to "create programs with the power and readability of C while retaining the efficiency of assembly language." It can produce MSDOS executables or .OBJ files which you can use in conjunction with other linkers to generate an executable. The above link leads to the source code and documentation for the compiler. If you want a precompiled binary, you can get it from the Unofficial Sphinx C-- Compiler site.
LSI C-86 C Compiler
The website for this compiler is written in Japanese which unfortunately is not displayed correctly in my browser (I don't have the necessary fonts), so I'm not able to comment for certain about this compiler. It looks like a cross-compiler that allows you to generate ROMable code. An older version (3.30c) of the compiler appears to be free. The free version runs on MSDOS only.
ACC C Compiler
This is an MSDOS compiler that handles a subset of the C language with some extensions (eg the #asm directive for inline assembler). Floating point is not supported. It generates protected mode 32 bit assembler code, which you will have to assemble and link using the supplied A86 assembler and linker. A copy of the DOS extender will also be embedded into your application.
CINT C and C++ Interpreter
This is a C/C++ interpreter that comes with source code. It can be compiled and used on a large variety of Unices, including HP-UX, Solaris, SunOS, AIX, Alpha/OSF, FreeBSD and Linux, as well as Windows NT. You can even issue system calls from the interpreter (such as Posix calls on Unix or Windows API calls from Windows). It accepts most of K&R and ANSI C and is close to the standard C++ (at the time of this writing). As with all interpreters, it may be useful in debugging programs or learning the language.
SDCC C Cross-compiler
This is a C cross-compiler that targets the Intel 8051, DS390, Z80, HC08 and PIC microprocessors. It can also be retargetted for other 8 bit MCUs or PICs. It comes with a retargetable assembler and linker, a source level debugger and a simulator, and it is capable of a variety of optimisations. The libraries are Standard C99 compatible. Source code for the compiler is available under GPL. Host platforms supported include Linux, Windows, Mac OS X, Alpha, Sparc, etc.
LADSoft CC386 C Compiler
This is an ANSI C compiler for MSDOS/DPMI and Win32 that comes with a runtime library, linker, rudimentary debugger, DOS extender (MSDOS version), an IDE (Win32 version) and a make utility. Source code is also available. It compiles most of the C99 constructs when ran in C99 compatibility mode. Note: The author is no longer working on this compiler. The files for the last available version from him is available at the mirror site linked above.
Cygwin Project (C & C++ Compilers)
This "project" includes a commercial quality compiler (GNU C/C++) that generates Win32 GUI and console applications. I have not used this port myself, but based on what I read, it appears that they have their own and so on. Source code for the compiler, libraries and tools are provided. Note that the default option in this package forces you to distribute your source code if you compile and link with their libraries. There is also a special option that you can invoke which will cause it to link with alternative libraries, allowing you to distribute your applications without sources. It appears that the free version has not been updated for some time now.
LCC-Win32 C Compiler
This is a C compiler that generates Win32 GUI and console applications. It comes with its own linker, IDE, debugger, resource editor and resource compiler. LCC-Win32 is based on the LCC compiler (see elsewhere on this page) and is free only for non-commercial use.
LCC - A Retargetable Compiler for ANSI C
LCC is a C compiler (source code only) that generates code for the Alpha, Sparc, MIPS R3000 and Intel x86. There is also a book A Retargetable C Compiler written by the authors of the compiler that explains the code of the C compiler. This compiler is the basis of at least 2 other Win32 C compilers.
Pacific C Compiler
This is a MSDOS C compiler that comes with a development environment. You can distribute programs compiled with the compiler freely. Latest news: the site now requires that you register before downloading. To download the program, go to the page linked to above, seach for Pacific C under the "Free Software" section, click the link, and create a new account.
Cyclone C
Cyclone C is not strictly an ANSI C compiler but a compiler of a "safe dialect" of C. It enforces type safety, has a variety of checks to protect against buffer overflows, array-bound violations, etc. It currently works on Linux and Windows (the latter via Cygwin), and requires you to have the GNU compiler tools on your system.
TenDRA C/C++ Compiler (mirror site)
TenDRA is a free C/C++ compiler and source code checker (like lint) that runs on a variety of Unix systems like AIX, HP-UX, Linux, Irix, OSF1, SCO, Solaris, SunOS, Ultrix, and Unixware. You can use it to replace your system C compiler, or use it as a lint-like utility to check your source code for correctness and potential bugs. The compiler comes bundled with sid, an LL(1) parser generator. (This is a link to a mirror. The original site seems to be gone at the time I write this.)
Leonardo IDE
Leonardo IDE is a Macintosh-based IDE, compiler and debugger for C programs. It has a syntax highlighting editor, an ANSI C compiler, a compiler for the ALPHA visualization language, a graph editor, a reversible virtual CPU, etc. Note that the programs are not compiled to native code but to code to be executed for the virtual CPU. The virtual machine and debugger allows you to execute code forwards and backwards and supports multitasking. The IDE comes with animated algorithms, plus example source code for games like Tetris, Checkers, etc. The IDE is useful for checking and debugging your source code, search for memory leaks, etc. Note: this project has been discontinued.
For Complete Syntax, Library and Code Refence click here...

Thursday, July 22, 2010

Removing Daprosy (Classified.exe Virus)

The easiest working solution to this viral infection is by using class-x by SubAtomica.
though i suggest to use HitmanPro first to clean all malwares and viruses to your startup directory and any virus running on memory.
You can download HitmanPro here.
Class-x Daprosy Virus Remover a.k.a (Classified.exe) download here.


just click next and let it update its database....
let it finish the scanning process and if a virus or a malware was found it will be automatically removed by clicking next. If you can't click next because it was asking for a registration key. you can click the Acquire 30 day trial key, wait for a while and you'll be given a 30 day trial period to use the software. You can now proceed and click next to remove the infected files.

It will ask you to reboot if a virus was found on a memory running and this will be removed after reboot.
After reboot it will scan again for any infected files. upon cleaning your pc memory for known threats you can now proceed on removing Classified.exe known as Daprosy Virus by using the script created by SubAtomica. Just Unzip the Class-x files and run class-x.bat use subatomica as password for the compress files.
Let the script finish the scan and. it will automatically removed all known infections made by Daprosy and restore your infected files to its original state :)

When your done cleaning your system from Daprosy, make sure to setup and install your favorite antivirus software and update it to its latest virus definitions. This is to prevent future virus infections on your system i also suggest installing and setting up USB Disk security too..

Goodluck

Wednesday, July 21, 2010

JAVA (GUI) Programming Part II w/ Videos

Continuation of JAVA (GUI) Programming...

Tutorial - 76 - MouseMotionListener interface


Tutorial - 77 - Adapter Classes


Tutorial - 78 - File Class


Tutorial - 79 - Creating Files


Tutorial - 80 - Writing to Files


Tutorial - 81 - Reading from Files


Tutorial - 82 - Exception Handling


Tutorial - 83 - FlowLayout


Tutorial - 84 - Drawing Graphics


Tutorial - 85 - JColorChooser


Tutorial - 86 - Drawing More Stuff


Tutorial - 87 - Series Finale

JAVA (GUI) Programming Part I w/ Videos

You may also want to read a bit about JAVA (GUI) Programming or continue learning JAVA (GUI) Programming through videos provided below. Enjoy...

Java Programming Graphical User Interface (GUI) Video Tutorials


Tutorial - 50 - Graphical User Interface GUI


Tutorial - 51 - GUI with JFrame


Tutorial - 52 - Event Handling


Tutorial - 53 - ActionListner


Tutorial - 54 - Event Handler Program


Tutorial - 55 - Intoduction to Polymorphism


Tutorial - 56 - Polymorphic Arguements


Tutorial - 57 - Overriding Rules


Tutorial - 58 - Abstract and Concrete Classes


Tutorial - 59 - Class to Hold Objects


Tutorial - 60 - Array Holding Many Objects


Tutorial - 61 - Simple Polymorphic Program


Tutorial - 62 - JButton


Tutorial - 63 - JButton Final Program


Tutorial - 64 - JCheckBox


Tutorial - 65 - The Final Check Box Program


Tutorial - 66 - JRadioButton


Tutorial - 67 - JRadioButton Final Program



Tutorial - 68 - JComboBox


Tutorial - 69 - Drop Down List Program


Tutorial - 70 - JList


Tutorial - 71 - JList Program


Tutorial - 72 - Multiple Selection List


Tutorial - 73 - Moving List Items Program


Tutorial - 74 - Mouse Events


Tutorial - 75 - MouseListener interface


JAVA (GUI) Programming Part II

Java Programming Part III

Continuation of JAVA Programming Tutorial

Tutorial - 31 - Enhanced for Loop


Tutorial - 32 - Arrays in Methods


Tutorial - 33 - Multidimensional Arrays


Tutorial - 34 - Table for Multi Arrays


Tutorial - 35 - Variable Length Arguments 



Tutorial - 36 - Time Class



Tutorial - 37 - Display Regular time


Tutorial - 38 - Public, Private and this


Tutorial - 39 - Multiple Constructors


Tutorial - 40 - Set and Get Methods


Tutorial - 41 - Building Objects for Constructors 


Tutorial - 42 - toString


Tutorial - 43 - Composition



Tutorial - 44 - Enumeration 


Tutorial - 45 - EnumSet range


Tutorial - 46 - Static


Tutorial - 47 - More on Static



Tutorial - 48 - final


Tutorial - 49 - Inheritance


Continue to JAVA Programming (GUI)...

Java Programming Part II

Continuation of Java Programming Tutorial...

Tutorial - 16 - Many Methods and Instances


Tutorial - 17 - Constructors



Tutorial - 18 - Nested if Statements


Tutorial - 19 - else if Statement


Tutorial - 20 - Conditional Operators


Tutorial - 21 - Simple Averaging Program


Tutorial - 22 - for Loops


Tutorial - 23 - Compound Interest Program


Tutorial - 24 - do while Loops


Tutorial - 25 - Math Class Methods


Tutorial - 26 - Random Number Generator



Tutorial - 27 - Introduction to Arrays



Tutorial - 28 - Creating an Array Table


Tutorial - 29 - Summing Elements of Arrays


Tutorial - 30 - Array Elements as Counters


Continue to JAVA Programming Part III

Java Programming Part I

What is Java?

A high-level programming language developed by Sun Microsystems. Java was originally called OAK, and was designed for handheld devices and set-top boxes. Oak was unsuccessful so in 1995 Sun changed the name to Java and modified the language to take advantage of the burgeoning World Wide Web.

Java is an object-oriented language similar to C++, but simplified to eliminate language features that cause common programming errors. Java source code files (files with a .java extension) are compiled into a format called bytecode (files with a .class extension), which can then be executed by a Java interpreter. Compiled Java code can run on most computers because Java interpreters and runtime environments, known as Java Virtual Machines
(VMs), exist for most operating systems, including UNIX, the Macintosh OS, and Windows. Bytecode can also be converted directly into machine language instructions by a just-in-time compiler (JIT).

Java is a general purpose programming language with a number of features that make the language well suited for use on the World Wide Web. Small Java applications are called Java applets and can be downloaded from a Web server and run on your computer by a Java-compatible Web browser, such as Netscape Navigator or Microsoft Internet Explorer.

More Reference below:
More elaborated definitions and development can be found here.
Java Programming Language Syntax or Command Parameters can be found here.


Lets get started...
JAVA Programming Part I


Tutorial - 1 - Installing the JDK


Tutorial - 2 - Running a Java Program


Tutorial - 3 - Downloading Eclipse


Tutorial - 4 - Hello YouTube



Tutorial - 5 - Variables



Tutorial - 6 - Getting User Input


Tutorial - 7 - Building a Basic Calculator


Tutorial - 8 - Math Operators


Tutorial - 9 - Increment Operators



Tutorial - 10 - If Statement


Tutorial - 11 - Logical Operators


Tutorial - 12 - Switch Statement


Tutorial - 13 - While Loop


Tutorial - 14 - Using Multiple Classes


Tutorial - 15 - Use Methods with Parameters


Continue to Java Programming Part II

Python (GUI) Programming Tutorial using WxPython w/ Videos

wxPython
One of the GUI toolkits available for Python is called wxPython. The current incarnation is fairly new to the Python scene and is rapidly gaining popularity amongst Python developers. wxPython is a Python extension module that encapsulates the wxWidgets C++ class library.


wxWidgets

wxWidgets is a free C++ framework designed to make cross-platform programming child's play. Well, almost. wxWidgets 2.0 supports Windows 3.1/95/98/NT, Unix with GTK/Motif/Lesstif, with a Mac version underway. Other ports are under consideration.
wxWidgets is a set of libraries that allows C++ applications to compile and run on several different types of computers, with minimal source code changes. There is one library per supported GUI (such as Motif, or Windows). As well as providing a common API (Application Programming Interface) for GUI functionality, it provides functionality for accessing some commonly used operating system facilities, such as copying or deleting files. wxWidgets is a framework in the sense that it provides a lot of built-in functionality, which the application can use or replace as required, thus saving a great deal of coding effort. Basic data structures such as strings, linked lists and hash tables are also supported.
Native versions of controls, common dialogs, and other window types are used on platforms that support them. For other platforms suitable alternatives are created using wxWidgets itself. For example, on Win32 platforms the native list control is used, but on GTK a generic list control with similar capabilities was created for use in the wxWidgets class library.
Experienced Windows programmers will feel right at home with the wxWidgets object model. Many of the classes and concepts will be very familiar. For example, the Multiple Document Interface, drawing on Device Contexts with GDI objects such as brushes, pens, etc., and so on.


Putting the two together

wxPython is a Python extension module that provides a set of bindings from the wxWidgets library to the Python language. In other words, the extension module allows Python programers to create instances of wxWidgets classes and to invoke methods of those classes.
The wxPython extension module attempts to mirror the class hierarchy of wxWidgets as closely as possible. This means that there is a wxFrame class in wxPython that looks, smells, tastes and acts almost the same as the wxFrame class in the C++ version. Unfortunately, not every class or method matches exactly because of differences in the languages, but the differences should be easy to absorb because they are natural to Python. For example, some methods that return multiple values via argument pointers in C++ will instead return a tuple of values in Python. wxPython is close enough to the C++ version that the majority of the wxPython documentation is actually just notes attached to the C++ documents that describe the places where wxPython is different. There is also a series of sample programs included, and a series of documentation pages that assist the programmer in getting started with wxPython.


Where to get wxPython

The latest version of wxPython can always be found at http://alldunn.com/wxPython/. From this site you can download a self-installer for Win32 systems that includes a pre-built extension module, documentation in html-help format and a set of demos.
Also available from this site is a Linux RPM, wxPython sources, documentation in raw HTML, and pointers to other sites, mail lists, etc.
If you will be building wxPython from sources yourself, you will also need the wxWidgets sources, available from http://www.wxwidgets.org/


Using wxPython
I've always found that best way to learn is by doing and then experimenting and tweaking with what's been done. So download and install wxPython, fire up your favorite text editor and get ready to play along as you read the next few sections.


A Simple Example

Familiarize yourself with this little wxPython program, and refer back to it as you read through the explanations that follow.
    from wxPython.wx import *
    
    class MyApp(wxApp):
        def OnInit(self):
            frame = wxFrame(NULL, -1, "Hello from wxPython")
            frame.Show(true)
            self.SetTopWindow(frame)
            return true
    
    app = MyApp(0)
    app.MainLoop()
    

The first thing to do in any program is import the classes and other items necessary for the application. The first line above imports all of wxPython into the current namespace. You can do more restrictive imports if you like, but the typical wxPython program will just import everything.
Every wxPython application needs to derive a class from wxApp and provide an OnInit method for it. The system calls this method as part of its startup/initialization sequence. The primary purpose of OnInit is to create the windows, etc. necessary for the program to begin operation. In our sample we create a frame with no parent, with a title of "Hello from wxPython" and then show it. We could have also specified a position and size for the frame in its constructor, but since we didn't defaults will be used. The last two lines of the OnInit method will probably be the same for all applications. The SetTopWindow method simply informs wxWidgets that this frame is one of the main frames (in this case the only one) for the application. When all top-level windows have been closed then the application terminates. Returning true from OnInit implies that OnInit was successful, if false had been returned then the application would exit.
The final two lines of the script again will probably be the same for all your wxPython applications. We simply create an instance of our application class, and then call its MainLoop method. MainLoop is the heart of the application and is where events are processed and dispatched to the various windows in the application. Fortunately wxWidgets insulates us from the differences in event processing in the various GUI toolkits.
Most of the time you will want to customize the main frame of the application, and so using the stock wxFrame will not be sufficient. The basic principles of Object Oriented Programming also suggest that the attributes and behaviors of the objects in your application should be encapsulated in a class rather than hodge-podged together in a place like OnInit. The next example derives a custom frame from wxFrame and creates an instance of it in OnInit. Notice that except for the name of the class created in OnInit, that the rest of the MyApp code is identical to the previous example.

    from wxPython.wx import *
    
    ID_ABOUT = 101
    ID_EXIT  = 102
    
    class MyFrame(wxFrame):
        def __init__(self, parent, ID, title):
            wxFrame.__init__(self, parent, ID, title,
                             wxDefaultPosition, wxSize(200, 150))
            self.CreateStatusBar()
            self.SetStatusText("This is the statusbar")
    
            menu = wxMenu()
            menu.Append(ID_ABOUT, "&About",
                        "More information about this program")
            menu.AppendSeparator()
            menu.Append(ID_EXIT, "E&xit", "Terminate the program")
    
            menuBar = wxMenuBar()
            menuBar.Append(menu, "&File");
    
            self.SetMenuBar(menuBar)
    
    
    class MyApp(wxApp):
        def OnInit(self):
            frame = MyFrame(NULL, -1, "Hello from wxPython")
            frame.Show(true)
            self.SetTopWindow(frame)
            return true
    
    app = MyApp(0)
    app.MainLoop()
    
    

This example shows off some of the built-in capabilities of the wxFrame class. For example, creating a status bar for the frame is as simple as calling a single method. The frame itself will automatically manage its placement, size and drawing. On the other hand, if you want to customize the status bar you can, simply by creating an instance of your own wxStatusBar derived class and attaching it to the frame.
Creating a simple menu bar and a drop-down menu is also demonstrated in this example. The full range of expected menu capabilities is supported, cascading submenus, checkable items, popup menus, etc. All you have to do is create a menu object and append menu items to it. The items can be text as shown here, or can be other menus. With each item you can optionally specify some short help text, as we have done, which will automatically be shown in the status bar when the menu item is selected.

Events in wxPython

The one thing that the last sample doesn't do is show you how to make the menus actually do something. If you run the sample and select "Exit" from the menu, nothing happens. Our next sample will take care of that little problem, but first a bit about events.Most, if not all, GUI systems and toolkits are designed to be event driven. This means that programs written using these GUI toolkits are basically a collection of event handlers. The event handlers determine the functionality of the program. They can open or update windows, access a database, whatever...
In non object-oriented toolkits, the event handlers are usually standalone functions that are attached to the event by calling a toolkit function. Object Oriented Programmers dislike these standalone event handler functions because they prevent complete encapsulation of the window's functionality into a single class.
To overcome this limitation many object oriented GUI toolkits, such as Java's AWT, use class methods for the event handlers. Basically events of a certain type are always sent to methods of a certain name. This fixes the encapsulation problem, but means that in order to catch an event you have to derive a new class and implement that method. Very often that is not an ideal situation, and typically causes a lot of clutter in the application as more and more classes are created just to handle certain types of events in different ways.
wxPython utilizes the best of both paradigms. Any method (or standalone function for that matter) can be attached to any event by using a helper function from the toolkit. wxPython also provides a wxEvent class and a whole bunch of derived classes for containing the details of the event. Each time a method is invoked due to an event, an object derived from wxEvent is sent as a parameter, the actual type of the event object depends on the type of event. wxSizeEvent for when the window changes size, wxCommandEvent for menu selections and button clicks, wxMouseEvent for, um…, mouse events, etc.
To solve our little problem with the last sample, all we have to do is add two lines to the MyFrame constructor, and add some methods to handle the events. We'll also demonstrate one of the Common Dialogs, the wxMessageDialog. Here's the code, with the new parts in bold.

    from wxPython.wx import *
    
    ID_ABOUT = 101
    ID_EXIT  = 102
    
    class MyFrame(wxFrame):
        def __init__(self, parent, ID, title):
            wxFrame.__init__(self, parent, ID, title,
                             wxDefaultPosition, wxSize(200, 150))
    
            self.CreateStatusBar()
            self.SetStatusText("This is the statusbar")
            menu = wxMenu()
            menu.Append(ID_ABOUT, "&About",
                        "More information about this program")
            menu.AppendSeparator()
            menu.Append(ID_EXIT, "E&xit", "Terminate the program")
            menuBar = wxMenuBar()
            menuBar.Append(menu, "&File");
            self.SetMenuBar(menuBar)
    
            EVT_MENU(self, ID_ABOUT, self.OnAbout)
            EVT_MENU(self, ID_EXIT,  self.TimeToQuit)
    
        def OnAbout(self, event):
            dlg = wxMessageDialog(self, "This sample program shows off\n"
                                  "frames, menus, statusbars, and this\n"
                                  "message dialog.",
                                  "About Me", wxOK | wxICON_INFORMATION)
            dlg.ShowModal()
            dlg.Destroy()
    
    
        def TimeToQuit(self, event):
            self.Close(true)
    
    
    
    class MyApp(wxApp):
        def OnInit(self):
            frame = MyFrame(NULL, -1, "Hello from wxPython")
            frame.Show(true)
            self.SetTopWindow(frame)
            return true
    
    app = MyApp(0)
    app.MainLoop()
    
    

The EVT_MENU function called above is one of the helper functions for attaching events to methods. Sometimes it helps to understand what is happening if you translate the function call to English. The first one is saying, "For any menu item selection event sent to the window self with an ID of ID_ABOUT, invoke the method self.OnAbout."
There are many of these EVT_* helper functions, all of which correspond to a specific type of event, or events. Some of the more popular ones are listed here:

EVT_SIZESent to a window when its size has changed, either interactively by the user or programmatically.
EVT_MOVESent to a window when it has been moved, either interactively by the user or programmatically.
EVT_CLOSESent to a frame when it has been requested to close. Unless the close is being forced, it can be canceled by calling event.Veto(true)
EVT_PAINTThis event is sent whenever a portion of the window needs to be redrawn.
EVT_CHARSent for each non-modifier (shift key, etc.) keystroke when the window has the focus.
EVT_IDLEThis event is sent periodically when the system is not processing other events.
EVT_LEFT_DOWNThe left mouse button has been pressed down.
EVT_LEFT_UPThe left mouse button has been let up.
EVT_LEFT_DCLICKThe left mouse button has been double-clicked.
EVT_MOTIONThe mouse is in motion.
EVT_SCROLLA scrollbar has been manipulated. This one is actually a collection of events, which can be captured individually if desired.
EVT_BUTTONA button has been clicked.
EVT_MENUA menu tem has been selected.
The list goes on an on... See the wxPython documentation for details.

Window Layout
Before going any further I should mention something about the various methods of managing the layout of windows and sub-windows in wxPython. There are several alternative mechanisms provided, and potentially several ways to accomplish the same thing. This allows the programmer to work with whichever mechanism works best in a particular situation, or whichever they are most comfortable with.
  1. Constraints: There is a class called wxLayoutConstraints that allows the specification of a window's position and size in relationship to its siblings and its parent. Each wxLayoutContraints object is composed of eight wxIndividualLayoutConstraint objects, which define different sorts of relationships such as which window is above this window, what is the relative width of this window, etc. You usually have to specify four of the eight individual constraints in order for the window to be fully constrained. For example this button will be positioned in the center of its parent, and will always be 50 percent of the parent's width.





    b = wxButton(self.panelA, 100, ' Panel A ')
            lc = wxLayoutConstraints()
            lc.centreX.SameAs   (self.panelA, wxCentreX)
            lc.centreY.SameAs   (self.panelA, wxCentreY)
            lc.height.AsIs      ()
            lc.width.PercentOf  (self.panelA, wxWidth, 50)
            b.SetConstraints(lc)
    
  2. Layout Algorithm: The class named wxLayoutAlgorithm implements layout of sub-windows in MDI or SDI frames. It sends a wxCalculateLayoutEvent to children of the frame, asking them for information about their size. Because the event system is used this technique can be applied to any window, even those which are not necessarily aware of the layout classes. However, you may wish to use wxSashLayoutWindow for your sub-windows since this class provides handlers for the required events, and accessors to specify the desired size of the window. The sash behavior in the base class can be used, optionally, to make the windows user-resizable. wxLayoutAlgorithm is typically used in IDE (integrated development environment) style of applications, where there are several resizable windows in addition to the MDI client window, or other primary editing window. Resizable windows might include toolbars, a project window, and a window for displaying error and warning messages.
  3. Sizers: In an effort to simplify the programming of simple layouts, a family of wxSizer classes have been added to the wxPython library. These are classes that are implemented in pure Python instead of wrapping C++ code from wxWidgets. They are somewhat reminiscent of the Layout Managers from Java in that you select the type of sizer you want and then add windows or other sizers to it and they all follow the same rules for layout. For example this code fragment creates five buttons that are laid out horizontally in a box, and the last button is allowed to stretch to fill the remaining space allocated to the box:





    box = wxBoxSizer(wxHORIZONTAL)
        box.Add(wxButton(win, 1010, "one"), 0)
        box.Add(wxButton(win, 1010, "two"), 0)
        box.Add(wxButton(win, 1010, "three"), 0)
        box.Add(wxButton(win, 1010, "four"), 0)
        box.Add(wxButton(win, 1010, "five"), 1)
    
  4. Resources: The wxWidgets library has a simple Dialog Editor available which can assist with the layout of controls on a dialog and will generate a portable cross platform resource file. This file can be loaded into a program at runtime and transformed on the fly into a window with the specified controls on it. The only downfall with this approach is that you don't have the opportunity to sub-class the windows that are generated, but if you can do everything you need with existing control types and event handlers then it should work out great. Eventually there will probably be a wxPython specific application builder tool that will generate either a resource type of file, or actual Python source code for you.
  5. Brute Force: And finally there is the brute force mechanism of specifying the exact position of every component programmatically. Sometimes the layout needs of a window don't fit with any of the sizers, or don't warrant the complexity of the constraints or the layout algorithm. For these situations you can fall back on doing it "by hand" but you probably don't want to attempt it for anything much more complex than half a dozen sub-windows or controls. wxPython does give you some tools to help though. One typical pitfall of specifying pixel coordinates for controls on a dialog box is what happens if the font size changes? Suddenly everything seems scrunched together or otherwise out of whack. By using dialog units instead of pixels for positions and sizes then the dialog is somewhat insulated from font size changes. A dialog unit is based on the default character size of the default font for the window, so if the font size changes then the size of a dialog unit changes too. The helper functions wxDLG_SZE and wxDLG_PNT turn dialog units into actual pixel sizes or positions.