C# Process.Start with hidden terminal window

Having issues getting the System.Disagnostics.Process.Start(…) method to run a process and hide the window. I tried all sorts of things including:

Finally came across this page on the msdn site that says:

If the UseShellExecute property is true or the UserName and Password properties are not Nothing, the CreateNoWindow property value is ignored and a new window is created.

I’m using the method:

Start(String command, String arguments)

However, there is another method that is:

Start(String command, String arguments, String user, SecureString password, String domain)

So, if we change the last line from:

p = Process.Start(proc, args);

to:

p = Process.Start(proc, args, null, null, null);

it works! Here is the complete code listing:

Spring Date converter using @InitBinder annotation

Here’s code for a controller to allow Spring to process dates properly.

Pentaho BI Server 5 – Missing data in jobId quartzjobkey.error_0002

My Pentaho scheduler was showing no data when I looked at it in the browser, and when I checked the logs I got an error that was along the lines of:

Missing data in jobId quartzjobkey.error_0002

This seemed to be caused by a JOB_NAME in the quartz hsql database that stores the scheduled job metadata. Specifically, bad job name was:

admin PentahoSystemVersionCheck 1428946692234

The other jobs all had names like:

mike.baranski:GeneratedContentCleaner:1393966687322

Looked to me like the whitespace in the job name was causing problems. I did not need the version checker, so I just opted to delete the job and hope that my job listing came back. There are several steps to accomplish this.

First, the Pentaho server uses a JNDI context definition to access the Quartz database. This definition is in ./tomcat/webapps/pentaho/META-INF/context.xml, and the relevant bit is:

Second, we need to be able to access this database. This can be done with the HSQL SqlTool. If you are not using hsql you need to use something that will work with your particular databse. To connect, I used the following command:

Now we are able to run commands on the database. Do note that hsql does not commit automatically, so I had to run the following to make this go away. Note the first statement to make sure I get the item I want to delete (and only the one I want to delete) before I remove records:

Now the offending job is gone and the UI will load the jobs that are there.

Simple Syrup for Beehive

Pour into a 1 gallon bag, poke a few (3) tiny holes in the top and lay it on top of the frames in the hive. I have a spacer that is about 4 inches that goes in to keep the top off of the bag.

You’ll need a large saucepan or stockpot, a bag of sugar and some water.

Ingredients

  • 4 lb bag of granulated sugar
  • 8.25 C of water
  • Add the sugar and water to the pan or pot, put it on the stove on high. When it boils it will be cloudy at first, then clear. When it’s clear take it off the heat and let it cool. When it’s cool, transfer to a 1 gallon plastic zip-close bag and it’s ready.

Great Circle Distance in Python

Java Convert List to JSON

This requires the jackson databind lib, here’s the maven dependency:

Postgres SQL to see disk usage for tables

Raspberry Pi B+ Garage Door Opener

Introduction

Here is the source for this project
This is my system designed around a Raspberry Pi B+, 2 magnetic overhead door contacts, and 2 5-volt relays. Wired into a 2 car garage this makes an internet enabled garage door opener/monitor that can be accessed from anywhere.

Requirements

* Raspberry Pi B+ kit
* overhead door contacts (one for each door)
* 5-volt relay (one for each door)
* NEMA or other enclosure to mount everything
* 18/4 wire (or some other low voltage wire)
* 2 Terminal blocks
* Various connectors to wire the devices together – Ribbon and jumpers
* Screw drivers and tools

Hardware Setup

1. Overhead Door Contacts

My door contacts needed a 2.5 inch or less gap to work. This made it easy to mount the sensor (the part with the wires) on the wall at the top corner of the door and to put the other part of the contact on the top corner of the door itself. Since there is only about a 3 foot space between the doors,

I mounted the right door’s contact on the upper left side and the left door’s contact on the upper right side. This meant that the 2 wires from each contact could meet in the middle and I could use 1 strand of the 4 conductor wire to get both contacts back to the NEMA box.

Top left contact mount

Top left contact mount

Closed door contact location

Closed door contact location

2. Opener Button Wiring

My door switch is on the inside wall, and is simply a contact closure switch that causes the motor to start going up or down. This is pretty simple, and it means that a relay is the perfect way to “push” the button with the Pi. To do this, we have to have 2 wires (or half of our 4 wires in the cable) wired to the NO side of the relay so when we send a signal to the relay it closes the loop and “pushes” the button.

There is a terminal strip on the back of the opener with 4 screw-in terminals. The wireless remote and door switch are already run to these terminals, and the 2 inside terminals are the ones that we want. I checked this by taking a screwdriver and shorting these 2 points; this caused door to open just like we’d pushed the button.

This means we have to run wire from the opener on the ceiling to the location of our equipment, just like the contact wiring. Since the openers are about 5 feet apart, I ran one wire to each unit even though I only needed half of the 4 wires.

Opener wiring

Opener wiring

3. Putting it together

Now, we mount the components on a board and put this into the NEMA box. Then, we pull the wires into the box and hook everything up. I used one inch pegboard to put the components on, but anything that closes to keep the dust out is good. The only issue with using an all-metal box is that the wireless does not work inside the box (I guess it’s a Faraday cage or something).

Connect the Pi to the relay

  1. Mount the 2 terminal strips, Pi board, 2 relay board and ground post to the board.  From the Pi, run the following pins to one of the terminal blocks:
    • The 5V pin
    • A ground pin
    • Two (2) GPIO pins for the Pi to use as to “push” the button
  2. Run the following wires from the relay to the terminal block to match the ones from step 1
    • The “VF” side of the relay coil goes to the 5V pin
    • The ground side of the relay goes to the ground Pi pin
    • The 2 relay coil activation pins to the GPIO pins, noting which is which (i.e. right door to GPIO 5)

wiring-cropped

At this point, the Pi should be able to control the relay.  My relay is activated when the activation pin on the relay goes low.  In other words, the GPIO pin connected to the relay should be ON unless we are pulsing the input.  This means that to “push” the button we start with the relay ON, when we want to push the button we turn the GPIO off, wait .2 seconds and then turn it back on.

Assuming your switch is on pin 3, here is how you would do this in python:

Now, we don’t have the other side of the relay hooked up yet, but you should be able to hear the relays click when the switch is activated.

Connect the relay to the switches

Locate one pair of wires coming from one of the opener units. You can check the wires because if you have the correct pair you can touch them together to short them and the door should close or open.

Hook these wires up to the terminal block on one side, and hook up one of the relay common and NO pins on these. This means that when the relay is activated the NO and common pins will be shorted and the motor should start. If you have it hooked up correctly, you should be able to run your pulse script again and the garage door should work!

Do this for the other pair of wires for the other opener and the other relay.

Connect the door contacs

The door contact should be hooked up with one wire going to the ground, and one wire going to a GPIO input.  The input is setup with a PULL_UP resistor which means that you will get a 1 (or True) when the contact switch is closed, and a 0 (or False) when the contact switch is open.

Setup software

To create your SSL keys for the app to use, once you’ve setup the software on your pi and created the */etc/garage* directory, you can run:

This will setup your SSL keys so you can use https, which you want to do if you’re going to setup port forwarding and enable this from the Internet.

Checkout door code, configure json file of doors, create ssl keys and make sure you have all the required packages.  Run the site.py file and then connect to https://raspberr-pi to see the site:

One Open Door

One Open Door

Both Doors Closed

Both Closed