Introduction of DOJO

Dojo is the Open Source JavaScript Toolkit. It is tool for constructing dynamic web
user interfaces. Dojo offers various widgets, utilities, higher IO (AJAX) abstraction etc.It is based on HTML and javascript. Dojo ups abstraction layer in a higher level. Dojo is sometimes advertised as AJAX
framework. It is able to make AJAX requests with Dojo But the technique of binding is under
the abstraction layer that Dojo has. Even if Dojo is nice, beautiful etc, it is quite heavy

We can one use Dojo by :-
1. Include package
2. use widget/utility/…

Package System
• Dojo consists of JavaScript files
• Package system takes care that only needed
files are included
• Each JavaScript file can be named as
package
dojo.provide(dojo.string);
• By that name the package can be taken in
use
dojo.require(dojo.string);
One has not to remember any file or
directory names
• Only dojo.js has to be included into HTML
document
• That file takes care of initialization of Dojo
• There is a couple of pre packaged builds that
consist of different kinds of packages
e.g. Widget, event or IO builds.

DOJO have following Language Libraries
• dojo.lang.*
• Wrappers for common idioms
• Functional programming APIs
• For Example
– dojo.lang.forEach
– dojo.lang.map
– dojo.lang.assert

Widget toolkit-

• Widget toolkit is also a very noticeable part of
Dojo toolkit
• Widget is a user interface object that has a
layout and some properties
• In Dojo widgets are HTML+CSS bound by
JavaScript
• Dojo has lots of useful widgets
e.g. Tabs, sorting table, dialogs

<script>
dojo.require(”dojo.widget.Editor2”);
</script>
<!-- ... -->
<textarea dojoType=”Editor2”>
...
</textarea>

For more info – www.dojotoolkit.org

pimp it

Thumbs Up

Experience Space using Microsoft WorldWide Telescope

We already have been visualizing the earth on our desktops for quite a long time now. Thanks Google Earth and Bind maps.

Ever wondered if we could visualize space this way as well? Imagine taking a close look at a stars or galaxies like Milky way right from your desktop? Or even taking a view of Moon or Mars? Well Microsoft Research has come up with a solution to this.

Microsoft Research WorldWide Telescope

Yes that’s true we have a software from Microsoft which will soon be integrated into Bing maps and it enables us to view space with the help of images captured by telescopes all around the world.

What is WWT
The WorldWide Telescope (WWT) is a Web 2.0 visualization software environment that enables your computer to function as a virtual telescope—bringing together imagery from the best ground and space-based telescopes in the world for a seamless exploration of the universe.

Choose from a growing number of guided tours of the sky by astronomers and educators from some of the most famous observatories and planetariums in the country. Feel free at any time to pause the tour, explore on your own (with multiple information sources for objects at your fingertips), and rejoin the tour where you left off. Join Harvard Astronomer Alyssa Goodman on a journey showing how dust in the Milky Way Galaxy condenses into stars and planets. Take a tour with University of Chicago Cosmologist Mike Gladders two billion years into the past to see a gravitational lens bending the light from galaxies allowing you to see billions more years into the past.

Some of the Tours available at the website are as follows:
Search for Extra Solar Planets
Apollo Missions 15 to 17
Pluto
Aug 1, 2008 Eclipse
Orion Nebula – Hubble’s
The Ring Nebula
Beautiful Nebulas
Center of the Milky Way
Universal Beauty
Impact with M31
and many more….

So what are you waiting for? just visit the website and enjoy looking at stars even during day time 🙂

kick it on DotNetKicks.com

Shout it

pimp it

Using Collections.copy for list

Using java Collections to copy array list

I have seen lot’s of people using Collections.copy and most of times you see this error on console

Exception in thread "main" java.lang.IndexOutOfBoundsException:
Source does not fit in dest.

Normally we use following code to copy an array-list

ArrayList<String> items = new ArrayList<String>();

items.add("item 1");
items.add("item 2");
items.add("item 6");

ArrayList<String> items2= new ArrayList<String>(items.size());
Collections.copy(items2,items);

Only problem in the above code is that for list items2 we are assuming that it has same capacity as list items. If you see the code carefully, it is only setting up initial capacity not size and Collections api check for size instead of capacity of list and it result to exception.

IMO there should be an improvement in collection api to copy items, based on capacity, instead of size. See http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6350752 .

Solution

You can use any of following option to copy a list

ArrayList<String> items2= new ArrayList<String>(items);
ArrayList<String> items2 = (ArrayList<String>)items.clone();

References

http://java.sun.com/javase/6/docs/api/java/util/Collections.html#copy(java.util.List,%20java.util.List)
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6350752