Friday, 30 August 2013

Have you ever wondered how your tweets are being posted in twitter?

Here is the answer to the Question . Our tweets are posted in a fraction of second ,but actually a lengthy process is involved . 

To help explain the importance of the JVM within the Twitter infrastructure, here is a high-level overview of the primary ways in which the JVM affects an average Tweet as it is set loose into the Twitter sphere:

1. A popular fashion pundit seesa Best Actress nominee emerge from her limousine on the evening of the Academy Awards. She types her impressions into a Twitter app on her smartphone: “Glamorous Jennifer Lawrence approaches red carpet in white Dior gown evoking old Hollywood.#OscarsFashion2013.” Her Tweet is geotagged with geographical metadata noting the location.
2. After she hits the Tweet button,her message is sent to Twitter’s
front-end routing and load balancing tier, which is written in Scala and runs on the JVM. The front-end system communicates with Twitter’s business tier, which also runs Scala, to authenticate the user and verify that her incoming Tweet conforms to the site’s business rules.
3. The Tweet enters an asynchronous pipeline that will end up delivering it to the caching and storage tiers. Once the Tweet enters this pipeline, the system sends back a reply informing her that her Tweet was successfully posted. In the background, the Tweet is then delivered to all the users who follow this popular fashion authority.
4. Next the Tweet enters Twitter’s relevance pipeline, which determineswhat it is about and who will be interested in it. Relevance is based not only on followers, but also on information within the Tweet: who the sender is, where it was sent from (geotag), and the hashtag that categorizes Tweets by keywords.
5. A Java program in this pipeline recognizes that the hashtag #OscarsFashion2013 is being used on a large number of Tweets and adds that hashtag to Twitter’s trending topics. Instantly, Twitter users around the world see #OscarsFashion2013 as a topic of interest and can send or receive Tweets with that hashtag.

6. When another fashion minded user sees the rending #OscarsFashion2013 hashtag, he or she can click on itwhichresults in a Scala program retrieving the Tweet from the cache or storage tiers

Tuesday, 27 August 2013

Twitter migrating to JVM related coding.

Twitter is one of the top 10 most visited sites on the internet. Unregistered users can read Tweets, and registered users can post them via the Web, SMS, or apps for mobile devices. Part of what makes Twitter attractive is its user-friendly functionality. Hashtags, trending topics, following, @replying, and retweeting all contribute to its ease of use and popularity. Engineers at Twitter admit that while the company has always cared deeply about the quality of its service, delivering on that has been challenging in the face of such explosive growth. Most longtime Twitter users are familiar with the fail whale error message. The whale illustration, created by Chinese-Australian artist Yiying Lu, pops up to inform users that Twitter is over capacity .But service outages on Twitter have been noticeably less frequent since late2010. That’s no coincidence. Benson says that Twitter’s engineers have been doing a lot of thinking about Twitter’s architecture and the challenge of handling so many requests every second. Years of constantly refining their approach have brought them to a solution that uses the JVM to build systems that can handle that load easily by scaling horizontally.“We don’t want to depend upon machines getting taller and taller or the resources in those individual boxes increasing,” Benson says. “We want computers that can handle requests in parallel. The JVM is a managed language runtime that can deal with concurrency in a very efficient way. It can handle these types of workloads. A great deal of our datacenter was dedicated to handling the API traffic of our customers. That can now be managed with far fewer machines on the JVM while delivering huge boosts in performance.”The Twitter team has moved many of the company’s most critical systems to a set of services written in Java and Scala running on the JVM. The service is now a worldwide presence that can capably handle sustained peak levels during major events like the Super Bowl and the US presidential election without an appearance from the fail whale. Users enjoy a very fast system that enables them to get information within seconds about events taking place all over the world. Benson says the migration to the JVM not only delivers performance wins; it also provides something he likes to call observability. “Running a service of this scale, things go wrong all the time, either because of runtime issues or because software is being deployed every hour,” he says. “We want to be sure we understand why those failures happen. With the JVM, it is a lot easier for us to examine those events in a robust way than it was with other runtimes we have used in the past.”Finally, one of the critical factors in moving to the JVM was the Open JDK open source project. “As the guy who needs to think strategically about how my organization can work, not only inside the building but also externally, the open source nature of the JVM is very important to me because we can seethe source on which we’re building the core infrastructure,” Benson says. “We hire engineers to work with that codebase and community to improve the runtime so that we can build faster and more predictable services on top of the JVM. These are the kinds of things that made the choice of migrating to the JVM easy.”

Monday, 26 August 2013

Interesting facts for a developer

The blog has been continuously updated with technical facts that are helpful for a developer to improve their technical skills. Today's post is also contributing to the reader's technical knowledge but in a much lighter way . A software developer cannot survive without the help of Google which we definitely have to admit . 
But , Have we ever thought the programming language that is being used to develop the so called largest used search engine. 

" Google " has been developed using Asynchronous javascript or xml which is acronymed as AJAX.
The second largest search engine that the software industry uses would be Yahoo . How many of us know the expansion of Yahoo ?

Yet Another hierarchy of officious oracle.
Yet some more on the way ... Continue reading 

Saturday, 24 August 2013

Project Lambda

Lambda is one of the exclusive feature that java 8 is expected to show cast . Lambda expression makes the code readable with fewer lines in the program . " -> "  operator is being introduced in java 8 which can be used in anonymous classes as follows
Without Lambda
Runnable runnable1 = new Runnable() {
@Override
public void run() {
System.out.println("Running without Lambda");
}
};
New way with Lambda
Runnable runnable2 = () -> { System.out.println("Running from Lambda"); };
Developers are ready to wait and support the delay in release of Version 8 as the community is facing some security issues and is expected to be fixed as early as possible. Lets Hope for the new look of Java 8.


Friday, 23 August 2013

Just In Java 8.

The release of the eagerly awaited Java 8 version which was scheduled to be released by september has been delayed citing a renewed focus on security.Java Development Kit 8 based on java platform is still in the process of development as new security issues is dogging oracle from releasing its brand new version.Oracle is committed to continue security issues at an accelerated pace to enhance the features of Java. Developers are in to support oracle on this delay as they are eagerly expecting the Project lambda to be added in Java 8 with all exclusive features in it . To Know more about project Lambda , Continue reading this blog.

Thursday, 22 August 2013

verbose Command to view our class files.

Java provides us commands to view our class files which are generated from the java source code after compilation . This bytecode supports us with a concept of platform independency and hence it is very important for a developer to view the class file to understand java even more better.

Wednesday, 21 August 2013

Create your own jar file.

Converting Files to a Jar file in eclipse:


Step 1:  Select the project and right click and go to Export


Step 2: Select the Jar file option under java 



Step 3: Select the project that is to be converted to jar file 



Step 4: Select the destination where the jar file is to saved.



 Step 5:  Click on next to continue



Step 6 :  Browse the main file


This  step can be done for application files using applets.
Click finish to complete conversion.



Monday, 19 August 2013

Debug Your code in eclipse.

Using the debugger :
To make use of the debugging tools in Eclipse, we have to change to the Debug perspective and make the Debug and Expressions views visible. If the perspective is not visible in the drop down menu, click on Other and select it from the presented list.





If the perspective is not visible in the drop down menu, click on Other and select it from the presented list.





It is possible to add a Breakpoint so that execution stops or starts from that particular line of code. Double clicking in the line number column on a particular line will automatically add or remove an existing breakpoint.



Next it is possible to add a watch expression which will be monitored during the debugging process. To perform this process, just right-click in the Expressions view and click on Add Watch Expression.


To start the debugging process, right-click in the window related to the class that you want to debug and choose Debug As then select Java Application.

It is now easy to Step-Into or Step-Over the code and visualise what is happening to the selected variables or object expressions declared in the Expressions view.

Advantage of object oriented features.

A number of advantages can be derived as a result of these object oriented features. Some of these are:
Reusability: Rather than endlessly rewriting same piece of
code, we write it once and use it or inherit it as needed.
Extensibility: A class can be extended without affecting its
users provided the user-interface remains the same.
Maintainability: Again, once the user-interface does not
changed, the implementation can be changed at will.
Security: Thanks to information hiding, a user can only access
the information he has been allowed to access.
Abstraction: Classification and Encapsulation allow portrayal of
real-world problems in a simplified model. 

Saturday, 17 August 2013

Why Write a ClassLoader?

JVM has a Inbuilt  class loader which loads all the class files  into the run time environment . Then why do we need to develop a class loader? Good question. The default ClassLoader only knows how to load class files from the local filesystem. This is fine for regular situations, when you have your Java program fully compiled and waiting on your computer.But one of the most innovative things about the Java language is that it makes it easy for the JVM to get classes from places other than the local hard drive or network. For example,browsers use a custom ClassLoader to load executable content from a Web site.There are many other ways to get class files. Besides simply loading files from the local disk or from a network, you can use a custom ClassLoader to:
* Automatically verify a digital signature before executing untrusted code
* Transparently decrypt code with a user-supplied password
* Create dynamically built classes customized to the user's specific needs
Anything you can think of to write that can generate Java bytecode can be integrated into

your application.

Friday, 16 August 2013

Be Versed on Your Class Loader.

There are several programming Languages which are being used in real world for various purposes , some being in embedded ,artificial intelligence etc. Java is one such language which is totally platform independent by running on the JVM and is being widely used all over the world.   This means that compiled programs are expressed in a special, platform-independent format, rather than in the format of the machine they are running on. This format differs from traditional executable program formats in a number of important ways. In particular, a Java program, unlike one written in C or C++, isn't a single executable file, but instead is composed of many individual class files, each of which corresponds to a single Java class. Additionally, these class files are not loaded into memory all at once, but rather are loaded on demand, as needed by the program. The ClassLoader is the part of the JVM that loads classes into memory.The Java ClassLoader, furthermore, is written in the Java language itself. This means that it's easy to create your own ClassLoader without having to understand the finer details of the JVM.

Thursday, 15 August 2013

Boost your system's performance.

                         The system’s performance starts detoriating once the drive configuration has been changed. In these cases the system may sit at the gray boot screen for a while before the OS loads, but when it finally does, the system will otherwise run just fine. This problem can happen after several types of drive configuration changes, which include replacing a faulty drive, upgrading the drive to a larger or faster one, or migrating to a new storage approach such as a custom Fusion Drive setup in OS X Lion or later.
   The first thing to check if your system is booting slowly is its default boot drive settings. While this is done in the system preferences, the variable for it is stored in the system's PRAM so it can be accessed and used at startup. If there is a problem with the PRAM in the system, the system may not be storing this setting properly. As a result, merely selecting the desired boot drive in the Startup Disk system preferences might not work and you might also need to reset the PRAM so it can store settings properly. To do this, reboot the system while hold the Option-Command-P-R keys all at once until the system automatically resets, and then release the keys and allow it to boot normally.

  In addition to ensuring the system has the drive set as the default boot drive, be sure to check the drive for any errors. To do so, open Disk Utility and first choose the boot drive device (listed above the boot volume name) and click the Verify Disk button in the First Aid tab. This routine will check the drive's partition table layout. Next, select the boot volume itself and rerun the same verification routine to check the drive's format structure. If either of these show any errors then click the Repair Disk button to fix them (you will have to boot to the OS X installation drive to repair the volume structure).
After checking the drive for errors, you can also use a maintenance program such as OnyX to clear boot caches and other temporary files from the system that may influence a slow startup. For a more in-depth maintenance routine to clear other potential errors that could affect how the system runs, try running a full general maintenance routine.


Wednesday, 14 August 2013

Concept Of Piping @ Java

Piping :

The Output of one program being used in another program is called piping . This can also be used when the output of the program is too large and cannot be viewed in one shot in the screen . One possible way to achieve the above is
                C:\Documents and settings\admin>java B >temp.txt
A temp.txt file will be created in the space which will contain the output of the program B.java. This file can be used as a input for another program . We could use the piping symbol to achieve the same . 
C:\Documents and settings\admin>java B  |  more


Tuesday, 13 August 2013

Java commands to be used in command prompt

The following java related commands can be used in command prompt  :
  • ·         java –version – gives you the version of the jdk installed in your system
  • ·         javac –version  - gives the version of the compiler alone/
  • ·         echo %PATH% - gives the path variable mapped in the environment variables.




Monday, 12 August 2013

Just Born Features in Java version 7

The below  mentioned are the  additional features that are available in the version 7.

  • Binary Literals
  • Underscores in Numeric Literals
  • Strings in Switch Statements
  • Automatic Resource Management
  • Suppressed Exceptions
  • Multi-Catch
  • More Precise Rethrow
  • Diamond Operator
  • Varargs Warnings –Erasure
  • ClassLoader Improvements –Deadlock Avoidance
  • Unicode 4 -> Unicode 6.0
  • Mixing of AWT and Swing –Works*
  • Standardize Translucent Windows
  • Better Support for Linux Fonts
  • JDBC 4.1
  • CSS for JavaDoc -stylesheet.css