What is a component A component represents a view on the screen. Everything what we see on the screen is a component. A single page can be constituted of one component or many components. Also, a component can have child components. Example, a page can have a menu, a header and body. All can be contained in a single component or there can be a menu component, header component and a body component. Similarly, a single control on a page can be a component or a combination of components. Example, a table on a page can be a single component or it may be aRead More →

 :last Selector – Meaning and Usage :last selector fetches the last element from the collection of elements matched using a selector. Example, $(“span”) will select all span elements on the page. Adding the :last selector to the $(“span”) will return the last span out of those. If :last selector is used with another selector then, first the elements matching that selector are retrieved and then out of selected elements, those elements which are last in this list is returned. Example, $(“span.source:last”) will first retrieve those span elements which have the class source and then out of this collection, the last span is returned. :last-child selectorRead More →

Meaning of @Override annotation @Override annotation is used over methods defined in a class. When this annotation is written over a method, then this method : Might be declared in a super class and defined in sub-class. Might be defined in a super(or parent) class and re-defined in sub-class(overridden). Might be declared in an interface and defined in the class implementing the interface. Example of this annotation is given below. public abstract class ParentClass { /* * Implemented method in parent class */ public void implementedMethod() { System.out.println(“Parent class method”); } /* * Abstract method in parent class */ public void declaredMethod(); } public classRead More →

Scenario Suppose your application starts a process (a server embedded in the application, let’s say). The application may be running from a command line interface or a GUI. Now, you want that whenever user terminates the application either by typing Ctrl + C(control and c keys pressed together) on command line or pressing close button on the application GUI, the process started by the application is also terminated. Shutdown Hook is the solution A shutdown hook is a piece of code which executes before an application terminates. Java provides a mechanism to apply shutdown hooks in an application. This shutdown hook is executed in belowRead More →

Monitoring directory : Meaning & Reason Monitoring a directory or a folder means keeping a watch on that directory for events such as a new file created, a file removed or modified. A typical requirement for such monitoring would be to implement an auto refresh functionality where you show the contents of a folder. With active monitoring on a folder, you can display the accurate list of files when the directory contents are modified in the background. How to Monitor a directory in Java Java 7 introduced java.nio package which provides support for monitoring a directory for changes. It allows us to create a serviceRead More →

Why use File filters Many times it happens that only files of certain type are required. Type may mean files of certain extension or files having some definite characters in their name. There is no sense of showing or listing files which are of no use in that scenario. Consider an example where you need to upload image files to an application. When you click on Browse button, you would only be interested in viewing the list of image files(having .bmp, .jpg, .jpeg or .png extension) in the directory you select. It would be a hassle for you to select the desired file if allRead More →

Overview Determining the type of a value stored inside a variable is very important in any programming language but in javascript, it is extremely important. This is because a javascript variable can hold values of many types and just by looking at the variable definition, you cannot tell the value which it shall hold. Without knowing the type of value, operations performed on them can lead undesired result. Example, a variable can be written as : var x = 25; var x = “codippa”; Suppose you are adding 5 to the value of v, then it does not make any sense to perform add operationRead More →

What is an enum ? An enum is a kind of data type in java which can contain a fixed set of values. These values are constants. The enum can have any one value out of these fixed set of values. Enum Syntax An enum is created using keyword enum followed by a user defined name and some fixed set of values enclosed between { and }. Where is enum used An enum is utilized when a particular type can have multiple fixed set of constant values. For Example, your application can have different types of user roles. Instead of using constants for these roleRead More →