What is Pointer?

What is Pointer?

In computer science, a pointer is a programming language object, whose value refers to (or “points to”) another value stored elsewhere in the computer memory using its address. A pointer references a location in memory, and obtaining the value stored at that location is known as dereferencing the pointer.

As an analogy, a page number in a book’s index could be considered a pointer to the corresponding page; dereferencing such a pointer would be done by flipping to the page with the given page number.

The term “Pointer” can also be defined as

  1. A variable does not store a value but store the address of the memory space which contains the value.
  2. A variable that contains the address of a location in memory. The location is the starting point of an allocated object, such as an object or value type, or the element of an array.
  3. A value that designates the address (i.e., the location in memory), of some value.
  4. Variables that hold a memory location.
  5. A memory address.

In general, Pointer is a long thin piece of metal on a scale or dial that moves to indicate a figure or position.

Interview Question : What is Hard Disk?

what-is-hard-disk-drive-hdd

A hard disk is part of a unit, often called a “disk drive,” “hard drive,” or “hard disk drive (HDD),” that stores and provides relatively quick access to large amounts of data on an electromagnetically charged surface or set of surfaces. Today’s computers typically come with a hard disk that contains several billion bytes (gigabytes) of storage.

A Hard disk can also be defined as:

  1. a rigid (“hard”) non-removable magnetic disk with a large data storage capacity.
  2. a data storage device used for storing and retrieving digital information using one or more rigid (“hard”) rapidly rotating disks (platters) coated with magnetic material.
  3. A magnetic disk on which you can store computer data. The term hard is used to distinguish it from a soft, or floppy disk. Hard disks hold more data and are faster than floppy disks.

Extra Information

A hard disk is really a set of stacked “disks,” each of which, like phonograph records, has data recorded electromagnetically in concentric circles or “tracks” on the disk. A “head” (something like a phonograph arm but in a relatively fixed position) records (writes) or reads the information on the tracks. Two heads, one on each side of a disk, read or write the data as the disk spins. Each read or write operation requires that data be located, which is an operation called a “seek.” (Data already in a disk cache, however, will be located more quickly.)

A hard disk/drive unit comes with a set rotation speed varying from 4500 to 7200 rpm. Disk access time is measured in milliseconds. Although the physical location can be identified with cylinder, track, and sector locations, these are actually mapped to a logical block address (LBA) that works with the larger address range on today’s hard disks.

To know more regarding the terms follow the post about Difference between Disc and Disk click here.

 

Android flat button (xml) Tutorial

What is flat design?

Flat design is a minimalistic design approach that emphasizes usability. It features clean, open space, crisp edges, bright colors and two-dimensional/flat illustrations.

Benefits of flat design

Bright, contrasting colors make illustrations and buttons pop from backgrounds, easily grab attention, and guide the user’s eye. The purpose of minimalistic imagery also contributes to flat design’s functional character.

Tutorial

First we need to choose two colors: for normal state and pressed state. Usually that’s the same colors with different type of depth. Pressed state color will also be used as for bottom line of flat button normal state.

Create colors.xml file inside values folder and define two colors there:

<resources>
    <color name="blue_pressed">@android:color/holo_blue_dark</color>
    <color name="blue_normal">@android:color/holo_blue_light</color>
</resources>

We used two standard android holo colors:

<!-- A dark Holo shade of blue -->
<color name="holo_blue_dark">#ff0099cc</color>
<!-- A light Holo shade of blue -->
<color name="holo_blue_light">#ff33b5e5</color>

 

Now we need to create dimen.xml file inside values folder and define two parameters:

<resources>
    <dimen name="corner_radius">4dp</dimen>
    <dimen name="layer_padding">3dp<<dimen>
</resources>

Corner radius indicate how rounded the corners of our button will be. See image below.say-hello-android-flat-button-1

 

Layer radius indicate distance between bottom and top layer of our button. See image below.say-hello-android-flat-button-2

 

Next step is to define shapes for button background. Create rect_pressed.xml file inside drawable folder. This will be our pressed state background and bottom layer for normal state.

<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="rectangle">
  <corners android:radius="@dimen/corner_radius" />
  <solid android:color="@color/blue_pressed" />
</shape>>

 

say-hello-android-flat-button-drawableFor normal state create rect_normal.xml file inside drawable folder. This drawable combines two layers, for bottom layer we used rect_pressed drawable and for top layer we defined new shape with little padding on the bottom (to make bottom layer visible) and new blue color.

<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
  <item android:drawable="@drawable/rect_pressed" />
 
  <item android:bottom="@dimen/layer_padding">
      <shape android:shape="rectangle">
          <corners android:radius="@dimen/corner_radius" />
          <solid android:color="@color/blue_normal" />
      </shape>
  </item>
</layer-list>

say-hello-android-flat-button-drawable-1

Last thing to do is to define selector for our button. Create flat_selector.xml file inside drawablefolder.

<selector xmlns:android="http://schemas.android.com/apk/res/android">
  <item android:state_pressed="true" android:drawable="@drawable/rect_pressed"/>
  <item android:drawable="@drawable/rect_normal"/>
</selector>

That’s all, now simply define your button and set background to flat_selector.

<Button
      android:layout_width="fill_parent"
      android:layout_height="wrap_content"
      android:background="@drawable/flat_selector"
      android:textColor="@android:color/white"
      android:text="Say Hello" />

Hope you enjoy this little article.

What is the Difference Between a Disc and a Disk?

In computers, disks are used for the storage of data.
In computers, disks are used for the storage of data.

Origin of Disc and Disk

For the most part, the words “disc” and “disk” can be used interchangeably to describe flat, rounded objects. The British tend to prefer “disc,” and Americans generally use “disk” as their default spelling. In some cases, the spelling with a “k” at the end is based on Germanic origins, and the spelling with a “c” at the end is based on Greek or Latin origins. The use of “disc” or “disk,” however, is often simply a matter of preference within a particular field of use. No matter the field or the typical spelling for a particular object, it is not unusual to see the other spelling used, even by respected sources.

The word “disk” entered the popular vernacular first, sometime during the 17th century. By the 18th century, however, there was a movement toward incorporating Latin roots whenever possible. The Latin word discus led to the use of “disc” to refer to thin, circular objects.

In Real World

Discs or disks appear in fields such as computers, media, science, anatomy and automotive mechanics. Some of these fields primarily use one spelling, and others use both, depending on the specific object. In many fields, the spellings can be used interchangeably.

Compact discs can store data.
Compact discs can store data.

In computers and media, “discs” or “disks” typically refer to storage devices for data, music and videos. Phonographic records were also known as discs, and people who played records on radio stations were called disc jockeys. When optical storage devices were introduced, this spelling carried over into compact discs (CDs) and digital versatile discs (DVDs). Magnetic storage devices often use the spelling with a “k” as seen in floppy disks and computer hard disks.

Anatomical objects typically use the “disc” spelling. For example, a healthcare professional might refer to a “herniated disc” when a patient has a certain injury to the fibrocartilage between vertebrae in the spine. Other discs in the human body include optic discs in the eyes and placental discs in females.

"Disc" is commonly used in the context of the spine and spinal injuries like disc herniation.
“Disc” is commonly used in the context of the spine and spinal injuries like disc herniation.

In automotive mechanics, a disc brake is a device that uses friction against a circular metal plate to slow or stop the vehicle’s wheel.

In astronomy, the shape of a galaxy might be described as a disc. A ring of debris orbiting an object such as a star, on the other hand, typically is referred to as a debris disk.

 

 

 

 

Source / Courtesy : WiseGeek

What is 4G Mobile Technology?

Fourth Generation (4G) mobile technology is a set of standards for providing broadband Internet access to devices like cellphones and tablets. Though it first became available in the US in 2009, no specific technologies were officially designated as 4G until 2011. Despite this, many devices were labeled as “4G” even though they did not meet the International Telecommunication Union’s (ITU) standards for the technology. The main difference between it and previous standards is a big increase in data transfer speeds and the types of media people can access with it.

Features

There are also a number of technical specifications, including things like the wireless standard, radio interface, and frequency spectrum used. As of 2011, there were only two technologies officially designated as 4G mobile: LTE-Advanced and WiMax Release 2. Though devices using these technologies can theoretically reach the data speeds and functionality requirements set out by the ITU, the actual function varies according to the network coverage, infrastructure, and location.

 

Other Versions

Former versions of LTE and WiMax, and another technology called HSPA+, are also commonly referred to as 4G; despite the name, none actually meet the standards set out in IMT-A. The technologies were marketed so often as “4G” that the ITU allowed them to claim the designation. Most major carriers in the US work with at least one of these standards, with some supporting both. Generally speaking, LTE services are faster than WiMax, but WiMax can often support a farther-ranging signal than LTE, meaning that a user could conceivably use the mobile device farther away from a hotspot. Additionally, LTE is primarily used for cellphones and similar mobile devices, while WiMax is sometimes used to provide at-home Internet connections.

As Compared to 3G

The main difference between 4G mobile technology and the previous standard, 3G technology, in terms of end usage is the data transfer speeds provided. This means that users can access much more sophisticated data that requires a lot of bandwidth very quickly. Depending on the service provider, however, 4G mobile devices may be limited to specific zones for making phone calls that are generally smaller than the areas covered by 3G. This means that people trying to make a call would have their call dropped if they went outside the covered area. Some 4G phones also have much shorter battery life than most 3G phones.

 

Source / Courtesy : WiseGeek

Interview Question : What is Thread?

Quad Core processor and Threads Winged Post

A thread is a single sequential flow of control within a program. the threads of a computer program allows the program to execute sequential actions or many actions at once. Each thread in a program identifies a process that runs when the program asks it to.

The term “Thread” can also be defined as

  1. a smallest unit of processing that can be scheduled by an Operating System.
  2. a portion of code that may be executed independently of the main program.
  3. an ordered sequence of instructions that tells the computer what to do
  4. In online discussion, a thread can refer to a series of related messages.
  5. In e-mail, a thread can refer to a series of replies back and forth pertaining a certain message.

Extended Information:

All programmers are familiar with writing sequential programs. You’ve probably written a program that displays “Hello World!” or sorts a list of names or computes a list of prime numbers. These are sequential programs. That is, each has a beginning, an execution sequence, and an end. At any given time during the runtime of the program, there is a single point of execution.

A thread is similar to the sequential programs described above. A single thread also has a beginning, a sequence, and an end. At any given time during the runtime of the thread, there is a single point of execution. However, a thread itself is not a program; a thread cannot run on its own. Rather, it runs within a program.

Some texts call a thread, a lightweight process. A thread is similar to a real process in that both have a single sequential flow of control. However, a thread is considered lightweight because it runs within the context of a full-blown program and takes advantage of the resources allocated for that program and the program’s environment.

Multiple threads can exists within the same process and share resources such as memory, while different processes do not share these resources.

 

Source / Courtesy : WiseGeek

Interview Question : What is Object Oriented Programming?

Object Oriented Programming Languages - Winged Post

Object Oriented Programming (OOP) is a type of programming in which programmers define not only the data type of a data structure, but also the types of operations (functions) that can be applied to the data structure. In this way, the data structure becomes an object that includes both data and functions. In addition, programmers can create relationships between one object and another. For example, objects can inherit characteristics from other objects.

The Object Oriented Programming can also be defined as:

1. A style of programming that focuses on using objects to design and build applications.

2. Object oriented programming (OOP) is a model of programming language that focuses on the use of objects instead of actions in order to carry out tasks. This involves taking an approach that is more mindful of data and less concerned with logic, which is more commonly the case in other programming paradigms.

3. Object-oriented programming (OOP) is a programming paradigm based on the concept of “objects”, which are data structures that contain data, in the form of fields, often known as attributes; and code, in the form of procedures, often known as methods.

 

For your information, the following are some additional concepts associated with the Object Oriented Programming:

  1. Encapsulation means that a group of related properties, methods, and other members are treated as a single unit or object.
  2. Inheritance describes the ability to create new classes based on an existing class.
  3. Polymorphism means that you can have multiple classes that can be used interchangeably, even though each class implements the same properties or methods in different ways.

 

What Is Electrical Conductivity?

Power lines are made of conducting materials.
Power lines are made of conducting materials.

Electrical conductivity (EC) is a property that is used to describe how well materials allow electrons to flow. It is determined using experiments and math equations. Conductivity is the reciprocal of resistivity, meaning the higher the conductivity, the lower the resistivity. A conductor is a material that has a high electrical conductivity, and an insulator is a material that has a high electrical resistivity. Both properties depend on the temperature and purity of materials.

Temperature dependence of electrical conductivity follows a general pattern. Metal is a conductor, and it has lower conductivity at higher temperatures. Glass is an insulator and shows higher conductivity at higher temperatures.

At very high temperatures, conductors behave like insulators, and insulators behave like conductors. This behavior of insulators and conductors is explained by the free electron model. In this model, conductors clearly show the ability to free electrons, and when a current, or electric force, is applied, the force can easily push around the extra electrons.

Soil is a mixture of minerals, salts and organic materials. It has a special electrical conductivity called soil electrical conductivity, which measures the amount of salt that is in a soil sample, which is called its salinity. The process can also measure other soil properties where salinity is low enough. These properties are related to the influence that purity has on EC data.

EC data of a soil sample can determine how much impurity is in the soil. Soil impurities are water, air and minerals. Each impurity influences the data differently, but a practiced soil scientist can determine this information from the gathered data. In general, more impurities lower the EC, with the exception of minerals that increase EC. Impurities also can explain the use of pure copper in electrical wiring.

Metals are often made of alloys, a mixture of two or more elements. This is not useful for conducting electricity. The metals in alloys are not the same elements and electrons cannot flow easily between different elements. Pure metals, such as copper wire, have high electricalconductivity. This applies only to solid metals because air pockets can lower the electricalconductivity of materials.

Materials that are not metals usually make good insulators. The best insulators are materials that naturally have air pockets in them, such as rubber. The air pockets are like impurities and disrupt the flow of electrons. Gases, such as air, are the best natural insulators. Modern chemistry has mastered insulators, creating materials that have thousands of times more resistivity than air.

 

Source / Courtesy : WiseGeek

What Is Electrical Resistivity?

Ohm's Law can be used to find the electrical resistance applied to a circuit by resistors.
Ohm’s Law can be used to find the electrical resistance applied to a circuit by resistors.

Electrical resistivity is the characteristic of a conductor, a semiconductor, or an insulator that limits the amount of current flow. It is determined by the atomic or molecular properties that may either allow or impede the flow of free electrons through the material. Electrical resistivity is almost the same as electrical resistance with the slight difference in the way electrical resistivity may refer to resistance of a specific length of a material. For instance, a basic unit of resistivity could refer to the amount of resistance per unit length of a copper cable.

Ohm’s law provides the relationship between the electrical resistance (R), the voltage (V), and the current flow in amperes (A). Resistance is the ratio of the voltage to the current. For the same voltage, a higher current is a result of a lower resistance. An electrical fuse is meant to have a very low voltage drop when placed in series with an electrical load. If the load is 9.999 ohms and the fuse has a resistance of 0.001 ohms, a 10-volt (V) supply voltage will produce a current of 1 A and the voltage across the fuse is negligible at 0.001 V.

Electrical resistivity tomography is an imaging tool that is able to present a three-dimensional profile of embedded materials. This is accomplished by using embedded electrodes and direct current (DC) to create a two-dimensional image. By using perpendicular image planes, it is possible to have an idea of the three-dimensional layout.

Various elements with notable electric resistivity have different uses in electrical applications. Silver and gold are very low-electrical resistivity elements that are used for special applications such as microbonding used in the semiconductor industry. Copper is the chosen commercial conductor sure to its acceptable electrical resistivity and relatively low price. Carbon is a low-cost material of choice for medium to high resistance resulting in huge varieties of carbon resistance in the market. The high stability of tungsten in relatively high temperatures makes it a common choice for incandescent and filament applications such as light bulbs, wire-wound variable resistors, and electric heaters.

Contact electrical resistance is usually very low when the conductive surfaces are not contaminated. In the case of relay contacts, the pressure that temporarily joins them determines how low the resistance will drop when the contact is closed. If the pressure is not enough and the current is high, it is possible for the contact to form plasma that can melt the contact. The spark generated due to repeated closures shortens the relay lifespan. In most cases, it is a good idea to use electronic DC switches such as the silicon-controlled rectifier (SCR) or use electronic alternating current (AC) switches like the three-terminal AC (TRIAC) switch.

 

Source / Courtesy : WiseGeek

What Is a Power Supply?

Solar panels are a type of power supply.
Solar panels are a type of power supply.

A power supply is a device that takes an incoming electrical current and amplifies it to levels required by various devices. In many instances, this type of device is also implemented to take the incoming electricity and deliver it across many other electronic devices, often at different preset levels. This device allows manufacturers to create electronics and machinery that can handle many different tasks from a single source of power, without the need for various adapters and additional hardware. Within other devices, a power supply is used to transform various types of power into a compatible format to be stored, like solar energy to electrical energy.

Perhaps the most common use of this type of device is within computer systems. As electricity enters the power supply, it is momentarily stored and then distributed to numerous functions throughout the system, allowing the motherboard, hard drive, and other various devices to receive electricity in order to function. Each one of these items requires a separate voltage, and it is delivered through specialized connectors that attach in a certain manner. For example, motherboards require either a 20-pin or a 24-pin power supply, and they are not interchangeable without the purchase of an additional adapter.

Modern vehicles also require a type of power supply in order to function, and it is referred to as an alternator. Although the wiring and design may be different, it essentially works in the exact same manner by taking incoming power and delivering it throughout the vehicle at the necessary levels. Alternators can be found on everything from lawn mowers to sea craft and industrial equipment, and without them, the devices would be rendered useless.

automobile alternator - Winged Post 0419515
An automobile engine’s alternator essentially serves as an electric generator.

Another common type of power supply can be found on windmills and solar panels, and its primary function is to convert various types of energy into electricity so that it can be stored and distributed across a grid. This is referred to as a generator, and it is often a free-standing object that is installed between the power source and the storage unit. Home and commercial generators, used during power outages, also work off of this same premise by transforming petroleum products into electrical energy by means of an engine. Many types of industrial tools also implement a type of generator. Other common types of power supplies are used within circuit breakers, battery-powered items and transformers.

 

Source / Courtesy : WiseGeek