Top Menu

Drop Down MenusCSS Drop Down MenuPure CSS Dropdown Menu

Friday, 8 April 2016

COCOS2D-X Installation Guide


COCOS2D-X Installation Guide

This is a guide to setup the cocos2d-x for android in Windows.

1.       Download Android SDK: Instead of downloading only SDK you can download the ADT Bundle which has a collection of Android SDK, Eclipse and Android Plugin for Eclipse. Download the latest version from http://developer.android.com/sdk/index.html. Extract ADT. I extracted in my E:\ Drive. My location of the ADT will beE:\adt-bundle-windows-x86_64-20130717. My location of the SDK will be E:\adt-bundle-windows-x86_64-20130717\sdk. Also remember to update the SDK.Select the latest version of API and also the Android 2.2 (API 8).
 

2.       Download NDK from http://developer.android.com/tools/sdk/ndk/index.html . I am using a 64 Bit Windows 8 OS. So, I downloaded the version android-ndk-r9-windows-x86_64.zip. Extract the NDK to your C:\ Drive. I extracted mine at E:\android-ndk-r9

3.       Download and install Cygwin from http://www.cygwin.com/install.html. Cygwin is a program that enables you to get a Linux feeling on Windows. You can install certain packages on Cygwin and have a minimal Linux like environment. Install Cygwin. When asked to select packages, search for the below packages and install them:
autoconf, automake, binutils, gcc-core, gcc-g++, gcc4-core, gcc4-g++, gdb, pcre, pcre-devel, gawk, make
Note: Select the GUI version of make as well otherwise you will not be able to build your project using NDK.

4.       Download JDK from http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html. No matter if you system is 32 bit or 64 bit, you need to download only the 32 bit version. Install Java in C:\Java

5.       Download the latest version of Cocos2d-X. Extract it to your C:\ Drive. I extracted mine at E:\cocos2d-x-2.2
 
6.       Setup Environment Variables for Java, Cocos2d-x, SDK and NDK:
Mine will look like below:

COCOS2DX_ROOT
E:\cocos2d-x-2.2

ANDROID_SDK_ROOT
E:\adt-bundle-windows-x86_64-20130717\sdk

NDK_ROOT
E:\android-ndk-r9

JAVA_HOME
C:\Java_32_Bit\jdk1.7.0_40\

If you are not sure how to set the environment variables here is a quick guide: http://www.computerhope.com/issues/ch000549.htm


7.       Open Cygwin: Right click on the icon and Run as administrator.

8.       We want to create a new cocos2d-x project now. We will create it for all the platforms and select only the android one later.
cd $COCOS2DX_ROOT
cd tools/project-creator


Now enter the below command to create a new project:
python ./create_project.py -project TestGame -package com.MyCompany.TestGame -language cpp


A new project will be created under the projects directory. For me it will be in the location E:\cocos2d-x-2.2\projects

While running the create_project.py script, If you are seeing some error like:
E:\cocos2d-x-2.2\tools\project-creator>create_project.py -project MyGame -package com.webfolks.AwesomeGame -language cpp
  File "E:\cocos2d-x-2.2\tools\project-creator\create_project.py", line 63
    print "Invalid -project parameter"
                                     ^
SyntaxError: invalid syntax

Perform the below steps to fix this issue:
Put all the print statements in the create-project.py file in paranthesis.

Original statement:
  print "Usage: create_project.py-project PROJECT_NAME-package PACKAGE_NAME-language PROGRAMING_LANGUAGE"

Revised statement:
  print ("Usage: create_project.py-project PROJECT_NAME-package PACKAGE_NAME-language PROGRAMING_LANGUAGE")

9.       Set Permissions: The problem with the generated new project is that, it is generated using a different user in windows and our actual login will not have access to copy or modify it. For this to work, right click on the generated project folder ‘TestGame’ go to the Security Tab, click Advanced and select the first option. Allow, Everyone, Full Control, This folder subfolders and files. Screen shots below.



Also check the option ‘Replace all child object permission entries with inheritable permission entries from this object’ This will modify the permissions for all subfolders.

10.   Now we are done creating a project. To import this to Android we need to build the generated project with NDK. To do this go to cygwin and navigate to the TestGame folder that we created.

     

Now go to the proj.android folder. Here, we need to run the build_native.sh script. Enter the command:
./ build_native.sh

It will take a while for the build to complete.

Most of you might see an error like:
cygwin warning:
  MS-DOS style path detected: E:\android-ndk-r9/ndk-build
  Preferred POSIX equivalent is: /cygdrive/e/android-ndk-r9/ndk-build

One way to fix this is to go the environment variables and change the NDK_ROOT from E:\android-ndk-r9 to /cygdrive/e/android-ndk-r9/ndk-build . If you do this you need to restart cygwin and run the build_native.sh.

I prefer an alternate method where I will edit the build_natiive.sh file and set the NDK_ROOK temporarily.

In Windows, go to the newly created project folder ‘proj.android’ and then navigate to proj.android. Here you will see a file called build_native.sh. Open this file in any of the text editor and add the below line in the second line:

set $NDK_ROOT = "/cygdrive/e/android-ndk-r9/ndk-build";

With this step there is no need to restart cygwin.

11.   Now, in cygwin go to the newly created project folder and go to the proj.android folder. Now run the command :
./ build_native.sh

It would take a while for your project to be built.

12.    Once this is done copy the entire project to any other location, I choose Desktop\Cocos_Games. Open Eclipse(Remember, you dowloaded the ADT from Android site for SDK and Eclipse), and import the new project. File > Import > Existing Android Code Into Workspace > Next
In the Root Directory click on Browse and navigate till proj.android and click ok.
Note: Do not select ‘Import to Workspace’ Option.

13.   You will see some errors in the imported project saying that it certain cocos2d import statements failed to be imported. To fix this follow the below steps(Thanks to Paras Mendiratta):

 1: In Eclipse, right-click on your project and select the last option "properties".
2: In Project Properties window, select "Java Build Path" in the left pane.
3: Under Java Build Path, select tab "source". It should be selected by default.
4: Click on button "Link Source"
5: Browse it to following location-> COCOS2D-X_INSTALLATION_FOLDER/cocos2dx/platform/android/java/src. My path will be: E:\cocos2d-x-2.2\cocos2dx\platform\android\java\src
6: Give any folder name. For example, remove src and replace it with: Cocos2d-x-source. Click Finish.


We are done now. Run your poject on an Andorid Device and it should show you the new cocos2d-x logo. Please note that running this in an Android Virtual Machine may not always work.
Read more...

Monday, 4 April 2016

How to install WordPress locally using WAMP server

Its good to have local instance of WordPress on your Computer when you want to test a theme or activate your website live, you can test any plugin too before activating it.

 

How to install WordPress locally using WAMP


Before you install WordPress on your computer you will need two things:
  • A WAMP server to install the WordPress
  • A copy of WordPress
What is WAMP?

WAMP or WampServer is nothing more than a compilation of Apache web server, PHP and MySQL bundled together for Windows computers.
It’s what you need to setup your own local server environment and install WordPress on Windows. It is free and easy to use.

Step 1: First, you need to download WAMP from their here.

Step 2: Now download a copy of WordPress from WordPress.org.

Step 3: As already explained in the beginning, WampServer comes with phpMyAdmin, a web-based application to manage MySQL databases. Click on the WampServer icon in the windows taskbar and then click on phpMyAdmin.


phpMyAdmin will open in a new browser window. Click on Databases in phpMyAdmin to create a new database for WordPress. Choose a name for your database, set the collation to utf8_general_ci and click on Create button. 

Step 4: Next, go to the folder where you downloaded WordPress, extract the zip file and copy the wordpress folder to C:\wamp\www. You can rename the wordpress folder to anything you want for example mysite, myblog, demosite, etc. Here for this tutorial, we renamed our wordpress directory to ambedkarmission.

Step 5: Open your browser and type: http://localhost/name-of-your-wordpress-folder (as already renamed the directory so it will be http://localhost/ambedkarmission).

Step 6: WordPress will inform you that it can not find a wp-config.php file. Click on the Let’s go button to create it.

Step 7: On the next screen, you need to provide your database information. The database name will be the one that you entered in Step 4. In our case, we called it ambedkarmission.

Keep in mind that your default database username will be root and the password will be blank. Click on the submit button and WordPress will create a configuration file for you.

Step 8: After this you will see a screen informing you that WordPress has successfully created the configuration file, and you can proceed with the installation. Click on the Run Install button.

Step 9: On the next screen, fill out the installation form. You need to provide a title for your website, choose an admin username and password and provide an admin email address. Finally press the Install WordPress button.

Step 10: WordPress will now run the installation and create database tables. Once done, you will see a success message after the installation. You can then proceed to your WordPress by clicking on the Login button.

Congratulations, you have successfully installed WordPress on your computer!
Read more...

Wednesday, 30 March 2016

Add 'Read More.." button in your Blogger/Blogger Post

Why Add 'Read More' button ?
Answer is here, Once you look for any content on any site there are lots of information present on the website. So all the information can not be shown on one page and to do that we need to show post/content with few detail with Read More option. And the user need to select this button to view the detailed information.

How to Add Auto 'Read More..' button ?
1. Login in to your blogger website
2. Go to Template -> Edit HTML
3. Go to HTML details and press Ctrl + F (for searching) and look for
<data:post.body/>
4. Replace the above code with below code
<b:if cond='data:blog.pageType == &quot;item&quot;'>
<data:post.body/>
<b:else/>
<b:if cond='data:blog.pageType == &quot;static_page&quot;'>
<data:post.body/>
<b:else/>
<div expr:id='&quot;summary&quot; + data:post.id'>
<data:post.body/>
</div>
<script type='text/javascript'>
createSummaryAndThumb(&quot;summary<data:post.id/>&quot;);
</script>
<div style='clear: both;'/>
<span class='rmlink' style='font-weight:bold;padding:5px;float:right;text-align:right;'><a expr:href='data:post.url'>Read more...</a></span><a href='http://www.pkrkinth.blogspot.com'/>
</b:if>
</b:if>
Note - If <data:post.body/> is present at more than one place then replace it at all places.

5. Now search for
<head/>
6. Copy paste the below code above of <head/>
<script type='text/javascript'>
var thumbnail_mode = "no-float" ;
summary_noimg = 400;  /* Summary length if no image*/
summary_img = 300; /* Summary length with image*/
img_thumb_height = 200; /*Image Height*/
img_thumb_width = 200; /*Image Width*/
</script>
<script type='text/javascript' src='http://netoopscodes.googlecode.com/svn/branches/Js%20files/auto-readmore-blogger.js' ></script>
7. Save the Template.

Congratulations!!! You are done.
Read more...

Tuesday, 29 March 2016

How to add Facebook like Fanpage in Blogger

Facebook like fanpage box is best way to promote your website or blog. This facebook like fanpage box will help your visitor to become regular reader just by clicking like button. So that this box will increase number of your facebook fans. To get this widget follow below procedure,

Here is the steps to add facebook fanpage box -

1. Login to blogger account
2. Go to Layout -> Add A Gadget
3. Select HTML / Javascript > Paste The Following Code In content Box


<iframe src="//www.facebook.com/plugins/likebox.php?href=http://www.facebook.com/weesync/?ref=aymt_homepage_panel&width=292&height=258&colorscheme=light&show_faces=true&border_color&stream=false&header=false&" style="border:none; overflow:hidden; width:292px; height:258px;" ></iframe>

Replace my facebook page URL with your page URL, Change Width And Height According To Your Template.

4. Now Save and you are done!
Read more...