Pages

5 Tips For Faster Loading Web Sites

Thursday, October 20, 2011

Recently I came across Aaron Hopkins' Optimizing Page Load Time article. It explains in depth how you should optimize your web pages for a faster browsing experience. It's full of brilliant theory, but not to so much about practical tips for the average blogger. So here is a list of 5 things you can do to optimize your web pages without having to redo your site design or set up distribution caches around the planet. It helped me to reduce load time of this web site by about 70% on average.
Some of these tips require some control over your web server, like being able to edit .htaccess or even the Apache server config. If so, they will be marked accordingly. Others can be done with every shared hosting plan.

Stylesheets and Javascripts

Hopkins states that many small external objects like images or stylesheets hurt your performance more then just a few big objects with the same total size. This is due mostly to the overhead created by multiple TCP connections but also by the fact, that the average user is connected with DSL and has a decent download rate but only limited upload bandwidth. Thus, many requests from the browser for small objects create a bottleneck in the upstream. Unless you serve static content from a subdomain, cookies are sent to the server with every request - even for static files.
But it's even worse. While up to four images are loaded in parallel in most browsers, stylesheets and javascripts are not. The browser waits until the first stylesheet has finished loading, then requests the second one and so on. In my tests, Firefox didn't actually load any images before all stylesheets and javascripts were done loading. A test with a simple HTML page over a DSL connection shows that one big stylesheet of 50 KB can speed up load time by factor 2 compared to five stylesheets that are 10 KB each in size: (look further down in this article for a detailed chart)
  • 5 Stylesheets (10KB each): 1100ms
  • 1 Stylesheet (50KB): 500ms
So here's my first tip: use one single stylesheet and javascript file instead of many small ones. I know one big file is harder to maintain, but once your site goes into production, you shouldn't have to change these files often anyway. Some sites like slashdot.org or digg.com reference dozens of .css and .js from their front page. Slashdot takes about twenty seconds for me to load from a clear browser cache. Don't go this mad with your css unless you have enough regular readers already. For someone new to your site coming over from Google this will be a major turn off.
If your stylesheets are static files and you would like to keep them seperate for better maintenance, you can bundle them into one request dynamically:
<?php
# File css.php
readfile("stylesheet1.css");
readfile("stylesheet2.css");
?>
As Kevin Palms points out, you will have to set the header information manually in PHP like this:
# File css.php
header('Content-type: text/css');
# ...
Save this code as a file called something like css.php and reference it from your HTML:
<link rel="stylesheet" type="text/css" href="/css.php" />

Caching is your friend

Needs Apache module mod_expires and .htaccess Many webmasters don't like the fact that their pages are being cached because they fear of loosing control over their content and not being able to track statistics. They put meta statements in the head of their HTML documents that tell proxies and browsers not to cache itself. But caching works on a lower level. It would be silly to download and read the file first to know wether or not the cached version should have been used. Proxies and browsers will always try to cache your pages, regardless of this. By setting up decent rules for caching with HTTP headers, you can at least gain some control over it.
You need to have Apache's mod_expires on your server for this to work. If you have access to your servers config files, check if the following line is commented out in the load modules section:
LoadModule expires_module modules/mod_expires.so
In your .htaccess or preferably virtual host container insert something like this:
ExpiresActive On
ExpiresByType text/html "access plus 30 seconds"
ExpiresByType text/css "access plus 2 weeks"
ExpiresByType text/javascript "access plus 2 weeks"
ExpiresByType image/png "access plus 1 month"
Modify to your needs. For every file type you would like to cache, insert an extra statement. For my server, I don't want text/html to be cached for long, because they are dynamic anyway and I want to see how often pages are requested. I use compression for these files, but we'll talk about that later.
If your files have changed, use a new file name. You can trick browsers into thinking the file URL has changed by adding a useless query string to static files like this: "stylesheet.css?new".
If your weblog features some kind of HTTP header manipulation for caching, you should turn it off so it doesn't interfere with your settings. I wasted much time trying to figure out why caching on a Textpattern website was not working right until I noticed a setting called "Send Last-Modified Header" was turned on in the admin preferences. It seems that Textpattern was forcing the Last-Modified header from within PHP for pages like css.php?n=default which resulted in unnecessary conditional GET requests. If you set a decent expiration date for your files, there's no need for conditional GET!
For more information about caching, head over to Mark Nottingham's Caching Tutorial.

Compress text files

Needs Apache 2, mod_deflate, mod_headers and access to server config. So now your static content is being cached properly, but it still needs to be downloaded once at least. Also there's your dynamic html. Compression can save you a huge amount of bandwidth and deliver pages faster. In the above example about stylsheets, compression decreased download size from 50KB to about 13KB. Here is a complete graph for the same test run again with and without compression for an uncompressed download size of ~50KB total:

This will not only save bandwidth, but also make pages load faster. Because pages are served faster, your server will be able to deliver more pages in the same time. The difference might be even bigger for users with low bandwidth. Keep in mind, that a slow client on dial up from New Zealand will keep one Apache child process (or thread, depending on your MPM) busy, while it is downloading the content.
To make this happen, you will need to have two Apache modules loaded:
LoadModule headers_module modules/mod_headers.so
LoadModule deflate_module modules/mod_deflate.so
The following directives don't work in .htaccess. You need to place them in your servers config, i.e your virtual host container:
# Compress some text file types
AddOutputFilterByType DEFLATE text/html text/css text/xml application/x-javascript

# Deactivate compression for buggy browsers
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html

# Set header information for proxies
Header append Vary User-Agent
The first line says what file types should be compressed. Add the uncompressed file types you host on your server. It makes no sense to compress already compressed files like images or archives. Compressing these files again will only increase your server's load. The next three lines just exclude some know buggy browsers from the benefits of compression. The last line tells proxies not to deliver the same content to all user agents, because some of them just can't handle it.
The downside of mod_deflate is the CPU time consumption. You may have to tweak the compression level to meet your needs:
# n = 1..9 with 9 being the highest compression level. Standard is 6.
DeflateCompressionLevel n
For more in depth information see the Apache 2 mod_deflate Benchmark by Frank Schoep.

Compress your images the right way

Saving your images with Photoshop and "save for web" doesn't mean they are optimized. There is more to image optimization than saving photos as Jpeg and navigation elements as PNG. Even lossless formats like PNG can often be compressed to 50% of it's original size without quality loss if you use the right software.
I have successfully used the freely available OptiPNG. OptiPNG compresses PNG, GIF and other formats. It comes with source code for Unix or as a precompiled binary for Windows. Build instructions for Unix are found in the README. It is a command line tool and can be run with wildcards to automatically optimize all images in a given directory.

Apache fine tuning

Needs access to .htaccess or server config If you have access to your servers configuration, there is some more settings you can play with. For one, disable host name lookups. It will safe time on every request. You will not have host names of clients available in CGI scripts and access_log, but there is better tools for that anyway in post processing of your log files. Preferably in your server config or on a directory level in your .htaccess turn it off like this:
HostnameLookups Off
In one last step, configure persistent connections in Apache's config. Persistent connections let the browsers request multiple files with one TCP connection, thus reducing overhead for TCP handshakes and speeding up requests a lot. These are the standard settings with Apache 2.2:
KeepAlive On
MaxKeepAliveRequests 100
KeepAliveTimeout 15
The standards are fine actually, but it's a good idea to experiment with these under your server's regular load conditions. MaxKeepAliveRequests is the maximum number of requests in one persistent connection. More is better, but bad spambots that request many pages at once may suck up all available connections if that number is too high.
KeepAliveTimeout is the timeout after which a persistent connection is dropped. The optimal value here depends on your server load and the clickyness of your web site. If visitors of your web site make many clicks in a short time, you can tweak that value to let one visitor always click within one persistent connection. Note that this is only advisable if your overall traffic is rather low. If you expect high peaks in traffic, don't set this value too high because you might end up having no connections left to serve new incoming requests.
That's all folks. If you're really bold and into building your own Apache server, have a look at my article about Compiling Apache 2.2.
READ MORE - 5 Tips For Faster Loading Web Sites

NVIDIA Network Access Managment tool

Friday, September 30, 2011

UTorrent claims Nvidia Network Access Manager needs to be updated
BIT Torrent claims Nvidia Network Access Manager needs to be updated

You appear to be running version 67.96 of NVIDIA Network Access Managment tool.
This version has known issues may create problems with uTorrent
Please upgrade your NVIDIA software to at least version 73.12


  http://in.download.nvidia.com/Windows/93.71/93.71_forceware_winxp2k_international_whql.exe
READ MORE - NVIDIA Network Access Managment tool

HACKERS TO KILL FACEBOOK ON NOV. 5th, 2011

Tuesday, August 16, 2011


HACKERS TO KILL FACEBOOK ON NOV. 5th, 2011
A hacker collective, “Anonymous” vows to take down the social networking giant this November.
Anonymous will attack Facebook  Nov 5, in protest of the government-social networking complex.  Facebook is taking the threat seriously and is planning a counterattack against  the hackers.
“They have no chance,” a hacker told  WWN in a secret meeting held Palo Alto.  “There is nothing Facebook can do to stop it.  The algorithm has already started.  They are going down.”
Media outlets around the world picked up the story and highlighted the two-week old video, which went viral this week.
Many “IT specialists” at top technology companies are calling the threat a hoax, but the hackers believe this is just a counter move by Facebook and government agencies to keep people using Facebook.
“The U.S. government has been working with Facebook for the last two years, collecting data on every American and citizens around the world.  They are planning to control us all.  We will not let that happen.  Facebook will die on November 5th, 2011.

A hacker collective, “Anonymous” vows to take down the social networking giant this November.
Anonymous will attack Facebook  Nov 5, in protest of the government-social networking complex.  Facebook is taking the threat seriously and is planning a counterattack against  the hackers.

The video first appeared on July 16 when a newly created YouTube channel — FacebookOp — uploaded the video “Message from Anonymous: Operation Facebook, Nov 5 2011.”
The manifesto urges the audience to kill Facebook over privacy-related concerns.
The speaker in the video claiming to be Anonymous encouraged hacktivists to “join the cause and kill facebook  for the sake of your own privacy  – and your freedom.”
Some have speculated that Mark Zuckerberg works for the CIA.
“Everything you do on Facebook stays on Facebook regardless of your privacy settings, and deleting your account is impossible,” the posts read. “Even if you delete your account, all your information stays on Facebook and can be recovered at any time.”
Facebook has been selling information to government agencies and giving clandestine access to information security firms so they can spy all the people from all around the world,” the post added.
For personal safety  reasons, Anonymous has neither confirmed nor denied it is connected to the video.
In recent months, Facebook has faced criticism about its privacy-related policies. In May, a Senate panel questioned Facebook executives for allegedly failing to prevent underage people from having access to the network. Security software company Symantec also has said third-parties like advertisers had access to sensitive data of millions of Facebook users for years.
Facebook has denied there was any security breach, saying no private information could have been passed to third parties. The site also said the Symantec report had ignored contractual obligations of advertisers and developers that prohibit them from obtaining or sharing user information in a way that violates its policies.
WWN has learned that the CIA and FBI are looking for “Anonymous” and plan to do “everything in their power” to stop the November 5th attack.

News broke yesterday that the hacktivist group Anonymous is vowing to destroy Facebook on November 5, 2011 (Guy Fawkes Day). Now there is speculation that it’s all just a hoax. After a little digging, I’ve found that the collective group Anonymous doesn’t support what a few of its members are reportedly up to.
I contacted Facebook last night to see what the company thinks about a possible Anonymous attack. Facebook did not get back to me, so today I decided to look for more information myself. First, let’s look at how this all started.

 These account names are a little odd: why not just use one of the many other mediums that Anonymous has used in the past? Furthermore, the released video, embedded above, is not of the usual computerized voice and visual production quality that we’re used to from Anonymous.
The dates are also questionable: why didn’t this news spread like wildfire three weeks ago? Whenever Anonymous or LulzSec declare a new target, the world definitely notices. Furthermore, while Guy Fawkes Day is a perfectly understandable choice, it’s very far away. There are 112 days between July 16, 2011 and November 5, 2011: Anonymous rarely gives more than a few days notice, if at all.
My suspicions were confirmed via a few Twitter accounts that Anonymous has previously used to talk to the media and the general public. They have given accurate information regarding the organization and its actions in the past, so I’m not as hesitant to believe what they are saying.
GroupAnon, which has some 26,000 followers, sent out these two tweets:
No one can speak for the whole of #Anonymous. There are some anons who support #OpFacebook whilst others do not. | #AnonOps
@Anonymous_SA Exactly! #OpFacebook is just an Op, it’s not Anonymous…
AnonOps, which has some 45,000 followers, sent out these four tweets:
We prefer to face the real power and not to face to the same medias that we use as tools. #OpFacebook #Anonymous
#OpFacebook is being organised by some Anons. This does not necessarily mean that all of #Anonymous agrees with it.
Dont be silly. Important things are happening in the world to deal with quirks like #OpFacebook. Lets keep our style & moral #Anonymous
TO PRESS: MEDIAS OF THE WORLD… STOP LYING! #OpFacebook is just ANOTHER FAKE! WE DONT “KILL” THE MESSENGER. THAT’S NOT OUR STYLE #Anonymous


spread the new video like AIDS NOU!!! youtube.com/watch?v=SWQTS8…
Also, here is the original “press release” from the YouTube video posted by FacebookOp:
Attention citizens of the world,
We wish to get your attention, hoping you heed the warnings as follows:
Your medium of communication you all so dearly adore will be destroyed. If you are a willing hacktivist or a guy who just wants to protect the freedom of information then join the cause and kill facebook for the sake of your own privacy.


Facebook has been selling information to government agencies and giving clandestine access to information security firms so that they can spy on people from all around the world. Some of these so-called whitehat infosec firms are working for authoritarian governments, such as those of Egypt and Syria.
Everything you do on Facebook stays on Facebook regardless of your “privacy” settings, and deleting your account is impossible, even if you “delete” your account, all your personal info stays on Facebook and can be recovered at any time. Changing the privacy settings to make your Facebook account more “private” is also a delusion. Facebook knows more about you than your family. 
You cannot hide from the reality in which you, the people of the internet, live in. Facebook is the opposite of the Antisec cause. You are not safe from them nor from any government. One day you will look back on this and realise what we have done here is right, you will thank the rulers of the internet, we are not harming you but saving you.
The riots are underway. It is not a battle over the future of privacy and publicity. It is a battle for choice and informed consent. It’s unfolding because people are being raped, tickled, molested, and confused into doing things where they don’t understand the consequences. Facebook keeps saying that it gives users choices, but that is completely false. It gives users the illusion of and hides the details away from them “for their own good” while they then make millions off of you. When a service is “free,” it really means they’re making money off of you and your information.
Think for a while and prepare for a day that will go down in history. November 5 2011, #opfacebook . Engaged.
This is our world now. We exist without nationality, without religious bias. We have the right to not be surveilled, not be stalked, and not be used for profit. We have the right to not live as slaves.
If Facebook is indeed attacked on November 5, 2011, it does not appear that Anonymous as a whole will be supporting the hacks.
READ MORE - HACKERS TO KILL FACEBOOK ON NOV. 5th, 2011

Object-Oriented Programming

Tuesday, August 2, 2011

You have probably heard a lot of talk about object-oriented programming. And, if the Java programming language is your first experience with an object-oriented language, you are probably wondering what all the talk is about.
You already know a little about object-oriented programming because after working the example programs in Java Programming Language Basics, Part 1 and Part 2, you are somewhat familiar with the object-oriented concepts of class, object, instance, and inheritance plus the access levels public and private. But mostly, you have been doing object-oriented programming without really thinking about it.
And that is one of the great things about the Java programming language. It is inherently object oriented.
To help you gain a deeper understanding of object-oriented programming and its benefits, this lesson presents a very brief overview of object-oriented concepts and terminology as they relate to some of the example code presented in this tutorial.
  • Object-Oriented Programming Defined
  • Classes
  • Objects
  • Well-Defined Boundaries and Cooperation
  • Inheritance
  • Polymorphism
  • Data Access Levels
  • Your Own Classes
  • Program Improvements
  • More Information

Object-Oriented Programming Defined

Object-oriented programming is a method of programming based on a hierarchy of classes, and well-defined and cooperating objects.

Classes

A class is a structure that defines the data and the methods to work on that data. When you write programs in the Java language, all program data is wrapped in a class, whether it is a class you write or a class you use from the Java platform API libraries.
The ExampleProgram class from the simple program in the first lesson of Part 1 is a programmer-written class that uses the java.lang.System class from the Java platform API libraries to print a character string to the command line.
class ExampleProgram {
  public static void main(String[] args){
    System.out.println("I'm a simple Program");
  }
}

Classes in the Java platform API libraries define a set of objects that share a common structure and behavior. The java.lang.System class used in the example defines such things as standard input, output, and error streams, and access to system properties. In contrast, the java.lang.String class defines character strings.
In the example, you do not see an explicit use of the String class, but in the Java language, a character string can be used anywhere a method expects to receive a String object. During execution, the Java platform creates a String object from the character string passed to the System.out.println call, but your program cannot call any of the String class methods because it did not instantiate the String object.
If you want access to the String methods, you can rewrite the example program to create a String object as follows. This way, you can call a method such as the String.concat method that adds text to the original string.
class ExampleProgram {
  public static void main(String[] args){
    String text = new String("I'm a simple Program ");
    System.out.println(text);
    String text2 = text.concat(
      "that uses classes and objects");
    System.out.println(text2);
  }
}

The output looks like this:
I'm a simple Program
I'm a simple Program that uses classes and objects

Objects

An instance is an executable copy of a class. Another name for instance is object. There can be any number of objects of a given class in memory at any one time.
In the last example, four different String objects are created for the concatenation operation, text object, text2 object, and a String object created behind the scenes from the " that uses classes and objects" character string passed to the String.concat method.

Also, because String objects cannot be edited, the java.lang.String.concat method converts the String objects to StringBuffer (editable) string objects to do the concatenation.
Besides the String object, there is an instance of the ExampleProgram.java class in memory as well.
The System class is never instantiated by the ExampleProgram class because it contains only static variables and methods, and therefore, cannot be instantiated by a program, but it is instantiated behind the scenes by the Java virtual machine1 (VM).

Well-Defined Boundaries and Cooperation

Class definitions must allow objects to cooperate during execution. In the previous section, you saw how the System, String, and StringBuffer objects cooperated to print a concatenated character string to the command line.
This section changes the example program to display the concatenated character string in a JLabel component in a user interface to further illustrate the concepts of well-defined class boundaries and object cooperation.
The program code to place the text in a label to display it in a user interface uses a number of cooperating classes. Each class has its own function and purpose as summarized below, and where appropriate, the classes are defined to work with objects of another class.
  • ExampleProgram defines the program data and methods to work on that data.
  • JFrame defines the top-level window including the window title and frame menu.
  • WindowEvent defines behavior for (works with) the Close option on the frame menu.
  • String defines a character string to create the label.
  • JLabel defines a user interface component to display static text.
  • JPanel defines the background color, contains the label, and uses the default layout manager (java.awt.FlowLayout) to position the label on the display.
While each class has its own specific purpose, they all work together to create the simple user interface you see here.
import javax.swing.*;
import java.awt.Color;
import java.awt.event.*;

class ExampleProgram extends JFrame {

  public ExampleProgram(){
    String text = new String("I'm a simple Program ");
    String text2 = text.concat(
      "that uses classes and objects");

    JLabel label = new JLabel(text2);
    JPanel panel = new JPanel();
    panel.setBackground(Color.white);

    getContentPane().add(panel);
    panel.add(label);
  }

  public static void main(String[] args){
    ExampleProgram frame = new ExampleProgram();

    frame.setTitle("Fruit $1.25 Each");
    WindowListener l = new WindowAdapter() {
      public void windowClosing(WindowEvent e) {
        System.exit(0);
      }
    };

    frame.addWindowListener(l);
    frame.pack();
    frame.setVisible(true);
  }
}


Inheritance

One object-oriented concept that helps objects work together is inheritance. Inheritance defines relationships among classes in an object-oriented language. In the Java programming language, all classes descend from java.lang.Object and implement its methods.
The following diagram shows the class hierarchy as it descends from java.lang.Object for the classes in the user interface example above. The java.lang.Object methods are also shown because they are inherited and implemented by all of its subclasses, which is every class in the Java API libraries. java.lang.Object defines the core set of behaviors that all classes have in common.
As you move down the hierarchy, each class adds its own set of class-specific fields and methods to what it inherits from its superclass or superclasses. The java.awt.swing.JFrame class inherits fields and methods from java.awt.Frame, which inherits fields and methods from java.awt.Container, which inherits fields and methods from java.awt.Component, which finally inherits from java.lang.Object, and each subclass adds its own fields and methods as needed.

Polymorphism

Another way objects work together is to define methods that take other objects as parameters. You get even more cooperation and efficiency when the objects are united by a common superclass. All classes in the Java programming language have an inheritance relationship.
For example, if you define a method that takes a java.lang.Object as a parameter, it can accept any object in the entire Java platform. If you define a method that takes a java.awt.Component as a parameter, it can accept any component object. This form of cooperation is called polymorphism.
You saw an example of polymorphism in Part 2, Lesson 5: Collections where a collection object can contain any type of object as long as it descends from java.lang.Object. It is repeated here to show you that Set collection can add a String object and an Integer object to the Set because the Set.add method is defined to accept any class instance that traces back to the java.lang.Object class.
String custID = "munchkin";
  Integer creditCard =  new Integer(25);

  Set s = new HashSet();
  s.add(custID);
  s.add(creditCard);


Data Access Levels

Another way classes work together is through access level controls. Classes, and their fields and methods have access levels to specify how they can be used by other objects during execution, While cooperation among objects is desirable, there are times when you will want to explicitly control access, and specifying access levels is the way to gain that control. When you do not specify an access level, the default access level is in effect.

Classes

By default, a class can be used only by instances of other classes in the same package. A class can be declared public to make it accessible to all class instances regardless of what package its class is in. You might recall that in Part 1, Part 1, Lesson 3: Building Applets, the applet class had to be declared public so it could be accessed by the appletviewer tool because the appletviewer program is created from classes in another package.
Here is an applet class declared to have a public access level:
public class DbaAppl extends Applet
                 implements ActionListener {
Without the public access level (shown below), its access level is package by default. You get an error when you try to interpret a class with an access level of package with the appletviewer tool. The same is true if the access level is protected or private.
class DbaAppl extends Applet
                 implements ActionListener {
Also, in Part 2, Lesson 6: Internationalization the server classes are made public so client classes can access them.

Fields and Methods

Fields and methods can be declared private, protected, public, or package. If no access level is specified, the field or method access level is package by default.
private: A private field or method is accessible only to the class in which it is defined. In Part 1, Lesson 7: Database Access and Permissions the connection, user name, and password for establishing the database access are all private. This is to prevent an outside class from accessing them and jeopardizing the database connection, or compromising the secret user name and password information.
private Connection c;
protected: A protected field or method is accessible to the class itself, its subclasses, and classes in the same package.
public: A public field or method is accessible to any class of any parentage in any package. In Part 2, Lesson 6: Internationalization server data accessed by client programs is made public.
package: A package field or method is accessible to other classes in the same package.

Your Own Classes

When you use the Java API library classes, they have already been designed with the above concepts in mind. They all descend from java.lang.Object giving them an inheritance relationship; they have well-defined boundaries; and they are designed to cooperate with each other where appropriate.
For example, you will not find a String class that takes an Integer object as input because that goes beyond the well-defined boundary for a String. You will, however, find the Integer class has a method for converting its integer value to a String so its value can be displayed in a user interface component, which only accepts String objects.
But what about when you write your own classes? How can you be sure your classes have well-defined boundaries, cooperate, and make use of inheritance? One way is to look at the functions you need a program to perform and separate them into distinct modules where each functional module is defined by its own class or group of classes.

Well-Defined and Cooperating Classes

Looking at the RMIClient2 class from the Part 2, Lesson 5: Collections lesson, you can see it performs the following functions: Get data, display data, store customer IDs, print customer IDs, and reset the display.
Getting data, displaying the data, and resetting the display are closely related and easily form a functional module. But in a larger program with more data processing, the storing and printing of customer IDs could be expanded to store and print a wider range of data. In such a case, it would make sense to have a separate class for storing data, and another class for printing it in various forms.
You could, for example, have a class that defines how to store customer IDs, and tracks the number of apples, peaches, and pears sold during the year. You could also have another class that defines report printing. It could access the stored data to print reports on apples, peaches, and pears sold by the month, per customer, or throughout a given season.
Making application code modular by separating out functional units makes it easier to update and maintain the source code. When you change a class, as long as you did not change any part of its public interface, you only have to recompile that one class.

Inheritance

Deciding what classes your program needs means separating functions into modules, but making your code more efficient and easier to maintain means looking for common functions where you can use inheritance. If you need to write a class that has functionality similar to a class in the Java API libraries, it makes sense to extend that API library class and use its methods rather than write everything from scratch.
The RMIClient2 class from the Part 2, Lesson 5: Collections lesson extends JFrame to leverage the ready-made functionality it provides for a program's top-level window including, frame menu closing behavior, background color setting, and a customized title.
Likewise, if you want to add customized behavior to an existing class, you can extend that class and add the functionality you want. For example, you might want to create your own JButton class with a different look. To do this, you can write your own class that extends JButton and implement it to appear the way you want. Then your program can instantiate your button class instead of the JButton class whenever you need a button with the new look you created.

Access Levels

You should always keep access levels in mind when you declare classes, fields, and methods. Consider which objects really need access to the data, and use packages and access levels to protect your application data from all other objects executing in the system.
Most object-oriented applications do not allow other objects to access their fields directly by declaring them private. Then they make their methods protected, public, or package as needed and allow other objects to manipulate their private data by calling the methods only. This way, you can update your class by changing a field definition and the corresponding method implementation, but other objects that access that data do not need to be changed because their interface to the data (the method signature) has not changed.

Program Improvements

Program improvements for this lesson include setting the correct access levels and organizing a program into functional units.

Setting Access Levels

It is always best to restrict access as much as possible. Going back to Part 2, Lesson 7: Packages and JAR Files, the server classes had to be made public and the DataOrder class fields also had to be made public so the client programs can access them.
At that time, no access level was specified for the other classes and fields so they are all package by default. All methods have an access level of public.
A good exercise would be to go back to the client classes and give the classes, fields, and methods an access level so they are not accessed inappropriately by other objects.
Here are possible solutions for the RMIClient1.java and RMIClient2.java client programs. Can you explain why the actionPerformed method cannot be made private? If not, make it private, run the javac command to compile, and see what the compiler has to say about it.

Organizing Code into Functional Units

One way to divide code into functional units is to put the user interface code in one class and the code that responds to user interface interactions in another class. Going back to Lesson 6: Internationalization, take the RMIClient1.java program and move the actionPerformed method to its own class.
Hints: The RMIClient1 class will become two classes.
  • The class that builds the UI has a main method; the second class does not.
  • The class with the main method creates an instance of the second class, and passes an instance of itself to the second class.
  • The second class accesses user interface components in the first class by referencing the class instance.
  • You will need to work out how the second class will get access to the message bundle with the translated text in it.
  • You will have to change some access levels so the classes can access each other's members.
Here is a possible solution:

  • RMIClientView
  • RMIClientControlle
READ MORE - Object-Oriented Programming

Why you want Object Oriented Programming in PHP

 Why you want Object Oriented Programming in PHP
First let me explain what the issue is around Object Oriented Programming (OOP). Traditionally (from the beginning of the computer era), programming was done by combining conditional statements with GOTO blocks to create a program flow. In the early '70s a Dutch computer scientist Edsger Dijksma strongly advocated the use of procedural programming, which means abandoning GOTO statements and creating a sort of chronological program flow in your code (from top to bottom). This style has been widely adapted and for most people is the way they program PHP applications. It is however already a thing of the past. Most modern programming languages are based on an OO approach and don't even allow for procedural coding anymore (for instance in languages as Java, C++, C#, Python, and Ruby). Explaining OOP goes beyond the scope of this article, so for understanding OOP in PHP I'd like to point you in this direction. For now let's just say that OOP is about creating relatively small objects with specific functions that interact with each other to form a complete application.

Typically, the main advantages of OOP are:

    Reusability of code; a well designed object has only one specific function and is therefore completely independent of the environment it is placed in and thus can be reused easily.
    Clearer structure of code; again a well designed object has only one specific function which means that all the code supporting that function is located in one place which increase maintainability.

A major disadvantage of OOP is that it requires more lines of code and is therefore more time consuming to produce.

In PHP we as developers are left with a choice. Typically, anyone who started out with PHP without any (OO) programming background will have started with learning procedural coding. Most tutorials on the web only cover procedural coding and quite honestly, the old fashioned way is just easier to use in many situations (for instance in small applications, or when you just start out with PHP).

However (here comes the wise lesson) Object Oriented Programming in PHP is definitely the way to go for any serious PHP developer taking on serious projects. For the past 8 months my web development firm has been working on a huge project for a real estate agent. The application takes care of many aspects of the clients administration, publishes it's information to multiple people (each with different clearances) and in multiple formats (web content, PDF, RTF). Using OOP in projects such as this is so incredibly superior over using procedural coding. Using OOP, we for instance model a real estate object (a house...) as a PHP object. The (PHP) object contains over 60 variables (all stored in a MySQL database but intelligently retrieved by the object) and many functions that allow the object to update it's data and return information on itself based on the users clearance levels. The data itself can be interpreted by either our web content generator object, or by our PDF generator object, no changes required. This goes for all the little parts the application has and you wouldn't believe how much time it has saved us in making small adjustments and adding small new features.

Doing this project in procedural code would have been horrible and messy. Just imagine having new additions to your project specifications on a weekly basis for several months and jotting all those things in between the already existing code using if/else statements etc. in procedural coding. You would probably go screaming mad about the PHP files containing more than 500 lines of code without any clear structure in them..

What's more, many of the classes we have designed for this project are useful in other projects as well (this actually already proved true). Furthermore we are experiencing nice and clean work divisions since we switched to OOP which definitely increased both our productivity and efficiency.

The thing is that the extra work needed when using OOP will be earned back with huge interest in a little while. Maintenance time is dramatically reduced, there is no more code overlap in your application and you (and your fellow programmers) will work more efficiently due to clearer work divisions and structure. Switching to OOP is really not that difficult, given the many tutorials (for instance this one, by Harry Fuecks) and will save you valuable time and most of all make your life easier.

If you are still not convinced I strongly suggest you read Harry Fuecks' tutorial mentioned in the previous paragraph as it will point out more advantages to you. Also you mind want to start learning OOP because of the PEAR project (standard libraries written in OO PHP, designed to really make your life easier by offering standard functions in freely available packages). Feel free to ask questions if you have any!
READ MORE - Why you want Object Oriented Programming in PHP

tips to start blogging

 Tips to Start Blogging
There are lots of ways to increase traffic in your blogs. One way of increasing traffic is SEO i.e. Search Engine Optimization.

You can try for getting target keywords through Google Adwords Research Tools. Select keywords which has lower search volumes, you can target more competitive keywords later. Very competitive keywords take months, maybe years to rank first page for. Use Google Trends to compare search volumes between different keywords.

Submit your blogs to the proper categories in Directories. For a start, submit to DMOZ.org.

Sign-up at SitePoint.com Forums and participate in their SEO Forums.

Watch some videos on YouTube about SEO. That will give you an overview about what you need to do.

For earning money through Adsense and monitoring your blog traffic

sign up for Google Adsense.

sign up for Google Analytics.

sign up for Google Webmasters Tools.

For any further information/ clarification regarding signing up or putting advertisements in your blogs, feel free to contact me through Shout Mix "Talk to me" given at the top left side.
READ MORE - tips to start blogging

Tips for Marketing Your Blog

 Tips for Marketing Your Blog
With so many blogs being created every day, it’s a mystery to many bloggers how to make their blog stand out. There are many types of blogs or purposes for blogs and a certain number of tactics are applicable to just about all of them. Some companies choose to hire a blog consultant, but others like to try things internally. For those “DIY” companies and individuals interested in practical tips for marketing and optimizing a business blog, try out the following list of blog marketing and optimization tips:

1. Decide on a stand alone domain name. Sub domain is also an option. Avoid hosted services that do not allow you to use your own domain name!
2. Obtain and install customizable blog software - WordPress and Moveable Type are my favorites.
3. Customize blog look and feel templates - aka design.
4. Research keywords and develop a glossary - Keyword Discovery, WordTracker, SitePoint, SEOBook Keyword Research.
5. Optimize the blog:
                 * Template optimization - RSS subscription options, social bookmark links, HTML code, Unique title tags, URLs, Sitemap
                 * Add helper plugins specific to WordPress or MT
                 * Create keyword rich categories (reference your keyword glossary)
6. Enable automatic trackback and ping functionality.
7. Create Feedburner Pro account and enable feed tracking.
8. Setup a Google account for Sitemap, validate and prep for future submission.
9. Identify authoritative blogs, web sites and hubs for outbound resource links and blogroll.
10. Format archived posts, related posts.
11. Enable statistics for tracking - Google Analytics, ClickTracks.
12. Submit RSS feed and Blog URL to prominent RSS and Blog directories / search engines.
13. Engage in an ongoing link building campaign.
14. If podcast or video content are available, submit to Podcast and Vlog directories.
15. Submit blog url to paid directories with categories for blogs - Yahoo, BOTW, bCentral, WOW, JoeAnt.
16. Optimize and distribute a press release announcing blog.
17. Request feedback or reviews of your blog in relevant forums, discussion threads. If you have a resourceful post that will help others, point to it.
18. Research and comment on relevant industry related blogs and blogs with significant centers of influence.
19. Post regularly. If it’s a news oriented blog, 3-5 times per day. If it’s an authoritative blog, 3-5 times per week, but each post must be unique and high value.
20. Monitor inbound links, traffic, comments and mentions of your blog - Google Alerts, Technorati, Blogpulse, Yahoo News, Ask Blogs and Feeds.
21. Always respond to comments on your blog and when you detect a mention of your blog on another blog, thank that blogger in the comments of the post.
22. Make contact with related bloggers on AND offline if possible.
23. When making blog posts always cite the source with a link and don’t be afraid to mention popular bloggers by name. Use keywords in the blog post title, in the body of the post and use anchor text when you link to previous posts you’ve made.
24. Use social networking services, forums and discussion threads to connect with other bloggers. If they like your stuff, they will link to you.
25. Remember when web sites were a new concept and the sage advice to print your web address everywhere you print your phone number? The same advice applies for your blog
READ MORE - Tips for Marketing Your Blog

Tips-Increase Traffic to your Blog

 Tips-Increase Traffic to your Blog

Do you want to increase traffic to your blog? Well, here are some ready tips to make a move in the world of success blogging. Get started with the following tips that make your task easy.

1. Make a habit of posting regularly in the blog.

2. Write a topic and post it in different sections and thereby create a series. This increases the curiosity of the web visitors who turn to the blog for the interesting follow-ups.

3. Write on controversial topics that arouse the interests of the web visitors.

4. Try to blog out breaking news first. It increases the popularity and creates an authentic image in the web community.

5. Use right keywords in the body content. The placement of the keywords in accurate density proves to be search engine friendly.

6. It is very important to encourage comments of web visitors in your blog. Highlight the most relevant comments on the blog. Try to build a cordial relation with the web visitors so that they visit your blog over and over again.

7. Submit your blog in blog directories and the RSS feed in RSS directories respectively.

8. It will be fruitful if you use the Ping-O-Matic service. Enter your blog name and its URL and select the directories according to choice. Any updates in your blog are automatically updated in the directories. The web visitors in these directories will be able to access your contents.

9. While designing your blog it is necessary to make an email subscription button and form. This proves to be very user friendly.

10. Try to comment on other blogs. This will introduce your blog in the blogger community.

11. List your favorite blogs in the blog rolls. You must also try to list your blog in other blogs.

12. It is highly important to add your blog’s URL to your email signature and any profiles other social networking sites. This will also introduce your blog in the web community.

13. It is essential to use Digg, Stumble and other social bookmarking sites for your blog. Once you send a post in the aggregators, it will reach millions in no time.

14.
Write on related topics. Post related topics in a row. This helps in stirring up the interest of the web visitors.

15. Show the topmost posts in the your blog which received great popularity. This will bear evidence of your blog’s authenticity and significance.

16. It is mandatory to add “previous” and “next” post buttons. This helps the user to quickly and easily navigate through the web pages.

17. Try to build up inbound links in your blog. This will help the web visitors to access other important pages in your blog and thus enhance traffic flow.

18. It is important to that you must claim the blog at Technorati, which gives ranking to blogs according to number of incoming links and rankings by Alexa Toolbar.

19. Rework on the post. Try to check out every detail in your post and make it exciting.

20. Use photos in your post.
READ MORE - Tips-Increase Traffic to your Blog

How to use Google for Hacking

Sunday, May 1, 2011

How to use Google for Hacking

Google serves almost 80 percent of all search queries on the Internet, proving itself as the most popular search engine. However Google makes it possible to reach not only the publicly available information resources, but also gives access to some of the most confidential information that should never have been revealed. In this post I will show how to use Google for exploiting security vulnerabilities within websites. The following are some of the hacks that can be accomplished using Google.

1. Hacking Security CamerasThere exists many security cameras used for monitoring places like parking lots, college campus, road traffic etc. which can be hacked using Google so that you can view the images captured by those cameras in real time. All you have to do is use the following search query in Google. Type in Google search box exactly as follows and hit enter
inurl:”viewerframe?mode=motion”
Click on any of the search results (Top 5 recommended) and you will gain access to the live camera which has full controls. You will see something as follows

As you can see in the above screenshot, you now have access to the Live cameras which work in real-time. You can also move the cameras in all the four directions, perform actions such as zoom in and zoom out. This camera has really a less refresh rate. But there are other search queries through you can gain access to other cameras which have faster refresh rates. So to access them just use the following search query.
intitle:”Live View / – AXIS”
Click on any of the search results to access a different set of live cameras. Thus you have hacked Security Cameras using Google.

2. Hacking Personal and Confidential DocumentsUsing Google it is possible to gain access to an email repository containing CV of hundreds of people which were created when applying for their jobs. The documents containing their Address, Phone, DOB, Education, Work experience etc. can be found just in seconds.
intitle:”curriculum vitae” “phone * * *” “address *” “e-mail”
You can gain access to a list of .xls (excel documents) which contain contact details including email addresses of large group of people. To do so type the following search query and hit enter.
filetype:xls inurl:”email.xls”
Also it’s possible to gain access to documents potentially containing information on bank accounts, financial summaries and credit card numbers using the following search query
intitle:index.of finances.xls

3. Hacking Google to gain access to Free StuffsEver wondered how to hack Google for free music or ebooks. Well here is a way to do that. To download free music just enter the following query on google search box and hit enter.
“?intitle:index.of?mp3 eminem“
Now you’ll gain access to the whole index of eminem album where in you can download the songs of your choice. Instead of eminem you can subtitute the name of your favorite album. To search for the ebooks all you have to do is replace “eminem” with your favorite book name. Also replace “mp3″ with “pdf” or “zip” or “rar”.
I hope you enjoy this post. Pass your comments. Cheers!
READ MORE - How to use Google for Hacking

New Gmail Hacking Tool

New Gmail Hacking Tool

many sites posted about the volunterability to hack gmail password but none given the link to donload the tool and they dint even mention the name of the tool
this is the first website to give the link to the tool enjoy
A tool that automatically steals IDs of non-encrypted sessions and breaks into Google Mail accounts has been presented at the Defcon hackers conference in Las Vegas.
Last week Google introduced a new feature in Gmail that allows users to permanently switch on SSL and use it for every action involving Gmail, and not only, authentication. Users who did not turn it on now have a serious reason to do so as Mike Perry, the reverse engineer from San Francisco who developed the tool is planning to release it in two weeks.

When you log in to Gmail the website sends a cookie (a text file) containing your session ID to thebrowser. This file makes it possible for the website to know that you are authenticated and keep you logged in for two weeks, unless you manually hit the sign out button. When you hit sign out this cookie is cleared.hack gmail password
Even though when you log in, Gmail forces the authentication over SSL (Secure Socket Layer), you are not secure because it reverts back to a regular unencrypted connection after the authentication is done. According to Google this behavior was chosen because of low-bandwidth users, as SLL connections are slower.
The problem lies with the fact that every time you access anything on Gmail, even an image, your browser also sends your cookie to the website. This makes it possible for an attacker sniffing traffic on the network to insert an image served from http://mail.google.com and force your browser to send the cookie file, thus getting your session ID. Once this happens the attacker can log in to the account without the need of a password. People checking their e-mail from public wireless hotspots are obviously more likely to get attacked than the ones using secure wired networks. Todd Mumford, from the SEO company called SEO Visions Inc, states This can be a serious problem for Internet Marketers who travel often and use their wireless laptops and Gmal services often and do not always have access to a secure connection
Perry mentioned that he notified Google about this situation over a year ago and even though eventually it made this option available, he is not happy with the lack of information. Google did not explain why using this new feature was so important he said. He continued and explained the implications of not informing the users, This gives people who routinely log in to Gmail beginning with an https:// session a false sense of security, because they think theyre secure but theyre really not.
If you are logging in to your Gmail account from different locations and you would like to benefit from this option only when you are using unsecured networks, you can force it by manually typing https://mail.google.com before you log in. This will access the SSL version of Gmail and it will be persistent over your entire session and not only during authentication.
by using our tool u can sniff the cookies of users who are using with out https and hack in to their account in no time .
if u want to sniff the ssl traffic in your lan i posted some new release tools to sniff the ssl and tsl trafffic check lan hacking
If u want to download the tool register in the site i will post it as a comment so that only registered users can see the link if u cant find the link just comment with your email i will mail u in 24 hrs
and also dont forget to subscribe to my feed
hack gmail password
happy hacking
READ MORE - New Gmail Hacking Tool

How to Block a Website ?

How to Block a Website ?Some times it becomes necessary to block a website on our Computers for one or other reason.You can easily and effectivily block access to a website by adding it to your Windows HOSTS file.Once the website is blocked in the HOSTS file,it will not appear in any of the browsers.That is,the website becomes completely unavailable.


1.Go to your HOSTS file which is located at:
C:\WINDOWS\SYSTEM32\DRIVERS\ETC for Vista and XP
C:\WINNT\SYSTEM32\DRIVERS\ETC for Win 2000
C:\WINDOWS for Windows 98 and ME
2. Open HOSTS with Notepad.
The default Windows HOSTS looks like this:
______________________
# Copyright © 1993-1999 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a “#” symbol.
#
# For example:
#
# 102.54.94.97 rhino.acme.com # source server
# 38.25.63.10 x.acme.com # x client host
#
127.0.0.1 localhost
_____________________________
3. Directly under the line that says 127.0.0.1 Localhost, you will want to type:
127.0.0.1 name of the URL you want to block
For example to block the website MySpace.com, simply type:
127.0.0.1 myspace.com
127.0.0.1 www.myspace.com
Other parts of MySpace could be blocked in a similar way:
127.0.0.1 search.myspace.com
127.0.0.1 profile.myspace.com
etc etc etc…
It is necessary to add a website with and without the “www.”. You can add any number of websites to this list.
4. Close Notepad and answer “Yes” when prompted.
5. After blocking the website, test it in any of the browser.If every thing is done as said above,the website must not appear in any of the web browsers. You should see a Cannot find server or DNS Error saying: “The page cannot be displayed”.I have also created a virus to block a website which automatically blocks a list of websites as specified in the source program.
Some people suggest that your add a website to the Internet Explorer ‘Privacy’ settings. This does not block a site. It only stops that site from using cookies.
READ MORE - How to Block a Website ?

reset bios password

Bios password can be set by executing debug command as:
debug <press enter>
-o 70 14 <press enter>
-o 71 26 <press enter>
-q <press enter>
Now you are out of debug command.
or

2)
debug <press enter>
-o 70 2e <press enter>
-o 71 ff <press enter>
-q <press enter>
Now you are out of debug command.
or

3)
debug <press enter>
-o 70 17 <press enter>
-o 71 17 <press enter>
-q <press enter>
Now you are out of debug command.
or

4)
debug <press enter>
-o 70 ff <press enter>
-o 71 17 <press enter>
-q <press enter>
Now you are out of debug command.
READ MORE - reset bios password

Minesweeper tricks All Windows Games' Cheats

Friday, April 22, 2011

Secret- Reveal Mines|Instructions - Minimize or close all running applications. Launch Minesweeper, then type xyzzy. Next hold down either shift key for one second. Now when you move the mouse cursor over a Minesweeper square you will see a tiny white pixel in the top left corner of your desktop screen. This pixel will change to black when your mouse moves over a mine. You may need to change you desktop background to a solid color other then white or black to see the pixel.
READ MORE - Minesweeper tricks All Windows Games' Cheats

Keyboard Shortcuts For Internet Explorer

Keyboard Shortcuts For Internet Explorer

  • To Select all items on a webpage use CTRL and A.
  • To Copy a selected item to the clipboard use CTRL and C.
  • To Paste an item from the clipboard into a document use CTRL and V.
  • To Add the current page/document to your favorites use CTRL and D.
  • To Open the IE search utility use CTRL and E.
  • To Open the FIND box to search the current document use CTRL and F.
  • To Open the History utility use CTRL and H.
  • To Open the Favorites utility use CTRL and I.
  • To Go to a new location/document use CTRL and L. Also CTRL and O.
  • To Open a new Explorer window use CTRL and N.
  • To Print the current page/document use CTRL and P.
  • To Refresh the current page/document use CTRL and R. Also you can use the F5 key.
  • To Save the current document/page use CTRL and S.
  • To Close the current Explorer window use CTRL and W.
  • These are achieved by holding down and pressing a combination of keys
  • To go to your default homepage use ALT and the HOME key.
  • To go forward one page (equivalent to the FORWARD button) use ALT and the right arrow key.
  • To go back one page (equivalent to the BACK button) use ALT and the left arrow key.
  • Type URL without a Mouse Click in IE you can use Alt + D key combination to highlight the address bar.
  • This allows you to enter a URL without the mouse click.
  • This will be helpful for the laptop users who find it uneasy to use their touchpad every time they want to type a URL.
READ MORE - Keyboard Shortcuts For Internet Explorer

Connect Two Computers Using A Crossover Cble

Connect Two Computers Using A Crossover Cble

If you need to connect two computers but you don't have access to a network and can't set up an ad hoc network, you can use an Ethernet crossover cable to create a direct cable connection.
Generally speaking, a crossover cable is constructed by reversing ("crossing over") the order of the wires inside so that it can connect two computers directly. A crossover cable looks almost exactly like a regular Ethernet cable (a "straight-through" cable), so make sure you have a crossover cable before following these steps.
Before buying a crossover cable, check your network adapter. Some newer network adapters automatically "cross over" when they detect that they are connected directly to another network adapter using a regular Ethernet cable.

To connect two computers with a crossover cable

This works best if both computers are running this version of Windows.
  1. Plug each end of the crossover cable into a network port on the back of each computer.
  2. On one of the computers that is running this version of Windows, do the following:
    Open Network and Sharing Center by clicking the Start button Picture of the Start button, clicking Control Panel, clicking Network and Internet, and then clicking Network and Sharing Center.
  3. In the network map at the top of Network and Sharing Center, double-click the Unidentified network‍ icon. (If you have more than one network, this icon will be labeled Multiple networks.)
  4. If network discovery and file sharing are turned off, in Network, click the Information bar containing the following message: "Network discovery and file sharing are turned off. Network computers and devices are not visible. Click to change...," and then click Turn on network discovery and file sharing. Administrator permission required If you are prompted for an administrator password or confirmation, type the password or provide confirmation.
  5. In the Network discovery and file sharing dialog box, select one of the following options:
    • No, make the network that I am connected to a private network
    • Yes, turn on network discovery and file sharing for all public networks
    The first option is usually the best choice because it only affects the network that you are connected to.

Notes

  • Networks created with crossover cables are automatically set up as "Public place" networks, which means that network discovery, file sharing, and printer sharing are off by default.
  • For Gigabit Ethernet or token ring networks, you will need a slightly different kind of crossover cable. For more information, contact a cable manufacturer.
Icons for both computers should now be visible in the Network window. Double-click each computer icon to share printers and other resources.

Note

If one of the computers is running Windows XP, it can take some time for that computer to appear in the Network window. You might need to move both computers to the same workgroup. You can do that by changing the workgroup on either computer. To change a workgroup, see Join or create a workgroup. You might also need to turn on file and printer sharing on the computer running Windows XP.
READ MORE - Connect Two Computers Using A Crossover Cble

 
 
 
΢