Tuesday 27 November 2012

Installing elastic search on Ubuntu 12.04

Steps for installing elastic search on ubuntu 12.04

1). Goto elastic search website and download the latest .deb version.

Download Elastic Search Here

3). Go to shell and install Elastic search with following command.

dpkg -i elasticsearch-0.19.11.deb

This will complete the elastic search installation on your machine.

4). Now simply start the elastic search service using command

sudo service elasticsearch start

5). Open you Browser and type following url in address bar
localhost:9200 
you will simply see something like this

{ "ok" : true, "status" : 200, "name" : "D'Ken", "version" : { "number" : "0.19.11", "snapshot_build" : false }, "tagline" : "You Know, for Search" }

-------Installation is completed -------------------

Now install the necessary plug-ins (head and bigdesk)
-------------------------------------------------------------

Navigate to elastic search directory using command 
cd /usr/share/elasticsearch/bin
and simply enter these two commands

sudo ./plugin -install mobz/elasticsearch-head (to install head plugin) 
 Now enter url in internet browser (e.g firefox) 

To see the output enter following url in address bar
http://localhost:9200/_plugin/head/

sudo ./plugin -install lukas-vlcek/bigdesk (to install bigdesk plugin)

To see the output enter following url in address bar

http://localhost:9200/_plugin/bigdesk/

Thursday 21 June 2012

JSTL Error: According to TLD or attribute directive in tag file, attribute items does not accept any expressions

_________________________________________________________

When you get this sort of exception, you just need to make some small changes in your path.

You may have used

<%@ taglib uri=”http://java.sun.com/jstl/core” prefix=”c”%>

so changed it to

<%@ taglib uri=”http://java.sun.com/jsp/jstl/core” prefix=”c”%>

and most probably you will get your problem solved ( it worked for me)


Wednesday 20 June 2012

Disable a button using CSS

__________________________________________________________


Disabling a button is actually disabling event on button, CSS is use to style elements like Divs, buttons etc. But in CSS we can use some sort of firefox hack to disable events on button.
IE does not support "pointer-event: none". Other browsers like Firefox, safari and chrome support.

Add ".active" class to the button.


.active {
   pointer-events: none;
   cursor: default;
}


your code would be like
<input type="image" id="ButtonId" name="buttonName" class="active"/>



Sunday 27 May 2012

Using "Assert" in java

_________________________________________________


An assertion is a statement in the Java programming language that enables you to test your assumptions about your program. For example, if you write a method that calculates the speed of a particle, you might assert that the calculated speed is less than the speed of light.

Each assertion contains a Boolean expression that you believe will be true when the assertion executes. If it is not true, the system will throw an error. (oracle docs)

Use:



 assert Expression1 ;

where Expression1 is a Boolean expression. When the system runs the assertion, like

assert(Expression1);

 it evaluates Expression1 and if 'Expression1' is false, it will throws an error 'AssertionError' with no detail message.

If you want to print some message if Assertion Error occuers, use the following format.

The second form of the assertion statement is:

    assert Expression1 : Expression2 ;

where:

    Expression1 is a Boolean expression.
    Expression2 is an expression that has a value. (It may simply be a string used as detail message).

Example:



int number = 9;

assert ( number != 10) :  "Number is not equal to 10";

// it will be throwing AssertionError with the message "Number is not equal to 10".

Tuesday 22 May 2012

JQuery : Extracting URL parameters using regular expression


____________________________________________________________

A normal URL contains a number of parameters.


for example: http://books.google.com.pk/bkshp?hl=en&tab=wp


this link contains a parameter ( &tab=wp)


Extract all parameters from a URL, the following code may help you.




$.urlParam = function(name){
   var results = new RegExp('[\\?&]' + name + '=([^&#]*)').exec(window.location.href);
   if(results != null)
   return results[1] || 0;


   
}
var bookTab = $.urlParam(' tab ');


where  bookTab  is javascript variable which store the value of url parameter named "tab".










Monday 12 March 2012

Registering and creating new domain/web site

I would like to show you that how you can register you domain name (free here) and then create your own website.

Steps:
1) First you need to register a domain name though which you will be getting redirect to your website. For ex: WWW.google.com is domain name which redirects you to google home page.
For registering a free accout i will suggest you.

2) Order for free account and fill in the required form.
  You can visit Here to have a free domain name

3) Once you activate your account ( where an email will be sent to you by the hosting site) log in into your account by clicking on "members area".

4) Go to control panel and click on File manager (or another file manager).

5) Go to directory named "public_html" and this is the place where you will be storing your pages that you will be creating ( i will show you how to create basic pages for your website in next tutorials).

6). Once you create you webpage, and put it in the desired location (public_html) you will be able to access it from any where in the world ( on internet , if available).