Ubuntu insights, Programming in groovy, java, et als!

Thursday, January 05, 2012

Why Android Sucks? Why iOS is better?

Prior to the reasons I depict to prove a point here, I would want to confess that neither do I blindly follow the cult of apple nor do I hate android based on sheer ignorance. The musings I share here are out of daily observances, experiences and a little bit of drilling into the technical aspects of Android as an OS and more.

I have been a heavy user of android on my HTC wildfire for a while. I find that Android does do what a smartphone ought to do but it doesn't do it with elegance. There are way too many shortcomings and glitches buried down deep into the sheath of the Android eco-system. On the contrary my experience with apple iOS has been limited only to iPod but I must admit the immense pleasure that it gives me and about how it provokes me to lay my hands on it again and again unlike my HTC Android that makes me moan about why I even considered buying it in the first place.

Initially, I was under the presumption that support for multiple hardware was cool but what I eventually realized after drilling in to details is that support for multi-hardware comes at a cost. If I were to design a gallery app for an android mobile or a tablet, I need to ponder over how to get the rendering right on different hardware at different resolutions. This is one reason why many apps on android are not compatible with all kinds of hardware. Take angry birds for instance, it doesn't run on all mobiles and tablets as it ought to. This is annoying both to the developer and to the user as well. On the contrary, within the apple world, all these complexities boil down to a simple fact that I am designing an app for a single target hardware that only runs at a given resolution(s). Because of this streamlined atmosphere to code, my psyche as a developer will subconsciously adhere to deliver THE BEST app for a single hardware rather than delivering a DECENT app that supports all hardware in the world.

Another interesting observation, Every new release of Android version makes me realize how crappy its predecessor is. On the other hand, every new release of iOS would make me realize how awesome the newer version is. There is a wide difference between the two in spite of seeming same. The focus on developing a newer version of Android is more towards rectifying the bad things in the current version and making it better in the newer version. In the iOS scenario, the focus of developing a newer version is to rope in newer features that never existed before. For example : It has been around eight months since I had bought a HTC wildfire running Froyo Android 2.2. Looking at the newer ice cream sandwich version, I whine about how atrocious Froyo is in its speed and performance compared to the latter and how good the newer version of HTC wildfire IS. Whereas if I had bought an iphone 4, probably the only thing that I would be whining about is that I do not get to use the SIRI but I would never be whining about its performance in what it delivers to me as a smartphone. So the key point that I would want to highlight here is that newer versions of Android or its supporting hardware would seem awesome only because the former versions were bad whereas newer versions of iOS and hardware would seem awesome because of their added innovation into every new release or update.

On an other note, the power of a smartphone would be realized to a maximum extent by the apps that run on it. As far as I know, Android is probably the first and foremost entity that can be credited for indirectly being responsible for the injection of infectious malware at a tangible level on a Linux based system. I mean, though not impossible to do it, a Linux core by default is highly resilient to such stuff and with all the malware and antivirus crap that are evidently used in the Android world could only mean one among these two things. Either Android could not exploit the strengths of a Linux core or the hacker/developer is way too smart, which I think the case is certainly the former.

Adding to that, it is way too easy to develop an app consisting of malware and releasing it into the Android market. Of course, Google continuously scrutinizes the apps submitted but that is not just good enough to prevent the damage. Forget malware, Nothing really stops me from writing an untested low quality lameass hello world android app and release it into the market whereas if I were to develop an app for iphone/ipad, I need to ensure that it is thoroughly tested and it literally takes 3 to 4 weeks for iStore to approve the app after submission. This is an example that depicts the spirit of apple, precisely the spirit of Steve Jobs to give the deepest attention to minutest of detail to develop something impeccably tangible.

A recent article on Google+ posted by Dianne Hackborne, an Android developer at Google, throws light, complaining the inefficiency relating to the Android's methodology of hardware acceleration to render graphics. Reading the article one would be convinced that Android fares well only under the availability of considerably high end hardware. One doesn't have to go all technical to comprehend the disabilities of Android. Pick up a HTC or Samsung smartphone, open up around 10 applications one after the other, the performance of the 11th or 12th application that you open up will certainly not be as smooth as the first few. Typically iOS does this task brilliantly. No matter what, most of the RAM will be used only by the opened/active process in the Apple tablet or mobile. Only one application can run at a time on the screen which gives a tremendous performance hit. Android does a similar job in a crooked way, somehow temporarily suspending the inactive process but that doesn't restrict an inactive app running in the background eating away my puny little RAM. For this reason, I even see task managers and process killing apps on Android. Geez! For Christ's sake, I am running a phone, not a super computer! Yet again, Apple proves its best in technical brilliance without compromising performance. With all the brouhaha that surrounds the Galaxy tab's 1 GB RAM and hardware excellence, I wonder if the users of the tab did ever make it a point to notice how iPad 2 does all this process magnificently better than the former within a bare minimum of 512 MB RAM.

From a techie's viewpoint, though the core of Android is written in C and C++, all the APIs and applications that surround it are built on java. There is all this dinosaur conversion of bytecode in dalvik's understandable dex format and other humongous stuff which certainly can never beat the iOS's simplistic approach of limiting all complexities to a mutually compatible C, C++ and Objective C. Anything that involves java usually sucks blood in performance. No matter how awesome the Samsung's hardware is, god knows how many hundreds and thousands of method calls are gone through in java to understand and process the multi-touch event. And again, one doesn't have to drill through all the technical crap to understand the complexities and disabilities of Android. Go ahead, Take a delicate bird feather and compare the touch sensitivity of an iPhone vs an Android phone or an iPad vs any other cog-in-the-wheel tablet you know of, You will get a hang of what I am trying to convey here.

In spite of all its internal flaws, more and more newer and better versions of Android may come up in the near future but it all accounts to mere band-aiding. What's the point? You got your basement built on wooden sticks and lay concrete pillars on your higher floors! Technically, an Android can never beat the brilliance of an iOS in its flawless design and architecture (both hardware and software). Who cares about the numbers in market? After all, it is okay for Galaxy tabs and the rest to be content about being second runners but in reality Apple is running a different race altogether.


EDIT: This post was written when Android devices were running 2.2/2.3. With the advent of ICS, things seem to have changed where in a lot of changes have been made to the Android code base (some portion completely re acrchitectured from scratch) to make it scalable on tablet devices. Also to admit, Off late Apple is just not able to pull out something innovative. Android is certainly moving up the ladder with almost 50% of tablet market conquered. Looking at the circumstances, Android is a clear winner especially when it comes to appealing to the eyes of a user.

PS: As I have quoted before, I am not an Apple fanboy. I am a technical person and I tried to throw some light on fineness of iOS as a whole when compared to Android. I never intended to compare the complete eco system of Android devices and Apple devices. In fact, to be honest, I'd never ever dream of buying an iPad over an Android tablet, for I know it is just a toy, completely ungeek and strict in user customization despite its flawless OS.


Thursday, December 22, 2011

Running Cobertura as Ant Script

I posted about configuring eCobertura plugin for eclipse in the previous blog post. In this post, I will describe the bare minimum steps to run Cobertura as an ant build script from eclipse. Cobertura unlike eCobertura plugin, provides advanced code coverage reporting in xml and html formats. This is much more flexible for custom configuration as it can be controlled via the ant script. Replicate the steps below :

1) Download cobertura zip.

2) Create a java/groovy project named "Sample" in eclipse.

3) Create a simple java/groovy class and a corresponding unit testcase class to test it.. Place them in seperate or same packages as you wish.

4) Create a folder called lib under the Sample project folder (as Sample/lib).. Place junit.jar, apache ant.jar, and all the jars in the downloaded Cobertura zip (most importantly cobertura.jar) into the lib folder and include the jars in the project's classpath.

5) From the downloaded Cobertura zip, pick up the two files build.properties and build.xml and place them in your Sample project base. (as Sample/build.xml and Sample.build.properties)

6) The build.xml is the ant script to run Cobertura and it uses the configuration in build.properties file.

7) Change the contents of build.properties as shown below:

build.properties
---------------------------------------------------------------------------------------------------------------------


# The source code for the examples can be found in this directory
src.dir=src

# The path to cobertura.jar
cobertura.dir=cobertura/complete

# Classes generated by the javac compiler are deposited in this directory
classes.dir=cobertura/complete/classes  

# Instrumented classes are deposited into this directory
instrumented.dir=cobertura/complete/instrumented

# All reports go into this directory
reports.dir=cobertura/complete/reports    


# Unit test reports from JUnit are deposited into this directory                          
reports.xml.dir=${reports.dir}/junit-xml       
reports.html.dir=${reports.dir}/junit-html       

# Coverage reports are deposited into these directories
coverage.xml.dir=${reports.dir}/cobertura-xml 
coverage.summaryxml.dir=${reports.dir}/cobertura-summary-xml
coverage.html.dir=${reports.dir}/cobertura-html

---------------------------------------------------------------------------------------------------------------------


8) Now change the contents of build.xml as shown below:


build.xml 

---------------------------------------------------------------------------------------------------------------------

<?xml version="1.0" encoding="UTF-8"?>

<project name="Sample" default="coverage" basedir=".">

 <description>
    Cobertura - http://cobertura.sourceforge.net/
    Copyright (C) 2003 jcoverage ltd.
    Copyright (C) 2005 Mark Doliner &lt;thekingant@users.sourceforge.net&gt;
    Copyright (C) 2006 Dan Godfrey
    Cobertura is licensed under the GNU General Public License
    Cobertura comes with ABSOLUTELY NO WARRANTY
    </description>

 <property file="build.properties" />

 <path id="cobertura.classpath">
      <fileset dir="lib">
           <include name="*.jar"/>
       </fileset>
 </path>

 <taskdef classpathref="cobertura.classpath" resource="tasks.properties"/>
 <target name="init"> 
  <mkdir dir="${classes.dir}" />
  <mkdir dir="${instrumented.dir}" />
  <mkdir dir="${reports.xml.dir}" />
  <mkdir dir="${reports.html.dir}" />
  <mkdir dir="${coverage.xml.dir}" />
  <mkdir dir="${coverage.summaryxml.dir}" />
  <mkdir dir="${coverage.html.dir}" />
 </target>



 <target name="compile" depends="init">
  <javac srcdir="${src.dir}" destdir="${classes.dir}" debug="yes">
   <classpath refid="cobertura.classpath" />
  </javac>
 </target>

 <target name="instrument" depends="init,compile">
  <!--
   Remove the coverage data file and any old instrumentation.
  -->
  <delete file="cobertura.ser"/>
  <delete dir="${instrumented.dir}" />
  <!--
   Instrument the application classes, writing the
   instrumented classes into ${build.instrumented.dir}.
  -->
  <cobertura-instrument todir="${instrumented.dir}">
   <!--
    The following line causes instrument to ignore any
    source line containing a reference to log4j, for the
    purposes of coverage reporting.
   -->
   <ignore regex="org.apache.log4j.*" />
   <fileset dir="${classes.dir}">
    <!--
     Instrument all the application classes, but
     don't instrument the test classes.
    -->
    <include name="**/*.class" />
    <exclude name="**/*Test.class" />
   </fileset>
  </cobertura-instrument>
 </target>

 <target name="test" depends="init,compile">
  <junit fork="yes" dir="${basedir}" failureProperty="test.failed">
   <!--
    Note the classpath order: instrumented classes are before the
    original (uninstrumented) classes.  This is important.
   -->
   <classpath location="${instrumented.dir}" />
   <classpath location="${classes.dir}" />
   <!--
    The instrumented classes reference classes used by the
    Cobertura runtime, so Cobertura and its dependencies
    must be on your classpath.
   -->
   <classpath refid="cobertura.classpath" />
   <formatter type="xml" />
   <test name="${testcase}" todir="${reports.xml.dir}" if="testcase" />
   <batchtest todir="${reports.xml.dir}" unless="testcase">
    <fileset dir="${src.dir}">
     <include name="**/*Test.java" />
    </fileset>
   </batchtest>
  </junit>



  <junitreport todir="${reports.xml.dir}">

   <fileset dir="${reports.xml.dir}">

    <include name="TEST-*.xml" />

   </fileset>

   <report format="frames" todir="${reports.html.dir}" />

  </junitreport>

 </target>



 <target name="coverage-check">

  <cobertura-check branchrate="34" totallinerate="100" />

 </target>



 <target name="coverage-report">

  <!--

   Generate an XML file containing the coverage data using

   the "srcdir" attribute.

  -->

  <cobertura-report srcdir="${src.dir}" destdir="${coverage.xml.dir}" format="xml" />

 </target>



 <target name="summary-coverage-report">

  <!--

   Generate an summary XML file containing the coverage data using

   the "srcdir" attribute.

  -->

  <cobertura-report srcdir="${src.dir}" destdir="${coverage.summaryxml.dir}" format="summaryXml" />

 </target>



 <target name="alternate-coverage-report">

  <!--

   Generate a series of HTML files containing the coverage

   data in a user-readable form using nested source filesets.

  -->

  <cobertura-report destdir="${coverage.html.dir}">

   <fileset dir="${src.dir}">

    <include name="**/*.java"/>

    <include name="**/*.groovy"/>

   </fileset>

  </cobertura-report>

 </target>



 <target name="clean" description="Remove all files created by the build/test process.">

  <delete dir="${classes.dir}" />

  <delete dir="${instrumented.dir}" />

  <delete dir="${reports.dir}" />

  <delete file="cobertura.log" />

  <delete file="cobertura.ser" />

 </target>



 <target name="coverage" depends="compile,instrument,test,coverage-report,summary-coverage-report,alternate-coverage-report" description="Compile, instrument ourself, run the tests and generate JUnit and coverage reports."/>



</project>

---------------------------------------------------------------------------------------------------------------------

9) Running the above build.xml as an ant script in eclipse will create a folder hierarchy. The generated xml and html format reports can be found at Sample/cobertura/complete folder.

PS: Instead of running the script from eclipse you can also run the build.xml from a command line using the ant -[options] command.





Sunday, December 18, 2011

Eclipse : Configuring eCobetura for Code Coverage

Recently, I stumbled across cobertura while searching for a decent code coverage utility for my java and groovy units. Major parts of Cobertura are under the GNU public license which I found would suffice my need for basic code coverage. You can read more about cobertura here at http://cobertura.sourceforge.net/

eCobetura is a comfy eclipse plugin that generates a code coverage report within the eclipse console itself..Here is how you can configure it.

Eclipse update site for eCobertura

http://ecobertura.johoop.de/update/

In eclipse, Under Help menu -> Install New software, add up the above (url) update site..

Check eCoberture code coverage option and proceed with Next until all the dependencies get installed..

Restart eclipse after installing the eCobertura plugin..

Sample unit test code coverage using eCobertura
Create a sample Java/Groovy project.

Create a java/groovy class PrintUtil

public class PrintUtil {                        
public String printHello(String msg){      
return "Hello "+msg;                    
}                                          

public String printGoodday(String msg){    
return "Good day "+msg;                 
}                                          
}                                               



Likewise create a JUnit/Gunit testcase class that will test the functionality of PrintUtil class.

import junit.framework.TestCase;                
public class PrintUtilTest extends TestCase {   
PrintUtil util = new PrintUtil();           
public void testPrintHello(){               
String out = util.printHello("World");  
assert(out=="Hello World");             
}                                           

public void testPrintGoodday(){             
String out = util.printGoodday("World");
assert(out=="Hello World");             
}                                           
}                                               

In eclipse, Under Window menu -> Show View -> Other, Select the Coverage Session View option to view the eclipse console for the code coverage results of the above unit test..

Select the PrintUtilTest testcase in the eclipse package explorer, Find the new shorcut for eCobertura in the eclipse toolbar (probably just best the debug menu icon).. Execute the PrintUtilTest as a junit under the Coverage As -> JUnit Test option.. The complete code coverage details will be shown in the Coverage Session View similar to the one shown below..


PS: This post focuses only about eCobertura, an eclipse plugin for Cobertura which can be used in tandom while running junits in eclipse.. However the original, Cobertura has more advanced features to generate a complete XML/ HTML reports on code coverage, etc..It can be run from command line or as an ant or Maven build.. You might want to exploit it for advanced reporting options.. 




Monday, December 05, 2011

Pharo Beginner : My first Smalltalk Program


DockingBarMorph new
  position: 0@225;

        addMorph: (SimpleButtonMorph new
                          label: 'Close';
                          target: [DockingBarMorph allInstances last delete];
     height: 55;
                          actionSelector: #value);

        addMorph: (SimpleButtonMorph new
            label: 'Open Transcript';
                          target: [Transcript open.
                                        Transcript show: '*** Default text in Transcript ***'
                                        ];
                          actionSelector: #value);

addMorph: (SimpleButtonMorph new
                        label: 'Open Browser';
     target: [Browser open.];
                        actionSelector:#value);

       addMorph: (SimpleButtonMorph new
                            label: 'New Workspace ';
                            target: [Workspace new open.];
                            actionSelector:#value);

addMorph: (SimpleButtonMorph new
                          label: 'Dock';
                          target: [UIManager inform: 'Hello world.. This is a sample Dock..'];
                         height: 55;
                          actionSelector: #value);
  openInWorld.


*************************

Tried to add up custom launchers for pharo development utilities. Currently implemented new Workspace open, System Browser, Transcript, etc.. Will have to make it complete so that the dock should be able to launch every component under the conventional right click popup in the pharo environment..

A simple pharo starter program which you can fiddle and extend, after a thorough understanding on ProfStef go.




Friday, December 02, 2011

Tutorial : List Operations in Python

#!usr/bin/python
""" All text within triple quotes is treated as comments in python """
""" This tutorial explains lists in python with the simplest operations as examples"""
""" Standard string concatenation using + operator """
""" Prints the message in a new line """
def printMessage(str):
print ">>>>> "+str
return


""" For loop : A similiar equivalent of each closure in groovy """
""" Note that indents are the only way to tell the interpreter about the blocks """
"""Also note that the below print it, prints elements in same line with space separated i.e a typical equivalent of System.out.print in java"""
def printList(aList):
for it in aList :
print it,
print
return



""" ********************** Start scripting : list operations ********************** """
list = [10, 1, 2, 3, 4, 5, 6]

"""*** Print the elements of the list *** """
list.append(9)
printMessage("Initial elements in the list : ")
printList(list)

"""*** add an element to the end of the list *** """
lastVal = 9
list.append(lastVal)
printMessage("Elements after appending a new element "+str(lastVal)+" at the end of the list : ")
printList(list)

"""*** insert element at index i *** """
insertVal = 8
indice = 7
list.insert(indice, insertVal)
printMessage("Elements after inserting : "+str(insertVal)+" at index : "+str(indice))
printList(list)

"""*** sort the elements ascending order by default *** """
list.sort()
printMessage("Elements after sort : ")
printList(list)

"""*** Reverse the elements : same as groovy *** """
list.reverse()
printMessage("Elements after reversal : ")
printList(list)

"""*** Removes the last element *** """
list.pop()
printMessage("Elements after removing last element : ")
printList(list)

"""*** Removes element at specified index *** """
index=3
list.pop(index)
"""Note the string cast below..A typical toString() equivalent in java"""
printMessage("Elements after removing element of index at : "+str(index))
printList(list)

"""*** Removes element with the value specified *** """
value=9
list.remove(value)
printMessage("Elements after removing the value : "+str(value))
printList(list)

""" *** number of times the element 1 occurs in a *** """
countFor = 1
printMessage("The number of times element : "+str(countFor)+" occurs in the list")
print list.count(countFor)

""" ****************** Some more looping and branch conditions ****************** """

""" *** Find the smallest element in the list using a typical for equivalent of eachWIthIndex groovy closure*** """
small = list[0]
smallestElementIndex = 0
for index, item in enumerate(list):
if item < small :
small = item
smallestElementIndex = index
print  "The smallest element of the list is "+str(small)+" at index "+str(smallestElementIndex)


""" *** While loop implementation *** """
printMessage("A simple while loop in python to convey : ")
sizeOfList = len(list)
i=0
while i<sizeOfList:
print "Python is fun \m/"
i = i + 1

--------------------------------------------------------------------------------------------------------------

Output for the above list operations performed :


>python -u "PythonBasicListOps.py"
>>>>> Initial elements in the list : 
10 1 2 3 4 5 6 9
>>>>> Elements after appending a new element 9 at the end of the list : 
10 1 2 3 4 5 6 9 9
>>>>> Elements after inserting : 8 at index : 7
10 1 2 3 4 5 6 8 9 9
>>>>> Elements after sort : 
1 2 3 4 5 6 8 9 9 10
>>>>> Elements after reversal : 
10 9 9 8 6 5 4 3 2 1
>>>>> Elements after removing last element : 
10 9 9 8 6 5 4 3 2
>>>>> Elements after removing element of index at : 3
10 9 9 6 5 4 3 2
>>>>> Elements after removing the value : 9
10 9 6 5 4 3 2
>>>>> The number of times element : 1 occurs in the list
0
The smallest element of the list is 2 at index 6
>>>>> A simple while loop in python to convey : 
Python is fun \m/
Python is fun \m/
Python is fun \m/
Python is fun \m/
Python is fun \m/
Python is fun \m/
Python is fun \m/
>Exit code: 0






Tuesday, November 22, 2011

Why Linked List is a Linear Data Structure?

Reminiscing my textbook definitions during graduation, all I ever read about linear data structures was that, they have elements placed adjacent to each other. Now, I curse myself for not being able to understand the inners of the concept rather than trying to perceive the whole thing at superficial level.

As I dig through this, I see that there are two aspects to the term linear. One is at the physical level (in bits and bytes of memory), other at the logical level (concerning the data structures used). At the logical level we talk about data structures as being linear or non linear. But in reality, at the physical level, computer memory is always linear i.e one memory block adjacent to other.

The concept of non linearity is (usually) implemented with the help of pointers that connect other memory chunks by storing their addresses. Technically, implementing pointers at the physical level is somehow helping us to understand non linearity at the logical level implementation of data structures. Assuming so, I was stumped at this point, wondering why a linked list is considered linear in spite of the nodes never being physically adjacent.

After an overwhelming head-breaking session, I started to see this differently. The terms linear and non linear are purely meant to be viewed at the logical level when used along side data structures. If a list is being used, irrespective of whether it is an array implementation or a linked list implementation, it should only be perceived as a data structure that stores elements adjacently (logically, abstract picture) and hence it is linear.

If the confusion still lasts, there is this thumb rule that you can take help of, to recheck if a data structure is linear or non linear. If you are required to sequentially traverse through all the elements of a data structure to access its nth element, then the data structure is linear. Else it is non-linear.

Example : Stacks, Queues, Lists are always linear. Irrespective of whether they are implemented using pointers or arrays, you need to sequentially traverse through the whole data structure to access the nth element which is not so in the case of trees and graphs wherein to access one element, traversing a specific branch might suffice.

Tuesday, November 15, 2011

Solve Graphic Driver Errors & Unity 3D Display Issues in Ubuntu 11.10

Graphic card compatibility issues with Ubuntu are very annoyingly frequent during installation. I've been a sufferer of the same recently when my graphic card drivers crashed and Unity 3D failed to render correctly, Instead it reverted to Unity 2D version which pretty much sucks. Here are some insights into Unity panel issues w.r.t the non-availability or incompatibility of your graphic driver.

Test if unity is supported  :
Type in terminal

/usr/lib/nux/unity_support_test -p 

You need to get an output saying Unity is Supported : Yes. If you don't, there are things that need to be answered which of course will be, in the below steps.

How do you know if Unity 3D is running :
In the terminal, type in

echo "$DESKTOP_SESSION"

If the output of the above command is Ubuntu, Unity 3D is enabled and running.
If the output of the above command is Ubuntu-2D, Unity is running in 2D mode.

PS: Make sure you are logged into Ubuntu and not into Ubuntu 2D. Verify this prior to login.


Test if Graphic card is detected :
In the unity dash, search for system Info. The System info will show you Processor, Memory, Graphics and other details. If the graphics details displayed is empty, it means that either the graphic card installed is not recognized or you might not have installed a graphic driver at all.

Moving On :
There are three ways of looking at any issue relating to graphic driver installation.

1) Install default binaries provided by Ubuntu (FGLRX drivers) (or)
2) Install Open source drivers to get the graphic card detected & running (or)
3) You either install the ATI binaries from the official ATI site.

You must stick to only one among the above three aproaches, out of which the Second option to install third party open source drivers is the best in my opinion. Here I've explained the first two approaches in detail.

Prior to taking any of the above approach, run this command to install dependencies :

sudo apt-get install build-essential cdbs fakeroot dh-make debhelper debconf libstdc++6 dkms libqtgui4 wget execstack libelfg0 dh-modaliases

1) Install FGLRX drivers provided by Ubuntu (I don't recommend)
To install the FGLRX drivers, search the Unity dash for Additional Drivers, Click on the appropriate FGLRX driver suggested and activate it.

2) Install Open source Graphic Drivers (Recommended)
The below command will remove all traces of Ubuntu's default fglrx drivers (if installed).

sudo apt-get remove --purge fglrx fglrx_* fglrx-amdcccle* fglrx-dev*


Remove the existing xorg.conf 
sudo rm /etc/X11/xorg.conf


Reinstall the xorg.conf
sudo apt-get install --reinstall xserver-xorg-core libgl1-mesa-glx:i386 libgl1-mesa-dri:i386 libgl1-mesa-glx:amd64 libgl1-mesa-dri:amd64


Configure xorg

sudo dpkg-reconfigure xserver-xorg

Reboot the system
sudo reboot

The above series of commands are most important, necessary and typically are the installation steps involved in using open source Graphic drivers to detect your graphic card.

PS: These open source drivers worked spot on with my Dell system with an AMD Radeon™ HD 6470M - 1GB (For ICC) video card. And should hopefully do the job for you too :)