Friday, August 27, 2010

Direct Web Remoting


Direct Web Remoting

DWR is a Java library that enables Java on the server and JavaScript in a browser to interact and call each other as simply as possible.
DWR is Easy Ajax for Java



DWR will generate the JavaScript to allow web browsers to securely call into Java code almost as if it was running locally. It can marshal virtually any data including collections, POJOs, XML and binary data like images and PDF files. All that is required is a security policy that defines what is allowed.
With Reverse Ajax, DWR allows Java code running on a server to use client side APIs to publish updates to arbitrary groups of browsers. This allows interaction 2 ways - browser calling server and server calling browser. DWR supports Comet, Polling and Piggyback (sending data in with normal requests) as ways to publish to browsers.
DWR provides integration with Dojo, TIBCO GI, Scriptaculous in the browser, and with Spring, Struts, Guice, Hibernate and others on the serve

Friday, August 20, 2010

How to draw a cube on flash using papervision with bitmap materials on faces

Here i'm going to show you how we can add a primitive data object cube on to flash canvas using flex and to load 6 different bitmap pictures on to different faces of the cube.

here what we need to know is there are standard names assigned by papervision libraries to a cube.There are:
front, back, right, left, top, bottom & all

'all' is the acronym that we can used to reference all the faces at once.

here is the total sample code:


import org.papervision3d.materials.BitmapFileMaterial;
import org.papervision3d.materials.utils.MaterialsList;
import org.papervision3d.objects.primitives.Cube;



var materialList:MaterialsList = new MaterialsList({
         front:new BitmapFileMaterial("pictures/tiles/1.jpg"),
back:new BitmapFileMaterial("pictures/tiles/2.jpg"),
right:new BitmapFileMaterial("pictures/tiles/3.jpg"),
left:new BitmapFileMaterial("pictures/tiles/4.jpg"),
top:new BitmapFileMaterial("pictures/tiles/5.jpg"),
bottom:new BitmapFileMaterial("pictures/tiles/6.jpg")});

var box:Cube = new Cube(materialList);
scene.addChild(box);

What we do here is first we make a list of faces assigned with a name which is to replace by bitmap material/picture.

then we create the cube with  material list. If there are the names we assigned are matched, then the materials are replaced.
Here is the sample output

Tuesday, August 17, 2010

Flex loading a 3D model as a new type class

The following code can be used to load a 3D model designed from Google sketchup tool, to load in to an ActionScript on Adobe Flex application on Flex builder

var myModelDisplayObject3D :DisplayObject3D = new DisplayObject3D();

[Embed(source="assets/Rack2.dae", mimeType="application/octet-stream")] private var MyModel:Class;


var myModel:MyModel= new MyModel();
var myModeldae:DAE = new DAE();
var myModelMaterialList:MaterialsList = new MaterialsList();
 myModeldae.load(XML( new myModel() ), myModelMaterialList );
 myModelDisplayObject3D = scene.addChild( myModeldae);
light.lookAt(myModelDisplayObject3D );

Sunday, August 15, 2010

CEH- Certified Ethical Hacker Exam Guide

Footprinting and Social Engineering

How to retrieve advances information from a domain name

Using piping few famous shell/bash command on a shell script can be used to get underlined important details about domain names and their servers:

host- this command can be used to get the IP address of a domain
whois- useful in retrieving details on a given IP address


What we do here is to transfer the domain name to host command and then pass its output to whois information server.Pipelining '|' is used to pass the value(its the fundamentals of shell scripting and Unix).


shell scripting is used to make the work easier with using loops and variables.

So, to do all of this all you wants is to make a shell script and run it.

make a .sh file and copy the following lines to it

vi dnsinfo.sh



#Edited Author-chandpriyankara@engineering.com @ www.chandpriyankara.tk
#Read params 
_domain=$@
# if no param URLs then echo a message and exit
[ $# -eq 0 ] &&
{
    echo "Usage: $0 example1.com example2.net ....";
    exit 1;
}
#iterate through all the given domain names
for dom in $_domain
do
#get the IP address of the domain name through famous shell string operations 
    _ipaddress=$(host $dom | grep 'has add' | head -1 | awk '{ print $4}')
    [ "$_ipaddress" == "" ] &&
    {
        echo "Error: $dom is not valid domain or dns error. Check your firewall settings also.";
        continue;
    }
    echo "Getting information for domain: $dom [ $_ipaddress ]..."
# retrieve the informations strating with the selected details
    whois "$_ipaddress" | egrep -w 'OrgName:|City:|State:|Country:|OriginAS:|NetRange:'
    echo ""
done


Then assign the file executable file attributes 


chmod 755 dnsinfo.sh


Now its all about what who's information you wants..


Here is a test run on www.google.lk


go to the path where the .sh located and type this:


./dnsinfo.sh www.google.lk www.yahoo.com www.facebook.com | less


Notice that i have added another command to the script here.









By removing: [

| egrep -w 'OrgName:|City:|State:|Country:|OriginAS:|NetRange:']  you can show all the information without filtering

Introduction to RIA(Rich Internet Applications) through Adobe Flex

Introduction to RIA(Rich Internet Applications) through Adobe Flex

Internet applications are getting more and more user interactive over time. 

What is Flex:

Build engaging, cross-platform rich Internet applications

Flex is a highly productive, free, open source framework for building expressive web applications that deploy consistently on all major browsers, desktops, and operating systems by leveraging the Adobe® Flash® Player and Adobe AIR® runtimes. While Flex applications can be built using only the free Flex SDKAdobe Flash Builder™ (formerly Adobe Flex® Builder™) software can accelerate development through features like intelligent coding, interactive step-through debugging, and visual design of the user interface layout.

Installing Flex
Flex is a tool used to build interactive Flash animations to be integrated on HTML, ASP, JSP, PHP or any web deployed scripts.
Mainly Flash developments using Flex need  Adobe Flex Builder be installed. Flex builder can be either as  a plugin to eclipseIDE/Netbeans  or as standalone too. Even the standalone tool is a flavor of eclipse.
Flex SDK need to be installed and paths set to enable the compilation of the project.
its available freely @ http://www.adobe.com/go/flex4_sdk.

Plugin for Eclipse :http://www.adobe.com/go/try_flashbuilder
Standalone version: https://www.adobe.com/go/try_flashbuilder_uk

Flex has mainly two flavors: J2EE and ColdFusion. Developers can use it as their interest.


this document is still on documenting and will be finished within a week :-)

i wish to address the following topics in further:
Loading a 3D model object built on Google Sketcher in to Web application and apply real-time user interaction on flash animation.
How to load textures, materials event function to 3D models to used Flex as a replacement to Java3D which can efficiently run on a Web browser.
How to introduce OOP concepts on to Flash using ActionScripts through scripting classes and .mxml applications.

Trans-Eurasia Information Network : TEIN3




The third generation of the Trans-Eurasia Information Network (TEIN3) provides a dedicated high-capacity Internet network for research and education communities across Asia-Pacific. TEIN3 already connects researchers and academics in China, India, Indonesia, Japan, Korea, Laos, Malaysia, Nepal, Pakistan, the Philippines, Singapore, Sri Lanka, Taiwan, Thailand, Vietnam and Australia. Bangladesh, Bhutan and Cambodia are in the process of getting connected, bringing the total number of partners involved in TEIN3 to 19.

More information on http://www.trin3.net

Wednesday, August 4, 2010

Add a script to Linux startup

To add a new script or a symbolic link to the startup init to run as  root, need to follow mainly two steps:
1. add the script or symbolic link to /etc/init.d/xxx and change permission to executable for root
2. update all/required run level startup scripts to run the added link

1. To add the link to init.d folder: if its a script, you can copy it:
#cp /path/to/required/file /etc/init.d/file

change executable permission for root(755)
#chmod 775 /etc/init.d/file

2.Now update all run level startups:
#update-rc.d file defaults
here defaults is for adding startup to all run levels

to remove the above script use following:
#update-rc.d -f file remove


to learn more about update-rc.d search manual pages by
apropos update-rc.d