Variable in Java Programming Language

The java programming language defines the following types of variables.

1) Instance Variables.(Non Static Fields)

2) Class Variable (Static Fields)

3) Local Variables.

4) Parameters.

1) Instance Variables (Non Static Fields)  Technically speaking, objects store their individual states in “non-static fields”, that is, fields declared without static keyword. Non static fields are known as instance variables because their values are unique to each instance of  a class(to each object, in other words); the currentSpeed of one bicycle is independent from  the currentSpeed of another.

2) Class Variables (Static Fields) A class variable is any field declare with the static modifier; this tells the compiler that there is exactly one copy of this variable in existence, regardless of how many times the class has been instantiated. A field defining the number of gears for a particular kind of bicycle could be marked as static since conceptually the same number of gears will apply to all instances.The code static int numGears=6; would create such a static field.

Additionally the final keyword could be added to indicate that the number of gears will never change.

3) Local Variables are the variables that are defined within the opening and closing brackets of a method.As such local variables are only visible to the methods in which they are declared, they are not accessible from the rest of the class.

Syntax (int i=0;)

4) Parameters are the variables that have been passed through methods as a arguments

For Eg

int add(int a,int b)

{

int c=a+b;

}

In the above example int a, int b are the parameters.

How to make window 7 Genuine using command prompt

How to make windows 7 genuine using command prompt.

Today I am going to discuss the most common problem for windows 7 that faces most of the users. The problem has various symtoms like genuiness window always pops up while working that makes person irritating what to do.

This is common problem that has a simple solution.

  • Now Type the command       SLMGR -REARM  in the cmd as shown below in the image.

SLMGR -REARM

  • Press Enter and Wait For Few Seconds.
  • Next Message a dialog box will appear specifying the command completed successfully , Please Restart the system to take effects.

Command Completed Successfully

  • Restart your computer and you are all done. You are free now for the Error “Windows 7 is not genuine”.

Note – You must run command prompt as  an administrator else this method will not work.

Directory listing in .htaccess allow deny disable enable directory listing in .htaccess

Directory Listing in .htaccess Allow Deny Disable Enable directory listing in .htaccess

When a web browser is pointed to the folder which does not contain and index.html and any other specific index.(extension file).
That url will point to the folder structure and displays the folder and their files in the browser.
That might be dangerous ahhhhhhh……
Because if he has access to all the stored files then he can misuse it.
Or suppose it got tracked by the hacker it self then GOD knows what happens.
The .htaccess is the strongest file through which we can restrict the users from unauthroized access to the server.

Disable Directory Listing
To disallow a web server to produce a directory listing, when ever you point a directory without index file.
Add following line in your .htaccess file.

Code
Options -Indexes

Enable Directory Listing
To allow a web server to produce a directory listing.

Add following line in your .htaccess file.

Code
Options +Indexes
# or #
IndexIgnore *

Change Listing Style
You can also display you directory list/or file structure in a more stylish way.
Add following snippet in .htaccess file.

Code
Indexoptions +FancyIndexing

Ignore files with specific extension.
It may happen that you may need to ignore certain files to get displayed in directory listing.This can be achieved using IndexIgnore directive in .htaccess file.

Code
IndexIgnore *.zip *.txt

Modify Index File
It is possible to change the default index file from index.html (index.php,index.jsp …) to any other file. Following line will change the index file to Home.html

Code
DirectoryIndex Home.html

Remove underscores (_) from url in code igniter replace with dashes (-)

Hi all,

I have done some research about hyphens v/s underscores in urls and I feel that this is the problem that everyone faces when it comes with  Search Engine Optimization.

As per Google  the URL word separator should be dashes (-)  not underscore ( _ ) because google counts the two words as a set of one word.

For example : (about_us)  will count as one word

And (about-us) will count as two words.

Quiet beneficial for SEO

For this you have to do some simple steps—

1) Create a file  “MY_Router.php” in  /application/core folder. And put the following code in it

/********************************************************/

<?php if (!defined(‘BASEPATH’)) exit(‘No direct script access allowed’);

class MY_Router extends CI_Router {

function __construct()
{
parent::__construct();
}

public function _set_request($segments){

// Fix only the first 2 segments
for($i = 0; $i < 2; ++$i){

if(isset($segments[$i])){

$segments[$i] = str_replace(‘-‘, ‘_’, $segments[$i]);

}
}

// Run the original _set_request method, passing it our updated segments.
parent::_set_request($segments);

}

}

/********************************************************/

2) Place the function names with underscore ( _ )  like about_us in your controller.

And just hit the url with the above name as “http://localhost/yourprojectname/classname/about-us (function name) you will see the page is now accessible with dashes as well.

Search Engine Optimization tricks for top ranking your site

Points that should be covered.

1) Put meta tags on all pages of website

Meta description -Meta description should contain between 70 and 160 characters (spaces included).Meta descriptions allow you to influence how your web pages are described and displayed in search results. A good description acts as a potential organic advertisement and encourages the viewer to click through to your site.

Ensure that your meta description is explicit and contains your most important keywords. Also, each page should have a unique meta description relevant to the content of that page.

2) You should rather use hyphens (these-are-hyphens) to optimize your SEO,  Since Google  treats hyphens as word separators, it does not treat underscores as word separators.

3) Keywords search.

4) Your website does not have a custom 404 Error Page.This is bad in terms of usability.Take the opportunity to provide visitors with a beautiful and helpful 404 Error Page to increase user retention.

5) Microformat is a technical semantic markup that can be used to better structure the data submitted to search engines.  http://en.wikipedia.org/wiki/Microformat

6)  W3C validity.

Visit the website  http://validator.w3.org/

Put your website url in the address field and click on check button.

7) Title in the websites.

Title Tag -A title tag is the main text that describes an online document. It is the second most important on–page SEO element (the most important being overall content), and appears in three key places: browsers, search engine results pages, and external websites. It should not have more than 70 characters .Place important Keywords close to the front of the Title Tag.Include your Unique Selling Point in the Title.

8) Sitemap.xml

Visit http://www.xml-sitemaps.com/ and enter the starting url and click on start button your sitemap.xml file will be generated.

Just upload it in the root folder of your website.

9) Robot.txt

Visit http://www.mcanerin.com/EN/search-engine/robots-txt.asp

Enter the sitemap.xml url

i.e. http://www.yousite.com/sitemap.xml

Copy the robots.txt and put it in the root folder named  robots.txt.

10) Broken Links

http://validator.w3.org/checklink

http://www.brokenlinkcheck.com/

Remove index.php in code igniter php

How to remove index.php url from site url in code igniter ?

The problem is simple but very useful for SEO search engines and optimization.

Step 1.

First goto the root directory of the your project and follow the path “application\config”  you will find the config file

Just change the parameter from this

$config[‘index_page’] = ‘index.php/’;

to this

$config[‘index_page’] = ”;

Remove index.php from index_page index in the config array.

 

Step 2.

And one more thing you have to do is include the .htaccess file in the root directory.

Code for this

 

<!————————————————————–>

<IfModule mod_rewrite.c>
RewriteEngine On
#RewriteBase /onlinetestb

#Removes access to the system folder by users.
#Additionally this will allow you to create a System.php controller,
#previously this would not have been possible.
#’system’ can be replaced if you have renamed your system folder.
RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /index.php?/$1 [L]

#When your application folder isn’t in the system folder
#This snippet prevents user access to the application folder
#Submitted by: Fabdrol
#Rename ‘application’ to your applications folder name.
RewriteCond %{REQUEST_URI} ^application.*
RewriteRule ^(.*)$ /index.php?/$1 [L]

#Checks to see if the user is attempting to access a valid file,
#such as an image or css document, if this isn’t true it sends the
#request to index.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>

<IfModule !mod_rewrite.c>
# If we don’t have mod_rewrite installed, all 404’s
# can be sent to index.php, and everything works as normal.
# Submitted by: ElliotHaughin

ErrorDocument 404 /index.php
</IfModule>

<!————————————————————–>

 

And thats it you are on the go

now you can view the url without the ink of index.php.