Friday, September 21, 2012

App Icons on iPad and iPhone


iPhone-only Apps

Include the following in your application's Resources group in the Xcode project:

Table 1  iPhone-only apps icon requirements.
Image Size (px)
File Name
Used For
Required Status
512x512iTunesArtworkAd Hoc iTunesOptional but recommended
57x57Icon.pngApp Store and Home screen on iPhone/iPod touchRequired
114x114Icon@2x.pngHome screen for iPhone 4 High ResolutionOptional but recommended
72x72Icon-72.pngHome screen for iPad compatibilityOptional but recommended
29x29Icon-Small.pngSpotlight and SettingsOptional but recommended
50x50Icon-Small-50.pngSpotlight for iPad compatibilityRecommended if you have a Settings bundle, otherwise optional but recommended
58x58Icon-Small@2x.pngSpotlight and Settings for iPhone 4 High ResolutionRecommended if you have a Settings bundle, otherwise optional but recommended

iPad-only Apps

Include the following in your application's Resources group in the Xcode project:

Table 2  iPad-only apps icon requirements.
Image Size (px)
File Name
Used For
Required Status
512x512iTunesArtworkAd Hoc iTunesOptional but recommended
72x72Icon-72.pngApp Store and Home screen on iPadRequired
50x50Icon-Small-50.pngSpotlight on iPadOptional but recommended
29x29Icon-Small.pngSettings on iPadRecommended if you have a Settings bundle, otherwise optional but recommended

Universal Apps

Include the following in your application's Resources group in the Xcode project:

Table 3  Universal apps icon requirements.
Image Size (px)
File Name
Used For
Required Status
512x512iTunesArtworkAd Hoc iTunesOptional but recommended
57x57Icon.pngApp Store and the Home screen on iPhone/iPod touchRequired
114x114Icon@2x.pngHome screen for iPhone 4 High ResolutionOptional but recommended
72x72Icon-72.pngApp Store and Home screen on iPadRequired
50x50Icon-Small-50.pngSpotlight on iPadOptional but recommended
29x29Icon-Small.pngSettings on iPad and iPhone, and Spotlight on iPhoneRecommended if you have a Settings bundle, otherwise optional but recommended
58x58Icon-Small@2x.pngSpotlight and Settings for iPhone 4 High ResolutionRecommended if you have a Settings bundle, otherwise optional but recommended

Add Icon files in Info.plist

To add the Icon files entry you will need to manually edit your Info.plist.
Open your Info.plist in Xcode, and locate the "Icon file" entry. Click on the plus (+) button at the end of the entry to make a new key entry. as shown in Figure 2.
Figure 2  Add a new entry under "Icon file" key

Then, type "Icon files" in the key column (notice the "s" added), or choose "Icon files" from the drop down list, as shown in Figure 3.
Figure 3  Add "Icon files" key in Info.plist

Next, turn down the disclosure triangle on "Icon files" and add the entries for the icons for your application, as shown in Figure 4 and Figure 5:
Figure 4  Add icon file entries for iPhone-only or Universal apps.
Figure 5  Add entries for iPad icon files.

Install apps on devices without certificate


         As you know to distribute the applications in App Store or even to debug them on real device according to Apple you have to pay $99 to achieve the provisiong and distribution certificate.But of course as you know, there are always other ways to achieve the similar result. But 1st. your device has to be jailbroken and 2nd. you can distribute your app only among jailbroken devices via Cydia, Icy or less friendly through SSH. It has advantages and disadvantage. Not all iPhones and iPod touches are jailbroken (I guess maybe 10% are), but you don’t have to obey the rules from Apple about submitted apps and you don’t have to wait at least one week for the review result.

Tasks you need to do only once (for developer):

  1. Jailbreak your iPhone
  2. Install LDID (Link Identity Editor), Mobile Termial and OpenSSH from Cydia
  3. Go to /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.sdk/
    I personally tested in on 3.0 that’s why I put that in bold, if you are going to built your app on a higher SDK, go to the appropriate directory.
  4. Open the SDKSettings.plist in your favorite editor (I recommend Property List Editor in Utilities) and in Root -> DefaultProperties set CODE_SIGNING_REQUIRED = NO. BTW check ifAD_HOC_CODE_SIGNING_ALLOWED equals NO and CODE_SIGNING_ENTITLEMENTS is blank.
  5. Save the file.

Please remember: modification of above .plist file simply allows you to build the package without signing it, so from now, you are able both to built package for Cydia and AppStore submission. Of course for App Store submission you provide a Distribution profile, for Cydia “Don’t Code Sign” in your project info under BuildCode SigningCode Signing IdentityAny iPhone OS Device.


Tasks you need to do for every package (developer):

  1. Build your project without signing it (Don’t Code Sign).
  2. SSH your bundle to /Applications on your device. You can use Fugu for Mac or  WinSCP for Windows.
  3. Now you have to fake-sign it to make it working. Open Mobile Terminal and type:
    su root
    you will be asked for password, by default: alpine. Next:
    ldid -S /Applications/My\ Project\ Name.app/My\ Project\ Name
    make sure every space in name comes with the backslash before
  4. If any error occurs, it means that you have provided wrong file path or didn’t built it with “Don’t Code Sign”.
  5. Now you can test your application, how it works on real device with full touch control, accelerometer and device’s performance, it’s really different from the Simulator.
  6. If everything works correctly download the file that you modified with ldid – it’s the file named exactly the same as your project without any extensions, and replace it with original from your bundle.
  7. Now you can distribute it in your own way.


Tuesday, September 11, 2012

Installing Android SDK in ubuntu 12.04

The Android SDK provides you the API libraries and developer tools necessary to build, test, and debug apps for Android. You can download AndroidSDK package by running the commands below. At the time of this writing, the current version was r20. Or click this link to download the .tgz archive file.

                          
wget http://dl.google.com/android/android-sdk_r20-linux.tgz

After downloading, run the commands below to extract the downloaded file.
tar -xvzf android-sdk_r20-linux.tgz

After extracting the package, run the command below to change into the tools directory.
cd ~/android-sdk-linux/tools


Finally, run the commands below to begin the installation.
./android

Install Android updates if there are any available.

android_precise_5



After updating, run the commands below to include AndroidSDK in your path environment.
gedit ~/.bashrc

Then add these lines at the very top of the file and save it.
export PATH=${PATH}:~/android-sdk-linux/tools
export PATH=${PATH}:~/android-sdk-linux/platform-tools

android_precise_6


Log out and log back in, then type android on the command line to launch the software.
android

Build your own phone.

android_precise_7

Monday, September 10, 2012

Install the Oracle JDK 6

Install the Oracle JDK 6

Oracle themselves have the official guide to install their JDK - below is based upon those instructions.
  • Download the 32bit or 64bit Linux "compressed binary file" - it has a ".bin" file extension
  • Give it permissions to execute and extract it
    chmod a+x [version]-linux-i586.bin
    ./[version]-linux-i586.bin
During installation it will ask you to register - press ENTER. Firefox will open with the registration page. Registration is optional.
JDK 6 package is extracted into ./jdk1.6.0_x directory, for example ./jdk1.6.0_30.
Lets rename it:
mv jdk1.6.0_30 java-6-oracle
  • Now move the JDK 6 directory to /usr/lib
sudo mkdir /usr/lib/jvm
sudo mv java-6-oracle /usr/lib/jvm

switch to Oracle JDK 6

webupd8.googlecode.com hosts a nice-easy script to help with this.
wget http://webupd8.googlecode.com/files/update-java-0.5b
chmod +x update-java-0.5b
sudo ./update-java-0.5b
don't worry - 0.5b refers to the script version - not the version of java!
An alternative to this is to use the webupd8 ppa and the update-java package.
enter image description here
Finally test the switch has been successful:
java -version
javac -version

Sunday, September 9, 2012

AUTO INCREMENT BUILD NUMBER IN XCODE 4.2


         Going forward, if you look on the Info tab for your Application Target, you should use the "Bundle versions string, short" as your Version (e.g., 3.4.0) and "Bundle version" as your Build (e.g., 500 or 1A500). If you don't see them both, you can add them. Those will map to the proper Version and Build textboxes on the Summary tab.

There are all sorts of schemes, but a popular one is:
{MajorVersion}.{MinorVersion}.{Revision}
  • Major version - Major changes, redesigns, and functionality changes
  • Minor version - Minor improvements, additions to functionality
  • Revision - A patch number for bug-fixe

Then the Build is used separately to indicate the total number of builds for a release or for the entire product lifetime.
Many developers start the Build number at 0, and every time they build they increase the number by one, increasing forever. In my projects, I have a script that automatically increases the build number every time I build. See instructions for that below.
  • Release 1.0.0 might be build 542. It took 542 builds to get to a 1.0.0 release.
  • Release 1.0.1 might be build 578.
  • Release 1.1.0 might be build 694.
  • Release 2.0.0 might be build 949.

Auto-incrementing build numbers in Xcode

It's a pain to build project in Xcode only to find out later that you forgot to update the build number.
In Xcode 4.2:
  1. Load your Xcode project.
  2. In the left hand pane, click on your project at the very top of the hierarchy. This will load the project settings editor.
  3. On the left-hand side of the center window pane, click on your app under the TARGETS heading. You will need to configure this setup for each project target.
  4. Select the Build Phases tab.
  5. At the bottom right, click the Add Build Phase button and select Add Run Script.
  6. Drag-and-drop the new Run Script phase to move it to just before the Copy Bundle Resourcesphase (when the app-info.plist file will be bundled with your app).
  7. In the new Run Script phase, leave the Shell: /bin/sh value alone. Copy and paste the following into the script area for integer build numbers:
# echo $(/usr/libexec/PlistBuddy -c "Print CFBundleVersion" "$INFOPLIST_FILE")
buildNumber=$(/usr/libexec/PlistBuddy -c "Print CFBundleVersion"${PROJECT_DIR}/${PROJECT_NAME}/${PROJECT_NAME}-Info.plist)
echo "Current Build version $buildNumber"
(( buildNumber += 1 )) #increment build number by one
echo "New Build version $buildNumber"

/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $buildNumber"${PROJECT_DIR}/${PROJECT_NAME}/${PROJECT_NAME}-Info.plist


Note you can view the echo message at log navigator in xcode.

You can access the version information using the following code
--------------------------------------------------------------
NSString * version = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleVersion"];
NSString * buildNo = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBuildNumber"];
NSString * buildDate = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBuildDate"];
NSLog(@"Application Version: %@ Build No: %@ Build Date: %@",version,buildNo,buildDate);

Thursday, September 6, 2012

Installing wordpress in ubuntu

WordPress is a popular blogging tool powered by PHP and MySQL. WordPress has many features including plug-in support, customizable templates, and widgets that can be re-arranged easily without inserting a single PHP or HTML code. It can be easily customized into a content management system (CMS).

In this guide we will show you how to install the latest WordPress version locally on a system running Ubuntu 11.10/12.04 or older. To be able to install WordPress on Ubuntu, you need first to install a web server supporting PHP and MySQL. You can find here a tutorial explaining how to install LAMP (Linux,  Apache, MySQL, PHP) on Ubuntu.

WordPress Installation

1. Download first the latest WordPress version (currently v3.2.1) using this command from the terminal:

wget http://wordpress.org/latest.tar.gz

2. Extract the archive file with this command:

tar -xzvf latest.tar.gz

3. Create now a folder for WordPress in the /var/www directory using this command:

sudo mkdir /var/www/wordpress

4. Now move all WordPress files to this created folder using this command:

sudo cp -r ~/wordpress/* /var/www/wordpress

5. If you are installing WordPress in a subdirectory not in the root directory (/var/www), then edit the apache2.conf file with this command:

sudo gedit /etc/apache2/apache2.conf

And at the end of the file, insert this line:

AddType application/x-httpd-php .html




Save the file and close it.

6. Restart now Apache with this command:

sudo /etc/init.d/apache2 restart

7. Now we need to create a new MySQL database with a user having all privileges for accessing it. These details will be then inserted in the config file for WordPress. To create a new database, you may use phpMyAdmin, or simply run this command to login to the MySQL server (use the password you assigned to your MySQL server during LAMP installation):

mysql>

8. Create now a new database with this command (replace WordPress with any other name of your choice):

CREATE DATABASE WordPress;

If the command is successful, the returned output will be similar to this:

mysql> CREATE DATABASE WordPress;
Query OK, 1 row affected (0.01 sec)            

9. Add now a new user with this command (replace "username" with any name of your choice):

CREATE USER username;

10. Assign a strong password to this new user with this command (replace "123" with your own password):

SET PASSWORD FOR 'username' = PASSWORD('123');

11. Grant now this user all privileges for the created database with this command:

GRANT ALL PRIVILEGES ON WordPress.* TO 'username' IDENTIFIED BY '123';

- WordPress --> Replace it with the name of the created MySQL database.
- username --> Replace it with the username you have just created.
- 123 --> Replace it with the password you assigned to the MySQL user.

12. Once you finish, run this command to exit the MySQL server:

exit

13. Rename now the wp-config-sample.php file to wp-config.php using this command:

sudo cp /var/www/wordpress/wp-config-sample.php /var/www/wordpress/wp-config.php

Note: If you are installing in another directory, then correct the given path to your own.


14. Edit now the wp-config.php file with this command:

sudo gedit /var/www/wordpress/wp-config.php

Insert now your MySQL settings you have just created by replacing:

- database_name_here   ---> with the database name you have created. For this tutorial, it's named "WordPress".
- username_here  ---> with the MySQL user you have created earlier.
- password_here  ---> with the password you assigned to the MySQL user.





Save your file and close it.

15. Open now one of these two links to set up your WordPress admin details (you will be redirected automatically):

http://localhost/wordpress/
or
http://127.0.0.1/wordpress/

16. Fill now in the following web forms, then click Install WordPress:

  • Site Title
  • Username
  • Password
  • Your E-mail



17. Login now to the admin section using the password you selected to start managing your blog:



18. Congratulations! Your WordPress blog is now successfully installed. Your blog is live at this link:

http://localhost/wordpress/


                                         
The admin section can be accessed here:

http://localhost/wordpress/wp-admin/






That's it.

Installing Xampp-1.7.7 Web server in Ubuntu 11.10 or above

Installing Xampp-1.7.7 Web server in Ubuntu 11.10

If you are a web designer/developer, you need to have a running local server to test your website. Installing a full pledged server and all of its components manually is a very tedious task because you first need to install the actual server (like apache) then download all modules that you need (MYSql, PHP, etc) and configure them to make all the bits and pieces to work together. Thanks to folks at apachefriends.org, we can have a working server with all of the required modules (Apache, PHP, MYSql, etc) just by installing a single application called Xampp. In this post we will see how to install Xampp-1.7.7 on Ubuntu 11.10.

Download the package

Fire up the terminal and issue the following command to download the .tar.gz package


If the download is interrupted for some reason, fear not, because wget can resume interrupted downloads. Simply execute the following command


Observe the -c switch in the command, it tells wget to resume the previously interrupted download.

Extract Contents

After the downloading is finished, extract the tar package into /opt directory.




sudo tar xvfz xampp-1.7.7.tar.gz -C /opt

You need root password to run the following command.

Start the Server

If the above command executed with no errors, then, the server is correctly installed. Now to start the server, issue the following the command
1sudo /opt/lampp/lampp start
Point to note, xampp under linux is called lampp.
To check if the server is running open any web browser and type http://localhost in the address bar. You should see the following welcome screen.

XAMPP Splash Screen

Shutdown the Server

If you need to shut down the server, run the following command in the terminal

sudo /opt/lampp/lampp stop

Adding Custom .html pages

Ok, you got server up and running, but where should you put your html files? By default Xampp (Apache) expects all your website related files inside /opt/lampp/htdocs folder. Let us create a test page, test.html, with the following contents,

    My Test Page

</pre>

<h3>This is a test page</h3>

<pre>
Now if you try to save the file in /opt/lampp/htdocs/ directory, you will get an error because of authentication problem. This is because, currently only root has access to /opt/lampp/htdocs/ directory

Authentication Issue

The following commands solves the authentication issues,

sudo adduser USERNAME www-data

sudo chown -R USERNAME:www-data /opt/lampp/htdocs

sudo chmod -R g+rw /opt/lampp/htdoc
Replace USERNAME with your username. What the above commands actually does is
  1. It adds you (User) to www-data (Group)
  2. Changes the ownership of the /opt/lampp/htdocs directory so that you will be the owner.
  3. Issue read+write permissions to the group www-data
Now, you can add the file, test.html, to /opt/lampp/htdocs folder. If everything is done correctly, you can view the file from browser by clicking this link http://localhost/test.html.

Create symbolic link [optional]

To make things simple, you can create a link in your home folder that points to /opt/lampp/htdocs folder

sudo ln -s /opt/lampp/htdocs /home/USERNAME/htdocs
So that’s it for now. In the next post, I will tell you how to host multiple websites in your local server…

Saturday, September 1, 2012

Upgrade to Ubuntu 12.04 from Ubuntu 10.04 via the Terminal

Few weeks back we showed you how to upgrade to Ubuntu 12.04 from 10.04. That tutorial showed you how to do it from Ubuntu Desktop. Doing it from the desktop is easy and is the best option for new users. To read that post, click here.
However, Ubuntu can also be upgraded via the command console and for some users, this method is the easiest and fastest. This brief tutorial will show you how to upgrade Ubuntu via the command console if you prefer this method.

Objectives:
  • Upgrade to Ubuntu 12.04 (Precise Pangolin) from Ubuntu 10.04 (Lucid Lynx) via the Terminal
  • Enjoy!

To get started, press Ctrl – Alt – T on your keyboard to open the Terminal. When it opens, run the commands below to install update-manager-core if isn’t already installed.

sudo apt-get install update-manager-core


update_to-precise-from-10_3

Next, run the commands below to open update-manager’s release upgrade file.
sudo vi /etc/update-manager/release-upgrades

update_to-precise-from-10

Then, change the line below from prompt=lts to prompt=normal.  To change it, scroll down to the line press the X key on the keyboard to delete each character. Then hit the I key and begin typing the new line. When you’re done, press Esc key, then type :wq to save and exit.

update_to-precise-from-10_1

Next, run the commands below to update all packages installed before you upgrade.
sudo apt-get update && sudo apt-get upgrade

update_to-precise-from-10_4

Finally, run the commands below to begin the upgrade process.
sudo do-release-upgrade

update_to-precise-from-10_5

When ask if you want to continue with the upgrade, type Y for yes.

Enjoy!