Friday, 13 July 2012

Teach Maths the right way..


Maths has never been an easy subject, be it for you or for teaching your little ones. I had to face a tougher challenge in teaching Maths for my son, when we moved to London from India couple of years back. While waiting for my son's school year 1 admission, I taught him addition and subtraction at home, oblivious of the fact that Maths is no longer taught in the traditional way that we learnt.

My son was bewildered with different methods taught at home and school. Just then, I came across the book 'Maths for Mums and Dads' by Rob Eastaway and Mike Askew. The book has changed my perception towards Maths all these years. The underlying principle in the modern methods is 'there is no single way in solving a Maths problem, be it a primary school addition or a high school algebra'.

Though initially the learning seem to be slower, it gradually paves the way for mental Maths and creative thinking. I believe that traditional methods cripple the creative thinking of children. The author gives a simple example of how a simple subtraction problem is solved differently by children

1. 56-38 is solved by 3 children in
a. 56                            b. 56                        c. 56
    38                                38                            38
-------                           ------                         ------
    26                                -2                              2
    20                                20                            16
-------                           ------                          -----
    18                                18                            18

It might take a while for us to even understand how they solved the problems in different ways but arrived at the right answer. Try to find out..:-)

Below are some examples of  addition, subtraction, multiplication and division taught in the modern method.
Before starting with addition, children should have a clear understanding of  partitioning  any number into units, tens and hundreds like 52 = 50 + 2 , 148 = 100 + 40 + 8. Next is to teach them the number bonds to 10s (6+4, 5+5, 8+ 2 and so on) and 100s.
Once they are thorough with the above, they can easily solve any addition using either partitioning or number line like the one below.

47 + 53 = 40 + 7 + 50 + 3 = 90 + 10 = 100

The same could be extended for higher digit numbers without having to teach them.
In fact , as adults we mostly follow partitioning and hardly use our traditional carry/borrow method while doing day to day calculations. Then why school Maths be taught in a different way?

Given a simple problem like 780-90 to a child who has been taught in the traditional way, he/she would need a paper/pencil to solve using the borrow method. Whereas the child who has been taught in the new method would immediately arrive at the answer by  doing  780 - 100 + 10 = 690.
It's mainly the thinking that matters more than the method.

In the same way, multiplication can be done by multiplying the units, tens and hundreds separately and then adding the individual results to arrive at the final result.

like 52 * 8 = 50*8 + 2*8 = 400 + 16 = 416

Similarly division can be done by chunking the whole number with the nearest divisors.

The book also has fractions, decimals and measurements taught in an interesting way.Besides these, the book has loads of games to help children learn Maths through fun.
So, parents are you ready to start your new adventure in Maths with your children?












Friday, 9 March 2012

Android - Application development issues and solution

Here are some quick tips that will come in handy when developing an android application.


S.No
Issue
Solution
1.
How to remove focus for an EditText control? (When a new screen is launched with EditText, keypad appears automatically hiding the screen layout).
Set android:focusableInTouchMode="true" in the layout where the EditText is coded to remove the automatic setting of focus. 
2.
How to add an image in a Button control?
Set android:drawableright=”drawable/image1”  in the Button layout to add the image to the right and  
android:drawableleft =”drawable/image1”  to add the image to the left.

3.
How to remove the background from a button and make it transparent?

Set android:background=”@android: color/transparent” in the Button layout

4.
How to allow signed numbers in EditText?
Set android:inputType=”numberDecimal/numberSigned” in the EditText layout.

5.
How to set gradient colour for a button?
Create an xml with shape object and give the gradient colours

<shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">

<gradient
    android:endColor="#9BBB59”
    android:startColor="#4F6228”
    android:angle="90" />       
</shape>

Include this xml in the drawable and give as background for the button.

6.
How to set a common background for 2 or more controls like a Button , Textview  and EditText?

Use a <Framelayout> and set the background colour or image in the layout. Include the controls inside the layout.

7.
How to manage multiple screen layouts in a single activity?
Use <ViewFlipper> and flip the screen layouts in the code.
8.
How to declare global variables to be used by all activities in a package?
Create a class file that extends Application and declare the variable in it.  In the other files, the variable can be accessed as follows:
Variable1 = ((class file name) getApplication()). Variable name.

9.
How to make the screen or part of the screen scrollable?
Wrap the layout to be scrolled in a ScrollView using <ScrollView> tag. Remember to have just one layout (like RelativeLayout or LinearLayout) or control (like TextView or Button) inside the ScrollView.
10.
How to display HTML text in a button?
Button.setText(Html.fromHtml(sText)) where sText is the string containing the text in HTML format.




Below is the list of some frequent issues encountered while testing an android application.

S.No
Issue
Solution
1.
NumberFormatException
This may occur due to several reasons and one of the reasons is setting the value of an EditText control with inputType as signed decimal, to spaces.
For ex: If an EditText control has inputType defined as below.
android:inputType=”numberDecimal/numberSigned”

If you set the value of the above EditText to spaces as below
mEditText.setText(“ “), it will throw a NumberFormatException.
Set the EditText control’s inputType to "numberSigned" only if you need the control to accept negative value, otherwise set it to just "numberDecimal".


2.
‘Window leaked error message’ when using an AlertDialog.
This error message will be thrown if the dialog is not dismissed (Dialog.dismiss()) in the onClick() method.

3.
WARNING: Application does not specify an API level requirement!
In the Android Manifest file set the minimum SDK version required as below.
<uses-sdk android:minSdkVersion=”3”/>






Sunday, 25 December 2011

A few simple ways to manage "Low on space" on HTC Desire

HTC Desire is a great Android phone providing a rich user experience with it's Sense UI. It runs smooth and fast. Several cool features made me love this phone at first sight. That was until I get the "Low on space" notification. HTC was so stingy that it had included just 576 MB of ROM of which around 430 MB is consumed by Android, HTC Sense and HTC's bundled apps. This leaves just around 140 MB of space for the user to use for installing his downloaded apps. This is very meagre and soon every HTC Desire owner hits the dreaded "Low on space" notification. This handicaps the expandability of the phone which is the core strength of any Android phone. Nevertheless I still love my phone. I had come up with a few techniques to "manage" this problem as shown below.

  • Move to SD: The first and the most obvious choice is to move apps to SD card. It's not possible to move every app to SD. Also, the apps for which there is a widget available and you use it, should not be moved to SD card.
  • Contacts Storage: Contacts storage may increase from around 10Mb to 80Mb, due to facebook contacts. Hence don't add facebook contacts to phone contacts (People), though you can link them. 
  • Clear Cache: Cache of several applications (like Market) can increase over time. Clear cache by selecting the app in Settings->"Manage Applications"->"Downloaded" tab and clicking the "Clear Cache" button. The easier way to do is by using the app Android System Cleaner - Cache Clean tab.
  • Low storage Apps: The beauty of Android is, there are several apps offering the same functionality and hence the user has a lot of freedom to pick and choose. Hence you can always find an app for a particular functionality that uses lesser storage than the one that you currently have on your phone. Look out for such apps and replace your current one. (I replaced Aldiko with Moon-reader and Rock Player with Mobo player, on this principle)
  • Adobe Flash: Adobe Flash (updates) normally consumes around 10MB of space. Uninstall the updates, you will not loose much on the functionality.
  • Internet Cache: Keep your stock Internet App's cache size at a minimum. I keep it at 2 MB.  You can do this by launching the internet app, choose settings and then selecting cache size. This is internal cache and is different from app cache. App cache size is over and above this setting, which we cannot control. Any amount less than 2 MB may increase the app cache size to mammoth proportions.
  • App Data: Periodically, you can delete all the data in social networking apps like, facebook, linked in/droidin etc. To do this,go to Settings->"Manage Applications". Click on those apps and click "Clear Data". The only trouble is, when you launch them now you will be prompted to enter your userid and password again.
  • Uninstall Apps: Finally, if you are not using any of your apps, uninstall them.