Tuesday 9 April 2013

Write a java program to display two strings bouncing in opposite directions.


/*
<applet code="BouncingWords" width="200" height="200">
</applet>*/ 

import java.io.*;
import java.applet.*;
import java.awt.*;


public class BouncingWords extends Applet
{         
                        static int i=0,j=1200,flag=0;
                        Thread th=new Thread();  //Defining Thread.
           
                        public void paint(Graphics g)
                        {                     

                                    if(flag==0)
                                    {
                                                if(i!=j)
                                                {
                                                             i++;
                                                             j--;
                                                 }
                                                else
                                                             flag=1;
                                    }
                                    else
                                    {
                                                if(i!=0&&j!=1200)
                                                {
                                                             i--;
                                                             j++;
                                                }
                                                else
                                                            flag=0;
                                    }
                                    g.drawString("Nothing is ",i,200); //Calling drawstring function
                                    g.drawString("Impossible",j,350);
                                    try
                                    {                                 
                                                th.sleep(5);
                                    }
                       
                                    catch (Exception e)
                                    {
                                    }
                                    repaint();  //Calling repaint method.

                        }
}

Output:

C:\>javac BouncingWords.java

C:\>appletviewer BouncingWords.java

Write a java program which accepts a word from command line and print each character of word on one line.



class Ass1
{
                        public static void main(String args[])
                        {
int len=args[0].length();
for(int i=0;i<len;i++)
                                    {
                                                System.out.println(args[0].charAt(i));
                                    }
}
}
Output:
E:\test>javac ass1.java
E:\test>java Ass1
E:\test>java Ass1 java
j
a
v
a

Thursday 6 December 2012

Program for addition of 2 sparse Matrix



#include<stdio.h>
#include<conio.h>

struct sparse
{
 int r,c,v;
}s1[10],s2[10],s3[10];

void display(struct sparse s[]);
void checksparse(int r,int c,int m[][10])
{
          int i,j,cnt=0,cnt1=0;
          for(i=0;i<r;i++)
          {
                   for(j=0;j<c;j++)
                   {
                             if((m[i][j])==0)
                             {
                                      cnt++;
                             }
                             else
                             {
                                      cnt1++;
                             }
                   }
          }
          if(cnt1>cnt)
          {
                   printf("Addition not possible matrix is not sparse\n");
                   getch();
                   exit();
          }
}

void makematrix(int r,int c,int m[10][10])
{
          int i,j;
          for(i=0;i<r;i++)
          {
                   for(j=0;j<c;j++)
                   {
                   printf("Enter value for m[%d][%d]:",i,j);
                   scanf("%d",&m[i][j]);
                   }
          }

}

void makesparse(int r,int c,int m[][10],struct sparse s[10])
{       int i,j,k=1;
          s[0].r=r;
          s[0].c=c;
          for(i=0;i<r;i++)
          for(j=0;j<c;j++)
          {
                   if(m[i][j]!=0)
                   {
                             s[k].r=i;
                             s[k].c=j;
                             s[k].v=m[i][j];
                             k++;
                   }
          }
          k--;
          s[0].v=k;

}

void addsparse(struct sparse s1[],struct sparse s2[])
{
  int i=1,j=1,k=1;
  s3[0].r=s1[0].r>s2[0].r?s1[0].r:s2[0].r;
  s3[0].c=s1[0].c>s2[0].c?s1[0].c:s2[0].c;

  while((i<=s1[0].v) && (j<=s2[0].v))
  {
          if(s1[i].r==s2[j].r)
          {
                   if(s1[i].c==s2[j].c)
                   {
                             s3[k].r=s1[i].r;
                             s3[k].c=s1[i].c;
                             s3[k].v=s1[i].v+s2[j].v;
                             i++;j++;k++;
                   }
                   else if(s1[i].c<s2[j].c)
                             {
                                      s3[k].r=s1[i].r;
                                      s3[k].c=s1[i].c;
                                      s3[k].v=s1[i].v;
                                      i++;
                                      k++;
                             }
                             else
                             {
                                      s3[k].r=s2[j].r;
                                      s3[k].c=s2[j].c;
                                      s3[k].v=s2[j].v;
                                      j++;
                                      k++;
                             }
          }
          else if(s1[i].r<s2[j].r)
                   {
                             s3[k].r=s1[i].r;
                             s3[k].c=s1[i].c;
                             s3[k].v=s1[i].v;
                             i++;k++;
                   }
                   else
                   {
                             s3[k].r=s2[j].r;
                             s3[k].c=s2[j].c;
                             s3[k].v=s2[j].v;
                             j++;k++;
                   }

          }
          while(i<=s1[0].v)
          {
               s3[k].r=s1[i].r;
               s3[k].c=s1[i].c;
               s3[k].v=s1[i].v;
               i++;k++;
          }
          while(j<=s2[0].v)
          {
               s3[k].r=s1[j].r;
               s3[k].c=s1[j].c;
               s3[k].v=s1[j].v;
               j++;k++;
          }
          k--;
          s3[0].v=k;
          printf("Addition of 2 sparse matricies is ");
          printf("\n");
          display(s3);

}
void display(struct sparse s[])
{
          int i;
          printf("ROW\tCOLUMN\tVALUE\n");
          for(i=0;i<=s[0].v;i++)
          {
                   printf("%d\t%d\t%d\n",s[i].r,s[i].c,s[i].v);
          }
}

void main()
{
          int r1,r2,c1,c2,m1[10][10],m2[10][10];
          clrscr();
          printf("Enter number of rows and columns in first Matrix:");
          scanf("%d%d",&r1,&c1);
          makematrix(r1,c1,m1);
          checksparse(r1,c1,m1);
          printf("Enter number of rows and columns in second Matrix:");
          scanf("%d%d",&r2,&c2);
          makematrix(r2,c2,m2);
          checksparse(r2,c2,m2);
          makesparse(r1,c1,m1,s1);
          makesparse(r2,c2,m2,s2);
          display(s1);
          display(s2);
          addsparse(s1,s2);
          getch();
}

Wednesday 5 December 2012

Microsoft will make $94 billion on "Google" patents


Google told a court that Microsoft will make more than $94 billion by using Google's patented wireless technology.
Michael Dansky, an expert for Google's Motorola Mobility unit, told the last day of the patent trial that the $94 billion figure included a wireless adapter that Microsoft no longer sells.

Microsoft declined to comment on the figure.

According to Reuters,  the trial looked at how much royalty Microsoft should pay Google for a licence to some of Motorola's patents. Google bought Motorola earlier this year for $12.5 billion.

It wants $4 billion a year for its wireless and video patents, while Vole thinks that $1 million a year is a nice round figure.
At stake is also the power of Motorola's patents to protect Google from similar spats with its rivals.

Apple and Microsoft have been taking on Google and its chums, like Samsung, which use the Android operating system on their mobile devices rather than have that nasty problem where they have to compete and make better products.

Dansky told the court that Motorola's video patents were crucial to Microsoft and other tech companies, and deserve a high royalty.

It would be difficult to sell smart phones or tablets without Motorola's technology, he told the court.
The court is not expected to release a ruling for several weeks as both companies must file further legal briefs. 


SanDisk 32 GB Mobile microSDHC Flash Memory Card SDSDQ-032G-AFFP

Automated Software


Software development is undoubtedly a complex and laborious process. Software engineers really work hard to carry out a particular software. But now a European experiment is going on which will automate the building and testing phase of programming, thus reducing the time and efforts used in this process.
Software Development Cycle
Software Development
First Ever Computer Program:
Computer programming has came a long way since days when Ada Lovelace wrote the first ever computer program in 1842. It was a small program written to calculate Bernoulli numbers. These days programming was not as complex and was not more than an individual effort.
Present day Scenario:
These days’ computer programs are getting more and more complex. A team of software developers works for years to develop a program, building the concept, coding, testing, debugging and then finally releasing and maintenance of programs.
Now if we need to reduce the time and effort in software development process, the only thing we can do is to “Automate the Process.”
The ETICS project:
ETICS project is a giant leap in the field of software development. It will automate the most of the software programming tasks thus helping software developers, managers and testers and will also help to obtain high quality. This will also help in reducing the cost of software and time taken in development.
The new system:
This new system will help software developers and users to automate the most of the process in development and testing execution. This amazing platform will use latest in “Grid” software and it can operate in multiple platforms. It can also be customized and developed further as it is an open source project.
Developers can install the client interface of system and then they can use results from round-the-clock builds. Tests can also be monitored via web and configuration metadata of software can also be browed and edited via a secure web application.
Mr. Alberto Di Meglio: Man behind this project
Mr. Alberto Di Meglio of CERN, the European organization for nuclear research is leading the research. In his words:
“By automating many of their day-to-day tasks, the ETICS system supports software managers, developers and testers in obtaining higher quality software.”
Development:
The ETICS platform has been developed in two phases over 3 years and has been continuously refined in collaboration with users. Some more new functions are being developed for ETICS 2 which will help software developers to run complex tests over distributed networks.
We must hope that this new system will surely bring a new revolution in the field of software development and testing.

SanDisk Ultra 32 GB MicroSDHC Class 10 UHS-1 Memory Card with Adapter (SDSDQU-032G-AFFP-A)

Robots can Learn

If the current research of Dr. Ashutosh Saxena of Cornell's Personal
Robotics Laboratory becomes successful then Robots of future will
learn to manipulate objects and will develop the ability of
generalization. This learning procedure will help Robots to adapt
according to new environments.

The main theory behind this is the use of machine learning programming
which leads to observation of events by Robots and find commonalities.
For an example a robot will see different cups, learn the common
characteristics of cups and will then identify cups in future no
matter what size and shape they will have. This kind of process will
also teach robots to handle cups correctly.

According to Saxsena, these new robots would be able to make decisions
like how to place cups on different places. Like a cup will be placed
upright on table while upside down in dishwasher. Robots will get
training of placing strategies and will be able to apply then on other
objects by the process of generalization.

In testing process scientists placed different things like a plate,
mug, glass, bowl, spoon and some other objects at different surfaces
like on flat surface, hook, stemware holder etc. Robots then tested
the suitable locations for placement of these objects after studying
the environment and gave priority to best locations to place an
object.

After such training Robot placed objects 98% correct at previously
seen environment and objects. This accuracy was 95% for new objects
and environments and that can be improved further by longer periods of
training.

The base of all this is the contextual relations in 3-Dimensions.
Although making a Robot that acts just like humans will take long time
but by making Robots like these is a giant leap in Robotics.

Thursday 15 November 2012

The square

Jack Dorsey, the co-inventor of Twitter, is promoting his latest
invention called the Square.
The square is a small plug-in attachment to your mobile phone that
allows you to receive credit card payments.

The idea originated from Dorsey's friend Jim McKelvey who was unable
to sell some glass work to a customer because he couldn't accept a
particular card being used.

Accepting credit card payments for something you're selling isn't
always easy, especially if you are mobile like a tradesman, delivery
service or a vendor at a trade show.

This latest invention uses a small scanner that plugs into the audio
input jack on a mobile device.

It reads information on a credit card when it is swiped. The
information is not stored on the device but is encrypted and sent over
secure channels to banks.

It basically makes any mobile phone a cash register for accepting card payments.

As a payer, you receive a receipt via email that can be instantly
accessed securely online. You can also use a text message to authorize
payment in real time.

Retailers can create a payer account for their customers which
accelerates the payment process.

For example, a cardholder can assign a photo to their card so their
photo will appear on the phone for visual identity confirmation.
Mobile devices with touch screens will also allow you to sign for
goods.

See Related Article On The Future Of Smart Phones
There are no contracts, monthly fees, or hidden costs to accept card
payments using Square and it is expected the plug-in attachment will
also be free of charge.
A penny from every transaction will also be given to a cause of your choice.

As with Twitter, it's anticipated that Dorsey will direct the company
based upon feedback from users.

Square Inc. has offices in San Francisco, Saint Louis and New York and
is currently beta testing the invention with retailers in the United
States.

Source: squareup.com

Saturday 15 September 2012

Different types of image formats

1. TIFF (also known as TIF), file types ending in .tif

TIFF stands for Tagged Image File Format. TIFF images create very
large file sizes. TIFF images are uncompressed and thus contain a lot
of detailed image data (which is why the files are so big) TIFFs are
also extremely flexible in terms of color (they can be grayscale, or
CMYK for print, or RGB for web) and content (layers, image tags).

TIFF is the most common file type used in photo software (such as
Photoshop), as well as page layout software (such as Quark and
InDesign), again because a TIFF contains a lot of image data.

2. JPEG (also known as JPG), file types ending in .jpg

JPEG stands for Joint Photographic Experts Group, which created this
standard for this type of image formatting. JPEG files are images that
have been compressed to store a lot of information in a small-size
file. Most digital cameras store photos in JPEG format, because then
you can take more photos on one camera card than you can with other
formats.

A JPEG is compressed in a way that loses some of the image detail
during the compression in order to make the file small (and thus
called "lossy" compression).

JPEG files are usually used for photographs on the web, because they
create a small file that is easily loaded on a web page and also looks
good.

JPEG files are bad for line drawings or logos or graphics, as the
compression makes them look "bitmappy" (jagged lines instead of
straight ones).

3. GIF, file types ending in .gif

GIF stands for Graphic Interchange Format. This format compresses
images but, as different from JPEG, the compression is lossless (no
detail is lost in the compression, but the file can't be made as small
as a JPEG).

GIFs also have an extremely limited color range suitable for the web
but not for printing. This format is never used for photography,
because of the limited number of colors. GIFs can also be used for
animations.

4. PNG, file types ending in .png

PNG stands for Portable Network Graphics. It was created as an open
format to replace GIF, because the patent for GIF was owned by one
company and nobody else wanted to pay licensing fees. It also allows
for a full range of color and better compression.

It's used almost exclusively for web images, never for print images.
For photographs, PNG is not as good as JPEG, because it creates a
larger file. But for images with some text, or line art, it's better,
because the images look less "bitmappy."

When you take a screenshot on your Mac, the resulting image is a
PNG–probably because most screenshots are a mix of images and text.

5. Raw image files

Raw image files contain data from a digital camera (usually). The
files are called raw because they haven't been processed and therefore
can't be edited or printed yet. There are a lot of different raw
formats–each camera company often has its own proprietary format.

Raw files usually contain a vast amount of data that is uncompressed.
Because of this, the size of a raw file is extremely large. Usually
they are converted to TIFF before editing and color-correcting.

Most of this info is courtesy of Wikipedia, which is a great place to
read more about all 5 file types.

Wednesday 12 September 2012

Principles Of Animations

1. SQUASH AND STRETCH

This action gives the illusion of weight and volume to a character as
it moves. Also squash and stretch is useful in animating dialogue and
doing facial expressions. How extreme the use of squash and stretch
is, depends on what is required in animating the scene. Usually it's
broader in a short style of picture and subtler in a feature. It is
used in all forms of character animation from a bouncing ball to the
body weight of a person walking. This is the most important element
you will be required to master and will be used often.

2. ANTICIPATION

This movement prepares the audience for a major action the character
is about to perform, such as, starting to run, jump or change
expression. A dancer does not just leap off the floor. A backwards
motion occurs before the forward action is executed. The backward
motion is the anticipation. A comic effect can be done by not using
anticipation after a series of gags that used anticipation. Almost all
real action has major or minor anticipation such as a pitcher's
wind-up or a golfers' back swing. Feature animation is often less
broad than short animation unless a scene requires it to develop a
characters personality.

3. STAGING

A pose or action should clearly communicate to the audience the
attitude, mood, reaction or idea of the character as it relates to the
story and continuity of the story line. The effective use of long,
medium, or close up shots, as well as camera angles also helps in
telling the story. There is a limited amount of time in a film, so
each sequence, scene and frame of film must relate to the overall
story. Do not confuse the audience with too many actions at once. Use
one action clearly stated to get the idea across, unless you are
animating a scene that is to depict clutter and confusion. Staging
directs the audience's attention to the story or idea being told. Care
must be taken in background design so it isn't obscuring the animation
or competing with it due to excess detail behind the animation.
Background and animation should work together as a pictorial unit in a
scene.

4. STRAIGHT AHEAD AND POSE TO POSE ANIMATION

Straight ahead animation starts at the first drawing and works drawing
to drawing to the end of a scene. You can lose size, volume, and
proportions with this method, but it does have spontaneity and
freshness. Fast, wild action scenes are done this way. Pose to Pose is
more planned out and charted with key drawings done at intervals
throughout the scene. Size, volumes, and proportions are controlled
better this way, as is the action. The lead animator will turn
charting and keys over to his assistant. An assistant can be better
used with this method so that the animator doesn't have to draw every
drawing in a scene. An animator can do more scenes this way and
concentrate on the planning of the animation. Many scenes use a bit of
both methods of animation.

5. FOLLOW THROUGH AND OVERLAPPING ACTION

When the main body of the character stops all other parts continue to
catch up to the main mass of the character, such as arms, long hair,
clothing, coat tails or a dress, floppy ears or a long tail (these
follow the path of action). Nothing stops all at once. This is follow
through. Overlapping action is when the character changes direction
while his clothes or hair continues forward. The character is going in
a new direction, to be followed, a number of frames later, by his
clothes in the new direction. "DRAG," in animation, for example, would
be when Goofy starts to run, but his head, ears, upper body, and
clothes do not keep up with his legs. In features, this type of action
is done more subtly. Example: When Snow White starts to dance, her
dress does not begin to move with her immediately but catches up a few
frames later. Long hair and animal tail will also be handled in the
same manner. Timing becomes critical to the effectiveness of drag and
the overlapping action.

6. SLOW-OUT AND SLOW-IN

As action starts, we have more drawings near the starting pose, one or
two in the middle, and more drawings near the next pose. Fewer
drawings make the action faster and more drawings make the action
slower. Slow-ins and slow-outs soften the action, making it more
life-like. For a gag action, we may omit some slow-out or slow-ins for
shock appeal or the surprise element. This will give more snap to the
scene.

7. ARCS

All actions, with few exceptions (such as the animation of a
mechanical device), follow an arc or slightly circular path. This is
especially true of the human figure and the action of animals. Arcs
give animation a more natural action and better flow. Think of natural
movements in the terms of a pendulum swinging. All arm movement, head
turns and even eye movements are executed on an arcs.

8. SECONDARY ACTION

This action adds to and enriches the main action and adds more
dimension to the character animation, supplementing and/or
re-enforcing the main action. Example: A character is angrily walking
toward another character. The walk is forceful, aggressive, and
forward leaning. The leg action is just short of a stomping walk. The
secondary action is a few strong gestures of the arms working with the
walk. Also, the possibility of dialogue being delivered at the same
time with tilts and turns of the head to accentuate the walk and
dialogue, but not so much as to distract from the walk action. All of
these actions should work together in support of one another. Think of
the walk as the primary action and arm swings, head bounce and all
other actions of the body as secondary or supporting action.

9. TIMING

Expertise in timing comes best with experience and personal
experimentation, using the trial and error method in refining
technique. The basics are: more drawings between poses slow and smooth
the action. Fewer drawings make the action faster and crisper. A
variety of slow and fast timing within a scene adds texture and
interest to the movement. Most animation is done on twos (one drawing
photographed on two frames of film) or on ones (one drawing
photographed on each frame of film). Twos are used most of the time,
and ones are used during camera moves such as trucks, pans and
occasionally for subtle and quick dialogue animation. Also, there is
timing in the acting of a character to establish mood, emotion, and
reaction to another character or to a situation. Studying movement of
actors and performers on stage and in films is useful when animating
human or animal characters. This frame by frame examination of film
footage will aid you in understanding timing for animation. This is a
great way to learn from the others.

10. EXAGGERATION

Exaggeration is not extreme distortion of a drawing or extremely
broad, violent action all the time. Its like a caricature of facial
features, expressions, poses, attitudes and actions. Action traced
from live action film can be accurate, but stiff and mechanical. In
feature animation, a character must move more broadly to look natural.
The same is true of facial expressions, but the action should not be
as broad as in a short cartoon style. Exaggeration in a walk or an eye
movement or even a head turn will give your film more appeal. Use good
taste and common sense to keep from becoming too theatrical and
excessively animated.

11. SOLID DRAWING

The basic principles of drawing form, weight, volume solidity and the
illusion of three dimension apply to animation as it does to academic
drawing. The way you draw cartoons, you draw in the classical sense,
using pencil sketches and drawings for reproduction of life. You
transform these into color and movement giving the characters the
illusion of three-and four-dimensional life. Three dimensional is
movement in space. The fourth dimension is movement in time.

12. APPEAL

A live performer has charisma. An animated character has appeal.
Appealing animation does not mean just being cute and cuddly. All
characters have to have appeal whether they are heroic, villainous,
comic or cute. Appeal, as you will use it, includes an easy to read
design, clear drawing, and personality development that will capture
and involve the audience's interest. Early cartoons were basically a
series of gags strung together on a main theme. Over the years, the
artists have learned that to produce a feature there was a need for
story continuity, character development and a higher quality of
artwork throughout the entire production. Like all forms of story
telling, the feature has to appeal to the mind as well as to the eye.

Tuesday 11 September 2012

IPAD VS KINDLE?


Let's get it out of the way up front: The new iPad and theKindle Fire are two completely different beasts. It's almost pointless to do a general side-by-side spec comparison without considering the varying needs of different tablet users. For some, the budget-friendly, reading-centric Kindle Fire will be more than enough. For others, though, the genre-defining iPad will be the obvious choice. So let's take a look at the various factors to consider when you're looking for your next tablet:
SpecsHardware isn't everything. That said, the new iPad absolutely creams the Kindle Fire in a strict spec comparison. Not everyone needs Apple's dual-core A5X processor with quad-core graphics. After all, the dual-core 1GHz TI OMAP4 processor in the Kindle Fire is no slouch. A tablet's screen is one of its most important features, and the iPad's ultra-sharp 9.7-inch 2,048-by-1536-pixel Retina Display can't be beat. But what if you want to slip your tablet into your jacket pocket? The Kindle's 7-inch (1,024-by-600-pixel) display makes it a lot easier to tote, but it also limits your screen real estate.
Both tablets offer unlimited cloud storage for their respective eco-system content, so internal storage may not be a huge factor, but it's worth considering if you want to load your own content. The Kindle Fire offers 8GB, while the iPad comes in 16, 32, and 64GB capacities. Neither, however, supports microSD or any other storage expansion options.
Chart
As far as connectivity, the new iPad offers 4G LTE compatibility, which gives it an edge over the Kindle Fire, but don't forget that there are plenty of solid and affordable mobile hotspot options that will bring the same capability to Amazon's Wi-Fi-only tablet. Both tablets are 802.11b/g/n Wi-Fi compatible, but only the iPad supports AirPlay and Bluetooth—this is especially important if you want to stream music or videos wirelessly to your compatible speakers or HDTV.
If, for whatever reason, you want your new tablet to replace your digital camera, then the iPad's new 5-megapixel camera will be a big factor. The Kindle Fire lacks a camera for stills or video, but the general usefulness of tablet cameras is still up for debate. Battery life will likely be longer on the iPad too, but that's because it's a bigger tablet that can house a bigger battery.
Advantage: Apple. The new iPad packs a vastly superior screen, 4G LTE compatibility, more internal storage, and more wireless connectivity options. Amazon did not skimp on components in the Kindle Fire, but it still cannot compete with the new iPad on a strictly hardware level.
Software and AppsThis is not your standard iOS vs. Android showdown. The iPad runs Apple's iOS mobile operating system and has access to the Apple App Store. The Kindle Fire uses a heavily modified version of Android 2.3 Gingerbread, which makes for a smooth, simple, and intuitive interface that is drastically different than the stock Google software. With those changes, though, the Kindle Fire also loses the Android Market (now rebranded as Google Play). You can, however, install your own APK's onto your Kindle Fire with the right tools, opening up the possibility to get nearly any app available in Google Play. The Amazon Appstore is perfectly capable too, with thousands of choices, but it can't compare with the more than 170,000 native iPad apps in the Apple App Store.  
It's hard to argue with the simplicity and elegance of Apple's iOS. Android has made significant strides, but still lacks some polish—especially in older flavors like Gingerbread and Honeycomb. Amazon's reimagined Android is undeniably smooth and easy to use, but it also loses some of that customizability that makes Android so attractive in the first place.
Advantage: Apple. Android is fine, and Amazon really did a lot to make it painfully clear what to do with the tablet. However, iOS is still the more polished, intuitive, and feature-packed of the two