Tuesday, 6 January 2015

Android Studio Tabs for our App Part 2

Welcome to the second part of the Android Studio App Development Tutorials in Java.
Today we are adding a TabHost to our App and you will also see what we made so far.Next time we will create the Contact List and our own Contact Class.

Android Studio First App Development Part 1

This time we are going to create another App in Android Studio. We aren't actually creating something completely useless and I just wanted to try a different approach at teaching, so I will be creating this project and comment on what I'm doing. Download Code Here

Android Studio Setting up a Project and Gradle

A video showing the new build system gradle for ndroid in android studio and how it differs from eclipse.

Android Studio Getting Started with Android Studio

Android Studio Overview

In this video, We will tell you how to set up Android Studio.Android Studio is the official IDE for Android application development, based on IntelliJ IDEA. On top of the capabilities you expect from IntelliJ, Android Studio offers:
Flexible Gradle-based build system
  • Build variants and multiple apk file generation
  • Code templates to help you build common app features
  • Rich layout editor with support for drag and drop theme editing
  • Lint tools to catch performance, usability, version compatibility, and other problems
  • ProGuard and app-signing capabilities
  • Built-in support for Google Cloud Platform, making it easy to integrate Google Cloud Messaging and App Engine
  • And much more
  • If you're new to Android Studio or the IntelliJ IDEA interface, this page provides an introduction to some key Android Studio features.
    For specific Android Studio how-to documentation, see the pages in the Workflow section, such as Managing Projects from Android Studio and Building and Running from Android Studio.

Friday, 26 December 2014

Show that every graph with two or more nodes there must be two nodes that have equal degree

You can prove it by induction. 
A graph with 2 vertices has either 0 or 1 edges, 
and in either case, the two nodes have the same degree. 

Assume the theorem holds for k vertices and there 
are two (or more) of same degree. 

The existing k vertices have at most (k-2) different 
degrees 1,2, ...., k-1 (with at least one missing, 
and at least one pair). [ by induction hypothesis ] 

Add another node and, one by one, its edges. 

When the first new edge is added, the new node has degree 1, 
and we have one of the following possibilities: 

1) connected to a node with a unique degree: 
Then there was another pair which remains intact. 

2) connected to a member of a pair of same degree. 
a) if there is another pair, that pair remains. 
b) if this was the only pair, let it be degree d and before 
we drew this edge, the list of degrees was 
1, 2, 3, ..., d , d, d+1, d+2, .... k-1 
with one element missing. 
If 1 was missing before, we now have 2 (d+1)s. 
If (d+1) was missing before, we now have 2 (1)s. 
If neither was missing before we now have both of them paired. 

This is the situation for each new edge added, but a different 
constant instead of 1 as the degree of the new node increases. 

Therefore, there is always a pair. 

Tuesday, 23 December 2014

Start a New Cocos2d-x Game

Create A New Project

$ cd cocos2d-x
$ ./setup.py
$ source ~/.bash_profile # may be ~/.bash_login or ~/.profile, depends on your environemnt
$ cocos new MyGame -p com.MyCompany.MyGame -l cpp -d ~/MyCompany
  • MyGame: name of your project
  • -p com.MyCompany.MyGame: package name for android
  • -l cpp: programming language used for the project, valid value is cppand lua
  • -d ~/MyCompany: directory to hold your project
new game
Folder structure of the generated project is as following:
folder structure
(Note: The directory may be different when the project type is lua.)

Build And Run New Project

$ cocos run -s ~/MyCompany/MyGame -p ios
  • -s: directory of the new project. This could be an absolute path or a relative path.
  • -p: which platform to run on. Options are ios,android,win32,mac and linux.
(Note: You are a tmux user, you should add reattach-to-user-namespace before the command cocos. For more information, please refer to this link for more information.)
You can run cocos run --help for more detail information.
run scree

For Win32 Users

using cmd as your shell: cd cocos2d-x-3.1.1\tools\cocos2d-console\bin or to wherever you have this on your filesystem

Then execute something like: cocos.py new YourGameTitle -p com.yourcompany.gametitle -l cpp -d C:\YourGameTitle

Using Cocos2d-x with Visual Studio

Environmental Requirements

Enable to start develop on Windows phone

registe to be a windows phone developer

visit the MSDN's windows phone link of developer register http://msdn.microsoft.com/en-us/library/windowsphone/help/jj206719(v=vs.105))
fill with your windows account and regist Windows phone developer account in steps
explanation of the Windows account:your account of Hotmail or SkyDrive or Xbox LIVE
the fee of developer account: $19 per year, while students account is free but cannot release applications with fees.

Compile and Run the TestCpp Project

  • Download cocos2d-x from our download page and unzip it on your working directory. The structure of the directory should look like as following:
  • Open file "cocos2d-wp8.vc2012.sln" in "build" folder as fllowing:
  • Right click the "cpp-tests" project, and select "Set as StartUp Project", you can select "Emulator" or a "Device" to run project, if you use Device, you need to connect your phone device using usb. 
then you can compile and run the TestCpp project, here is the screenshot in Emulator:

How to debug in project

right click cpp-tests, select "Properties", in "Debug", you can select debug target:
If you select "Managed Only" in "UI Task", it's to debug c# code in cpp-tests. And if you select "Native Only", it's to debug c++ code in cpp-testsComponent. Note that If you select "Native Only" and want to use CCLog function to write log in Output, right click cpp-testsComponent and define "COCOS2D_DEBUG=1" in "Preprocessor Definitions":


Copyright @ 2013 Amanullah Tariq.