The Many Faces of a Sequence Comprehension (blogs.sun.com)
Last month I held a presentation about the JavaFX Script programming language at my university. It was easy to impress the audience by showing how fast a graphical user interface can be done. Last year I worked as a teaching assistant for a Java course, where I had to use Eclipse as an IDE. Due to not having a visual GUI editor, I spent a whole day preparing a simple Swing source code example (the students then used it for an exercise). In the JavaFX Script programming language the more intuitive way of writing (and reading) Swing applications is a great relief.
In the functional part of my presentation I used a sequence comprehension, similar to that I found in the draft language reference [1], to decide if a number is a prime number or not.
for (i in [2..n/2] where n % i == 0) i(1)It returns a list of factors of a natural number n, not including 1 and n, so that n is prime iff the sequence of factors is empty. In mathematics one could say, there is a corresponding set of factors of n denoted by
{i | i ∈ [2..n/2], n mod i = 0}. A sequence comprehension consists of three parts: a list of input sequences, a filter and an expression. The expression is "applied" to the filtered input. The expression in (1) is i, so that just the identity function is applied to the filtered input. We get the same result by only filtering [2..n/2].
function filter ( lst : Integer []
, f : function(:Integer):Boolean ) : Integer [] {
var res : Integer [] = [];
for (i in lst) {
if (f(i)) {
insert i into res;
}
}
return res;
}
function factors (n : Integer) : Integer [] {
return filter( [2..n/2]
, function(i) { return n%i == 0; } );
}Instead of defining a filter function, that takes a sequence and a predicate and returns a new sequence, we could use the built-in selection syntax.
[2..n/2][i | n % i == 0]On the other hand, the filter function demonstrates the possibility of passing functions as arguments. The predicate passed by
factorsis an anonymous function.There is also an equivalent sequence comprehension for a sequence syntax without filtering. The filter has just to be always true.
Link
Hey you twits, use Java ME tech-enabled Tiny Twitter (blogs.sun.com)
![]()
It's tiny. It twitters. It's a Java ME tech-enabled version of Twitter for your cell phone.
See:
Use Twitter from a Java ME mobile device
Here's a quote:
This is where TinyTwitter comes in: a free, tiny, widely compatible [J]ava app, that twitters via your GPRS data connection(usually much cheaper than SMS). Simple and effective, this application allows you to send twitterings, receive those of your friends and that?s about all. But it works on most mobile phones, it?s easy to set up and use. It simply works. What else could a Twitter fan wish for?Indeed! Creating things that are simple and effective is what Java ME technology is all about--as evidenced by developers like the one who wrote TinyTwitter.
- Java ME and J2ME
Sun Thrives on the Web (blogs.sun.com)
Sun Technologies are the most important in the web space and web companies especially web 2.0 start ups need to make the best use of Sun technologies to be technically relevant in todays fast paced world.
Most Important Reasons being to prove it :
UltraSparc - Worlds First true System on a Chip
Solaris Operating System
Crossbow - Network Virtualisation and Resource Control
ZFS
Glassfish - Open Source Application Server
MySQL, PostgreSQL, JavaDB
Java
Javafx for generating Rich Internet Applications
Sun's Next Generation Web Technologies
Now let me
explain each Technology in detail so that you get to know why SUN
technologies are the best for web and solve the myth.
Let us start
from server side. Typically a web company ( Web 2.0 Social networking
sites, Web application Service providers and others) needs a Good Web
Server ( Hardware and Software)
Web Servers need good computing speed and power. Sun has the perfect stack for running the latest Technologies.
Lets Start from the microelectronic layer - Yes UltraSparc T2 Processor powered Server.Some of its cool features:
Higher performance and throughput, more network bandwidth, integrated security, low power consumption
Optimized to run multithreaded applications rapidly, efficiently, and securely
Superior consolidation and virtualization capabilities: Up to 64 domains on a single processor
Leverages Solaris 10, the most advanced OS available
Built in Virtualisation facilities like Ldoms
Features and Benefits
Revolutionary Multithreaded Networking
Unprecedented Throughput
Faster I/O Expansion
The Consolidation Processor
"Zero Cost" Security
Advantages for OEMs and Developers
With All
these cool features its no doubt Sun Ultra Sparc supported Processors
can handle the load efficiently which a Typical Web Application (
Example Online Transaction Analytical Processing ) would impose on the
underlying OS /Hardware.
Next we come
to Solaris Operating System - The Best and Most Advanced OS on the
Planet. Lot of innovation has been happening in OS like Dynamic Tracing
(Dtrace) , Zetta Byte File System (ZFS) , Service Management Facility
(SMF), Predictive Self Healing, Virtualisation using Zones ( Containers
), Network Virtualisation and Resource Management using Project
Crossbow etc.
Perhaps the most revolutionary Technology applicable to the web is the Database. And Sun has 3 databases to offer.![]()
![]()
The best in the pack being MySQL which it recently acquired. The coolest features based on my personal experience are :
Easy to use and very Developer Friendly - even a newborn can start creating tables and forms.
Well integrated with PHP , Python , Java , Ruby etc. The Database ODBC Drivers are easily available.
Open Source , Hence No vendor Lock in.
Free . Customer needs to just pay for the Support / Service. Hence lower TOTAL cost of ownership (TCO).
Has a pluggable Database Engine which is a great innovation unique to MYSQL.
All these amazing Database Technologies Along with ZFS storage
solutions can store really large amounts of Data at very cheap cost and
also retrieve data within a flash giving a good experience for a user
visiting a user.
Now we get to Application Layer where you have a plethora of
technologies supported by SUN. Java leads the way. You have JavaFX to
develop sexy rich internet Applications ( RIAs) . JavaFX Script allows
you to make cool Applications in a very short time. You also have
visual tools to help ease of Development. And wait..... JavaFX is not
just for web. It also takes care of Mobile clients too. The processing
and networking capabilities in today's mobile handsets have the
potential to deliver a new class of rich, Internet-enabled content. To
allow content creators to tap into this power, Sun Microsystems is
bringing JavaFX technology to mobile devices. Moreover, JavaFX Mobile
builds on top of the market-leading Java ME platform to take advantage
of its powerful, device-level capabilities.
Just check the following web pages to experience Javafx.
JavaFX Technology at a Glance
JavaFX Home
JavaFX Learning Centre

Some of its cool features:

