Awesome-O

Saturday, March 07, 2015

My CivicCRM Journey

I am trying CivicCRM on Drupal to see how it fits in my overall plan. So first stop is to setup the fundamentals.


  1. Apache
  2. Php
  3. MySQL
  4. Drupal
  5. CivicCRM
I am installing them on my Mac - Yosemite so Apache and Php are already installed. The needed steps can to ensure setup are all good to go can be found nicely documented on computersandyou.com article.

In setting up apache and php, I found the command apachectl -t to be great as it checked the correctness of the configuration syntax.

More updates soon. Going to get drupal and civiccrm going tonight.

Labels: ,

Thursday, October 09, 2014

LED Blinking on Raspberry Pi B Plus using PI4J

import com.pi4j.io.gpio.GpioController;
import com.pi4j.io.gpio.GpioFactory;
import com.pi4j.io.gpio.GpioPinDigitalOutput;
import com.pi4j.io.gpio.PinState;
import com.pi4j.io.gpio.RaspiPin;

/**
 * This example code demonstrates how to perform simple state
 * control of a GPIO pin on the Raspberry Pi.
 *
 * @author Robert Savage
 */
public class ControlGpioExample {
   
    public static void main(String[] args) throws InterruptedException {
       
        System.out.println("<--Pi4J--> GPIO Control Example ... started.");
       
        // create gpio controller
        final GpioController gpio = GpioFactory.getInstance();
       
        // provision gpio pin #01 as an output pin and turn on
        final GpioPinDigitalOutput pin = gpio.provisionDigitalOutputPin(RaspiPin.GPIO_06, "MyLED", PinState.HIGH);
        System.out.println("--> GPIO state should be: ON");
       
        Thread.sleep(5000);
       
        // turn off gpio pin #01
        pin.low();
        System.out.println("--> GPIO state should be: OFF");

        Thread.sleep(5000);

        // toggle the current state of gpio pin #01 (should turn on)
        pin.toggle();
        System.out.println("--> GPIO state should be: ON");

        Thread.sleep(5000);

        // toggle the current state of gpio pin #01  (should turn off)
        pin.toggle();
        System.out.println("--> GPIO state should be: OFF");
       
        Thread.sleep(5000);

        // turn on gpio pin #01 for 1 second and then off
        System.out.println("--> GPIO state should be: ON for only 1 second");
        pin.pulse(1000, true); // set second argument to 'true' use a blocking call
       
        // stop all GPIO activity/threads by shutting down the GPIO controller
        // (this method will forcefully shutdown all GPIO monitoring threads and scheduled tasks)
        gpio.shutdown();
    }
}

Capture Video with Raspberry Pi B Plus using PI4J

//Importing the libraries
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Date;
import com.pi4j.io.gpio.event.GpioPinListenerDigital;
import com.pi4j.io.gpio.event.GpioPinDigitalStateChangeEvent;

//Declaring the class
public class VideoCameraExample {

    //Declaring the variables
    private final String height = "720";
    private final String width = "960";
    private final String fps = "15";
    private final String destDir = "/home/pi/capture/";

    // Remember to add filename and extension!
    private final String startInstruction = "/usr/bin/raspivid -t 10000 -h 800 -w 600 -o " + destDir;
   
    //method to create capture command
    private void startCapture() {
        Date date = new Date() ;
        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd-HH-mm-ss");
        String filename = this.startInstruction + "vid-"+dateFormat.format(date) + ".h264";
        executeCommand(filename);
    }

    //method to execute the command
    private void executeCommand(String cmd) {
        Runtime r = Runtime.getRuntime();
        try {
            r.exec(cmd);
        } catch (IOException e) {
            // TODO Auto-generated  catch block
            e.printStackTrace();
        }
    }
   
    public static void main (String[] args) {
       VideoCameraExample videoCameraExample = new VideoCameraExample();
       videoCameraExample.startCapture();
    }

}

Capture Picture with Raspberry Pi B Plus using PI4J

//Importing the libraries
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Date;
import com.pi4j.io.gpio.event.GpioPinListenerDigital;
import com.pi4j.io.gpio.event.GpioPinDigitalStateChangeEvent;

//Declaring the class
public class StillCameraExample {

//Declaring variables
private final String destDir = "/home/pi/capture/";
private final String stillPictureInstruction = "/usr/bin/raspistill -o ";

//method to start the capture
private void startCapture() {
Date date = new Date() ;
//Creating date using the format
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd-HH-mm-ss");
//Constructing the filename
String filename = this.stillPictureInstruction + destDir + "image-"+dateFormat.format(date) + ".jpg";
//Execute the method that execute command
executeCommand(filename);
}

//method to execute the command
private void executeCommand(String cmd) {
Runtime r = Runtime.getRuntime();
try {
r.exec(cmd);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}

//Main method to execute
    public static void main (String[] args) {
        StillCameraExample stillCameraExample = new StillCameraExample();
        stillCameraExample.startCapture();
    }
}

Motion Sensor Raspberry Pi B Plus Using PI4J Codes

/*
 * #%L
 * **********************************************************************
 * ORGANIZATION  :  Pi4J
 * PROJECT       :  Pi4J :: Java Examples
 * FILENAME      :  ListenGpioExample.java  
 * 
 * This file is part of the Pi4J project. More information about 
 * this project can be found here:  http://www.pi4j.com/
 * **********************************************************************
 * %%
 * Copyright (C) 2012 - 2014 Pi4J
 * %%
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * #L%
 */

import com.pi4j.io.gpio.GpioController;
import com.pi4j.io.gpio.GpioFactory;
import com.pi4j.io.gpio.GpioPinDigitalInput;
import com.pi4j.io.gpio.PinPullResistance;
import com.pi4j.io.gpio.RaspiPin;
import com.pi4j.io.gpio.event.GpioPinDigitalStateChangeEvent;
import com.pi4j.io.gpio.event.GpioPinListenerDigital;

/**
 * This example code demonstrates how to setup a listener
 * for GPIO pin state changes on the Raspberry Pi.  
 * 
 * @author Robert Savage
 */
public class ListenGpioExample {
    
    public static void main(String args[]) throws InterruptedException {
        System.out.println("<--Pi4J--> GPIO Listen Example ... started.");
        
        // create gpio controller
        final GpioController gpio = GpioFactory.getInstance();

        // provision gpio pin #02 as an input pin with its internal pull down resistor enabled
        final GpioPinDigitalInput myButton = gpio.provisionDigitalInputPin(RaspiPin.GPIO_11, PinPullResistance.PULL_DOWN);

        // create and register gpio pin listener
        myButton.addListener(new GpioPinListenerDigital() {
            @Override
            public void handleGpioPinDigitalStateChangeEvent(GpioPinDigitalStateChangeEvent event) {
                // display pin state on console
                System.out.println(" --> GPIO PIN STATE CHANGE: " + event.getPin() + " = " + event.getState());
            }
            
        });
        
        System.out.println(" ... complete the GPIO #02 circuit and see the listener feedback here in the console.");
        
        // keep program running until user aborts (CTRL-C)
        for (;;) {
            Thread.sleep(500);
        }
        
        // stop all GPIO activity/threads by shutting down the GPIO controller
        // (this method will forcefully shutdown all GPIO monitoring threads and scheduled tasks)
        // gpio.shutdown();   <--- implement this method call if you wish to terminate the Pi4J GPIO controller        
    }
}

Friday, July 23, 2010

Nice deve

had an interesting conversation in the morning, and it strikes me on the perception and the first impression a person have visually. Talked to my product manager and he is complaining that the application is not as easy to use with scroll bars popping up here and there. Interestingly, among other things

Wednesday, March 19, 2008

OH-NO-12514

been ages since i update the tech blog, anyway here it goes.

Issue faced - ORA-12514: TNS:listener does not currently know of service requested in connect descriptor

You should be able to find heaps of solutions that you can try. But I think this should be try first before venturing into the abyss of solutions.

  1. Check your listener.ora (chances are your db is not registered to the listener)
  2. Login into your DB (sqlplus / as sysdba)
  3. Type "show parameter listner"
    • Check if the local_listener parameter is available if not you would have to add
  4. alter system set local_parameter='orcl'
With this it should solve the problem.

p.s. basically writing this down just in case I forget.... :-P

Labels: ,

Thursday, November 23, 2006

Having fun with Oracle TopLink

I started this project recently with some scepticsm because we are using TopLink as an OR-tool. However, so far it has been pretty smooth and I get to understand some of the terms used in the TopLink Developer's Guide.

I will give the update on some of my adventure with TopLink, stay tune.

Labels:

Thursday, October 05, 2006

ADF-Faces and Me

I am embarking on a new but rather familiar project - Disaster Management. Under the new management it is now called Oracle CARE project (courtesy of the team lead). But like trish said, who cares ? ha ha..

Anyway, I am looking at the Oracle Tech stack for this project implementation. With all the talk that we must start developing with the mindset of creating a product - Oracle Product that is, so naturally it must be using Oracle Technologies.

So I start with ADF, we used JSF in the first project and now we will use ADF-Faces. After reading about it (now with more purpose than before), I realized, "Hey how can we work with ADF-Faces as a team". Much of the examples given are from the POJOs to the UIs. DAMN !!! how can we cleanly separate our work by following the MVC pattern.

I am determine that there is away to do this (might be painful oouuchhh ), and yes the ADF Developer Guide doesn't help on this issue. But anyway, it is an opportunity again.. so I think BPEL you shall take a rest for now, I need to do some ADF right now.

Shall be back for more updates :-)

Tuesday, July 11, 2006

What I need to know to Know BPEL ?

When I start trying to do BPEL "stuff", I jumped straight into the tutorials that are provided on the Oracle Technology Network (OTN). It got me through the tutorials and I kindda understand how it works. So I challenged myself, let's create an application.

Yupe, so I started, then I realized, it is not so easy to create one from scratch. The tutorials provide the schemas and data needed. Just follow the steps and magically all works. Not the same case when it is from scratch.

So I decided to explore the technologies used in a typical bpel process and below are the technology that I think that are necessary for someone to have to acquire BPEL without much pain.

1. XML Namespace
2. XML Schema
3. XPath
4. WSDL
5. SOAP