Friday, October 22, 2010

Computer Basics

And now some bytes of info Kilo, Mega, What? With so many different file sizes, it may be hard to keep them all straight, so here is a little refresher that any computer user can always use!

So, what really are the differences in all of the sizes you see on your computer?
Kilobytes,
megabytes,
gigabytes, etc?

File sizes tend to be one of the more perplexing issues for both the fledgling and intermediate computer user. So, we've put together a breakdown of the various file size "units" you may encounter.
  • Bit - The smallest unit in computing. It can have a value of 1 or 0.  You'd be hard pressed to find a file size listed in bits.
  • Byte - A (still small) unit of information made up of 8 bits.
  • Kilobyte(KB) - A unit of approximately 1,000 bytes (1,024 to be exact). Most download sites use kilobytes when they give file sizes.
  • Megabyte (MB) - 220 bytes = 1,048,576 bytes or 1,024 kilobytes. Sometimes used to mean 1 million bytes.
  • Gigabyte (GB) - Approximately 1 billion bytes (1,024 MB).  Most hard drive sizes are listed in gigabytes.
I know that even with the information above, it can still be confusing, so I thought I would compare these digital units of measure to some everyday objects. Just picture them being completely hollow so you can store information in them.
  • Bit - Let's call this a regular sized marble.
  • Byte - Compared to the marble, this would be a baseball.
  • Kilobyte - Now we jump up to a pickup truck size.
  • Megabyte - Now for the leap - this would be a medium sized sky scraper.
  • Gigabyte - Take 1,024 of the medium sized sky scrapers and stick them together for this one!

OK, now for a little practical application.
  •  A 3 1/2" floppy disk holds 1.44 Megabytes (1,474 KB).
  • A CD Rom holds 650 to 700 Megabytes (though most programs you get don't utilize the whole amount). This would be around 450 of those 3.5 floppies.
  • A 20 Gig hard drive will hold the same amount of info as 31 CD ROMs or 14,222 floppy disks.
  • It takes between 7 to 10 minutes to download a one megabyte (1,024 KB) file using the average dial up Internet connection.
  • A typical page of text is around 4KB.
  • To see the size of a given file, just right-click it (in Explorer or My Computer) and select Properties from the resulting menu (or Alt+ double click the file).
Regards and Cheers
Amey Nevrekar
ameynevrekar@gmail.com

Printer Buying Guide

Printer Buying Guide

Here are some guidelines you can follow when you go out printer shopping! Here are some questions you should keep in mind to ask the sales person at the printer store of your choice:

1.) How does the printer handle different types of paper? Check and see if the printer can handle things like envelopes, cards or other types of paper you might use. Also, ask how much paper the printer is able to hold at one time. You don't want to be constantly refilling the paper and you don't want to run into any paper jams.

2.) What type of ink cartridge does the printer take? You'll want to ask about black and color ink cartridges. Check on the cost of them (you don't want to be forking out tons of money for ink later on), how easy the installation is for refills, etc. Ink is what makes your projects turn out at all, so you want your new printer to be top notch in that area. Also, even if you're buying a printer on the cheaper side, it may cost more to refill the ink down the road, so always double check on this.

3.) How easy is it to install this printer on my computer? Always ask the sales person who is helping you how the installation process is. Some printers can be more difficult than others and you can save yourself some hassle by asking. Most printers just come with a CD kit and you just have to walk through the process with a wizard, but make sure that is all you're getting yourself into.

4.) How durable is the printer? Depending on what you're going to be printing with your new printer, you'll want to find out how much it can handle. If you're only going to be printing items every so often, a standard printer will be fine, but if you're going to be printing in high volume, you may need something a little more advanced.

5.) Does the printer handle postscript language? If you're going to be printing a lot of heavy graphics and so forth, make sure your printer supports the language.

6.) How noisy is this printer? You should definitely ask the sales person to do a quick test print for you so that you will be able to see exactly how your printer will act and also how it will sound. You don't want your printer to be so noisy that
every time you print something, you can't even hear yourself think.

7.) What type of warranty does the printer come with? Always check on this to keep yourself covered.

8.) And finally, the most important question of all: How much does it cost? If you keep these sample questions in mind, you should be able to find the printer of your dreams and one that will fulfill all your needs.

Keep Smiling
Amey Nevrekar
ameynevrekar@gmail.com

Thursday, October 21, 2010

Rajni vs Amitabh

Rajnikanth was bragging to Amitabh Bachan one day, "You know, I know everyone. Just name someone, anyone, and I know them.
Tired of his boasting, Amitabh Bachan called his bluff, "OK, Rajini how about Tom Cruise?"
"Sure, yes, Tom and I are old friends, and I can prove it" Rajini said.
So Rajini and Amitabh Bachan fly out to Hollywood and knock on Tom Cruise's door,
And sure enough, Tom Cruise shouts : "Thalaiva! Great to see you! You And your friends come right in and join me for lunch!"
...Although impressed, Amitabh Bachan is still skeptical. After they leave Cruise's house, he tells Rajini that he thinks Rajini knowing Cruise was Just lucky.
"No, no, just name anyone else" Rajini says

..."President Obama", Amitabh Bachan quickly retorts
..."Yes", Rajini says, "I know him.

And off they go. At the White House, Obama spots Rajini on the tour and motions him, saying, : "Rajini, what a surprise, I was just on my way to a meeting, but you and your friend come on in and let's have a cup of coffee first and catch up".

Well, Amitabh Bachan is much shaken by now, but still not totally onvinced. After they leave the White House grounds, he implores him to name anyone else.

"The Pope," Amitabh Bachan replies
..."Sure!" says Rajini, "My folks are from Italy and I've known the Pope a long time".

Rajini and Amitabh Bachan are assembled with the masses in Vatican Square when Rajini says, "This will never work. I can't catch the Pope's eye among all these people. Tell you what, I know all the guards so let me just go upstairs and I'll come out on the balcony with the Pope."
And he disappears into the crowd headed toward the Vatican.. Sure enough, half an hour later Rajini emerges with the Pope on the balcony. But by the time Rajini returns, he finds that Amitabh Bachan has had a heart attack and is surrounded by paramedics.
Working his way to Amitabh Bachan's side, Rajini asks him, "What happened?"
Amitabh Bachan looks up and says,
"I was doing fine until u and the pope came out on the balcony and the Italian man next to me said,
"Who's that on the balcony with Rajini?"

Few brilliant tweets after India Vs Australia Test Match

#Flash: Home Ministry has issued advisory for all people named Laxman against traveling to Australia

#I wont be surprised if Laxman is made honorary Australian citizen: better to have him on your side than a constant thorn in the flesh...

#I hereby declare that I am starting proceedings to find LaxmanJanmabhoomi so we can build a Laxman temple.

#Last week belonged to Ram. This week belongs to Laxman

#Lets demolish the hospital where Laxman was born n build a bhavya Laxman mandir!

#Sydney se 50-50 kos door gaon me jab koi cricketer rota hai..toh uski maa kehti hai beta chup hoja nahi toh laxman aa jaega

#Dear Kalmadi, if u have an extra gold medal pls give it to VVS Laxman, he deserves!! And a Silver to Ishant & a Bronze to Raina for running

#Gandhiji's last words were - 'Hey Ram', Ponting's last words would be 'Hey laxman'

#The day VVS LAXMAN retires from Test cricket, it will be a National holiday in Australia

Intelligent!!

While visiting India , George Bush is invited to tea with Indian President Abdul Kalam. He asks Kalam what his leadership philosophy is. He says that, it is to surround himself with intelligent people.

Bush asks how he knows if they're intelligent.
"I do so by asking them the right questions," says Kalam."Allow me to demonstrate. "

Bush watches as Kalam phones Manmohan Singh and says, "Mr.Prime Minister, please answer this question: your mother has a child, and your father has a child, and this child is not your brother or sister. Who is it?"

Manmohan immediately responds, "It's me, Sir !"

"Correct. Thank you and good-bye, sir," says Kalam. He hangs up and says, "Did you get that, Mr. Bush?"

Bush nods: "Yes Mr. President. Thanks a lot. I'll definitely be using that!"

Bush, upon returning to Washington, decides he'd better put the Condoleeza Rice to the test. Bush summons her to the White House and says, "Condoleeza, I wonder if you can answer a question for me."

"Why, of course, sir. What's on your mind?"

Bush poses the question: "Uhh, your mother has a child, and your father has a child, and this child is not your brother or your sister. Who is it?"

Rice was puzzled and finally asks, "Can I think about it and get back to you?" Bush agrees, and Rice leaves. Rice immediately calls a meeting of senior senators, and they puzzle over the question for several hours, but nobody can come up with an answer. Finally, in desperation, Rice calls Colin Powell and explains the problem.

"Mr. Powell, your mother has a child, and your father has a child, and this child is not your brother or your sister. Who is it?"

Powell answers immediately, "It's me, of course."

Much relieved, Rice rushes back to the White House, finds George Bush,and exclaims, "I know the answer, sir! I know who it is! It's our Colin Powell!"

And Bush replies in disgust, "Wrong, its Manmohan Singh!"

Enjoy!!

ENJOY!!

: A guy went up 2his father, saying: "Daddy, I fell in love nd want 2date dis awesome girl!"
Father:That's great,son. Who is it?
Son:It's Sandra, the neighbour's daughter.
Father: Ohh I wish u hadn't said dat. I hav 2tell u sumthing, son, bt u must promise nt 2tell ur mum. Sandra is actually your sister.
The boy is naturally bummed out, bt life goes on, nd indeed, a couple of months later..
Son:Daddy,I fell in love again nd she is even hotter!
Father:That's great, son. Who is it?
Son: It's Angela, d other neighbour's daughter.
Father:Ohhh I wish u hadn't said dat. Angela is also your sister.
This went on another couple of times, nd d dude was so mad, he went straight 2his mother, crying.
Son:Mum I am so mad at dad! I fell in love with six girls bt I can't date ny of them coz dad is their father!

D mother hugs him affectionately nd says:"My love, u cn date whomever u want. He isn't your father :)!!

Crazy CID Facts

Crazy CID Facts


1. Daya has the world record of breaking most number of doors.
2. C.I.D bureau has 1 toyota qualis since last 11 years.
3. In entire 20 storeyed building of C.I.D only 7-10 people works.
4. There is no POLICE, C.I.D handles every stupid case.
5. Accused person accepts his crime only after getting slap from Daya on face.
6. None of them ever got married.
7. None of them ever got promotion, not even ACP.
8. Salunke just presses CTRL+ALT gets Finger prints tested.
9. people remember a person they just saw once give excat sketch.
10.End of episode, all cases are solved and criminals admit their guilt!

Ajax Anywhere

Brief IntroductionAJAX

:
AJAX (Asynchronous JavaScript and XML) is a method of building interactive applications for the Web that process user requests immediately. Ajax combines several programming tools including JavaScript, dynamic HTML (DHTML), Extensible Markup Language (XML), cascading style sheets (CSS), the Document Object Model (DOM), and the Microsoft object, XMLHttpRequest. Ajax allows content on Web pages to update immediately when a user performs an action, unlike an HTTP request, during which users must wait for a whole new page to load. For example, a weather forecasting site could display local conditions on one side of the page without delay after a user types in a zip code.

Google Maps is one well-known application that uses Ajax. The interface allows the user to change views and manipulate the map in real time. Ajax applications do not require installation of a plug-in, but work directly with a Web browser. Because of the technique's reliance on XMLHttpRequest, early applications worked only with Microsoft's Internet Explorer browser, but most other browsers now support Ajax.

AjaxAnywhere Introduction:

AjaxAnywhere is designed to turn any set of existing JSP or JSF components into AJAX-aware components without complex JavaScript coding.
In contrast to other solutions, AjaxAnywhere is not component-oriented. You will not find here yet another AutoComplete component.
Simply separate your web page into multiple zones, and use Ajax Anywhere to refresh only those zones that needs to be updated.


What is AjaxAnywhere?

·         AjaxAnywhere, a JSP tag library that uses AJAX to refresh "zones" on a web page.
·         This is a simple way to enhance an existing JSP / Struts / Spring / JSF application with AJAX.



How it works?

  1. Mark "reload-capable" zones of a web page with AjaxAnywhere custom tags.
  2. Instead of submitting a form in traditional way, do it by AjaxAnywhere javascript API.
  3. During request processing on the server-side, determine the zones to refresh. (You can implement this logic either on the client-side via JavaScript or on the server-side, via AjaxAnywhere API.)
  4. On the server-side AjaxAnywhere will generate an XML containing only the "updated" HTML.
  5. On the client-side AjaxAnywhere javascript will receive the XML, parse it and update the selected zones.
Note: Explained in detail with an example

Why go for AjaxAnywhere?

  • Less JavaScript to develop and to maintain. Absence of commonly accepted naming convention, formatting rules, patterns makes JavaScript code messier then Java/JSP. It is extremely difficult to debug and unit-test it in multi-browser environment. Get rid of all those complexities by using AjaxAnywhere.
  • Lower technical risk. Switch whenever you need between AJAX and traditional (refresh-all-page) behaviour of your web application. Your application can also support both behaviors.
  • Default graceful degradation. You do not need to develop another interface for older browers support. If XMLHttpRequest is not available, application will keep working in traditional way, refreshing the entire page.
  • JavaScript received by AJAX is treated in a special way. AjaxAnywhere executes it via eval(""), it is also able to extract the declared functions into the proper context. (as if the page was reloaded completely). However, it is impossible to execute document.write() command inside AJAXable zone.
  • The zones to reload might be known before submitting the request. In this case, override AjaxAnywhere.getZonesToReload() JavaScript function on the client-side. No additional server side logic is necessary.
  • response.sendRedirect() during Ajax request is transformed into location.href=.. JavaScript commmand.
  • AjaxAnywhere doesn't require changes to the underlying code, so while it's more coarse than finely-tuned AJAX, it's also easier to implement, and doesn't bind your application to AJAX (i.e., browsers that don't support AJAX can still work.)


Limitations on AjaxAnywhere

·         AxajAnywhere is not as dynamic as pure-JavaScript AJAX solutions.
·         Can only update a set of complete DHTML objects without breaking then apart.


Get started with AjaxAnywhere:

AjaxAnywhere Installation (Along with Struts 1.1):

·         Download the tool kit for AJAXAnywhere from internet (http://sourceforge.net/projects/ajaxanywhere/)
·         Extract JavaScript file(s) (aa.js) from the binary distibution file into your web application root. In my case I have placed it along with my JSP files
·         Copy the JAR file to /WEB-INF/lib or your web application
·         Add AAFilter mapping for dynamic URLs to web.xml. Make sure that AjaxAnywhere filter in the first one in the chain.
      <display-name>AjaxAnywhere</display-name>
      <filter>
            <filter-name>AjaxAnywhere</filter-name>
            <display-name>AjaxAnywhere</display-name>
            <filter-class>org.ajaxanywhere.AAFilter</filter-class>
      </filter>
      <filter-mapping>
            <filter-name>AjaxAnywhere</filter-name>
            <url-pattern>*.jsp</url-pattern>
      </filter-mapping>
      <filter-mapping>
            <filter-name>AjaxAnywhere</filter-name>
            <url-pattern>*.do</url-pattern>
        </filter-mapping>



Lets implement AjaxAnywhere with an Example:
Abstract of the example: We would be displaying three different time zones in a drop down, on selecting a particular Time zone it has to call the action class and display the time accordingly. For this we will be using AjaxAnywhere, where in the complete page should not be refreshed on selecting the Zone (Normal AJAX functionality)

Step 1) Complete AjaxAnywhere Installation

Follow the above installation steps i.e., downloading the jar file and extracting aa.js and placing along with the Project files and making the configuration setting in web.xml
Please note: I would be using Struts 1.1 in my example to explain the functionality.

Step 2) Create New JSP File

Create a new JSP file for the time zone drop downs along with the zone(s) on Ajax call as below:

<%@ page language="java"%>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="http://ajaxanywhere.sourceforge.net/" prefix="aa" %>


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">

<HTML>
<HEAD>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<META name="GENERATOR" content="IBM WebSphere Studio">
<META http-equiv="Content-Style-Type" content="text/css">
<LINK href="../theme/Master.css" rel="stylesheet" type="text/css">
<TITLE>Time Zones</TITLE>
<script language="javascript" src="aa.js"></script>


<SCRIPT>
function getCountryList(ref){
      if(ref.value == " "){
            alert("Please select a Time Zone.");
            document.getElementById('showTime').style.display="none";
            return;
      }
      ajaxAnywhere.submitAJAX();
      document.getElementById('showTime').style.display="block";
}
</SCRIPT>
</HEAD>
<BODY onload="alert('This Alert is just to show that the page is loaded only once.');">
<html:form action="SampleServlet.do">
<table>
      <tr>
            <td>Time Zone:</td>
            <td></td>
            <td>
            <html:select property="dropDownValue" onchange="getCountryList(this)">
                  <html:option value=" ">---Select---</html:option>
                  <html:option value="Asia/Calcutta">INDIA</html:option>
                  <html:option value="GMT">UK</html:option>
                  <html:option value="America/New_York">NEW YORK</html:option>
            </html:select>
            </td>
      </tr>
</table>
<div style="display:none" id="showTime">
<aa:zone name="countriesList">
<%=request.getAttribute("TIME_ZONE")%>
</aa:zone>
</div>
</html:form>
</BODY>
</HTML>

Step 3) Create the Action Class with below code:



     
      Date now = new Date();
     
      DateFormat df = new SimpleDateFormat("MM-dd-yyyy HH:mm:ss z");
      df.setTimeZone(TimeZone.getTimeZone(((DropDown)form).getDropDownValue()));
     
      System.out.println(df.format(now));
           

      request.setAttribute("TIME_ZONE", df.format(now));
      if(AAUtils.isAjaxRequest(request)){
            AAUtils.addZonesToRefresh(request, "countriesList"); 
      }    
      return mapping.findForward("SUCCESS");

Step 4) Create Form Bean as below:


      private String dropDownValue;
     
      /**
       * @return
       */
      public String getDropDownValue() {
            return dropDownValue;
      }

      /**
       * @param string
       */
      public void setDropDownValue(String string) {
            dropDownValue = string;
      }

Step 5) struts-config.xml

<struts-config>

<form-beans>
      <form-bean name="DropDown" type="com.wipro.forms.DropDown"/>
</form-beans>

<action-mappings>
<action path="/SampleServlet" type="com.wipro.servlet.SampleServlet" name="DropDown">
 <forward name="SUCCESS" path="/JSP/DependentDropDown.jsp" />
</action>
</action-mappings>

</struts-config>


  

CONCLUSION

  • AjaxAnywhere doesn't require changes to the underlying code, , it's also easier to implement, and doesn't bind your application to AJAX (i.e., browsers that don't support AJAX can still work.)