Category Archives: Android

Using your Camera to Search an image or item in Google

Have you ever passed by an item in a store or a mall and wanted to know the name of that item and other information like what it is for, how much is it, where else I can buy it from.

Or when you were on a trip to a museum or a tourist on vacation some place  foreign and saw an artifact or a piece of art or maybe a historical landmark and wanted to know the background of it,

Or even in a bookstore to check on a book or a grocery store to check out some new food items.

Well, there is an App that will make your life much easier in getting information just by using your phone camera. Point your phone camera at something and Google Goggles will find out all about it for you.

google goggles

While tapping the search box on the home screen and typing a word or phrase is straightforward, Google Goggles provides a different way to search: by using the camera. This has many benefits and one of its great features is its ability to recognise famous landmarks. Just point your device at the landmark and in seconds Goggles has analysed the scene and recognised it. It then shows one or more links to information on the web, Wikipedia entries and so on. Google Goggles can recognise books and DVDs. Just point the camera at the item and it scans it, then provides a series of links at the foot of the screen, such as the author, artist and so on. It can recognise barcodes on products and by using this to identify the item, you can follow the links to discover where you can buy it online and who has the best shopping deals. It recognises text and can add contacts by scanning business cards. Paintings and photos are recognised. It’s a handy way to search.

How to Use:

1: Choose the network

goggles01

If you want to use Goggles when you are out and might not have a Wi-Fi connection, select the first option. Bear in mind that it uploads photos and uses a fair amount of data.

2: Point and scan

goggles02

Point the camera at something and hold it steady for a second. If it recognises items in the frame, it automatically takes a snapshot, but you can also tap the camera button.

3: View the results

goggles03

One or more items in the image may be recognised. Here it has detected three and displayed them as a series of links at the bottom of the screen.

4: Start a search

goggles04

Tapping one of the recognised items at the bottom performs a web search. Here we tapped on the photo, which it recognised, and there are Wikipedia entries and more.

5: Share your results

goggles04b

You can share your results to your friends and families to give them information if ever they have the same interest or they have asked you to research on that item.

6: Scan barcodes

goggles05

Any item with a barcode can be scanned and this enables the item to be instantly recognised.

7: Go shopping

goggles06

It assumes you might be interested in buying this item and it therefore shows links to places where you can buy it online. There are options to show videos, images and more.

And so before your next trip in the mall, in the streets, or to another country, get your google goggles installed and ready to bring out the best information that search can provide by a click of the camera shutter.

 

 

 

 

 

 

 

 

 

How to get started in Android Development

One of the challenges on shifting and venturing to another programming language or platform is having to figure out how to setup the right environment and tools needed for that language or platform.

In Android, the people in Google made this task the least painstakingly as possible . To get started developing in Android, you will only need to download the ADT (Android Developer Tools) Bundle. You can download this from http://developer.android.com/sdk/index.html#download

This bundle includes the following:

Eclipse
an integrated development environment used for Android development. Because Eclipse is also written in Java, you can install it on a PC, a Mac, or a Linux computer. The Eclipse user interface follows the “native look-and-feel” of your machine, so your screen may not look exactly like the screenshot below:

eclipse_ide

Android Developer Tools
a plug-in for Eclipse.  As of this writing (July 2014) , version of ADT (Android Developer Tools) is 23.0.2 You should make sure
you have that version or higher.

Android SDK
the latest version of the Android SDK tools and Android platform-tools for debugging and testing your apps, a system image for the Android emulator lets you create and test your apps on different virtual devices

After downloading, you just need to extract it to your local drive and run the eclipse application executable file under the bundle and eclipse folder.

That simple!

The only extra effort you need to do aside from the above is if your Java Runtime Environment version installed in your local machine is not compatible with the minimum requirement of the Android SDK. In this case, you only need to upgrade or install your Java Runtime Environment version to the latest one (check https://www.java.com/en/download/).

Next stop in this journey is learn android development

A Basic MySQL Tutorial

About MySQL

MySQL is an open source database management software that helps users store, organize, and retrieve data. It is a very powerful program with a lot of flexibility—this tutorial will provide the simplest introduction to MySQL

How to Install MySQL on Ubuntu and CentOS

If you don’t have MySQL installed on your droplet, you can quickly download it.

Ubuntu:

sudo apt-get install mysql-server

Centos:

sudo yum install mysql-server
/etc/init.d/mysqld start

How to Access the MySQL shell

Once you have MySQL installed on your droplet, you can access the MySQL shell by typing the following command into terminal:

mysql -u root -p

After entering the root MySQL password into the prompt (not to be confused with the root droplet password), you will be able to start building your MySQL database.

Two points to keep in mind:

  • All MySQL commands end with a semicolon; if the phrase does not end with a semicolon, the command will not execute.
  • Also, although it is not required, MySQL commands are usually written in uppercase and databases, tables, usernames, or text are in lowercase to make them easier to distinguish. However, the MySQL command line is not case sensitive.

How to Create and Delete a MySQL Database

MySQL organizes its information into databases; each one can hold tables with specific data.

You can quickly check what databases are available by typing:

SHOW DATABASES;

Your screen should look something like this:

 mysql> SHOW DATABASES;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| test               |
+--------------------+
4 rows in set (0.01 sec)

Creating a database is very easy:

 CREATE DATABASE database name;

In this case, for example, we will call our database “events.”

 mysql> SHOW DATABASES;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| events             |
| mysql              |
| performance_schema |
| test               |
+--------------------+
5 rows in set (0.00 sec)

In MySQL, the phrase most often used to delete objects is Drop. You would delete a MySQL database with this command:

 DROP DATABASE database name;

How to Access a MySQL Database

Once we have a new database, we can begin to fill it with information.

The first step is to create a new table within the larger database.

Let’s open up the database we want to use:

 USE events;

In the same way that you could check the available databases, you can also see an overview of the tables that the database contains.

 SHOW tables;

Since this is a new database, MySQL has nothing to show, and you will get a message that says, “Empty set”

How to Create a MySQL Table

Let’s imagine that we are planning a get together of friends. We can use MySQL to track the details of the event.

Let’s create a new MySQL table:

CREATE TABLE potluck (id INT NOT NULL PRIMARY KEY AUTO_INCREMENT, 
name VARCHAR(20),
food VARCHAR(30),
confirmed CHAR(1), 
signup_date DATE);

This command accomplishes a number of things:

  1. It has created a table called potluck within the directory, events.
  2. We have set up 5 columns in the table—id, name, food, confirmed, and signup date.
  3. The “id” column has a command (INT NOT NULL PRIMARY KEY AUTO_INCREMENT) that automatically numbers each row.
  4. The “name” column has been limited by the VARCHAR command to be under 20 characters long.
  5. The “food” column designates the food each person will bring. The VARCHAR limits text to be under 30 characters.
  6. The “confirmed” column records whether the person has RSVP’d with one letter, Y or N.
  7. The “date” column will show when they signed up for the event. MySQL requires that dates be written as yyyy-mm-dd

Let’s take a look at how the table appears within the database using the “SHOW TABLES;” command:

 mysql> SHOW TABLES;
+------------------+
| Tables_in_events |
+------------------+
| potluck          |
+------------------+
1 row in set (0.01 sec)

We can remind ourselves about the table’s organization with this command:

 DESCRIBE potluck;

Keep in mind throughout that, although the MySQL command line does not pay attention to cases, the table and database names are case sensitive: potluck is not the same as POTLUCK or Potluck.

 mysql>DESCRIBE potluck;
+-------------+-------------+------+-----+---------+----------------+
| Field       | Type        | Null | Key | Default | Extra          |
+-------------+-------------+------+-----+---------+----------------+
| id          | int(11)     | NO   | PRI | NULL    | auto_increment |
| name        | varchar(20) | YES  |     | NULL    |                |
| food        | varchar(30) | YES  |     | NULL    |                |
| confirmed   | char(1)     | YES  |     | NULL    |                |
| signup_date | date        | YES  |     | NULL    |                |
+-------------+-------------+------+-----+---------+----------------+
5 rows in set (0.01 sec)

How to Add Information to a MySQL Table

We have a working table for our party. Now it’s time to start filling in the details.

Use this format to insert information into each row:

INSERT INTO `potluck` (`id`,`name`,`food`,`confirmed`,`signup_date`) VALUES (NULL, "John", "Casserole","Y", '2012-04-11');

Once you input that in, you will see the words:

 Query OK, 1 row affected (0.00 sec)

Let’s add a couple more people to our group:

INSERT INTO `potluck` (`id`,`name`,`food`,`confirmed`,`signup_date`) VALUES (NULL, "Sandy", "Key Lime Tarts","N", '2012-04-14');
INSERT INTO `potluck` (`id`,`name`,`food`,`confirmed`,`signup_date`) VALUES (NULL, "Tom", "BBQ","Y", '2012-04-18');
INSERT INTO `potluck` (`id`,`name`,`food`,`confirmed`,`signup_date`) VALUES (NULL, "Tina", "Salad","Y", '2012-04-10');

We can take a look at our table:

mysql> SELECT * FROM potluck;
+----+-------+----------------+-----------+-------------+
| id | name  | food           | confirmed | signup_date |
+----+-------+----------------+-----------+-------------+
|  1 | John  | Casserole      | Y         | 2012-04-11  |
|  2 | Sandy | Key Lime Tarts | N         | 2012-04-14  |
|  3 | Tom   | BBQ            | Y         | 2012-04-18  |
|  4 | Tina  | Salad          | Y         | 2012-04-10  |
+----+-------+----------------+-----------+-------------+
4 rows in set (0.00 sec)

How to Update Information in the Table

Now that we have started our potluck list, we can address any possible changes. For example: Sandy has confirmed that she is attending, so we are going to update that in the table.

UPDATE `potluck` 
SET 
`confirmed` = 'Y' 
WHERE `potluck`.`name` ='Sandy';

You can also use this command to add information into specific cells, even if they are empty.

How to Add and Delete a Column

We are creating a handy chart, but it is missing some important information: our attendees’ emails.

We can easily add this:

 ALTER TABLE potluck ADD email VARCHAR(40);

This command puts the new column called “email” at the end of the table by default, and the VARCHAR command limits it to 40 characters.

However, if you need to place that column in a specific spot in the table, we can add one more phrase to the command.

 ALTER TABLE potluck ADD email VARCHAR(40) AFTER name;

Now the new “email” column goes after the column “name”.

Just as you can add a column, you can delete one as well:

ALTER TABLE potluck DROP email;

I guess we will never know how to reach the picnickers.

How to Delete a Row

If needed, you can also delete rows from the table with the following command:

DELETE from [table name] where [column name]=[field text];

For example, if Sandy suddenly realized that she will not be able to participate in the potluck after all, we could quickly eliminate her details.

mysql> DELETE from potluck  where name='Sandy';
Query OK, 1 row affected (0.00 sec)

mysql> SELECT * FROM potluck;
+----+------+-----------+-----------+-------------+
| id | name | food      | confirmed | signup_date |
+----+------+-----------+-----------+-------------+
|  1 | John | Casserole | Y         | 2012-04-11  |
|  3 | Tom  | BBQ       | Y         | 2012-04-18  |
|  4 | Tina | Salad     | Y         | 2012-04-10  |
+----+------+-----------+-----------+-------------+
3 rows in set (0.00 sec)

Notice that the id numbers associated with each person remain the same.