Monday, June 17, 2013

Extract useful data from iPhone 4 including Shazham tags list, wallpaper images such as lock screen background or home background

1 Install SQLite Database Browser in your Applications Folders
Click here to download

2 Install iPhone Backup Extractor
Click here for download

3 Download iTunes 11.0.4.4

4 backup your phone with iTunes

5 Launch iPhone Backup Extractor
5.1 Select Expert mode

5.2 For Shazam

5.2.1 Check the file com.shazam.Shazam/Documents/ShazamDataModel.sqlite
5.2.2 Choose File/Export, choose Export only checked file(s) ShazamDataModel.sqlite
5.2.3 Save the ShazamDataModel.sqlite file
5.2.4 Open the file with SQLite Database Browser and export the list to your favorites format

5.3 For lock Screen

5.3.1 The wallpaper is actually stored under the Springboard folder in the "Library". So, extract the file called HomeBackground.cpbitmap
or LockBackground.cpbitmap

5.3.2 Open your browser at http://cpbitmap.cleverbyte.com.au/
5.3.3 Select the output format PNG or JPG (loosy compression)
5.3.4 Upload the cpbitmap and enjoy your converted file
5.3.5 Scale the image to fit new iPhone 5 screen size using Photoshop/Gimp
5.3.6 Send the new file to your new iPhone 5 and update the lock screen


Note:You can also build the CPBitmap yourself using Visual Studio 2010 but you might have to change the code from time to time
if any changes to the cpbitmap has occured. The source code of the project is available here

Monday, June 03, 2013

Getting Public Key Token of Assembly Within Visual Studio

This is a very common Assembly.Load failure exception text. The terminology, this is called Ref-Def-Mismatch. This exception is thrown when your project finds an assembly that does not match what you
are looking for. A very common mismatch is version number. An example is, you asks for version 1.0.0.0, but version 2.0.0.0 is found. (keep in mind that for simply named assemblies, version
number is ignored. So we are really talking about strongly named assemblies here.)

The only time this exception will be thrown is when the mismatched assembly is in your appbase. Visual Studio will probe GAC first. If the assembly is not found in GAC, then it will probe your
appbase. If an assembly is found that matches the simple name, but has mismatch on other part of the assembly name, this exception will be thrown. Say you call
Assembly.Load(”MyAsm,Version=1.0.0.0,Culture=Neutral,PublicKeyToken=0123456789abcdef”, and VisualStudio finds MyAsm.dll in your appbase, but its version is 2.0.0.0, an exception will be thrown at
compilation time.

Regarding binding design decision.

Another interesting observation on this is for dependencies of LoadFrom assemblies. For dependencies of LoadFrom assemblies, we will probe the appbase, then the parent assembly's directory. If a
mismatch assembly is found in appbase, it does not mean a matching assembly won't be found in parent assembly's directory.

To solve this you can force specific version using Strongly named assembly. You must sign the assembly during the build step then reference your project with an assembly already build
in the target folder and then you can edit the project and force a specific assembly version using the PublicKeyToken attribute.

To generate the PublicKeyToken
In Visual Studio, go to the Tools menu and choose External Tools.




That brings up a new dialog window.

Click the Add button and add the following:

Title: Get &PublicKeyToken

Command: C:\Program Files\Microsoft SDKs\Windows\v8.0A\bin\NETFX 4.0 Tools\sn.exe

Arguments: -Tp $(TargetPath)

Check the Use Output Window checkbox. The final looks like this:




Create a project and sign it using a strong name key. Then choose Tools / Get PublicKeyToken, and in the output window you will see something like the following:

Microsoft (R) .NET Framework Strong Name Utility Version 3.5.21022.8
Copyright (c) Microsoft Corporation. All rights reserved.

Public key is

0024000004800000940000000602000000240000525341310004000001000100d59451ff2ed310
447372c4d689f24dcece5aaaef6dddaffc3e43c36a9235586b33ec9e3121ad844ee521bd76fbc0
9a9a357bfeec32d87d8cd1278cd7697667263724e6ff1712e5ee3054542cfbb11b9241da118fbd
c1df7439ba13db77b63f8bf557c7f081946c02e32884c82806e0e95667e879d15b9a2912012398
76e0efa7

Public key token is 9589fa1be527eb6c

You can use the Public Key to force the dependency with a specific assembly.
This is useful for design time assembly or to differentiate assembly limited
in feature with full featured assembly