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