Monday, July 02, 2007

D-Link Releases Wireless Router with Integrated Display

Today, D-Link announced its new Limited Edition Xtreme N Gigabit Router (DIR-660) featuring an integrated OLED display to monitor network activity.

# The built-in display
# An industry first for a wireless router
# Relays network information on-demand


letting you monitor your network's health and check configuration settings right on the router. D-Link claims that its Xtreme N technology is up to 14 times faster with six times the range of 802.11g routers. The DIR-660 is also backward- compatible with legacy 802.11b and 802.11g devices, including some game consoles and digital media players.

In addition, the DIR-660 improves web surfing efficiency with its intelligent wireless prioritization technology. Xtreme N's Intelligent QaS adapts to your web surfing habits, allocating speed as necessary. For instance, it knows to give streaming movies or music priority over traditional file downloads for the smoothest wireless Internet experience possible.

Sunday, July 01, 2007

XML Validation



using System;
using System.Collections.Generic;
using System.Text;
using System.Xml;
using System.Xml.Schema;
namespace XMLVAlidation
{
class Program
{
private static bool isValid = true; // if validtation error happens set this flag false
static void Main(string[] args)
{
//XmlTextReader r = new XmlTextReader("C:\\XML\\ProductWithDTD.xml"); //to load product with DTD -validation type
//XmlTextReader r = new XmlTextReader("C:\\XML\\ProductWithXDR.xml"); ////to load product with XDR - vali type
XmlTextReader r = new XmlTextReader("C:\\XML\\Header.ascx.en-US.resx");
//XmlTextReader r = new XmlTextReader("C:\\XML\\ProductWithXSD.xml"); // validation type schema
XmlValidatingReader v = new XmlValidatingReader(r);
//v.ValidationType = ValidationType.DTD; //validation type for DTD
v.ValidationType = ValidationType.Schema; ////validation type for XDR
v.ValidationEventHandler += new ValidationEventHandler(MyValidationEventHandler);
while (v.Read())
{
// Can add code here to process the content.
}
v.Close();
// Check whether the document is valid or invalid.
if (isValid)
Console.WriteLine("Document is valid");
else
Console.WriteLine("Document is invalid");

Console.ReadLine();
}
public static void MyValidationEventHandler(object sender,ValidationEventArgs args)
{
isValid = false;
Console.WriteLine("Validation event\n" + args.Message);
}
}
}


Needed resources

Product.xml

< Product ProductID = "123" >
< ProductName > Rugby jersey < / ProductName >
< / Product >


ProductWithDTD.xml

< ? xml version = "1.0" ? >
< ! DOCTYPE Product SYSTEM "Product.dtd" >
< Product ProductID = "123" >
< ProductName > Rugby jersey< / ProductName >
< ProductID > 123 < / ProductID >
< / Product >


Product.dtd


< ! ELEMENT Product ( ProductName ) >
< ! ATTLIST Product ProductID CDATA #REQUIRED >
< ! ELEMENT ProductName ( # PCDATA ) >


ProductWithXSD.xml

< ? xml version = "1.0" ? >
< Product ProductID = "123"
xmlns : xsi="http: // www.w3.org/2001/XMLSchema-instance"
xsi : noNamespaceSchemaLocation="Product.xsd">
< ProductName > Rugby jersey < / ProductName >
< / Product >



Product.xsd

< ? xml version= "1.0" ? >
< xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" >
< xsd:element name="Product" >
< xsd:complexType >
< xsd:sequence >
< xsd:element name="ProductName" type="xsd:string" / >
< / xsd:sequence>
< xsd:attribute name="ProductID" use="required" type="xsd:int" / >
< / xsd:complexType >
< / xsd:element >
< / xsd:schema >


ProductWithXDR.xml

< ? xml version="1.0" ? >
< Product ProductID="123" xmlns="x-schema:Product.xdr" >
< ProductName > Rugby jersey < / ProductName >

< / Product >


Product.xdr

< ? xml version="1.0" ? >
< Schema name="ProductSchema"
xmlns="urn:schemas-microsoft-com:xml-data"
xmlns:dt="urn:schemas-microsoft-com:datatypes" >

< ElementType name="Product" content="eltOnly" >
< attribute type="ProductID" required="yes" / >
< element type="ProductName" / >
< / ElementType >

< AttributeType name="ProductID" dt:type="int" / >
< ElementType name="ProductName" dt:type="string" / >
< / Schema >

XML Node count




count.xml




#
#
#
#
#
#
#
#
Program.cs - This is a console application

using System;
using System.Collections.Generic;
using System.Text;
using System.Xml;
namespace CountXMLNodes
{
class Program
{
static void Main(string[] args)
{
int countBooks = 0;
int countDVD = 0;
int countGames = 0;
int countOther = 0;
XmlDocument doc = new XmlDocument();
doc.Load("C:\\XML\\count.xml");
foreach (XmlNode node in doc.DocumentElement.ChildNodes)
{
switch (node.Name)
{
case "Books":
countBooks++;
break;
case "DVD":
//something.
countDVD++;
break;
case "Games":
//something.
countGames++;
break;
default:
//something.
countOther++;
break;
}
}
Console.WriteLine("Books = " + countBooks);
Console.WriteLine("DVD = " + countDVD);
Console.WriteLine("Games = " + countGames);
Console.WriteLine("Other = "+ countOther);
Console.ReadLine();
}

}
}
Microsoft to Sell Complete PCs In India


By Reuters
NEW DELHI (Reuters) - Microsoft Corp. said on Wednesday it would introduce a low-cost personal computer in India in partnership with Advanced Micro Devices Inc. and Zenith Computers Ltd.

The computer will be built on AMD hardware and manufactured by Zenith Computers, and will include Microsoft software.

The computers, priced at 21,000 rupees, would be sold in 10 retail outlets each in Bangalore and Pune from July on a test basis for three months and will be expanded later on the basis of response.

"We don't see any gain in the short term. Our perspective is long term," Microsoft India chairman Ravi Venkatesan told reporters.


In 2006/07 the total installed base of PCs in India was 22 million, that is, a PC for about every 50 Indians, industry tracking body IDC said in a recent report.

The company said its online portal www.msn.com will provide educational content to students. It also plans to launch a job search service this year for the country's nearly 400,000 engineers graduating every year.

Microsoft said it was in talks with partners in government and industry for the job search portal.

Microsoft's job portal will compete with Info Edge (India) Ltd.'s www.naukri.com and Monster Worldwide Inc.'s www.monsterindia.com, among others.

That's where today India is so where are we?????????

Tuesday, June 26, 2007

Java Native Method Calling - Tute 1


Using java native method

I will do this with simple program Hello.java

1. javac Hello.java
2. javah –jni Hello
It will create a “Hello.h” header file for the native method we are using.
Do not edit that
3. write the your native file “Hello.c”
including “Hello.h” and jni.h and other header files as needed
4. next step compile the Hello.c
take visual studio command prompt
cl -I ”C:\Program Files\Java\jdk1.5.0_11\include”
-I ”C:\Program Files\Java\jdk1.5.0_11\include\win32”
-LD Hello.c -Felibnative.dll

This will create libnative.lib, libnative.exp, Hello.obj, libantive.dll
* you should give the path to libnative.dll in the “Hello.java”

5. to run the java file
java Hello ------- will give "Hello world!" as output

Codes

1.Hello.java

class Hello{
public native void sayHello();
static{
System.load("C:\\java\\test\\Hello\\New Folder\\libnative.dll");
}
public static void main(String[] args){
Hello h = new Hello();
h.sayHello();
}
}

2. Hello.h – this is created header file in the second step

/* DO NOT EDIT THIS FILE - it is machine generated */
#include
/* Header for class Hello */

#ifndef _Included_Hello
#define _Included_Hello
#ifdef __cplusplus
extern "C" {
#endif
/*
* Class: Hello
* Method: sayHello
* Signature: ()V
*/
JNIEXPORT void JNICALL Java_Hello_sayHello
(JNIEnv *, jobject);

#ifdef __cplusplus
}
#endif
#endif

3. Hello.c

#include
#include "Hello.h"
#include

JNIEXPORT void JNICALL Java_Hello_sayHello
(JNIEnv *env, jobject obj)
{
printf("Hello world!\n");
return;
}
Java Native Method Calling - Tute 1





Using java native method

I will do this with simple program Hello.java

javac Hello.java
javah –jni Hello
It will create a “Hello.h” header file for the native method we are using.
Do not edit that
write the your native file “Hello.c”
including “Hello.h” and jni.h and other header files as needed
next step compile the Hello.c
take visual studio command prompt
cl -I ”C:\Program Files\Java\jdk1.5.0_11\include”
-I ”C:\Program Files\Java\jdk1.5.0_11\include\win32”
-LD Hello.c -Felibnative.dll

This will create libnative.lib, libnative.exp, Hello.obj, libantive.dll
* you should give the path to libnative.dll in the “Hello.java”


Codes

1.Hello.java

class Hello{
public native void sayHello();
static{
System.load("C:\\java\\test\\Hello\\New Folder\\libnative.dll");
}
public static void main(String[] args){
Hello h = new Hello();
h.sayHello();
}
}

2. Hello.h – this is created header file in the second step
/* DO NOT EDIT THIS FILE - it is machine generated */
#include
/* Header for class Hello */

#ifndef _Included_Hello
#define _Included_Hello
#ifdef __cplusplus
extern "C" {
#endif
/*
* Class: Hello
* Method: sayHello
* Signature: ()V
*/
JNIEXPORT void JNICALL Java_Hello_sayHello
(JNIEnv *, jobject);

#ifdef __cplusplus
}
#endif
#endif
3. Hello.c

#include
#include "Hello.h"
#include

JNIEXPORT void JNICALL Java_Hello_sayHello
(JNIEnv *env, jobject obj)
{
printf("Hello world!\n");
return;
}

Monday, June 25, 2007

Sorting a Portion of a Collection

int[] arNumbers = {13, 4, 7, 10, 2, 8, 17, 5, 1, 11};
System.Array.Sort(arNumbers, 2, 5); // sort numbers between 2 to 5

Automatic Sorting Using a SortedList

Dim usStates As New SortedList
usStates.Add("CA", "California")
usStates.Add("AZ", "Arizona")
usStates.Add("NV", "Nevada")
Console.WriteLine(usStates.GetKey(1) + usStates.GetByIndex(1))Console.ReadLine()
' slsStates order:'
' Keys Values
' ---------------
' AZ Arizona
' CA California
' NV Nevada

Sunday, June 24, 2007

Sorting Arrays

Sorting a Pair of Key-Value Arrays:

Dim aryStateKeys() As String = {"CA", "AZ", "NV", "AK", "WA", "OR", _
"HI", "UT", "ID"}
Dim aryStateValues() As String = {"California", "Arizona", _
"Nevada", "Alaska", "Washington", "Oregon", "Hawaii", "Utah", _
"Idaho"}

Array.Sort(aryStateKeys, aryStateValues)

' New order of the arrays:
'
' aryStateKeys aryStateValues
' -----------------------------
' AK Alaska
' AZ Arizona
' CA California
' HI Hawaii
' ID Idaho
' NV Nevada
' OR Oregon
' UT Utah
' WA Washington

Tuesday, June 05, 2007

Wireless Sensor Networks

Unlike in wired network, in wireless you don’t have wire connecting each and every node (device) in the network. In here devices are connected to the network using mostly radio waves.
Development of wireless sensors were booted by the military researches because of the high military value they possessed. But today these sensor network technologies have penetrated each and every corner of the world. Modern housing equipments, environmental monitoring, healthcare sector are the core areas benefiting through this.

So let’s see the parts of a sensor node
Normally each node has a radio transceiver or other wireless communication device, microcontroller, an energy source. Size of a sensor node can vary from depending on the service provided by the sensor and the technology which has been used to develop it. Today we have sensor nodes of a size of small dust and which are intelligent enough to identify an object or a specific chemical.

Key areas today using wireless technology

Environmental monitoring
Habitat monitoring
Acoustic detection
Seismic Detection
Military surveillance
Inventory tracking
Medical monitoring
Smart spaces
Process Monitoring
Structural health monitoring
In WSN what is the scarcest resource?The answer will be power or the energy. As these sensor nodes are laid in different places where supply of the power is very limited and still today we don’t have a technology to transfer energy through air power is a key issue. The most energy consuming operation is transmission. As each node has to transmit its data to its base station living long and communicating is really a challenge.
Best solutions to these issues are still on research level and in my point of view what we can save energy by reducing the weight of the transmission data and reducing the data transmission distance because of the polynomial growth of the power with the distance.

Friday, June 01, 2007

New 'Google Gears' Allows Offline Web Apps

SAN FRANCISCO (Reuters) - Google Inc. said on Wednesday it had created Web software that runs both online, and offline, marking a sea change for the Internet industry by letting users work on planes, trains, spotty connections and even in the most remote locations.

The technology, called Google Gears, would allow users of computers, phones and other devices to manipulate Web services like e-mail, online calendars or news readers whether online, intermittently connected to the Web or completely offline.

Read this story

Monday, April 02, 2007

Profiling an Application

When come to the computer projects, the biggest issue is the emergence of problems after the deployment. This is a real nuisance all the people in the world of computer faces.
So to minimize the effect we can use a process called "Profiling".
By profiling an application we can analyze application execution and identify performance problems like, execution bottlenecks, object leaks, system resources limitations. So by doing so solution provider will be able to chose the right combination of tools and technologies throughout the application life cycle, from development trough production by analyzing the usage of them through out the execution.

Eclipse TPTP (Test and Performance Tools Platform) is profiling tool you can use. As it is an open source project anybody can download from http://www.eclipse.org/tptp .

The easiest way to install TPTP is to use the Remote Update site (see Figure 1). Open the Remote Update window (Help -> Software Updates -> Find and Install->Search for new features to install ->TPTP update site), and select the current TPTP versions and update.

· If you are downloading manually you have to download and install following items.

1. TPTP Runtime or SDK (ALL - Which includes Platform, Monitoring Tools, Tracing and Profiling Tools, and Testing Tools)

2. Agent Controller (For a desired platform)

3. Technology Preview (Automated GUI Recorder)

4. All items listed under 'Requirements'

· You can also download an Eclipse version which includes all TPTP tools.

Where to use TPTP

TPTP can be used form the begging of your application to test the performance of the applications algorithms which implements business logics,

identify methods with high execution time then jump to the source code to fix the performance problem

or you can do it at the end of the project, once the application is almost ready for production.

TPTP lets you test several aspects of your application's behavior, including memory usage (how many objects are being created, and how big they are), execution statistics (where did the application spend most of its time?), and test coverage (how much of the code was actually executed during the tests).

According to the 80-20 rule of thumb, 80% of performance issues will occur in 20% of the code. Or, in other words, you can obtain substantial performance improvements with relatively little effort by simply concentrating on the areas of the application that are executed most often. This is where execution statistics can be useful

How to use TPTP

First run your application so that it will save the last changes and compile the code.

Right click the main class (the class which has the main method) and select profile as -> java application.

You can see the following window there.


Select types of analysis you want. When you press “OK”, program will run and TPTP profiling tools will analyze the execution.

It will display the following window













Wednesday, March 28, 2007

Is Sri Lanaka taking the real advantage of natural resources

Sri lanka is a country enrich with lots of natural resources. So what these people do with resources. Just nothing. We have clay without converting into goods we export. we have stones which can be used to make expensive granite, but we just export them and import the granite paying bigger amount. We have the world best silica ... what we do... just export..
.. those are just a small portion of the list Sri Lankan's do.

So in a country, this happens .. can they become a developed nation .. only in dreams.
Air Force base of Sri Lanka hit for the SECOND TIME

Why this happened..
The first time LTTE cadres came from ground and did a massive attack to the Sri Lankan Air Force Base and SriLankan Airlines.
This week Monday early around 1.00 a.m they launch their second attack from air and went to wanni safely with no casualties.
What's Sri Lanka's approach to this incident.
What do you think about the way of Sri Lankan government facing this problem

Comment

Thursday, February 22, 2007



Sri lankan Most poular Bluetooth enabled Nokia phone

Nokia - 6630
Using J2Me in mobile application development...

we can use j2me in mobile application development and it really gives a vast amount of capabilities in development. But big problem comes as we going to test the developed application in the mobile device. The application may not work in the device. This was a real nasty experience i really experienced. There is nothing wrong in the application, but it does not work in the phone just because the way the phone developed is not really supported.
In my experience some of my developed applications did not worked in the some Nokia phones, but the same application worked in a different Nokia phone.
Mobile is a small device and manufactures try to use the memory and the cpu more efficiency and try to give a better specifications and features comparison to their oponents in the market. But the main functionalities does not change. So when we are going to develop an application with more special features it really becomes pretty much difficult as the phone might not really give a real contribution to the running of the application.
What is more better .. Java or .Net ?..

It's a bit of a confusion what is really better java or Microsoft's .Net based application development.
Well using .Net in development is pretty much easier comparison to Java.
If you want to develop an application to run anywhere, then Java is the solution.
"Once written , Run anywhere "
When come to the speed of execution which is more faster ?..
it's a kind of a tricky question.
Bluetooth technology

Bluetooth is on fast track... costless in using the bandwith really atracts more and more customers.
Another reason is languages like Java gives a real potential hwen it comes to develolping bluetoth applications. J2ME gives application developers to develop more and more bluetooth based applications.
yet to be revealed

Thursday, February 15, 2007

Sri Lankans are Ready......

Sri lankans are ready to face the upcoming sensor technology as University of Colombo School of Computing , UCSC starts a cource for sensor technology under the guidance of Dr. Kasun De Zoysa