Friday, September 16, 2011

Google Music Beta on Android

You might have heard that Google had launched the music beta service, which is similar to the other Google service which is linked to your Google account, but only limitation as of now is that it is available on in the United States, and it also says that its free for limited period of time. May be only till the beta testing is complete, but I hope to have it continued after that. You can store about 20,000 songs to your account and they will be stored in cloud, so that it can be accessed from any device, such as TAB or Android Phone. You can carry your music collection where ever you go, sound impressive huh? why don't you get one? 

All you need is an US proxy and log into your Google account from the proxy server or VPN and request for one, or if you have a friend who can send invite ask him to send one. So you would get the invite in few days if you have requested for one. 

After the invite is received you can download the music manager from music.google.com and install it. 
  • Make sure you keep all your tag information for the songs updated before uploading using Google Music Manager, otherwise it becomes a mess later to organize your music. Google music would organize your music based on the tag information.
  • Also make sure that you use the folder upload option rather than windows media player library sync, because mostly if you have updated the tag information recently, it seems to be not working fine. 
  • Anyways, follow which ever method, but upload the music, but one thing to remember, while uploading you don't need to be in VPN, and sometimes with VPN, if corporate it will not work.
Now you need android application to use the same music on your android device, but if you are not in US, then the market wont allow you to install from there, even though it is free application. So you need to download it from here, and install using any other method, such as copy to SD card then install by enabling non market application installation in settings.


Once you have installed fortunately, it does not need a VPN to play your music, you can be in any country, Wifi/3G/EDGE/GPRS, it can play the music for you.


Thursday, September 15, 2011

Root Samsung Galaxy SL (i9003) Gingerbread 2.3.4 (XXKPH)

I had hard time finding how to root the Samsung Galaxy SL, 2.3.4, XXPKH. There were many blogs and website talking about rooting, but because XXKPH was the latest version and it was 2.3.4, most of the methods mentioned in there does not work. 

The most basic method is to use the SOC (Super One Click) and it does not work with XXKPH, because the kernel exploit cannot be done by Ginger break, and it seems they have closed the loophole which ginger break was using. The original Ginger break method was mentioned in this website, and he has clearly mentioned that it has to be using the usb debugging mode on adb. SOC also uses the same method, and it should be the only way to do it.

Now how do we proceed, I read in a Spanish website for i9000 that the kernel must be replaced with a kernel which can be exploited and then exploit using SOC and replace back the original kernel after installing SU (super user app). I found it something convincing and then tried the method on XDA developer where he talks about flashing the fixed binary and then normal boot again. I was scared to try this before as I do not want to use any modified binary as the XXKPH is very stable, and battery life and GPS are working awesome for me. Any change would only deteriorate the performance, as these people may have done somethign which they are not very sure of.

Here goes the method for XXKPH
  • After Flashing to new Firmware , Go to Downloading Mode By pressing volume down + menu button + power button and Flash the Phone Using the PDA file GT-I9003_PDA_XXKPE-fixed.tar
  • Root USing SOC (Latest version of SOC can be downloaded from here)
    • While rooting, you may find that it it stuck at step #6, may be you can disconnect the cable and connect back, and it should do the trick !! (happened with me)

  • Flash PDA with the normalboot.img.tar attached below
Note: With the absolutely beautiful ADB exploit I use, titled rageagainstthecage (ratc), absolute ALL devices can be rooted. This is because it exploit is ADB which all devices use. There is an issue though. Some devices have a NAND lock which does not allow you to write to the /system mount. Because of this, you can't copy su, sqlite or busybox to /system/bin. This creates some issues but there is a work around. For things that don't need access to /system (like enabling non-market apps) I can use the ratc exploit to make those changes. If your device cannot use su in /system/bin then you can simple select a checkbox (as of v1.5) that says to use ratc. 


There are 3 levels of "root" we can define:
Level 1: Shell Root (with ratc rooting the adb shell but no /system write access)
Level 2: Temporary Root (/system/bin/su installed but lost on reboot)
Level 3: Full Root (/system/bin/su installed and sticks)

Some devices have a NAND lock. SuperOneClick will only give a Shell root until you remove this lock.

Gingerbreak uses rageagainstthecage,  is a root exploit via a fork bomb. Some antivirus program may raise alert for malicious content while unzipping, and here is the explanation for it. 

It IS a potentially malicious payload, BUT it is being used with owner's consent to root the phone. The DreamDroid malware use exactly same payload - they are trojans, but this is a helpful tool. It IS a dangerous tool in the wrong hands, but this is a root exploit, so you should exercise common sense and a little understanding of what it does and how it works.

Tuesday, September 13, 2011

Update Galaxy SL (i9003) to Gingerbread 2.3.4

I followed the procedure from here. Out of all the guides out there, which are most confusing this is the best one I have ever come across. He is clear and straight forward of what you have to do, and small guide, not to get confused with lengthy ones.

I am copy pasting it here for your reference, may be for my reference later, as I am not interested with all of it.







Note: XXKPH can only be flashed with help from it's supporting predecessor XXKPE, So make sure you have XXKPE downloaded. User flashing version varies with this, but this is my successful 100% assured boot.
  1. Firstly, Download the link from spacebar's XXKPH Feedback thread.
  2. Run Odin3 v1.83
  3. Set your phone to download mode : Press Volume down + OK first, then hold Power button.
  4. Connect your phone, you should see Odin shows your phone is Added with COM number.
  5. Click PIT button and select this file: latona_20110114.pit
  6. You should see Re-Partition, Auto Reboot and F. Reset Time checked.
  7. Click PDA button and select this file: CODE_I9003XXKPE_CL409735_REV08_user_low_ship.tar
  8. Click PHONE button and select this file: MODEM_I9003XXKPE_REV_00_CL1041909.tar
  9. Click BOOTLOADER button and select this file: APBOOT_I9003XXKPE_CL409735_REV08_user_low_ship.tar
  10. Click CSC button and select this file: GT-I9003-CSC-MULTI-OXAKPE.tar
  11. Click Start button to flash these files to phone.
  12. Do not touch anything till you see PASS on the program window.
  13. Turn off the phone and set it back into download mode once you get an initial first boot to homescreen. Do not set up anything, Just power off and set to download mode. 
    Note: You only need to flash once to XXKPE before proceeding to XXKPH
  14. In Odin, press Reset button. Re-partition should be unchecked automatically.
  15. Select file I9003XXKPH_I9003XXKPH_I9003SERKPH_HOME.tar as PDA
  16. Click on Start to flash XXKPH PDA to phone
  17. Once you have flashed, after the phone started up, press *#1234# and check your PDA,Phone and CSC, everything should ended with KPH
  18. Factory reset and enjoy
Feedback: These is my experience and it may differ.

I had updated for KB2 Indian version. I flashed first XXKPE as suggested by the guide, and then XXKPH. 
  1. Now the battery life seem to have increased, I am not very sure about it, but feels like, my phone use to always crib low battery, and not it does not happen. I hardly put on charging these days :)
  2. No overheating etc, as some might have wrongly mentioned, but as far as I know this is official release for Russia so such issues can't be there
  3. All peripherals and system functions such as wifi, camera everything works fine.
  4. The GPS works like charm, and it has been fixed, it locks within 5 seconds and you are connected. 
  5. There are three new apps
    • Samsung Navigation Route 66 - which seems promising, it has information about the city, so easy to search and navigate.
    • Publication Reader - You can put your paper/magazine subscriptions and can be read offline.
    • There is a short cut to downloads which was much needed and was missing in previous version
  6. Not many cosmetic changes compared to 2.2 Froyo, it's all the same look and feel. The boot animation music has changed, I felt previous one was better.
  7. Performance has not changed much, it's almost same, may be little better I could say. 
  8. Last, but not the least Gmail video chat is something which is expected in 2.3.4 and it does not present in this, and for this you need to root and install the apk from outside, but as of now no good rooting available for 2.3.4, and whatever present seem to be not working.
  9. So if you have problem with battery life, then only update, else no need, and don't wait for gmail video chat support to come, I don't think it would ever come on SL
Note: All the binaries needed can be downloaded from here

Monday, July 25, 2011

Type Casting in C++

Converting an expression of a given type into another type is known as type-casting. We have already seen some ways to type cast:

Implicit Conversion

Implicit conversions do not require any operator. They are automatically performed when a value is copied to a compatible type. For example:

short a=2000;
int b;
b=a;

Here, the value of a has been promoted from short to int and we have not had to specify any type-casting operator. This is known as a standard conversion. Standard conversions affect fundamental data types, and allow conversions such as the conversions between numerical types (short to int, int to float, double to int...), to or from bool, and some pointer conversions. Some of these conversions may imply a loss of precision, which the compiler can signal with a warning. This can be avoided with an explicit conversion.

Implicit conversions also include constructor or operator conversions, which affect classes that include specific constructors or operator functions to perform conversions. For example:


class A {};
class B { public: B (A a) {} };

A a;
B b=a;

Here, a implicit conversion happened between objects of class A and class B, because B has a constructor that takes an object of class A as parameter. Therefore implicit conversions from A to B are allowed.

Explicit Conversion

C++ is a strong-typed language. Many conversions, specially those that imply a different interpretation of the value, require an explicit conversion. We have already seen two notations for explicit type conversion: functional and c-like casting:

short a=2000;
int b;
b = (int) a; // c-like cast notation
b = int (a); // functional notation

The functionality of these explicit conversion operators is enough for most needs with fundamental data types. However, these operators can be applied indiscriminately on classes and pointers to classes, which can lead to code that while being syntactically correct can cause runtime errors. For example, the following code is syntactically correct:

// class type-casting
#include <iostream>using namespace std;

class CDummy {
float i,j;
};

class CAddition {
int x,y;
public:
CAddition (int a, int b) { x=a; y=b; }
int result() { return x+y;}
};

int main () {
CDummy d;
CAddition * padd;
padd = (CAddition*) &d;
cout << padd->result();
return 0;
}

The program declares a pointer to CAddition, but then it assigns to it a reference to an object of another incompatible type using explicit type-casting:

padd = (CAddition*) &d;

Traditional explicit type-casting allows to convert any pointer into any other pointer type, independently of the types they point to. The subsequent call to member result will produce either a run-time error or a unexpected result.

In order to control these types of conversions between classes, we have four specific casting operators: dynamic_cast, reinterpret_cast, static_cast and const_cast. Their format is to follow the new type enclosed between angle-brackets (<>) and immediately after, the expression to be converted between parentheses.

dynamic_cast <new_type> (expression)
reinterpret_cast <new_type> (expression)
static_cast <new_type> (expression)
const_cast <new_type> (expression)

The traditional type-casting equivalents to these expressions would be:

(new_type) expression
new_type (expression)

but each one with its own special characteristics:

Dynamic Cast

dynamic cast can be used only with pointers and references to objects. Its purpose is to ensure that the result of the type conversion is a valid complete object of the requested class.

Therefore, dynamic_cast is always successful when we cast a class to one of its base classes:

class CBase { };
class CDerived: public CBase { };

CBase b; CBase* pb;
CDerived d; CDerived* pd;

pb = dynamic_cast<CBase*>(&d); // ok: derived-to-base
pd = dynamic_cast<CDerived*>(&b); // wrong: base-to-derived

The second conversion in this piece of code would produce a compilation error since base-to-derived conversions are not allowed with dynamic_cast unless the base class is polymorphic.

When a class is polymorphic, dynamic_cast performs a special checking during runtime to ensure that the expression yields a valid complete object of the requested class:


// dynamic_cast
#include <iostream>#include <exception>using namespace std;

class CBase { virtual void dummy() {} };
class CDerived: public CBase { int a; };

int main () {
try {
CBase * pba = new CDerived;
CBase * pbb = new CBase;
CDerived * pd;

pd = dynamic_cast<CDerived*>(pba);
if (pd==0) cout << "Null pointer on first type-cast" << endl;

pd = dynamic_cast<CDerived*>(pbb);
if (pd==0) cout << "Null pointer on second type-cast" << endl;

} catch (exception& e) {cout << "Exception: " << e.what();}
return 0;
}

Compatibility note:

dynamic_cast
requires the Run-Time Type Information (RTTI) to keep track of dynamic types. Some compilers support this feature as an option which is disabled by default. This must be enabled for runtime type checking using dynamic_cast to work properly.

The code tries to perform two dynamic casts from pointer objects of type CBase* (pba and pbb) to a pointer object of type CDerived*, but only the first one is successful. Notice their respective initializations:

CBase * pba = new CDerived;
CBase * pbb = new CBase;

Even though both are pointers of type CBase*, pba points to an object of type CDerived, while pbb points to an object of type CBase. Thus, when their respective type-castings are performed using dynamic_cast, pba is pointing to a full object of class CDerived, whereas pbb is pointing to an object of class CBase, which is an incomplete object of class CDerived.

When dynamic_cast cannot cast a pointer because it is not a complete object of the required class -as in the second conversion in the previous example- it returns a null pointer to indicate the failure. If dynamic_cast is used to convert to a reference type and the conversion is not possible, an exception of type bad_cast is thrown instead.

dynamic_cast can also cast null pointers even between pointers to unrelated classes, and can also cast pointers of any type to void pointers (void*).

static_cast

static_cast can perform conversions between pointers to related classes, not only from the derived class to its base, but also from a base class to its derived. This ensures that at least the classes are compatible if the proper object is converted, but no safety check is performed during runtime to check if the object being converted is in fact a full object of the destination type. Therefore, it is up to the programmer to ensure that the conversion is safe. On the other side, the overhead of the type-safety checks of dynamic_cast is avoided.


class CBase {};
class CDerived: public CBase {};
CBase * a = new CBase;
CDerived * b = static_cast<CDerived*>(a);

This would be valid, although b would point to an incomplete object of the class and could lead to runtime errors if dereferenced.

static_cast can also be used to perform any other non-pointer conversion that could also be performed implicitly, like for example standard conversion between fundamental types:

double d=3.14159265;
int i = static_cast<int>(d);

Or any conversion between classes with explicit constructors or operator functions as described in "implicit conversions" above.

reinterpret_cast

reinterpret_cast converts any pointer type to any other pointer type, even of unrelated classes. The operation result is a simple binary copy of the value from one pointer to the other. All pointer conversions are allowed: neither the content pointed nor the pointer type itself is checked.

It can also cast pointers to or from integer types. The format in which this integer value represents a pointer is platform-specific. The only guarantee is that a pointer cast to an integer type large enough to fully contain it, is granted to be able to be cast back to a valid pointer.

The conversions that can be performed by reinterpret_cast but not by static_cast have no specific uses in C++ are low-level operations, whose interpretation results in code which is generally system-specific, and thus non-portable. For example:


class A {};
class B {};
A * a = new A;
B * b = reinterpret_cast<B*>(a);

This is valid C++ code, although it does not make much sense, since now we have a pointer that points to an object of an incompatible class, and thus dereferencing it is unsafe.

const_cast

This type of casting manipulates the constness of an object, either to be set or to be removed. For example, in order to pass a const argument to a function that expects a non-constant parameter:


// const_cast
#include <iostream>using namespace std;

void print (char * str)
{
cout << str << endl;
}

int main () {
const char * c = "sample text";
print ( const_cast<char *> (c) );
return 0;
}

typeid

typeid allows to check the type of an expression:

typeid (expression)

This operator returns a reference to a constant object of type type_info that is defined in the standard header file <typeinfo>. This returned value can be compared with another one using operators == and != or can serve to obtain a null-terminated character sequence representing the data type or class name by using its name() member.


// typeid
#include <iostream>#include <typeinfo>using namespace std;

int main () {
int * a,b;
a=0; b=0;
if (typeid(a) != typeid(b))
{
cout << "a and b are of different types:\n";
cout << "a is: " << typeid(a).name() << '\n';
cout << "b is: " << typeid(b).name() << '\n';
}
return 0;
}

When typeid is applied to classes typeid uses the RTTI to keep track of the type of dynamic objects. When typeid is applied to an expression whose type is a polymorphic class, the result is the type of the most derived complete object:


// typeid, polymorphic class
#include <iostream>#include <typeinfo>#include <exception>using namespace std;

class CBase { virtual void f(){} };
class CDerived : public CBase {};

int main () {
try {
CBase* a = new CBase;
CBase* b = new CDerived;
cout << "a is: " << typeid(a).name() << '\n';
cout << "b is: " << typeid(b).name() << '\n';
cout << "*a is: " << typeid(*a).name() << '\n';
cout << "*b is: " << typeid(*b).name() << '\n';
} catch (exception& e) { cout << "Exception: " << e.what() << endl; }
return 0;
}

Note: The string returned by member name of type_info depends on the specific implementation of your compiler and library. It is not necessarily a simple string with its typical type name, like in the compiler used to produce this output.

Notice how the type that typeid considers for pointers is the pointer type itself (both a and b are of type class CBase *). However, when typeid is applied to objects (like *a and *b) typeid yields their dynamic type (i.e. the type of their most derived complete object).

If the type typeid evaluates is a pointer preceded by the dereference operator (*), and this pointer has a null value, typeid throws a bad_typeid exception.

What our compiler returned in the calls type_info::name in the this example, our compiler generated names that are easily understandable by humans, but this is not a requirement: a compiler may just return any string.

Monday, July 18, 2011

My Favorite Android Games

There are thousands of games out there in market most of them are paid or free, but which one do you like, I did refer to people’s blog to find it out, and many like variety of games. But here is the list of paid and free games which I liked, and I play almost every day.

Angry Birds RioAngry Birds Rio is a variant of original Angry birds, so obviously it’s a FUN game, here you have different types of levels which makes it more attractive compared to the original game. They keep updating, so more fun to come in future. It’s free game but comes with Ads, if you disable the data connection while playing this game then you won’t see any ads, that’s the best way to deal with it.

Angry Birds SeasonsAngry Birds Seasons is another variant where in you can play them in different seasons such as Christmas, in snow falls etc., more or less same as the original one, but here you have some bonus levels if you complete all levels in 3 stars, so kind of challenging and keeps the game spirit on till the end of the game

Angry BirdsAngry Birds (Original) is a fun game, and you will get addicted to this game so fast that every night you have to play this before going to sleep, that’s the level of addiction.

Its whole aim is to use some physics knowledge and make the birds jump on the pigs and destroy them, who takes the eggs of these birds. There will be so many obstacles when you try to destroy them, so plan well and achieve the goal.

Bebbled

Bebbled may not be interesting to that extent, but it’s a good time pass game. There is a target pointes to be made for each level, and until you make those many points you wont be allowed to go to next level. You need to touch the bubbles of the same color to make them disappear and make points out of it. More bubbles of same colors come together the more points you get.

Bonsai Blast

Bonsai Blast is the ZUMA game which we use to play in computers, where there would be a FROG at the center and colored balls would come and you need to shoot them before reaching the end point. If you make the balls of same color count more than three, then they disappear, lot more weapons etc., are there but you need to install it to explore. It is good one, but not as good as the ZUMA, but still a time pass game.

Bubble Blast 2

Bubble Blast 2, I have never played the first version. This one has lot of levels, may be I would never be able to complete. Its just a time pass game, you don’t need to know anything, and its very difficult to plan the game also, but over all it’s a time pass game. Keep touching the bubbles and they grow and finally blast, there are some restrictions on the number of touches you need to finish blasting all the bubbles, sometimes if becomes so difficult that you may have to take an hint. Only one hint per day.

Klondike Solitaire

Klondike Solitaire  is the best solitaire game I have come across for android devices, and this one is simple and intuitive, and easy to use game. A very good time pass game. Levels are somewhat difficult.

Just disable the data connections, else the ads would be irritating.

Magic Marker

Magic Marker is not a game, but it’s a FUN app, with which you can make your phone a drawing board, and draw in different colors, which come as magic lights. If you want to write something and show to someone special may be this would come in handy.

I have the pretty old version which does not have ads, but recent version comes with ads, so you may have some irritating ads popping up in the screen.

Need for Speed Shift

Need For Speed (NFS) Shift, if you are a fan of NFS and or a fan of racing, then this is one game you must buy, such an awesome graphics and such a wonderful game play, you would love it.

There are different tracks and different cars. You need to buy the cars from the money you make from racing and build your career.

Paper Toss

Paper Toss is an game for time pass when you don’t have any work to do. It’s as simple as throwing a paper into a dust bin.

There are different levels such as office, toilet, airport, basement etc., where the distance would be different and the fan would be placed in different locations.

Pool Master Pro

Pool Master Pro is the best pool game I have come across for android. It has such awesome graphics that you keep playing and get addicted to it.

There is one more game which is 3D but then its not as good as this. Its free and ad free. So go for it.

 

Slice It

Slice it! is a game mostly for kids, but still it’s a FUN game you can play. You will be given objects of different shape and you need to slice them into N equal parts by certain number of counts.

Initially the game would be easier, and it keeps becoming complex as you go up. You may have to check your geometric skills once again. Its not as simple as slicing a piece of cake. Mind it!