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”/>