Tuesday, August 21, 2018

Basic Networking (part-1)

What is Computer Networking?

Network is a collection of independent computers and network devices that they can communicate with each other to share resources like files, printers, CD-ROMS, Backup devices and so on. When Networks at multiple locations are connected using services available from phone companies or Internet, they can share links, conduct video conferences and sending e-mails With remote users.
Every network includes the following
  1. Two or more computers and network devices.
  2. Network interface cards ( NICs) to connect to the network
  3. Medium to connect network devices. Typically connection medium is a wire or a cable or a wireless communication
  4. Supporting network operating systems like windows NT, 2000, xp, Novell Netware, UNIX and Linux…

Types of Networks

LAN (Local Area Network)
LAN is confined to a geographic area, such as a single building or a college campus. lans can be small as linking few computers or can be big as it contains hundreds of computers .
WANs (Wide Area Networks)
Wide area networking combines multiple LANs that are geographically separate. This is accomplished by connecting the different LANs using services such as dedicated leased phone lines, dial-up phone lines (both synchronous and asynchronous), satellite links, and data packet carrier services.
MANs (Metropolitan area Networks)
MAN refers to a network of computers with in a City
Internet
The Internet is a system of linked networks that are worldwide in scope and facilitate data communication services such as remote login, file transfer, electronic mail, the World Wide Web and newsgroups.
Intranet
With the advancements made in browser-based software for the Internet, many private organizations are implementing intranets. An intranet is a private network utilizing Internet-type tools, but available only within that organization. For large organizations, an intranet provides an easy access mode to corporate information for employees.


VPN (Virtual Private Network)
VPN uses a technique known as tunneling to transfer data securely on the Internet to a remote access server on your workplace network. Using a VPN helps you save money by using the public Internet instead of making long–distance phone calls to connect securely with your private network. There are two ways to create a VPN connection, by dialing an Internet service provider (ISP), or connecting directly to Internet.

Categories of Network:

Network can be divided in to two main categories
  • Peer-to-peer
  • Server –based ( client-server)
Peer-to-Peer Network
In peer-to-peer networking there are no dedicated servers for administration. All the systems in this network are equal and work as a client/server. There is no centralized administration. There is no one assigned to be an administrator responsible for entire network. Peer-to-peer network is good for small organizations.
Peer-Peer Network
source: Wikipedia


Server-based Network
In server-based networking there is a centralized administration. In this network data is processing between clients and power full servers
Advantages of server-client network
  • Security
  • Centralized file storage
  • Clients can Share Database and applications by server
Server-Client Network
source: Wikipedia

Basic Networking (part-2) – OSI Model

The OSI Model :

OSI stands for Open System Interconnection .This is a standard model for networking protocols, developed by ISO (Industrial standard Organization) in 1984. OSI is standard for worldwide communications that defines a networking framework for implementing protocols in seven layers . Control is passed from one layer to the next, starting at the application layer in one station, and proceeding to the bottom layer, over the channel to the next station and back up the hierarchy.
Understanding how the OSI Model works is not only useful for taking certification exams, but also for real life scenarios The short form used to memorize the layer names of the OSI Model is “All People Seem To Need Data Processing”. The lower two layers are normally put into practice with hardware and software. The remaining five layers are only implemented with software.
source: wikimedia.org


Layer 1 – Physical
Physical layer defines the cable or physical medium, e.g., electrical impulse, light or radio signals. It is responsible for bit-level transmission between nodes. It provides the sending and receiving of data through physical carrier, including defining cables, cards.
Layer 2 – Data Link
The Data Link layer of the OSI model defines the communication between adjacent nodes. At this layer, data packets are encoded and decoded into bits. The data link layer is divided into two sub layers: The Media Access Control (MAC) layer and the Logical Link Control (LLC) layer. Logical Link Control (LLC), Media Access Control (MAC), Data Framing, Addressing, Error Detection and Handling are the key tasks in Data link layer. Switches, bridges, Network interface boards are the devices normally associated with data link layer.Layer 3 – Network
Network layer describes the methods or paths for moving data among multiple networks called as routing. Network layer routes the data using switching, network layer addressing and routing algorithms .Routers operates the network layer.
Layer 4 – Transport
The transport layer is responsible for transferring data between end users. Transport layer provides reliable transfers to the upper layers by using segmentation/desegmentation, flow control and error control.
Layer 5 – Session
The session layer controls the connection between nodes. It establishes, manages and terminates the connections between the local and remote application.
Layer 6 – Presentation
The presentation layer works to transform data into the form that the application layer can accept. This layer formats and encrypts data to be sent across a network. The Presentation Layer is responsible for defining the syntax which two network hosts use to communicate. Encryption and compression should be Presentation Layer functions, although they are frequently provided on other layers. HTTP, SMTP, and SNMP. Works in presentation layer.
Layer 7 – Application
Provides network services to the end-users. Mail, ftp, telnet, DNS, NIS, NFS are examples of network applications

Basic Networking(part-3) -Topologies

Network topologies

Topology refers to the way the networked computers and resources are connected physically. Five mostly used topologies are BUS, RING, STAR, MESH, and TREE

BUS Topology

In BUS Topology all the devices are connected to a single central cable called as BUS or Backbone. Below diagram is the visual example for BUS topology of a simple network.


source: Wikipedia




All the systems except first and last are connected to a single cable by using T connectors (T shaped, and first and last nodes are connected using Terminators
Advantages:
  • Easy to setup and cheaper
  • Suitable for small networks
Disadvantages
  • Difficult to troubleshoot when network goes down.
  • As cable length is limited, it limits the number of systems connected to the segment.
  • Not suitable for large networks.

Ring Topology

In ring topology all the nodes are connected in ring structure. (Last node is connected fist node)Each node contain repeater, which receives the signal from other node. The repeater processes signal and retransmit to next node until it reaches destination. Here is the diagram of Ring topology
source: Wikipedia



Advantages
  • Easy to setup and maintain
  • Performance is better when compared to star topology
  • Can create larger networks using token rings
Disadvantages
  • Failure of a single node in the network can cause the entire network to down.
  • Add, move or changes to the existing network may effect performance.

Star Topology

In star topology each node is directly connected a central hub or concentrator. Data on star network passes through central device and reaches destination. This configuration is common for twisted pair cables. However this topology can be used with coaxial or fiber optic cable. Here is the diagram of Star topology.
source: Wikipedia


Advantages
  • Easy to install and suitable for large networks,
  • Easy to expand the network
  • Can be used with different types of cables
  • No interruptions to the existing network when adding or removing a node
  • Easy to find and troubleshoot problems
Disadvantages
  • Requires more cable
  • If the central Hub fails, the nodes attached are disabled

Tree Topology

Tree topology is a combination of both star and bus topologies. It consists of a group of nodes configured as a star-topology, connected to backbone cable of bus topology. Tree topology extends the existing network. . Here is the diagram of tree topology

Advantages
  • Central Hub increases the distance of a single segment in bus topology
  • Peer-peer wiring for individual systems
  • Supported by several software and hardware vendors
Disadvantages
  • Distance of a single cable used in a segment is limited
  • If the backbone cable breaks, the entire segment goes down
  • Difficult to configure when compared to other topologies

Mesh topology

In mesh topology network every node is physically connected to every other node which provides greater performance and reliability. If one node fails the network finds an alternate route to reach its destination. Here is the diagram of Mesh topology.

source: Wikipedia


Advantages
  • Reliable than other topologies
  • No traffic problems
  • No network break downs
Disadvantages
  • Huge amount of cable is required.
  • Installation is difficult.

Registry Tweaks For XP

Most of the settings in xp can change easily. But sometimes we need to modify registry to change some settings. Here I am giving some registry tweaks for xp .
To open registry editor go to start–>RUN –>type regedit and press enter
Hide an User account from logon screen
This tweak allows an account that is normally displayed on the Welcome screen to be hidden from view. To log on using the hidden account it’s necessary to use the Log On dialog box similar to the one in Windows 2000 .
Note : If you have welcome screen , Press alt+ctrl+del two times to get logon dialog box.
Go to
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\WindowsNT\
CurrentVersion\Winlogon\SpecialAccounts\UserList
Create a DWORD value with the name of user account to be hiddden ,and give the data value either 0 ( to hide the account) or 1 ( to dispaly the account)
Disable/Enable Task Manager
Go to HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System
Create/Modify DWORD value DisableTaskMgr and give the data value either 0 ( enable-default ) or 1 ( disable )
Speed Up start menu display
Go to HKEY_CURRENT_USER\ControlPanel\Desktop Create/Modify String Value MenuShowDelay
and adjust the data value to preference ( default =400 , make it less than 400)
Speed up shutdown process
If your system is shutting down slowly, follow the steps given below
Go to HKEY_CURRENT_USER\Control Panel\Desktop Change the following string values
PowerOffActive = 1
AutoEndTasks=1
HungAppTimeout=4000
WaitToKillAppTimeout=4000
WaitToKillServiceTimeout=4000
Close regedit and restart the system .
Fix for shutting down automatically
Go to HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Winlogon
Change the value of PowerdownAfterShutdown to 1
Defrag system files at every boot
To increase system performance, we can enable defragmentation of system files at every boot by using the following registry tweak
Go to HKEY_LOCAL_MACHINE\Software\Microsoft\Dfrg\BootOptimizeFunction and change the value of Enable to Y
Disable the Security Center warnings
Go to HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Security Center and change the DWORD values for the following keys
AntiVirusDisableNotify =1
FirewallDisableNotify =1
Make NTFS file system faster
If you are using NTFS file system, you can improve the performance by changing the following entry in registry
(Note : check the properties of C: drive to find the type of file system)
Go to KEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Filesystem
change the following registry values, as you wish:
DisableNTFSLastAccessUpdate = 1 (last file access is no longer registered).
NtfsDisable8dot3NameCreation = 1
NtfsMftZoneReservation = 2
(with this tweak there will be no more fragmenting of the MFT( master file table) default value = 1, range 1-4)
Identify the reason for windows crash
If you would like to know the reason why there was a sudden crash of Windows,
Go to HKEY_LOCAL_MACHINE\SOFTWARE\ Microsoft\Windows\CurrentVersion\Reliability
change the DWORD-value for ShutdownReasonUI temporarily to 1 and restart the PC .After a reboot you will find the reason why your Windows shuts down suddenly in the logs.
Note : To open logs go to start–>RUN–> type eventvwr.msc and press enter . Change the value ShutdownReasonUI back to 0 after analyzing.
Low disk space warning
Probably you have seen the irritating ‘low disk space’-warning if your hard disk reaches full capacity. This warning message can be turned off by adding the DWORD-value.
Go to HKEY_CURRENT_USER\Software\MicroSoft\ Windows\CurrentVersion\Policies\Explorer Create a DWORD NoLowDiskSpaceChecks with value 1

Monday, June 6, 2011

Executing a Java Program without main() method.

Did you get any doubt why main() is a must to run any java program ?? Can we run without main() method in java ?? , the answer is yes. WE CAN run the JAVA program without MAIN() method.
  1. Create a Class with any class name.
  2. Write a Static block and write the statements to execute.
  3. At the end of the static block give System.exit(0), to avoid the exception in thread main() no main() method found.
  4. Now save the file with the [class_name].java.
  5. Finally compile and run.
EXAMPLE :
The Demonstration of above steps is show bellow
  1. class nomain //step1
  2. {
  3. static//step 2
  4. {
  5. System.out.println("This is in Static method");//step3
  6. System.exit(0);//step 4
  7. }
  8. /* public static void main(String []args)
  9. {
  10. System.out.println("This won't execute");
  11. }*/
  12. }



running and compiling
javac nomain.java
java nomain.java
output :
This is in Static method