logo
Login

Sponsored Links

FrontPage Posts

A StopWatch Game in Python

Project

Build a simple digital stopwatch that keep
track of the time in tenths of a second.  The stopwatch should contain
"Start", "Stop" and "Reset" buttons.  To help guide you through this
project, we suggest that you download the provided program template for this project and build your stopwatch program as follows:

Mini-project development process

  1. Construct a timer with an associated interval of 0.1 seconds
    whose event handler increments a global integer.  This integer will keep
    track of the time in tenths of seconds.  Test your timer by printing
    the global integer to the console. To stop the timer and print
    statements, use the reset button in upper left. Important: Do not
    use floating point numbers to keep track of tenths of a second!  While
    it's certainly possible to get it working, the imprecision of floating
    point can make your life miserable.  Use an integer instead, i.e., 12
    represents 1.2 seconds.
  2. Write the event handler function for the canvas that draws the
    current time(simply as an integer, you should not worry about formating
    it yet) in the middle of the canvas. Remember that you will need to
    convert the current time into a string using str before drawing it.
  3. Add "Start" and "Stop" buttons whose event handlers start and
    stop the timer.  Next, add a "Reset" button that stops the timer and
    reset the current time to zero.
  4. Next, write a helper function format(t) that returns a string of the form A:BC.D where A, B, C and D are digits in the range 0-9.  Test this function independent of your project.  Note that your helper function format should always draw leading zeros correctly.  For example
    • format(0) == 0:00.0
    • format(11) = 0:01.1
    • format(321) = 0:32.1
    • format(613) = 1:01.3

    Hint: Use integer division and remainder (modular arithmetic) to
    extract various digits for the formatted time from the global integer
    timer.

  5. Insert the format function into your canvas event handler will complete the stopwatch.
  6. Finally, to turn your stopwatch into a test of reflexes, add to two
    numerical counters that keep track of the number of times that you have
    stopped the watch and how many times you manage to stop the watch on a
    whole second. These counters should be drawn in the upper lefthand part
    of the stopwatch canvas in the "x/y" where x is the number of successful stops and y
    is number of total stops.  My best effort at this simple game is around
    a 25% success rate.  Note that hitting the "Stop" button when the timer
    is already stopped should not change your score.
  7. Modify "Reset" so as to set these number back to zero when clicked.

     The output would look something like this.

Python stop watch

Using Location Services in Android

Android Location ServicesNeed help with directions? Or want to know where you are? Google Maps is one of the great service that Google provides to the masses free of cost. Using Maps in your android application is easy as long as you know what you are doing. In this tutorial I will demonstrate a simple application which will display your current position in a map and update it every time you move.

Step 1: Get a Google Maps API key
Before doing anything you need to get a MD5 key which will allow you to use the API in your application. To get a key you first need to create a simple certificate fingerprint. For this tutorial I have created a SDK Debug Certificate which has to be used for development. I am using eclipse for developing this application so to create the certificate I first needed to locate my debug.keystore file. I found the location in Eclipse by using Window->Preferences->Android->Build. Once I got the location I ran a simple command on the command prompt:

Building Live Stock Quotes App in Android

Stock Ticker App Android

Web Services and Service Oriented Computing has revolutionized the internet in the past decade. It is quite true that without web services most Apps in the App Store will not be that interesting!!

Mobile devices have a limited processing power so it becomes necessary to let a web server do the heavy lifting when it comes to computation. So in this tutorial I am bringing you a way to use RESTful webservice in your android app and parse the XML response.

The example web service that I am using is here. This web service lets you access current price of Stock based on its trading symbol.

Step 1: Know Thy Web Service

Before calling any web service you must know how to call it and what you will get in response. This web service is a RESTful service so calling it is easy using a GET request.

  1. GET /stockquote.asmx/GetQuote?symbol=string HTTP/1.1
  2.  
  3. Host: www.webservicex.net

Sending SMS using Android

Sending SMS Android AppSMS - Short Message Service is very effective and quick way of communication. Your app may have a use case wherein it needs to send SMS to someone. So lets see how it can done, it is relative simple as you would see below:

Step 1: Creating the project
This is the simplest step of them all. Just go to your project wizard and create a new project with the following details:

Project name: SendSms2.3
Application name: SendSms2.3
Package name: send.sms
Minimum Required SDK: API 8
Target SDK: API 10
Main Activity: SendSmsActivity
Layout name: main

Building Paint like Application in Android

Android Paint AppWhat was the first thing that you did when you logged on to a Computer the first time? For me, it was Microsoft Paint. As a child who never drew a circular-circle in her entire life, it was exciting to draw perfect circles, rectangles and straight lines. And now when I see kids painting their first painting on an Android app it reminds me of my childhood.

A Simple Quiz Game in Andriod

Quiz Android App

In this post, I am bringing you a simple trivia quiz. The subject of questions is computer science in this app but I think it is obvious that you can keep it any way you like. The app in this tutorial reads questions from a database and marks you out of 5 for your performance. The questions are asked one by one  using a single layout as you will see as I proceed.

Game development in Python

Python Game Development

The scripting language Python is easy to use, and thus very convenient to program simple games. And to make it even simpler, there one Python module which is dedicated to games creation: pygame. It makes you life much easier when programming a game as it takes care of the user input, the graphics and the sound effects.

To install it, if you are using Ubuntu as I did for this tutorial, you can simply install it by typing this command in a terminal:

sudo apt-get install
pygame

If you are using another
operating system, please refer to the
downloads page
of the pygame website.

HTML5 specific new tags

Review HTML5 new Tags

The web has significantly evolved during the last years. Blogs, social networks, and web-based applications are some modern applications of the Internet that were never even imagined when the HTML 4.01 specification was released in 1999. Basically, what HTML5 adds compared to the previous specification is a brand new set of tags to improve the functionalities of HTML.

Essential Keyboard Shortcuts for XCode 4?

XCode 4 ShortcutsWith the introduction of XCode 4, a lot of shortcuts have changed. There are a lot of shortcuts but its kind of difficult to remember all, esp. when you are new to XCode knowing the most common shortcuts will give you most bang for you buck. The following are the most essentials ones that any developer would need to learn to be productive.

 

Building a TODO List app in Android using SQLite

Android SQLite Todo ListStoring data locally in Android is very easy. Here are few ways we can do it:

  1. Using SharedPreferences
  2. Using Files
  3. Using SQL databases.

This tutorial will tell you how to save data using SQL databases. For this we are taking a very simple application which stores a very simple list of tasks with their boolean status: done or not done.

The Database

The database contains only one table called "task" which has the following columns:

  1. Id
  2. Task
  3. Status

This tutorial will show us how to save data in a SQL database. For this we are would build a very simple application which stores a list of tasks with their boolean status(whether done or not done).

Subscribe & Follow

RSS Feed Follow me on Twitter! Follow me on Facebook! Follow me on Youtube!
Feed via Email:

Sponsored Links

Facebook

Sponsored Apps

Job Change Alert for Linkedin


Contact2CRM for Salesforce


Advertise on DeveloperFeed

About

Manpreet is an Architect & Software developer currently focusing on developing mobile apps on the iOS (iPhone/iPad) Platform. He’s the founder of a small iPhone development studio
called Livrona.

Subscribe to Developer Feed iPhone Blog

Tags

Who's online

There are currently 2 users and 1 guest online.

Online users