Tuesday, March 25, 2008

OSI 7 layer use in the physical world.

Person A wants to buy an item from Amazon using his credit card over the internet. How does the OSI 7 layer help him achieve this?
1. [Application layer] -> He uses a browser to open up Amazon's website. This browser is the application layer. Provides an interface to the user to start interacting with the data.
2. [Presentation] -> The data he will be sending needs to encrypted as it is his cc number. This layer will add encryption to the data packets and wrap it up with an header.
3. [Session] -> During the buying process a constant session needs to be maintained so that the system does forget the users request. Without this layer the system might just close the connection due to load balancing. But with a session in place all interference is avoided with this transaction.
4. [Transport] -> This layer makes sure that the data is reliably transferred without being dropped. If there is no acknowledgment from the receiver than the packet is resent.
5. [Network] -> This is the layer where all the routers work. The look into the header of the packet and decide where to send the packet to. Since layer 4 is on top of layer 3, we normally call it TCP/IP. TCP over IP.
6. [Data] -> This is the layer which decides how to share the physical devices like NIC.
7. [Physical] -> The actual physical layer which receives the data and understand the zeros and ones.


Powered by ScribeFire.

Monday, March 10, 2008

OSI 7 layer use in the physical world.

Person A wants to buy an item from Amazon using his credit card over the internet. How does the OSI 7 layer help him achieve this?
1. [Application layer] -> He uses a browser to open up Amazon's website. This browser is the application layer. Provides an interface to the user to start interacting with the data.
2. [Presentation] -> The data he will be sending needs to encrypted as it is his cc number. This layer will add encryption to the data packets and wrap it up with an header.
3. [Session] -> During the buying process a constant session needs to be maintained so that the system does forget the users request. Without this layer the system might just close the connection due to load balancing. But with a session in place all interference is avoided with this transaction.
4. [Transport] -> This layer makes sure that the data is reliably transferred without being dropped. If there is no acknowledgment from the receiver than the packet is resent.
5. [Network] -> This is the layer where all the routers work. The look into the header of the packet and decide where to send the packet to. Since layer 4 is on top of layer 3, we normally call it TCP/IP. TCP over IP.
6. [Data] -> This is the layer which decides how to share the physical devices like NIC.
7. [Physical] -> The actual physical layer which receives the data and understand the zeros and ones.


Powered by ScribeFire.

Thursday, January 31, 2008

What is web 2.0 and what problem did it solve?

Web 1.0 is write by one and read by many kind of web sites. The content is managed by one person. www.yahoo.com

Web 2.0 websites create content from its users. Just like wikipedia and flickr.

Web 2.0 gives every user the power to publish his writings on the web. The content is very machine friendly and so the websites can be created without any human interaction.

Web 2.0 wants the users to have rich and fast UI experience just like he is using a desktop application. For this it uses AJAX technology. Example google maps.

There are basically 4 level of applications:
Level 3.0: Application only has online prescence; like craigs list, wikipedia.
Level 2.0: Application has offline prescence but grows online; flickr.
Level 1.0: Application operates offline but gains features online; google docs
Level 0.0: Application lives both online and offline; yahoo maps, google maps.
Non web applications: Email clients, Telephone.


Powered by ScribeFire.

Wednesday, October 31, 2007

PDF vs XPS

pdf->Universally accepted format
xps->Only recently printer manufacturers have been adding it.
pdf->Can be opened using acrobat reader on any os.
xps->xps viewer only works on windows xp, server 2003 and vista

Monday, October 22, 2007

What is SOA and how does it work?

Previously applications were considered as an isolated entity. They reside on on machine and do not have much ability to communicate with other applications. This lead to the following problems.
1. There was no reuse of the same functionality present in different applications.
2. The applications once deployed have very less chance of changing or updating there functionality.
3. If solid small applications are created with robust testing and they group together to create a composite application, then the chances of them being buggy is minimized.

The idea behind the SOA architecture is that there will be lot of small modular applications which can be called by a composite application on a service basis. This composite applications decides on the services it needs and then groups together all this small applications and gets its job done by delegating tasks to each of these applications. As an example:
A train carrying tourist is traveling between two cities through a scenic terrain and depending on the weather it has the option to decide on multiple pathways. The train can achieve this dynamic calculations of the path by having a software on board the trains computers which determine the weather outside and then do the calculation or it can just call a service running somewhere on the internet and this tells what path it should take.

The problem with the application in the onboard computers is that if there is a change in the pathway, like addition of a new path or closing of a old path, the software needs to be updated on every train that runs in this route, whereas if the train is just using a service then you just update the service once and all the trains will get the correct and up to date information.

Another advantage is that this weather service can also be shared by other people including sports team who are trying to schedule a outdoor event. They could just reuse the weather module of the service instead of writing a new application for that.

SOA solves thses problems.


Powered by ScribeFire.

Friday, October 12, 2007

Why we need libraries in C and how do you create them?

Link to the article:

http://users.actcom.co.il/~choo/lupg/tutorials/libraries/unix-c-libraries.html

1. The c language is a very basic construct with just the language syntax.
2. All the other functionalities are accessed through the libraries.
3. Advantage of the dynamic library is that multiple programs can access the same library at one time and this will save a lot of memory.
4. You do not need to compile each program separately if you change one library.
5. Static library if just the grouping together of the all the object files. Like libstdc++.a is the grouping of math.o string.o stdlib.o ect
6. The static library is created using the "ar" command which just groups the .o files together.
Like ar rc libutil.a util_file.o util_net.o util_math.o
7. Share lib can be Position independent code or can be Library file creation which is platform dependent.


Powered by ScribeFire.

Macromedia Flash?

This is a technology to display audio and video on the websites. The browser needs to download a client program and this reads the .swf files and displays the video. Vector graphics is used in the actionscript language that is used to code a flash program.


Powered by ScribeFire.

Thursday, October 11, 2007

Component Object Model problems

1. Dll hell is the problem when a old dll is installed over a new on then it overwrites part of the new Dll in the registry and the applications using this DLL stop working correctly.
2. Reference counts and Release reference are particulary difficult to manage in com. Addref and releaseif not implemented correctly can lead to premature release or never release of the COM object
3. COM is mostly windows standard and building bridges from it to other platform is difficult
4. COM interface such IUnknown and IDispatch have a huge learning curve.

.Net architecture

1. What technology does this replace?
It replaces the Win32 model and attempts to replace the Java technology. Java programs follow the "build once in Java and run on multiple platform" pattern. Net is build in any .net language and run in any platform.
2. Do we need any special software installation to run a .net program?
Just like the Java (JVM) we need to install the CLR to run a .NET program.
3. Is it really true that with .net architecture we can run software on any platform, anytime, anywhere and on small and large devices?
Yes, Developers can create a programin windows and run it in Linux or Mac provided they offer a CLR environment.
4. What are the .net languages?
C++, C#, vb.net, asp.net
5. What does it mean when we say .Net is web enabled?
6. How can a CLR environment be installed in the Mac OS?

Thursday, September 27, 2007

PDL vs PCL vs PJL

PDL is page description language. Describes how a page is going to look for a printer. PCL is a PDL. And so is KPDL and PCL5e and PCL5c. PCL stands for Printer Command Language and not Printer Control Language. PJL is Print job language. This manages the job level control management such as separation between jobs and status reedback.


Powered by ScribeFire.

What is Javascript and how it is different from Java Server pages (JSP)

Javascript is a scripting language and it is not code in Java. It is primarily used to write functions that are embedded in HTML. It is primarily used to do the following things
1. On the client side it can validate forms before submitting it to the server.
2. Opening up a new window with programmatically controlling the size.

JavaServerPages on the other hand are HTML+ Java code. The are written instead of servlets to dynamically render HTML pages. Instead of writing many println command to write html, we insert tags for java code in the html code. This creates a Java Server page.


Powered by ScribeFire.

Tuesday, August 07, 2007

SNMP Analogy

What is SNMP, why was it created and how do I relate it to the physical world?

Simple Network Management protocol. A network of devices connected can communicate with each other. Each device has an attribute, like the name, its capabilities, its location, address book of the users in the machine ect. Inorder to manage this settings or to change them we need a protocol. SNMP was invented to do this. It has only 5 method to do all the operations( Get, Get-Next, Get-Response, Set, trap) and so the name simple. SNMP stores all the data in a MIB structure(Management Information Base). Each data is stored in a tree like structure and is assigned a number. You can reach any item by following the numbers. Like the root is . and then an address would look like .1.3.2.1.1.6.1347
SNMP has 4 layers.
The bottom layer is the 10 base T which is like the roads in a city.
The next layer is the IP layer which like the address of the houses in the city connected by the roads.
The next layer is UDP which is like a car carrying some passengers(messages) in it.
The top layer is the application (SNMPWALK) which is like the human who initiate the service.

Tuesday, July 31, 2007

How does the CUPS filter work?

Printing in the Unix world is heavily dependent on filters. These are the work horses of the unix printing. Filters are nothing but a program which one data type as input and converts them into another format. Different applications can generate data in different formats. Like a plain text file, Postscript file or an image file. Printers can also support different data types. A postscript printer will not need any filter if the application is generating postscript data. This is how the  print flow looks
Application-> CUPS->Application->CUPS->Filter->CUPS->printer.

1. User clicks on the print button of the application.
2. Application calls CUPS to show the list of printers installed in the system.
3. User selects a printer.
4. Cups reads the PPD file associated with the printer and displays the print options available for that model. If no PPD is available then a default list of options are shown.
5. When user finishes making all the choices, CUPS parses PPD and gets the appropriate postscript commands for the options. Like for duplex command the PPD contains a specific postscript command.
6. If a filter is mentioned in the PPD, cups will try to convert the output data type of the application to the input data type of the filter.
7.How does cups determine the output data type of the application. For this it uses a mime.types file. This file has 2 columns. The 1st column describes the data type/sub type. Like image/jpeg. The 2nd column tells the extension of the file and the hexadecimal code found in the beginning of the file. Like application/x-dvi dvi string(0,<F702>) F7 and 02 shows it is a dvi file.
8. Now it looks into a mime.convs file. This file has 4 entries. Source data type,  output datatype, cost, name of filter.
application/x-dvi application/postscript 50 dvitops
9. The cost determines which path to take to reach the output type if multiple ways are available.
10. The filter takes its input from the argv parameter in the main function.
11. The filter mostly takes it input from the  stdin, but can also take from the a filepath stored in the argv[6] location.


Powered by ScribeFire.

Tuesday, July 24, 2007

What is JSP?

Java Server Pages. (This is a technique to separate static HTML form dynamic by adding tags in the html document).
Is it written in JavaScript? -> No it is HTML + Java
How does a Servlet look -> A Servlet is pure Java code.
How to call a function included in a JAR package in JSP? -> Include the Jar package in the webapps/lib/ folder. And then import the package name, which is there in the top line of the Java source file in the JSP file. You can now use the function in the Java classes.

Monday, July 23, 2007

What is WSDL and why do we need it?

If WSDL is the web description language of a method, then why do not we define it the function in english. What is the advantage of having a structured form for the WSDL?
Sol-> The reason WSDL is not in english and is in XML is so that other programs can read this XML and generate function prototypes for developers. For example, microsoft provides WSDPrint.wsdl file which defines the functions for sending a print job to a webservice enabled printer. Programs like gSoap can read this WSDL and then create function stubs like CreatePrintJobRequest() and SendPrintJobRequest() with all the necessary parameters. The developer then just needs to implement the reuired portions inside the function and complete the implementation. A Java developer can also use this WSDL to create Java function stubs and so this gives a lot of freedom for the language of implementation.


Powered by ScribeFire.

What is the Tomcat server and why do we need it?

A Tomcat server is a container for Java written code. This code can be called servlets or JSP (Java server pages). What the server does is takes this Java code, compiles it into .class files and then displays this to the end user.
What is a Servlet?
A servlet is a piece of Java code which generates a HTML page. This code resides on the server side and depending on the options selected by the user, different parameters are sent to the servlet. The servlet basically has lot of print statements to generate the HTML code dynamically.
JSP is just a easier way to do the same thing what the servlet does. JSP has tags which can be used to embed the Java code inside HTML. The Tomcat server compiles the Java code and makes HTML out of it dynamically. This saves the developer to write lot of print statements to generate the HTML like head, body, title etc.

Friday, April 27, 2007

What is raster printing?

Raster print data is the uncompressed print data in 1 and 0. This data can be compressed to form jpeg image or can be re-aranged with some header info making a bitmap or tiff image. All these image formats have a header which contains information about the image, like the size of the image, the color planes used ect... The actual image data follows this image and this is the raster data. The header stores a pointer to the raster data.
When we send data to the printer, we convert this raster image given to us by the application to a printer understood language like PCL, PS, XPS, or PDF. There are different filters which can take this raster image and convert it to a particular format. Like the cups filters, rastertops, rastertotiff.

Thursday, February 15, 2007

What is a postscript printer?

Postscript file describes the print job. PDF is a mathematical + portable way to represent a document on paper. If all the printers have a postscript interpreter than there will not be any need of multiple drivers. What we need is just a postscript interpreter in the printer(Postscript printer) and a way to generate PS files from the application. A postscript file includes information about the print job, like number of copies, orientation, who sent the job ect. All applications in the Unix world and Mac generate PS files and PDF files. So all we need to print this files on a PS printer is just send it to them. No comes the next issue which is how to customize the job. For general options like duplex and number of copies we can just send the postscript commands. But different manufacturers might support different set of options in there printer and the corresponding ps command may not be supported by other manufacturers. To solve this issue the PPD file was created. PDF is nothing but processed Postscript.This just a printer description file and list down all the capabilities of the printers and its corresponding ps options. So if a user wants to do stapling-booklet mode, the printing system just looks into the PPD and sends the appropriate PS command with the ps file to the printer.
Unlike the PS file(which is a printable file) the pdf does not store any print job information in it. It just has the document info. So the user has to select all these options like page size, orientation ect before he sends it the printer. Now comes XPS file format introduced by microsoft. XPS file format is based on XML and includes a print ticket with it. There is a default print ticket and a custom print ticket attached on the outside of the document. Now the user can be given a XPS document and when he prints this it will exactly look the way the creator of the document wanted it look like.

lpd printing system

lpd is line printing daemon. unix 1st printing system. Initial printing involved just dumping the text file to the printer connected via the parallel port. lpr is the program which submitted the job to the spooling daemon. But lpr did not support any of the options supported by the device except for usual options such as duplex and number of copies. Why do we need a spooling daemon? So that the printing interface can be separated from the the application world. Instead of each application supporting its printing, now they can communicate with a centralized printing system which takes of all the printing in the system. The application just need to handover the print job to this system and go back to doing what they were doing. The spooler will keep the print jobs together from all the applications and send them as an when the printer is available. This is the common concept of printing in all the OS's.

Tuesday, January 02, 2007

HTTP Analogy

Imagine a small city with well developed roads and all houses connected to it. There is a very good bus service to take people around the city.
The internet broadband cables are the roads in the city. Each house is a computer and the address of the house is the IP address. The house can recieve and send mail. To establish a mail exchange they follow a rule in a particular sequence. House A looks for a House B and asks him if he would like to chat. If House B accepts then the enter into a exclusive one to one seesion and continue there mail exchange. This is TCP/IP.
Sometimes House A just wants to drop a message to House B and does not want to get into a converstaion. In this case he just writes down the address of House B and sends the package. House B decides to keep or discard it. This is UDP.
Now there is another House called 'WEB'. It stores lot of information about the world. House A wants to get some information from there and read it as he is reading a book. So House A opens up his browser(like internet explorer) and types in the address of House WEB. The browser which is like a page of your book now uses another set of rules to communicate with House WEB. This is called HTTP. HTTP rides over TCP/IP. HTTP uses lot of single sessions to communicate and once the answer to your query is got the conncetion is dropped. Every time you click on a link you send a HTTP request query to the House WEB. It is like a bus leaves your house everytime you click on a link. The passengers in the bus have this message for ex "Take me to ABCD restaurant". House WEB sees this message and fills in the address of ABCD restaurant in the BUS and sends it back to House A. Now the bus service has terminated and this was a single session. The format of the message returned from House WEB can be of different types. So they use a format called MIME(Multiple internet mail exchange). So for example if the address to the restaurant returned by the House WEB is a picture format, then this format is registered and sent to House A so that he know to open up a picture viewer to see the data.
House WEB can be providing lot of services, web server(HTTP request) may be one of them. So to keep each service separate it has a separate door for each of them. These doors are called ports and each a fixed number. For HTTP we have port number 80 as the default door number.

Thursday, December 28, 2006

PrintTicket Vs devmode

This is how the sequence flows.
Printer tells about its printer capabilities through the API device capability=>>
Apps read this info and provide the UI to the user to make some selection such as Page Size and orientation=>>
App fills the devmode structure with this info and send it to the printer with the printjob=>>
Printer reads this info and delivers the print job.
The devmode also has a private part which stores info about the printer model.
Everything is great with this design but there is a problem. Which is that the devmode cannot be attached to the print job.
In case of a printticket, the job settings are in XML format stored in a document. This xml specification is attached to the XPS job. The end user will be able to print the document exactly the way the developer of the document wanted it to be printed out. Like if I have a word document, I want it to be printed with 2 NUP duplex option, this info can be embedded with the document if you print it to a xps doc with the printticket in the xml format.

Tuesday, May 30, 2006

How does the Foomatic printing system work?

It consists of 3 parts.
1. Foomatic-db which stores the information about all the printers in XML format. The reason being that the DB size is small now as the ppd can be generated on the fly. The printer-driver-option combo is only stored in XML format and PPD file generated dynamically. Each option is stored separately in a XML file.
2. Foomatic-db engine which creates the PPD file from the XML db
3. The foomatic filter which is included in the cups-filter line of the ppd. This converts the Postscript to the printer language.

Why we need ICM profile and how they work?

Each color is defined by the there RGB component. But depending on the device calibration even if you provide the same color component, like R = 255, G = 128, B = 172, different devices will come up with a slight different color. To map the exact color, we have a color table. ICM profile is one such table. We have a standardised color table. Depending on the variation of the color from the device we add an offset its colors. If you want to print an image to paper we follow this path.
ICM profile of the monitor is added to the screen color. Then the printer driver adds the color profile to the print data to take care of the printers color offset and then it is printed. 2 color profiles need to be used for any mapping in the printer world. 

Thursday, March 09, 2006

Langauge monitor and port monitor

Why do we need both and what purpose do each solve?

Friday, September 09, 2005

TCP/IP snmp

TCP/IP what it is and why it is needed?
1. We need a way to communicate between our pcs or otherwise called hosts.
2. The communication needs to be reliable and secured.
How it is achieved.
We have something called OSI or 7 layer interface. Why 7 layers?
For simplicity it has been broken down as follows.
7. Physical layer-> This is where the network card of the pc handles the data to be communicated.
6. Network layer(IP)-> The data is communicated from the network card into stream packets to the transport layer.
5. Transport layer(TCP)->Communicates the stream with the application. TCP can handle a stream from the application whereas UDP can only handle chunks of data called the messages.
4,3,2,1: Application layer-> Application generates the data, creates sockets and put information into envelopes. TCP adds its own envelope(header) and ip adds its own envelope. These envelopes are added to deliver the data sequentially n the correct order.

What is SNMP?
Simple netwrok Management Protocol. This a application layer included with the TCP/IP suite. it operates in 3 layers
1.NMS or your computer which you use to manage the network devices.
2. Managed devices which contains an snmp agent which collect all the information. It is also called the MIB.
3. Agent translates the information into snmp compatible type.