Who’s in the room? Raspberry Pi & Bluetooth Based Room Monitoring Project

Overview

This project uses a Raspberry Pi and Bluetooth technology to monitor who’s in my room. I wrote a python script to ping certain devices, i.e. my cell phone, and update the status to a web server.

Hardware

Required:
  • Raspberry Pi. I used a Pi2.
  • Bluetooth dongle. I used ” Cambridge Silicon Radio, Ltd Bluetooth Dongle (HCI mode)”
Optional:
  • Breadboard
  • LED
  • Resistors
  • Jumper wires

Software

  • Python 2.5+
  • Requests library
  • RPi.GPIO
    • Or you can use RPIO. The only problem is if you are using a Pi 2, the RPIO from apt-get is not working, you can clone my Github repo which has the modified version for Pi 2.
    • git clone https://github.com/tylerwowen/RPIO.git
      cd RPIO
      sudo python setup.py install
      
    • Cleanup by your self. Just delete the whole repo directory after installation
  • A running web server with PHP configured
  • apt-get packages: bluetooth, bluez-utils
  • sudo apt-get install bluetooth bluez-utils

Installation

Client Side

The following is the script that pings devices and updated their status both to LED indicators and the web server. You can delete the LED part if you don’t need them. Replace the two fake MAC addresses with your device’s

Mind the indent. Directly copied code may not work.

# bt.py
# Tyler Weimin Ouyang
import subprocess
import time
import os
import RPi.GPIO as GPIO
import httphandler

# PIN numbers
tylerLED = 11
karlLED = 15

# !! Replace the following two MAC address with your device's
tyler_iPhone = "90:FD:41:D8:79:59"
karlPhone = "C0:64:CA:D1:20:38"
devnull = open(os.devnull, 'w')

# turn on func
def turnOn(pin):
 GPIO.output(pin, GPIO.HIGH)
 return

# turn off func
def turnOff(pin):
 GPIO.output(pin, GPIO.LOW)
 return

# to use Raspberry Pi board pin numbers 
GPIO.setmode(GPIO.BOARD) 
# set up GPIO output channel 
GPIO.setup(tylerLED, GPIO.OUT)
GPIO.setup(karlLED, GPIO.OUT) 

try:
 while (True):
  outT = subprocess.call(["l2ping", "-c", "1", tyler_iPhone],
  stdout=devnull,
  stderr=devnull)
  outK = subprocess.call(["l2ping", "-c", "1", karlPhone],
  stdout=devnull,
  stderr=devnull)

# if tyler is out
 if (outT != 0):
  turnOff(tylerLED)
  httphandler.deRegisterUser("tyler")
 else:
  turnOn(tylerLED)
  httphandler.registerUser("tyler")

# if karl is out
 if (outK != 0):
  turnOff(karlLED)
  httphandler.deRegisterUser("karl")
 else:
  turnOn(karlLED)
  httphandler.registerUser("karl")

# check every 5 minutes 
 time.sleep(300) # 5 min 

# handle exceptions
except KeyboardInterrupt: # If CTRL+C is pressed, exit cleanly:
 turnOff(tylerLED)
 turnOff(karlLED)
 GPIO.cleanup() # cleanup all GPIO

The next script posts data to a web server. You must name it as “httphandler”, otherwise the previous script won’t work. Use your own server address to replace “example.com”.

The requests library makes the POST method really easy to use.

# httphandler.py
import requests

def registerUser(user):
 userData = {'name':user,'present':'true'}
 requests.post("http://example.com/post.php", data=userData)
 
def deRegisterUser(user):
 userData = {'name':user,'present':'false'}
 requests.post("http://example.com/post.php", data=userData)
Extra

For debugging, you can set up the following circuit. Ignore the button and two jumper wires. The green LED is connected to PIN 15 (Board number, or GPIO 22), and the red is connected to PIN 11(GPIO 17).

IMG_2873

Server Side

First you need an index.php to show data. It reads from two .txt files which are generated by post.php.






Then, the post.php receives the data from Raspberry Pi and generates two status files.


Results

From the web server, you should see a page like this

pi bluetooth web screenshot

 

This is not a comprehensive tutorial, some details are not shown in this article. For any questions, please leave your comments.

Posted in Raspberry Pi | Leave a comment

piSensors–Use Node.js + Express.js to Create a RPi Sensor Dashboard

This is blog is written in Markdown(GFM). For better reading experience, please go to this project’s github page

What’s the temperature in my room? Do I need to water my plants? I have a Raspberry Pi with several sensors connected to it, it’s not hard to answer these questions. SSH to Pi, run a Python script I wrote before and then I can get the data. The problem here is, however, how to access them easily? A web app is a good candidate for this purpose.

Github repository.

## Overview

The basic idea is that to create a web app that shows the data from different sensors. The data can be either cached or just updated. The information is presented in a table, with an Update button at the end of each row. Once Update is clicked, the front-end makes an API call so the backend activates the sensor and sends back the date.

## Setup

I chose Node.js with Express.js framework as my backend. For front-end, apart from HTML, Javascript and CSS, I also used Jade to generate pages.

Installation

  • Install Node.js + npm
    sudo apt-get install node
  • Choose a proper directory and clone my git repo

    bash
    cd somewhere/
    git clone https://github.com/tylerwowen/pisensors
    cd pisensors
    npm install

    npm install will install all required dependencies that are defined in package.json

  • I include a python script that reads from DHT 11 Temperature and Humidity sensor. Change permission of temphum.py if you see any thing like: sudo: ./scripts/temphum.py: command not found

    sh
    chmod 755 pisensor/scripts/temphum.py

After the above steps, the layout should be like this:

├── app.js
├── bin
│   └── www
├── node_modules
│   ├── body-parser
│   ├── debug
│   ├── express
│   ├── jade
│   └── morgan
├── package.json
├── public
│   ├── images
│   ├── javascripts
│   └── stylesheets
│       └── style.css
├── routes
│   ├── cache
│       └── cache.json
│   ├── objects
│       ├── humidity.js
│       ├── sensor.js
│       ├── temperature.js
│       └── vibration.js
│   ├── index.js
│   └── users.js
├── scripts
│   └── temphum.py
└── views
    ├── error.jade
    ├── index.jade
    └── layout.jade

Configuration

Dependencies

  • To run /scripts/temphum.py, you need to install the Adtruit_DHT library.

    bash
    sudo apt-get update
    sudo apt-get install build-essential python-dev
    git clone https://github.com/adafruit/Adafruit_Python_DHT.git dhtlib
    cd dhtlib
    sudo python setup.py install
    cd .. && sudo rm -r dhtlib

  • If you have other sensors instead, you should also place your scripts/programs under this directory

Add New Sensors

When you need to add a new sensor.

  • In /routes/objects, create a subclass of sensors.js. For example, create a light.js

    “`javascript
    var Sensor = require('./sensor.js');

    function Light(sensor, value, unit) {
    Sensor.call(this, sensor, value, unit);
    }

    Light.prototype = new Sensor();

    Light.prototype.fetchDataFromSensor = function(callback) {
    var cmd = 'sudo ./scripts/light.py'; // You need to write this script
    Sensor.prototype.fetchDataFromSensor.call(this, cmd, callback);
    };

    Light.prototype.fetchDataFromCache = function(cachedData) {
    var JSONData = cachedData.light;
    Sensor.prototype.fetchDataFromCache.call(this, JSONData);
    };

    module.exports = Light;
    “`

  • In /routes/index.js

    • Add litsSensor = require('./objects/light.js'); under var vibSensor = require('./objects/vibration.js');
    • Add var lightSensor = new litSensor("Light", "False", "Boolean"); under var vibrationSensor = new vibSensor("Vibration", "False", "Boolean");
    • Add data.push(lightSensor); under data.push(vibrationSensor);
  • In /routes/cahe/cache.json, append initial data to make it look like this:

    json
    ...
    "Vibration": {
    "sensor": "Vibration",
    "value": "True",
    "unit": "celsius",
    "updatedAt": "11:37:31 PM"
    },
    "Light": {
    "sensor": "Light",
    "value": "True",
    "unit": "celsius",
    "updatedAt": "12:27:31 PM"
    }
    ...

    Since I haven’t implemented the database at this moment(July 26, 2015), it’s necessary to modify the cache file manually. Later the MongoDB will be added and this part will be discarded.

## Implementation

/routes/index.js

This file is the core of this web application. It has two responsibilities (I know this violates the Single Responsibility Principle, but I will explain):

  • Generates the contents of index page

  • Responses to API calls in JSON format

/routes/objects/Sensor.js

It is the super class for all other specific sensors. It’s not totally abstract, and it has some concrete methods.

/views/index.jade

The index.jade provides a layout for the data table. It works for any number of sensors. To do so, it loops over the array sensorData which is passed from index.js.

/public/javascript/main.js

This is the front-end javascript that listens to click events. Once an user clicks the Update button of a sensor, the scripts calls the corresponding API and updates the row based on the response from backend. An example API call: http://127.0.0.1:3000/update/Temperature.

## Outcome

The web page looks like the picture below.
!alt test

## Todo

[ ] Add MongoDB supports
[ ] Beautify front-end with Bootstrap
[ ] Data visualization — present history data in diagrams

Posted in IOT, node.js, Raspberry Pi | Leave a comment

Who’s in the Room V2 — Raspberry Pi with Parse IoT SDK

Introduction

In the post Who’s in the room? Raspberry Pi & Bluetooth Based Room Monitoring Project, I introduced a way to use the basic HTTP POST method to communicate with the server. In this post, I’m going to summarize the procedures how I re-implemented the original idea with Parse IoT SDK.

Requirements

Hardware

Same to V1

  • Raspberry Pi. I used a Pi2.
  • Bluetooth dongle. I used ” Cambridge Silicon Radio, Ltd Bluetooth Dongle (HCI mode)”

Software/Services

You need a Parse account first. In this project, you will use Parse’s JavaScript SDK, Hosting and Embedded C SDK(IoT).

On Raspberry Pi

  • Parse IoT SDK(Embedded C version). Just follow this Quick Start guide to get started.

Any device

You can install the following tool wherever you want.

  • Parse Command Line tool. Go to this guide, choose your platform and follow the instructions.
    Note: By doing this, you’re using Parse Hosting. If you want deploy this project on your own server, it should also work, but some steps will be different.

Installation

Parse Side

  • Create a new Parse App. I named mine as “SmartHome”, and I will use it in this tutorial. You can use any name, but just make sure to use it consistently.
  • Create a data class on Parse.
    • Parse Dashboard -> Core -> Data -> Add Class -> Choose “Custom” with class name “Status”
    • Click the class “Status”, and add two new columns with
      • type: String, name: User
      • type: Boolean, name: Status
    • Add rows(instances) in the class.
      • Name the User attribute of each row, e.g. “Tyler”, and make sure every User is unique.
      • Set Status to false.
  • On the device you installed the Parse Command Line tool, do the following things:
$ parse new SmartHome
 
Email: ninja@gmail.com
Password:
1:SmartHome
2:MyOtherApp
Select an App: 1
 
$ cd SmartHome
  • Use the email address and password for your Parse account to log in. If you signed up via OAuth and never set a password, you should now set one by editing your account settings. This will create a directory called SmartHome in the current directory.
  • Replace the whole public directory under SmartHome with mine — SmartHomePublic.
  •  Notes:
    • In index.html, I use ”Tyler” and “Karl” to present two users. Edit, add, or delete users accordingly. Each HTML div element in line 26-27 should have an id that matches the value of its corresponding Status class instance.
    •  <div id="Tyler">!!Tyler is not in the room</div>
       <div id="Karl">!!Karl is not in the room</div>
    • You need to modify the JavaScript file check.js under SmartHome/public/js.
      • Line 2, fill in your Parse Application ID and JavaScript Key. You can find your keys under Settings -> Keys.
    •  Parse.initialize("Your Application ID", "Your JavaScript Key");
  • In the ‘Hosting’ section of your app’s settings, you’ll see a field at the top that allows you to set your subdomain, e.g. smarthome.parseapp.com. Fill it in with a unique name, then run:
$ parse deploy

If you can see a webpage like the screen shot with the red rectangle and the update time, everything is good so far.

Screen Shot SmartHome

Raspberry Pi Side

  • Refer to V1 to set up bluetooth
  • Install dependencies
  • sudo apt-get update
    sudo apt-get install autoconf automake libtool
    sudo apt-get install libcurl4-openssl-dev uuid-dev
  • Download and install the SDK
  • $ wget https://parse.com/downloads/embedded_linux/parse-embedded-sdks-1.0.0.zip
    $ unzip parse-embedded-sdks-1.0.0.zip
    $ cd parse-embedded-sdks-1.0.0
    $ autoreconf -fi
    $ ./configure --prefix=/usr
    $ make
    $ sudo make install
    • You can delete the directory after installation
  • Download this package – SmartHome and unzip it on your raspberry pi.
  • $ wget http://tyler.gauchomeet.me/wp-content/uploads/2015/04/SmartHome.zip
    $ unzip SmartHome.zip 
    $ cd SmartHome
    $ ls
    LICENSE main.c Makefile README.md
  • Edit main.c
    • #define NUM_OF_DEVICES 2
      #define DEVICE_BT_ADD {"90:FD:61:D8:70:12", "C0:64:B6:DD:20:23"} // Add more devices here
      #define OBJ_ID {"845eqPnHjv", "HFp9jqPnj8"} // Add more objectID here
      #define APP_ID "your application id" // Application ID
      #define CLIENT_KEY "your client key" // Client Key
    • Line 19, change NUM_OF_DEVICES to the number of devices you want to ping to.
    • Line 20, figure out your devices’ bluetooth mac address and put them in the braces.
    • Line 21, get the objectID of your Status class instances. The order matters!
    • Line 22-23, paste your Application ID and Client ID  respectively.Screen ShotSmartHome2
    • Save, compile and run:
    • $ sudo ./smarthomedeamon
  • Go to the web application, and click Get Status
  • If your see the following info from your raspberry pi’s terminal window, it means everything is working fine.
  • received push: '{"data":{"alert":"From Web!!!"},"time":"2015-05-02T04:24:41.949Z"}'
    Good Ping
    Can't connect: Host is down
    successfully sent respond

Configuration

 to be continued…

Posted in Raspberry Pi | Leave a comment

Raspberry Pi — Connect to a Bluetooth Keyboard

1. Connect the Bluetooth dongle to an USB port

$ lsusb
Bus 001 Device 005: ID 0a12:0001 Cambridge Silicon Radio, Ltd Bluetooth Dongle (HCI mode)

2. Install supporting software, and check Bluetooth status

$ sudo apt-get install --no-install-recommends bluetooth
...
$ sudo service bluetooth status
[ ok ] bluetooth is running.

3. Scan, and get the MAC address

$ hcitool scan
Scanning ...
 20:42:A1:00:8E:4A Bluetooth Wireless Keyboard

4. Pair, trust and connect

$ sudo bluez-simple-agent hci0 20:42:A1:00:8E:4A
$ sudo bluez-test-device trusted 20:42:A1:00:8E:4A yes 
$ sudo bluez-test-input connect 20:42:A1:00:8E:4A

Source:

LinkA, LinkB, LinkC

 

Posted in Raspberry Pi | Leave a comment

Raspberry Pi Double Blinker

Connect one LED to pin 11, the other to pin 13(both are board numbers).

Code:

import RPi.GPIO as GPIO
import time
# turn on func
def turnOn(pin):
 GPIO.output(pin, GPIO.HIGH)
 return
# turn off func
def turnOff(pin):
 GPIO.output(pin, GPIO.LOW)
 return
# to use Raspberry Pi board pin numbers 
GPIO.setmode(GPIO.BOARD)
# set up GPIO output channel 
GPIO.setup(11, GPIO.OUT)
GPIO.setup(13, GPIO.OUT)
# blink GPIO17 50 times 
for i in range(0,50):
 turnOn(11)
 turnOff(13)
 time.sleep(1)
 turnOn(13)
 turnOff(11)
 time.sleep(1)
GPIO.cleanup()

Video:

Posted in Raspberry Pi | Leave a comment

Reducing Xcode: “The working copy ____ has uncommitted changes” Warnings

It’s quite annoying when I just Discard All Changes… or Commit… my changes and tried to switch to a branch and the warning “The working copy ____ has uncommitted changes” jumped out. My solution was keep clicking Discard All Changes… , but it doesn’t work every time. Finally, I found the problem and its solution.

Cause:

I checked all check marks to include everything ‘important’. The action caused Git to track some system/state files like ‘.DS_Store’, ‘UserInterfaceState.xcuserstate’.

Solution:

1. Follow this link
The main point is to remove trouble-causing files from Git repo.

find . -name .DS_Store -print0 | xargs -0 git rm -f --ignore-unmatch

The command finds all .DS_Store in the Git directory and tells Git to ignore them. In addition, a .gitignore file will take care of future new added DS_Store files. “A gitignore file specifies intentionally untracked files that Git should ignore.” Just add a line, “.DS_Store”, to the .gitignore file.

git add .gitignore
git commit -m '.DS_Store removed from taking list!'

2. Follow the second link

3. Extra info

  1. Download gitignore file here http://gitignore.io. The .gitignore contains Xcode, C, C++. Swift, Objective-C related files that should be ignored. You can always edit it and make it fulfill your requirements.
  2. Apply .gitignore. You can follow this Stackoverflow post if you don’t know hot to do so.
  3. If you don’t know about gitignore, you should read this article from git.
Posted in Apple, iOS, Project | Leave a comment

Upgrade to WordPress 4! Add mySQL5

After two nights of struggling, I finally imperfectly made WordPress 4 run on my Pogoplug. In a prior blog, I mentioned that the latest supported WordPress version was 3.1.4 due to the outdated mySQL. In fact, the optware source contains a mySQL 5 package, which is high enough to support WordPress 4. However, if you directly install it, many problems will occur. Those problems are caused by the incompatibilities between the PHP-mySQL extension and mySQL5. To solve those problems perfectly, you need to install a newer php-mysql extension, but it is super complicated. Luckily, I found a easier solution to fool php, as shown in the following:

First, back up necessary library files. Go to the directory /opt/lib, duplicate /mysql and its files.

cp -r /opt/lib/mysql /opt/lib/mysql4

Remove mySQL4 and install mySQL5

ipkg remove mysql -force-depends
ipkg install mysql5
# back up library files of mysql5
cp -r /opt/lib/mysql /opt/lib/mysql5

Make mySQL 5 work by modifying /opt/etc/my.cnf. Credit 

# The MySQL server
 [mysqld]
 user = root // add this line
 datadir = /opt/var/lib/mysql // add this line

Test if mySQL is successfully installed.

/opt/etc/init.d/S70mysqld start

Copy back library files, and test PHP

cp /opt/lib/mysql4/*14* /opt/lib/mysql

// or
rm /opt/lib/mysql/*
cp /opt/lib/mysql4/* /opt/lib/mysql
cp /opt/lib/mysql5/*15* /opt/lib/mysql
// end or

php

If you don’t see any errors, it is done.

Known issues: php might not respond after editing your contents. This is highly possibly caused the incompatibilities. Restart your web server by 

/opt/etc/init.d/S80lighttpd restart
Posted in Project | Leave a comment

Host a WordPress on a Pogoplug v4

This tutorial is based on OddballHero‘s tutorial LLMP (Linux, Lighttpd, MySQL, PHP) on a Plug

First, follow OddballHero’s tutorial to build a LLMP sever. The following is a copy of his tutorial. If you already has a LLAP or LLMP running on your machine, jump to the second part directly.

Lighttpd

1. Install Lighttpd and PHP after making the root file system accessible and creating /var/run:

mount -o rw,remount /
mv /var /varold
#If you stop using optware, you can restore the old var with "mv /varold /var"
mkdir /opt/var
#You might not need this if /opt/var already exists.
mkdir /opt/var/run
ln -s /opt/var /var
ipkg install lighttpd php fcgi php-fcgi php-pear mysql phpmyadmin

2. Configure Lighttpd by editing lighttpd.conf in /opt/etc/lighttpd by typing “cd /opt/etc/lighttpd” and edit lighttpd.conf with your preferred editor (if you use nano, try to invoke it with “nano -w filename” so that long lines are not wrapped). Because Pogoplug based plugs use port 80 for Cloud Engines functionality, a different port such as 8081 needs to be used. You also need to turn on some modules. The web site directory has to be designated.

Make sure “mod_access“, “mod_auth“, “mod_fastcgi“, and “mod_accesslog” and any other modules you choose are uncommented.

server.modules              = (
#                               "mod_rewrite",
#                               "mod_redirect",
#                               "mod_alias",
                               "mod_access",
#                               "mod_cml",
#                               "mod_trigger_b4_dl",
                               "mod_auth",
#                               "mod_status",
#                               "mod_setenv",
                               "mod_fastcgi",
#                               "mod_proxy",
#                               "mod_simple_vhost",
#                               "mod_evhost",
#                               "mod_userdir",
#                               "mod_cgi",
#                               "mod_compress",
#                               "mod_ssi",
#                               "mod_usertrack",
#                               "mod_expire",
#                               "mod_secdownload",
#                               "mod_rrdtool",
                                "mod_accesslog" )

The default web site directory has to be designated. The default is “/opt/share/www”. Change this to your preference.

server.document-root        = "/opt/share/www/"

The port has to be set and if you are using my.pogoplug.com services, you cannot use port 80. So change the port to 8081 (which is not typically used).

So when you try to access your WordPress when it is setup, you need add “:8081” at the end of your address. For example, if you want to access this blog, you should input “http://169.231.11.30:8081

server.port                = 8081

Save you changes and then type “cd /opt/etc/lighttpd/conf.d” and check if 10-php-fcgi.conf exists. You can verify its contents:

server.modules += ( "mod_fastcgi" )
fastcgi.server = ( ".php" =>
                   ( "localhost" =>
                     ( "socket" => "/tmp/php-fcgi.sock",
                       "bin-path" => "/opt/bin/php-fcgi",
                       "max-procs" => 1,
                       "bin-environment" =>
                         ( "PHP_FCGI_CHILDREN" => "2",
                           "PHP_FCGI_MAX_REQUESTS" => "1000" )
                     )
                   )
                 )

3. Test lighttpd by starting it and look for any error messages:

 /opt/etc/init.d/S80lighttpd start

Fix any errors that show up and try to access it by using your web browser with the address “http://your.pogoplug.ipaddress:8081&#8221;. You should see the lighttpd default web page.

PHP

You can test php by creating the file “php-info.php” in you web site directory with the contents:

<html> <head> <title>PHP Test Page</title> </head> <body> <?php phpinfo(); ?> </body> </html>

And then accessing it with your web browser with the address “http://your.pogoplug.ipaddress:8081/php-info.php&#8221;. This should give you the PHP configuration. You may want to rename or remove this file if you do not want other people to know your configuration.

You need to initialize pear by typing “pear install DB”. Make sure to place “/opt/share/pear” in your php.ini include_path.

MySQL (with PHPMyAdmin)

1. Time to set up your MySQL root password which should probably be different from your system password”

opt/bin/mysqladmin -u root password 'sqlrootpassword'

Where sqlrootpassword is the password you chose and should remember because you need it also for the next step.

2. Change to the phpmyadmin directory with “cd /opt/share/www/phpmyadmin” and edit config.inc.php with your favorite editor (if you use nano, make sure you use it as “nano -w filename” which is important here). Next, search for the line $cfg[‘Servers’][$i][‘password’] and fill in your sql root password between the empty quotes without removing them. Save your changes.

3. If you used a different default web site directory other than “/opt/share/www” then phpmyadmin has to be place there. You can do this with a symbolic link”

ln -s /opt/share/www/phpmyadmin /default/website/directory/phpmyadmin

Where /default/website/directory is the actual one your chose.

4. At this point, it is time to start MySQL and fix any errors:

/opt/etc/init.d/S70mysqld start

5. Restart Lighttpd:

/opt/etc/init.d/S80lighttpd restart

6. Check to make sure that you can access PHPMyAdmin by using your web browser with the address “http://your.pogoplug.ipaddress:8081/phpmyadmin/&#8221;. You are now ready to create databases.

7. You can now insert “/opt/etc/init.d/S70mysqld start” and “/opt/etc/init.d/S80lighttpd start” in your rcS or mount_optextX file so they can be called at system start up.

8. You can type “mount -o ro,remount /” to return your root file system to read only.

9. Try rebooting your computer to make sure that everything works.

Second Part

Since the above method would only install mySQL version 4.1.22, so the latest version of WordPress can be installed is 3.1.4. Download it from WordPress.org. Unpack the downloaded package to /your/website/directory/
You will see a new directory /your/website/directory/wordpress
Now  you have to make a decision. If you merely host WordPress, then pull all files in the /wordpress to /your/website/directory/ . If you want to host other things, like your web, just leave it. The following instructions assume that  you put your files in the root directory of your website directory.

Create a database
Access your pogoplug’s PHP admin page via your web browser http://your.pogoplug.ipaddress:8081/phpmyadmin.
Goto databases, and create a database called wordpress of type Collation.

Install WordPress
Then goto http://your.pogoplug.ipaddress:8081. Then follow its instructions, only fill in your database name – wordpress, and your ID & PW for your mySQL. WordPress will do almost everything for you.

You are all set!

If you want to change themes or install plugins, you have to configure your FTP service also.

Posted in Pogoplug | Tagged , , | Leave a comment

GIT mini Tutorial

The Golden bitbucket team is built and configured.
https://bitbucket.org/gauchos

The following is the  manual instruction to create a clone on your local clone in your machine.

Go to a good location

mkdir /Users/yourUsername/Developer/project
cd /Users/yourUsername/Developer/project
Then configure git
git config --global user.name "Your Name"
git config --global user.email you@example.com
git config --global push.default simple

check

 more ~/.gitconfig

Clone

git clone https://yourusername@bitbucket.org/gauchos/gauchomeet.git

or

# You need add your public SSH key in the team management
# the benefit is you will not be asked to input password in the future
git clone git clone git@bitbucket.org:gauchos/gauchomeet.git

(The instruction for SSH keys is here, or go to the bottom of this blog)
It will require your password for Bitbucket. Then, you will see a directory

ls
# you should see a directory gauchomeet

You have everything now.

If you want to push your changes, there are several ways (you’d better cd into the git directory, namely, /Users/yourUsername/project/gauchomeet )

1. if you use TextWrangler or any other text editor
1.1 you can do it manually  by inputing following commands in Terminal

#add everything, p.s. make sure you have things to be added
git add .
#commit
git commit -am “your description of your modification “
#push
git push https://yourusername@bitbucket.org/gauchos/gauchomeet.git
#or
git push git@bitbucket.org:gauchos/gauchomeet.git

1.2 or you can download SourceTree, it will help you. But it takes time to learn how to use it, but worth it!

2. If you use Xcode, and it is upgraded to 5.x or up
2.1 When a Xcode projected is created, you can see a file “projectName.xcodeproj”, which is a Xcode project. Just open it.
2.2 You will see Source Control in the menu bar.
Pull first
always commit before push
push

Call me or text me for further problems

-generate ssh key

ls -al ~/.ssh
#check key
#if no key
ssh-keygen -t rsa -C "your_email@example.com"
eval "$(ssh-agent -s)"
ssh-add ~/.ssh/id_rsa
cat ~/.ssh/id_rsa.pub
#than copy it into github

-push to server

#add everything
git add .
#commit
git commit -am "some comments"
git push origin master
# master could be replaced by other branch names

 

Posted in Project | Tagged | Leave a comment

Swift Study Resources

Swift is a new programming language, so its resources are very limited. Here are some useful ones.

Two books: The Swift Programming Language and Using Swift with Cocoa and Objective-C are available in iBooks store.

Apple Swift Blog — https://developer.apple.com/swift/blog/

Apple posted a sample app Lister which was written in both Objective-C and Swift. Here is the LINK. More sample code is available here.

Videos from WWDC. LINK

Posted in iOS, Project | Tagged , , | Leave a comment