Saturday, July 14, 2007

Java hints ...

I have started learning Java, I am going to leave my hints from SAMS teach yourself Java in 24 hours here in my blog.

Hope it helps someone ...

Java programs that run locally on your own computer are called applications. Programs that run on web pages are called applets.

Unlike applications, applets do not have a main() block. Instead, they have several different sections that are handled depending on what is happening in the applet. Two of the sections are the init() block statement and the paint() block. init() is short for initialization, and it is used to take care of anything that needs to be set up as an applet first runs. The paint() block is used to display anything that should be displayed.

Java is case-sensitive when it comes to variable names, so you must always capitalize variable names in the same way throughout a program.

The first letter should be lowercase, and if the variable name has more than one word, make the first letter of each subsequent word a capital letter. For instance, if you wanted to create an integer variable to store the all-time high score in a game program, you can use the following statement : int allTimeHighScore;

You can't use punctuation marks or spaces in a variable name, so neither of the following will work:

int all-TimeHigh Score;
int all Time High Score;

The following order is used when working out an expression:

1. Incrementing and decrementing take place first.

2. Multiplication, division, and modulus division occur next.

3. Addition and subtraction follow.

4. Comparisons take place next.

5. The equal sign (=) is used to set a variable's value.

In Java, a long integer variable can be anything from –9,223,372,036,854,775,808 to 9,223,372,036,854,775,807. This range ought to give your mathematical expressions plenty of breathing room when you can't use int, which has a range of –2,147,483,648 to 2,147,483,647.

Unlike the other types of variables you have used—int, float, char, boolean, and so on—the name of the String type is capitalized. The reason for this is that strings are somewhat different than the other variable types in Java. Strings are a special data resource called objects, and the types of all objects are capitalized.

To display double quotations in a string, Java has created a special code that can be put into a string: \". Whenever this code is encountered in a string, it is replaced with a double quotation mark. For example, examine the following:
System.out.println("Jane Campion directed \"The Piano\" in 1993.");

You can insert several special characters into a string in this manner. The following list shows these special characters; note that each is preceded by a backslash (\).

Special characters

Display

\'

Single quotation mark

\"

Double quotation mark

\\

Backslash

\t

Tab

\b

Backspace

\r

Carriage return

\f

Formfeed

\n

Newline

The + operator has a different meaning in relation to strings. Instead of trying to do some math, it pastes two strings together. This action can cause strings to be displayed together, or it can make one big string out of two smaller ones.Concatenation is a word used to describe this action, because it means to link two things together.

 
 
favorite.equals(guess)

This code statement is known as a method. A method is a way to accomplish a task in a Java program. This method's task is to determine whether one string, favorite, has the same value as another string, guess. If the two string variables have the same value, the text TRue will be displayed. If not, the text false will be displayed. The following is the output of this example:
 
String change = baines.toUpperCase();

int nameLength = cinematographer.length();
 

To look inside a string, use its indexOf() method. Put the string you are looking for inside the parentheses. If the string is not found, indexOf() produces the value -1. If the string is found, indexOf() produces an integer that represents the position where the string begins. Positions in a string are numbered upwards from 0, beginning with the first character in the string. (In the string "The Piano", the text "Piano" begins at position 4.)

Script is the string that includes the whole text.

int position = script.indexOf("you have shamed those trunks");

The indexOf() method is case sensitive, which means that it only looks for text capitalized exactly like the search string. If the string contains the same text capitalized differently, indexOf() produces the value -1.

To be continued ...

Wednesday, September 20, 2006

Laptop Maintenance

1) Clean Your Hard Drive

Over the course of a month it is easy to accumulate a lot of unnecessary files on your laptop hard drive. Take the time once a month to go through your hard drive and examine the files there. Determine which should be saved elsewhere for future reference and which can be trashed. If you download programs on a regular basis to try new things or just to have access to new programs for projects, properly un-install those programs when no longer needed. A cleaner hard drive runs smoother.

2) Defrag Your Hard Drive

Defragging your hard drive is another step to ensuring your laptop will run more efficiently. Taking the time to defrag once a month will allow your programs to run more quickly and make better use of the space on your hard drive. When you defrag your laptop hard drive on a monthly basis you should notice fewer software crashes or freeze ups and programs will run better.

3) Keep Your Laptop Clean

Cleaning your laptop helps prevent overheating and those nasty dust bunnies from building up inside your laptop fans and exposed ports. Cleaning the screen also means you'll always view your data clearly and it's much easier on the eyes. Keeping your case free of dust and dirt buildup will help your laptop by preventing that dirt from getting inside the laptop.

4) Full Back-Up

Full back-ups should be conducted on a monthly basis and you should have a secure, fire-proof location to store your back-up. There are a variety of software and hardware options available. You should chose the method that is easy and can be done without fuss on a monthly basis. It may require trying different methods before you find the best back-up system for your needs.

5) Software Updates

Just as you keep your anti-virus and firewall software up-to-date, you should also keep your software programs updated. For many programs the updates will address security issues which help keep your laptop and data protected while on the road.

Source : About.com
Cartoon : Photosearch.com

Wednesday, May 17, 2006

NTC 2006-Iran-Tehran, Azad University, South Tehran Branch : J2EE vs .NET



New Technologies Conference
Java vs .NET
Java vs .NET
Java vs .NET
Java vs .NET
Java vs .NET
Java vs .NET
Java vs .NET
Java vs .NET
Java vs .NET
Java vs .NET
Java vs .NET
Java vs .NET
Java vs .NET
Java vs .NET

Monday, December 12, 2005

Registery Learning : Fixing Taskbar @ its place

Here is another trick which can be useful for computers which are used in public places. If you are sick of seeing people comming around & move your Taskbar or resize it in the way they want, then this trick works for you.

This manipulation of registery just disable any changes on the taskbar. It means your taskbar would be stuck in its place and no one would be able to change it.

1. Run Registery Editor.
2. Go to :
HKEY_CURRENT_USER > Software >Microsoft > Windows > Current Version >Explorer> Advanced

3. Right click on the right window of registery editor. Choose New & then select BinaryValue. Name it "TaskbarSizeMove". Then, Right click on TaskbarSizeMove, go to modify>modifyBinaryData. Afterwards, enter " 00 00 00 01".

Hope it would be useful.

Shahab.

Saturday, December 10, 2005

Registery Learning - Showing a message at startup

Trick 1 : Showing a message at windows start up.

1. Run Registery Editor as described in last post.
2. In different versions of windows, this step is different.

*** Win 98 & Me : HKEY_LOCAL_MACHINE>Software>Microsoft>Windows>CurrentVersion>Winlogon

*** Win NT & XP : HKEY_LOCAL_MACHINE>Software>Microsoft>WindowsNT>CurrentVersion>Winlogon

3. Right click on the right window(frame) of the registery editor. Select New & then choose String(Text) Value. Name it as LegalNoticeCaption(it might already exist) .Select it & choose modify, Then enter the caption(The headline that apears on top of the windows that is going to show your message) of your message as value.

4. Again right click on the right window(frame) of the registery editor. Select New & then choose String(Text) Value. Name it as LegalNoticeText (it might already exist) .Select it & choose modify, Then enter your message as value.

Well you're done & the message would apear on every windows startup.

Shahab.

Registery Learning

Well lets start with some tricks about windows registery.
In this learning, I'll show you some trick to manage windows manualy with codes. At first you have to know how to handle registery codes. For this you have to run REGISTERY EDITOR first.

1. Press Start button.
2.Click on Run.
3.Type "regedit" & then press Enter.
4.You will have registery editor infront of yourself on screen (Visual editor).

Shahab.

First post ...

Hi,

I am shahab, student of Computer Hardware Engineering. I made this blog to share my programming experience with others ... I call this weblog Lapskaus IT because it contains various numbers of different subject in computer world exactly as ingredients in real Lapskaus which in a north European food ...


Hope to be useful ...

With regards.

Shahab.
Iran, Tehran.