Monday, January 5, 2015

Titanium sdk and Android SDK notes and command line stuff

titanium links

previous sdks

previous studios:

old studios:!/guide/Reverting_to_a_Previous_Version

android sdk

* list avds
android list avd

* install apk (restart afterwards?)
adb -e install path/to/apk

* start emulator
emulator -avd name_of_avd

unfortunately you need a google api emulator to test out the map

* if you have a problem with the emulator (like it won't start), try restarting adb
adb kill-server

General titanium sdk notes

it uses argb for colors

command line titanium interface

* build
ti build (cd to the project folder)

* build only w/o running
ti build --build-only --platform android

Tuesday, October 28, 2014

PHP and Databases Intro

Databases and PHP ================== PHp is interpreter. Translates PHP code to machine code, the processor runs and it outputs text (we use echo statements to output html friendly text). Programming languages require connectors to get to database. PHP usually comes with this. Just have to enable it. mysqli - class for working with mysql databases from PHP Database Management System - This is your database server (or service). Manages access to the databases in an efficient manner. Databases - Usually a collection of files efficiently organized to retrieve and update data. Contain tables and security information (login info and who has access to what). Tables - reside in a database. They store the data in the form of rows. Tables have columns which multiple properties. Index - way to improve the speed of searching a database based on certain fields, like if we wanted to search a dentist's name. Dentist table example ~~~~~~~~~~~~~~~~~~~~~ Dentist (id -primary key, name - unique, address, phone, email_address - unique ) Column properties: auto increment primary key data type - integers, strings (varchar, char, usually have to specify number of characters), date, datetime, bit (1 or 0) unique 1, john smith, 123 street, 123 456 7890 2, beth , 456 street, 123 456 7890 3, debbie, 789 street, 123 456 7890 3, james, 789 street, 123 456 7890 <-- illegal , can't happen because of primary key constraint 4, james, 123 street, 123 456 7890 <-- illegal, can't happen because of unique key constraint Dentist (id -primary key, name , address, phone, email_address - unique ) Better to use email address as unique constraint. Operations you usually do on a database: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ designing (create tables, columns, constraints, indexes etc) assigning access querying (reading) -- usually do this in php updating -- usually do this in php inserting (create) -- usually do this in php deleting -- usually do this in php CRUD (create, read, update, delete) operations

Thursday, October 9, 2014

Web Design - Basic elements of a web page

Download the files for this intro web design lesson from here 

How  web pages render. 

Web pages (or web document) are built using plain text files with special syntax.

<!DOCTYPE html>
My First Heading</h1>
My first paragraph.

They are stored on web servers whether they be on a physical server, cloud server, or some other hosting system. Web servers wait for requests for documents and assets from web browsers. Assets usually consist of images, javascript files, and CSS files.

When a user points their web browser to a particular web address it creates a request to download the web page document to your browser for processing. If the syntax is correct within the web document then the page is rendered in your browser.

How to create a simple web document

1) Download a copy of notepad++ or sublime text 2
2) Create a new document
3) copy and paste this html text into your document

<!DOCTYPE html>
My First Heading</h1>
My first paragraph.

4) Save it as test.html and double click it to open it in your web browser

Parts of a web document

<!DOCTYPE html>
<head><title>Page 1</title>
<style >
#header {
#nav {
#section {
#footer {

  <div id="header">
  <h1>Some header</h1>

  <div id="nav">

  <div id="section">
  <h1>Page 1</h1>
  I'm a paragraph
  I'm a paragraph too</p>

  <div id="footer">
  I'm a footer

Let's go over the above. Our web page is broken down into main elements  which are separated by tags. We use the div tags to divide a html document so we get the layout we desire. Typically a web document is divided so it has a header, menu or navigation , body and footer. This is totally arbitrary but it is a good design because it allows users to navigate your site easily with a menu and there is enough real estate to brand your website and provide content. The style tag allows us to take advantage of CSS. There are few rules here and they directly pertain to the tags we defined in the body tag. As you probably noticed the div tags have id attributes to distinguish them. These allow us to easily apply CSS to them as above.


Try creating the other 2 pages and link them together. So page 1 through 3 are each can link to each other.

Intro to Bootstrap

Try the following example for bootstrap. Get a copy of it from here :

<!DOCTYPE html>
<head><title>Page 1</title>
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="">
<!-- Optional theme -->
<link rel="stylesheet" href="">


    <div class="navbar navbar-inverse navbar-fixed-top" role="navigation">
      <div class="container">
        <div class="navbar-header">
          <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target=".navbar-collapse">
            <span class="sr-only">Toggle navigation</span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
          <a class="navbar-brand" href="#">Project name</a>


    <!-- Main jumbotron for a primary marketing message or call to action -->
    <div class="jumbotron">
      <div class="container">
        <h1>Hello, world!</h1>
        <p>This is a template for a simple marketing or informational website. It includes a large callout called a jumbotron and three supporting pieces of content. Use it as a starting point to create something more unique.</p>
        <p><a class="btn btn-primary btn-lg" role="button">Learn more ></a></p>

    <div class="container">
      <!-- Example row of columns -->
      <div class="row">
        <div class="col-md-4">
          <p>Donec id elit non mi porta gravida at eget metus. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Etiam porta sem malesuada magna mollis euismod. Donec sed odio dui. </p>
          <p><a class="btn btn-default" href="#" role="button">View details ></a></p>
        <div class="col-md-4">
          <p>Donec id elit non mi porta gravida at eget metus. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Etiam porta sem malesuada magna mollis euismod. Donec sed odio dui. </p>
          <p><a class="btn btn-default" href="#" role="button">View details ></a></p>
        <div class="col-md-4">
          <p>Donec sed odio dui. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Vestibulum id ligula porta felis euismod semper. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus.</p>
          <p><a class="btn btn-default" href="#" role="button">View details ></a></p>


        <p>© Company 2014</p>
    </div> <!-- /container -->

    <!-- Bootstrap core JavaScript
    ================================================== -->
    <!-- Placed at the end of the document so the pages load faster -->
    <script src=""></script>
    <!-- Latest compiled and minified JavaScript -->
<script src=""></script>


Exercise: try sprucing up the layout we created before using bootstrap. 

Wednesday, June 25, 2014

Pregnancy Quiz Vocab App

Released a new android quiz app to the google play market!

It features over 100 multiple choice questions to help get you ready for your pregnancy.

Content for this quiz app, comes from the Women's Health government website.

Go to the google play store to get the Pregnancy Quiz Vocab App today :)


Friday, March 28, 2014

How to set up a test cas server on windows

Set up tomcat 

1)  install tomcat

2) download cas from

3) Extract the download and copy the war file from the modules folder to webapps folder in your tomcat root

4) Create a self-signed certificate with keytool (or get a certificate)

keytool -genkey -keyalg RSA -keysize 2048 -keystore c:\path\to\keystore.jks -alias mykey -validity <days>

Replace <days> with number days the certificate will be valid for.

Answer all the questions and put in a keystore password. This will be used in the tomcat configuration later.
Certain password characters like ampersands may need to be escaped in the tomcat config

4) Edit your server.xml

Add the following line under the <server ..> tag

    <Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true"
                   maxThreads="150" scheme="https" secure="true"
               clientAuth="false" sslProtocol="TLS"  keystorePass='<password here>' keystoreFile="C:/path/to/keystore.jks"/>

5) restart Tomcat and the war should installed

Config CAS

6)  Open the webapps/cas-server-webapp-version/web-inf/deployerConfigContext.xml file

Comment out the bean


like this

class="" />-->


Add the generic authentication method:

<bean class="org.jasig.cas.adaptors.generic.AcceptUsersAuthenticationHandler">
   <property name="users">
            <entry key="testuser" value="test" />

Under the authenticationHandlers tag.

8) Copy the cas-server-support-version.jar to webapps/cas-server-webapp-version/web-inf/lib folder

9) Restart tomcat

10) you should be able to login by going to the following url:


Tips for the CAS clients to avoid redirect loops

CAS clients are pretty particular about the ssl certificates. If the certificate is not trusted by the web application using your CAS server you may get redirect loops.

To avoid this buy a certificate or put your self-signed certificate in the trusted store on the computer where the web server is.

Helpful links

To set up CAS you have a good knowledge of SSL, tomcat and java keystores, especially if you want to do proxy authentication. There are many links below that can shed some light on these concepts and related issues.

Saturday, March 1, 2014

GIT 101

I apologize in advance. I'm a lot more familiar with svn.

In the process of playing with git, I put together some steps on how to accomplish some basic git tasks. The main goal is to set up a repository on a server and get your developer stations synching with it.

Git is a little bit of a change from svn and make take a little getting used to.

How to set up a git repository and configure for ssh on LInux.

From the command line: (you can check by typing whereis git )
If you don't already have git installed

1) Download git

 wget --no-check-certificate

2) unzip git-master
3) cd git-master
4) make
5) make install
6) make sure git is in your path
May want to edit your ~/.bashrc or whatever loginscript you have to edit your path.
Or you can just create a link to it in one of your bin folders : /bin, /usr/local/bin, etc.

To create a repository on the server

1) Make sure git is in your path
Create a new git folder for your projects.
mkdir git
2) cd git
3) create a new project directory
mkdir project1.git
4) cd project1.git
5) git init --bare

To push your code onto the remote repository
1) git remote add origin ssh://username@server_ip/home/pathto/git/project1.git
2) git push

To get the project onto another machine and commit changes
1) git clone ssh://username@server_ip/home/pathto/git/project1.git
2) git remote add origin ssh://username@server_ip/home/pathto/git/project1.git
3) git add whatever_file_you_changed_or_added
4) git commit -m "message here"
5) git push

To update your local copy 
1) git pull origin master
This calls git fetch and merge to get the  latest changes.

Other commands
To see your git commit log :
git log --all

For windows you may want to install the google code project msysgit

Reference links


Wednesday, May 29, 2013

How to manually add entity to edmx

Recently had to add entities manually to edmx file since using the "update model from database" feature kept erasing mappings.

The edmx was originally generated using Huagati edmx tool : which I didn't have.

Steps to manually table to edmx:

Note: you should have some entities in your edmx file already so you can follow their naming conventions and patterns.

1) Open the edmx file with a xml editor
2) navigate to the SSDL section and add a new EntitySet tag under EntityContainer
3) also in SSDL within EntityContainer, create a new EntityType tag
the property tags will match the column names for the database table

4) In CSDL, under EntityContainer, create an EntitySet tag
5) Now add the EntityType also under EntityContainer
6) Save and open in the designer so you can add the mappings in (map model to database fields).

Environment I used:

Visual Studio 2012
Entity Framework 5

Good references: