Posts Tagged ‘element’

Example of using ArrayList in Java 5

ArrayList in Java is most frequently used collection class after HashMap in Java. Java ArrayList represents an automatic resizable array and used in place of array. Since we can not modify size of an array after creating it, we prefer to use ArrayList in Java which resize itself automatically once it gets full. ArrayList in Java implements List interface and allow null. Java ArrayList also maintains insertion order of elements and allows duplicates opposite to any Set implementation which doesn”t allow duplicates. ArrayList supports both Iterator and ListIterator for iteration but it’s recommended to use ListIterator as it allows the programmer to traverse the list in either direction, modify the list during iteration, and obtain the iterator”s current position in the list. But while using ListIterator you need to be little careful because ListIterator has no current element; its cursor position always lies between the element that would be returned by a call to previous () and the element that would be returned by a call to next (). In this Java ArrayList tutorial we will see how to create Java ArrayList and perform various operations on Java ArrayList.

ArrayList has been modified in Java5 (Tiger) to support Generics which makes Java ArrayList even more powerful because of enhanced type-safety. Before Java5 since there was no generics no type checking at compile time which means there is chance of storing different type of element in an ArrayList which is meant for something and ultimately results in ClassCastException during runtime. with generics you can create Java ArrayList which accepts only type of object specified during creation time and results in compilation error if someone tries to insert any other object into ArrayList in Java; for example if you create an ArrayList of String object you can not store Integer on it because add() method of ArrayList will check Type before adding object into ArrayList in Java opposite to add() method of Java4 which accepts any object.

It’s also important to remember that ArrayList is not synchronized and should not be shared between multiple threads. If multiple threads access a Java ArrayList instance concurrently, and at least one of the threads modifies the list structurally, it must be synchronized externally. (As per Java doc a structural modification is any operation that adds or deletes one or more elements, or explicitly resizes the backing array; merely setting the value of an element is not a structural modification.) This is typically accomplished by synchronizing on some object that naturally encapsulates the list. If no such object exists, the list should be "wrapped" using the Collections.synchronizedList method. It’s recommended to synchronize the list at the creation time to avoid any accidental unsynchronized access to the list. Another better option is to use CopyOnWriteArrayList which is added from Java 5 and optimized for multiple concurrent read. In CopyOnWriteArrayList all mutative operations (add, set, and so on) are implemented by making a fresh copy of the underlying array and that”s why it is called as "CopyOnWrite"

[ View Full Tutorial ]

VN:F [1.9.18_1163]
Rating: 0.0/10 (0 votes cast)

CSS3 Cascading Principals #3 External Styles

Rounding out our cascading series is the external style sheet; a method that gets its descriptor because it’s not something that will actually be contained within your HTML document, but rather a separate file with the .CSS extension.
There are a couple of reasons you might want to break out your CSS file from your HTML document. For one, it allows you to select multiple style sheets, from which you can pick and choose styles from within your markup; and allows you to create multiple styles that are even further segmented. But perhaps the biggest windfall is that you can apply those style sheets across multiple pages, saving you the effort of having to re-create them in each of your HTML documents. Not only is this a tremendous time saver, but it also cuts down on potential mistakes that might be made across a large project.
Externals style documents also have the least clout in our CSS order-of-importance hierarchy, so if an in-line style or head style addresses an element, they will take precedence.

Link syntax.
<link rel=”stylesheet” type=”text/css” href=”style.css” />

Before your HTML document can begin pulling styles, however, you’re going to need to tell it where those styles are located. By linking your style sheets, the document knows to treat it as an extension of itself, and when then apply those styles just as if they appeared in the head of the document. Which is why, when we insert a <link> element, we place it in the head of our document. It works as kind of a placeholder for “styles yet to be determined”.
If you have multiple style sheets, you just repeat the process for each .CSS file that you’d like to call. You only need to include .CSS files that you are using for that particular document, and it’s important to make sure that there are no conflicts. If you have different style definitions that are attempting to alter the same element, the last style sheet you link to will be applied.
If you’re ever in the market for some great Windows web hosting, try Server Intellect. We have been very pleased with their services and most importantly, technical support… Read the rest of this entry »

VN:F [1.9.18_1163]
Rating: 0.0/10 (10 votes cast)

CSS3 Fundamentals #2 Background Images

Inserting a background image into your HTML document using CSS.

Background images have a rather storied history when it comes to the World Wide Web. Just like furry wallpaper and wood paneling, there’s no accounting for taste; and almost immediately after the release of Mosaic in 1995 those cursed with just a smidgen of creativity starting cladding their works with a cursed combination of teddy bears and tiled stars. After a while, the web started looking your great aunt’s Thanksgiving sweater, for better or… No. Just worse.\r\n \r\nDespite the historic stigma, background images can (and are) quite often used as an effective component in great web design, and is an essential part of CSS. You can use background images on a page level, or within individual page elements that you have created. The image will assume the total size of your element; or if smaller than the element itself, be tiled starting at the top-left corner.\r\n \r\n#background-image Syntax Formatting


All that’s required to insert a background image is specifying the location of the image. Most common image formats are supported, and as always, it’s a good idea to keep your image locations relational to your HTML document.

We chose Server Intellect for its cloud servers, for our web hosting. They have managed to handle virtually everything for us, from start to finish. And their customer service is stellar.

#background-image Example

Now we’ll create a simple page utilizing a tiled background image with a sample image included in the project source. Create a new HTML5 document, and enter the following CSS definition within the header:

Background image style.

body { background-image:url(”background.gif”);}

Because our image is substantially smaller than our page, it will render in-browser tiled. Keep in mind, not all images will tile in an aesthetically pleasing manner, so make sure your image is so suited. Our example as provided here is applying the style to the entire body of the document, so all other page elements and divisions will inherit this background unless otherwise specified.

Now let’s add a <div> so that we may employ another background image, and see what our page looks like with some content: Read the rest of this entry »

VN:F [1.9.18_1163]
Rating: 0.0/10 (10 votes cast)

Indirect illumination Concept

Hello! We are pleased to share with you a new portion of 3d stuff. Continuing the theme of the correct configuration of V-Ray renderer, in this and the following three tutorials, we look into the second important part of V-Ray settings, the Indirect illumination.

To understand the setups of indirect illumination in V-Ray and any other render engine it is worth to find out what is indirect illumination, and why it is important to photo-realistic rendering.

Global illumination is one of the modern rendering engine algorithms, which adds to the final image an additional render element. For ease of understanding of the rendering engine, the simplest way to imagine forming of final image is as it obtained by superimposing separate render elements, such as shadow, color, light, information about transparency, etc. each on other according to certain rules. That is to imagine the final rendering as a collection of separate images with different information. Those who know Photoshop can compare this process with the overlaying of different layers with a specific blending mode. Indirect illumination is one of the render elements, which adds to the overall result the information about the indirect light present in scene. To understand more exactly, what is added to the final image with this element, let us learn what the global, secondary or indirect illumination is in principle.
Read the rest of this entry »

VN:F [1.9.18_1163]
Rating: 0.0/10 (10 votes cast)

jQuery for Beginners – Step by Step Tutorial (Part 2)

Here we will continue from previous part of jQuery for Beginners Tutorial.


The selectors in jQuery seems like this: $(…). By using them we can call elements by his name, id, class, tag (a, td, div) with initializing jQuery object.

If you have and DIV element and want by moving mouse over it, to execute some code, you can do this: Read the rest of this entry »

VN:F [1.9.18_1163]
Rating: 7.1/10 (10 votes cast)

Working with Graphics in Dreamweaver

Dreamweaver works with almost all known image formats, which makes it very practical and useful. Used images can quickly and easily be placed and formed. To insert a graphics element, do one shown in the picture below : Read the rest of this entry »

VN:F [1.9.18_1163]
Rating: 0.8/10 (11 votes cast)

Working with PHP Arrays

This tutorial will show you how to work with arrays in PHP.

To create an array in PHP use the fowling code: Read the rest of this entry »

VN:F [1.9.18_1163]
Rating: 0.0/10 (0 votes cast)