Thursday, January 23, 2014

The 1-Minute Trick - A Productivity Hack:

Are you feeling your everything is messed up..? Here is a cool productivity hack, it's simple, easy and efficient.. Just give it a try


When you are doing your day to day life. You encounter a lot of things which can be completed within a minute. For example keeping your shoes in the right place, replying an e-mail or a SMS message, keeping a book at the right place. But we usually neglect those tasks and postpone that task. The result is a messed up and untidy life. This trick is simple

Any task you can do within a minute, Do it at that time, without any delay.

Just give it a try and see how beautiful and easy you life would be :)

for more info http://www.linkedin.com/today/post/article/20140121122045-6526187-productivity-hacks-the-1-minute-trick?trk=mp-details-rc

Monday, January 13, 2014

Do I really need to use 'safely remove' feature for USBs?

Safely remove hardware and Eject Media feature is beneficial in three ways

  1. Removing the USB drive when some files are being writing into the drive will definitely corrupt data. That feature will prevent it
  2. Operating Systems use a write cache to speed up writing into drives, Sometimes OS would not write all the date at the time it receives the write request, but OS might keep it in a cache and write once substantial amount of data is present to write. When we use the safely remove feature OS flushes the cache and writes all the date to the drive.
  3. A stable supply of power is required for  a small time period for a USB device to properly write all the date. It is actually an electrical requirement. That time is not very significant. Therefore this will not affect most of the time

The Good news is

Most operating systems including Windows do not use a write cache for removable drives, which means your removing without using this feature would not do much harm
to your data in the USB drive. But it is better to use that feature unless you are in a big hurry :D
More Info

Tuesday, August 6, 2013

Tank Game AI and UI - Programming Challenge


The Tank battle game is a popular Nintendo game in 90s and early 2000s.The tank game is also known as Tank 90. It is a game where you have a treasure to secure while destroying enemy tanks. The treasure is surrounded by a brick wall; the treasure is symbolized by an eagle sign. The enemy tanks try to destroy our treasure; each state is having fixed number of enemy tanks. All the tanks have different level, those levels state the armor and the speed of the each tanks, higher the level higher the armor. The level is reduced when a tank is hit by a bullet. The level of our tanks can be increased by accruing suddenly appearing power symbols. There are various power symbols. Some are to increase our level, some are to lock all the enemy tanks for a period of time, some are to blast all the remaining enemy tanks.



There are types of blocks, they are bricks, stones, trees and water.

We can also play the game in the battle mood, where two players are given separate two treasures to secure. In order to with the game each player must either destroy opponent’s tank or the treasure.

Our Task

Our task was to deign the game client, which is mainly having two components


  • Artificial Intelligence Component (AI)
  • Graphical User Interface Component (GUI)

Artificial Intelligence Component

The game client should understand the game map and act accordingly. The AI part should first identify the
game map. Then it must be able to decide its path. Since the goal of this game is to collect as much as coins the AI component should mostly concentrate on gathering as much as coin. AI should identify nearby coin piles, and also it must take into account the lifetime of the coin pile. It should select the coin piles which are reachable before it disappears.

Since other tanks can shoot the tank, AI must avoid getting shot and need to restore health by acquiring life packs. AI should shoot other tanks, in order to be safe and steal the coins collected by those tanks.

Graphical User Interface Component

There should be a component to see the game from the client computer by decoding the server messages.

Tuesday, July 16, 2013

HACKING JOSH OS IMPLEMENTING A COMMAND TO SHOW HARDWARE INFORMATION


The assignment given for us was to implement a new command to show hardware information. In order to achieve that goal, first I had to understand the basic structure of the given kernel (file named “kernel-3.0.asm”). Following is the structure I realized observing the kernel. I have stated the functionalities and the responsibilities of each section.

Starting part
  • Setups memory locations
  • Setups interrupt services
  • Displays welcome message
  • Calls the shell

Interrupt 0x21
  • Displays a String on the slandered output

Shell
  • Responsible for all the interactive work
  • Accepts a command (as string)
  • Manipulate it and perform action
  • Procedure to Display the version of the OS (a basic functionality which was already given)
  • Procedure to exit/restart (a basic functionality which was already given)
  • Procedure to display a message when unknown command was given
  • Procedure to accept the as a string and to store it
  • Procedure to split the command
  • Procedure to display space, a new line and the prompt

Data
  • The strings and number constants used in the kernel
First I implemented a command to display my information. Command “about” will display my information. Following is a snapshot of the command.

Following is the code used to implement it

Then I implemented a procedure to display a list of available commands. Command ‘help’ is used.


Then I implemented the command to display hardware information. The command ‘info’ displays the hardware information.


To implement this command, it is divided into separate procedures, which will display each detail separately. Each of them are explained separately


Display processor information






The CPUID opcode is a processor supplementary instruction (its name derived from CPU IDentification) for the x86 architecture. It was introduced by Intel in 1993 when it introduced the Pentium and SL-Enhanced 486 processors.By using the CPUID opcode, software can determine processor type and the presence of features (like MMX/SSE). The CPUID opcode is 0FA2h and the value in the EAX register specifies what information to return. [1]

In order to load the vender ID of then cpu CPUID has to called with EAX =0. To set the value 0 in EAX, the instruction “xor eax, eax” is used (xor of the same value will result 0).
The above instruction returns then CPU manufacturer’s ID string – a twelve character ASCII string stored in EBX, ECX and EDX – in that order. The highest basic calling parameter (largest value that EAX can be set to before calling CPUID) is returned in EAX.[1]
Then the value of then EBX, ECX and EDX has to be stored in a single string in order to display the vender ID. I have used the string ‘strCPUID’ to store the vender ID.

Then I have used the following instruction to get the processor bran string
EAX=80000002h,80000003h,80000004h: Processor Brand String
These return the processor brand string in EAX, EBX, ECX and EDX. CPUID must be issued with each parameter in sequence to get the entire 48-byte null-terminated ASCII processor brand string. I have used the ‘_string_store’ subroutine to store those values each time.