Saturday, December 2, 2017

Java Webstart

Launching Java webstart apps on linux OS

In my tests today, these will fail to launch as per the original specs that once existed and per my past experiences with Webstart Deployed apps. Instead what is happening is that the file is being downloaded instead of being launched.

Provided you already have a JDK installed, the trick is this....

  • Just download the JNLP (Java Network Launch Protocol) file to somewhere
  • Then locate the file and right click it then choose.... Open With
    • locate javaws. Find this in the bin folder of your JDK (java development kit)
  • Whoalla!

Wednesday, November 22, 2017

Recording PC screen on linux PC

SimpleScreenRecorder does the job nicely. Do a search and you'll find it! :)

Hands-free mobile phone use while driving

After finally getting around to putting the effort into a hands free kit for mobile use in the car, these are my findings and works pretty well!

Hardware

Phone device:

Samsung s7 edge

Bluetooth device:

I do not have a stereo system or head unit in my daily-driver that is Bluetooth capable. In fact it is the original stereo from Japan which only has a frequency rage of...  todo. 
Rather than install a stereo system capable of bluetooth, what I did was purchased a roidmi device. See url: https://xiaomi-mi.com/fm-transmitters/
This device transmits audio via a set FM channel of your choosing to your existing car stereo.
You wont need this if your stereo is already Bluetooth capable (which many are)


Wednesday, November 1, 2017

Find your linux version information


Recently I had to install virtualbox but feedback coming back at me from the install process was telling me that not all dependencies were being satisfied and therefore the installation was being aborted.

Looking at the download page for virtualbox it provided information on the ubuntu code names such as...

  • Trusty
  • Precise
  • Wheezy
  • etc etc...

Turns out I needed the download for xenial



Feed this into a terminal and see version info

cat /etc/*release

Wednesday, August 23, 2017

Auto-mounting external USB drive onto a linux OS

Yes, by default this will typically happen anyway.

However...

If like me and you have an app that starts up at boot time and needs access to a particular USB drive.... we find that in some cases the drive may not be accessible right at the moment our app needs it and so it fails to run as expected!

The fix???

Assuming you have the drive mounted at this moment, get a terminal and punch in..
$ cat /proc/mounts

Look through all the muck and find the drive of interest. For me it's...

/dev/sdb1 /media/mugwhy/blueDrive ext4 rw,nosuid,nodev,relatime,data=ordered 0 0

Yours will be different of course!!!

Take a copy of that to your clipboard!

Now launch your GUI Disk tool. Choose your drive from the list in the left. Now nosy around and look for the mount options. Make sure Automatic Mount is Off! Click OK and close the tool!

Now, in your terminal punch in...

$ sudo gedit /etc/fstab


You'll get a file loaded into a text editor.

At the end of the file add a comment such as...

# blah blah so I wont forget what the following is for...

then paste in the line from your clipboard!

Save the file and  re-boot!!

You-re done!!!

The drive should now get mounted at boot and before apps try to access it....

Note:
A small clue to let you know it's probably working.... Your computer may take a little longer to boot since it's now looking to boot from the USB drive (if it's bootable), then if not, boot will continue on as normal!  :)

Good luck!






Saturday, March 4, 2017

Playing video in a Visual Studio Solution/Project using the FFmpegInterop




The following relates to my experiencing of tireless trial and error of finally getting the FFmpegInterop building and running as described here...

https://github.com/Microsoft/FFmpegInterop in Visual Studio 2017

I'm running Windows 10.
My tests were performed with VisualStudio 2015 and 2017 community editions



I like to think of the process like this...

  1. Get a copy of FFmpegInterop
  2. Getting a compatible build of ffmpeg
  3. Combine the two into one folder structure
  4. Load up the FFmpegInterop Solution/Project in VS 2015 edition. Build and run
  5. Copy the FFmpegInterop folder from Visual Studio 2015 projects folder and place into the VS 2017 projects folder
  6. Load build and run





FFmpegInterop
16 March 2017:
Head over to...
https://github.com/Microsoft/FFmpegInterop

Have a read. Check this is actually something you want.

Grab a copy of the project file.
I recommend putting it in a safe place such as your personal archives for future use. Put it somewhere where you will not mess with it's data. 
Somewhere for safe keeping!

Now grab a copy of the above file and  place it on your desktop.
Extract the file.
Inside the extracted folder is another folder of the same name. 
I recommend taking a copy of this internal folder (of the same name) and putting it in a safe place such as your personal archives for future use. Somewhere for safe keeping.



Compatible build of FFmpeg

16 March 2017
As per the prerequisites as noted on the FFmpegInterop download page, we will need a compatible build of FFmpeg for this to work.

So using git, grab yourself a copy of the latest ffmpeg source code using git...



git clone git://source.ffmpeg.org/ffmpeg.git
You will end up with a folder called ffmpeg

As always, I recommend putting a copy of this away in a safe place so you can replicate your success with good data in the future.

Now head to...
https://trac.ffmpeg.org/wiki/CompilationGuide/WinRT

and simply follow the instructions.
There's a lot there. Follow the instructions very carefully. Take your time!

During my time attempting this, there were a couple of things that tripped me up.


Trip-up 1...

You will need Visual Studio 2015 with Cross Tool launchers in your Windows start menu.
I had an install of Visual Studio 2015 that did not provide the launching of (in my case....  
VS2015 x86 x64 Cross Tools Command Prompt
from the Windows Start menu

So this was a little hit-and-miss for a while but I finally found an install that gave me...
VS2015 x86 x64 Cross Tools Command Prompt
See the picture below. Hunt around for the download that provides the many  Cross Tools in your Start menu.



My download file was called...
vs_community_ENU.exe
I'm sorry but I can't recall where I got this download from.


Trip-up 2
My Windows 10 username comprises of both my First and Last name and I had my ffmpeg source folder hanging from that. Example...

C:\Users\MyFirstName MyLastName\Documents\here

So you can see here that the path has white space in it. A successful build and compile etc will fail if you build in such a path.

----------------------

Sort out Trip-up 1 above
Regarding Trip-up 2, Just make a folder directly on your root c drive. Ive called mine...
C:\here
Grab your copy of ffmpeg and place it in the above folder. So now you'll have...
C:\here\ffmpeg

Now that the above is sorted, continue on with the instructions here...
https://trac.ffmpeg.org/wiki/CompilationGuide/WinRT
and remember to take your time.

Once you have successfully built a compatible ffmpeg folder, put it away safe (since that was a lot of work)

------------------------------------

Get your copy of FFmpegInterop folder from your archives and place it in your VS 2015 projects folder

In the above folder should be an ffmpeg folder which should be empty.

What you want to do now is replace the ffmpeg folder with your newly built ffmpeg folder.

You can now Launch VS 2015 and load up the appropriate Windows10 or Windows8.1 solution. Set the startup project to...
MediaPlayerCS 
for c#

And build/run
It's very possible that VS will present prompts stating you need to update/convert this that and the other. just go with the flow here and accept the defaults.

Once you get success with 2015, Copy the  FFmpegInterop project folder from VS 2015 to VS 2017

Reload with VS 2017 and test

Good luck!




Findings....
Out of the box solution plays various media types straight off the hard drive no problem.
Also plays RTSP streams no problem.
Cant seem to play my IP camera http streams. With some tweaking I'm hoping to overcome this!
















Tuesday, February 28, 2017

Smart Home systems using zwave technology


Install Considerations

Light/Lux sensors
If you're going to sense light levels in the same room where you switch lights on and off then consider that light levels can obviously change depending if lights are on or off. You may want to make some conditional and additional checks depending if night/day, lights are already on or off etc before reading lux levels and determining what to do before hand as you may end up having your lights oscillating on and off by them-selves.
eg...

  • light level low, turn light on
  • light level high, turn light off
  • light level low, turn light on
  • etc
  • etc
You don't want that!
Consider NOT mounting the lux sensor too close to the lights being controlled.
Think about sensing light levels outside to determine whether to switch inside lights.




AEOTEC 4-in-1 sensor

Model: DSB05-ZWAU (921.42MHz)


Motion
Once motion has been sensed it will not be able to re-sense again until a time-out period has lapsed. I can not remember the factory setting but it's an amount somewhere in minutes!!! Often far too long to be practical.
For setting  the above setting using the Veraedge controller, I had to go to the device options. Look for the timeout variable and enter your desired setting.
Remember, the device will need to be awake for the setting to be set. See "Setting device options" under the documentation for the Vera Edge

Sensitivity is set using an adjuster behind the battery compartment.

Wake-up:
A click longer than about 2 seconds then release seems to wake the unit up so it can accept receiving your user programmable parameters.




AEOTEC 6-in-1 sensor


Model: ZW100-8 (921.42MHz)

Settings button:
After inserting batteries etc, put the back lid back in place. There is a button under this lid and it's not intended to be pressed directly.
In one corner of the lid is an indentation. The idea is that you push here with a pointy object to activate the button beneath. In my experience it is best not to use a sharp object as you risk puncturing a hole right through the plastic like I did. The button can easily be activated just by pressing with your finger or thumb!


Factory reset:
Keep the button pressed for about 20 seconds to reset the unit. Eventually you will see the LED change smoothly from one color to the next, the perfect indication that a factory reset has just taken place.

Include mode:
A brief click puts the unit into include mode.

Wake-up:
A click longer than about 2 seconds then release will wake the unit up so it can accept receiving your user programmable parameters.

Repeater:
Yes these units can be used as a repeater but to do this you must power the device via it's USB port.
That means, exclude the device from the controller if already powered by batteries, then re-power the device via its USB port then re-include! Obviously you'll then need to re-set your own parameters for your application. By re-powering the device from a factory reset/exclusion means the device to automatically assign more appropriate config settings to accommodate.

Motion:

Once motion has been sensed it will not be able to re-sense again until a time-out period has lapsed. For this model, the minimum time-out is 10 seconds! Settings less than this will fail to be written to the device! I spent hours on this trying to set a period of 5 seconds, agh!!!
For setting  the above setting using the Veraedge controller, I had to go to the device options and add a configuration setting
When you add a configuration setting you get a row of columns with 4 fields. You need to look up the variable fields in the device documentation somewhere. See example that enables a re-trigger of motion after 10 seconds.
The variable 3 I think can include a comment if you enter for example 3-blahBlahBlah. I have not tested that yet!

Configurable settings variable Data size Desired value Current value Delete buttons
3 2 byte dec 10 10 X (Delete this row)

Remember, the device will need to be awake for the setting to be set. See "Setting device options" under the documentation for the Vera Edge

Sensitivity can be set using the same technique.

Manually wake the device
Press and hold the button for about 2 seconds and release. When the device is awake it's programmable config options can easily be set without waiting for devices to wake up naturally.




VeraEdge

Factory reset
You can hold the rest button on the side for about 30 seconds to factory reset. This will reset all configurations and wipe your included devices etc...

Home / Away / Night / Vacation       modes
Where you configure mode presents, seems best not to set who will get notifications here else you will get repeatedly bombarded with these. Example... when sensor sensed motion, when sensor stops sensing motion... etc etc
You can set scenes to notify anyway and it seems you only get one notification per event which is what we want. Not multiple!

Recording what cameras see
02 March 2017:
First things first, the Vera Edge as I see it, DOES NOT record video but rather a series of single snapshots. As my cameras do not seem to be fully compatible, I can NOT confirm this fully.

My foscam cameras do not seem to be fully compatible according to the features and instructions that I have read in the documentation thus far. Mainly, the cameras will not record for the given time of 15 - 20 seconds when set to do so! It will take a single snapshot however... regardless if I set system to record the 15-20 seconds or to take a single snapshot
More often than not, with a single snapshot, it is possible that the subject that caused motion to be sensed and therefore a photo to be grabbed from the VIDEO camera... will not be caught in the photograph. This is because my motion sensor can pickup movement before the subject moves into view of the camera.
My work around is this...
  • Create a scene with an action that simply takes a single snapshot immediately
  • Add another action that takes another snapshot 1 second later
  • Add another action that takes another snapshot 2 seconds later
  • Add another action that takes another snapshot 3 seconds later
  • etc
  • etc
  • Then finish off the scene in the usual manner
This for me is working well! With this technique you end up getting a cluster of still photographs.

Note:
Viewing the camera thumbs within the GUI in UI7 is just hopeless. Far too small with only a maximum of 12 snapshots per page. It is best to use your smart phone app for this!

Setting device options
You can enter your desired values here and save the changes. If the variable you want to change within the device is not show, you can simply add it.
When you add a configuration setting you get a row of columns with 4 fields. You need to look up the variable fields in the device documentation somewhere. And see which values are available that you want to set.
Example...

Configurable settings variable
Data size
Desired value
Current value
Delete buttons
3
2 byte dec
10
10
X (Delete this row)


Save your changes!
Settings will be sent to the device.... eventually.  If the device is not awake, then the setting will be written when the device wakes up. This could take a while... minutes!!!!
Better to look for documentation for your device and find out how to manually wake the device. Then set your config options until your done!
Note:
Device > Advanced > Commands-tab > [Configure node right now]
Will send the setting to the device immediately if the device is awake!

Adding devices to custom-named-rooms
03 March 2017
For sub devices...  example....
An AEOTEC 6-in-1 sensor is 6 devices in 1. One of the devices however is what I would call the master device and the remaining devices sub devices. As of this the day the Vera does not allow me to assign one of the sub devices to a room other than the same room as the master device. While the system does actually allow me to do it AND the results show on-screen... after a browser re-fresh????  your changes are messed up. Keep this in mind.
Most multi-devices will be in the same room but you have occasions where it would be nice to split them into different rooms.
Example.. I have a double switch behind a wall-plate with two switches exposed. One switch is for a light in the same room as the wall plate while the other switch is for the light  on the other side of the wall (outside the house). In this circumstance I simply can not assign each switch to different rooms. In my case an inside room and outside!



Open Zwave


04 March 2017:

My system...
Windows 10
AEOTEC Z-Stick Gen5. Model: ZW090-B(921.42MHz)
Visual Studio Community 2015

Download the code from github. URL...
https://github.com/OpenZWave/open-zwave

You will end up with the file...
open-zwave-master.zip

Extract this somewhere. You'll end up with the folder...
open-zwave-master
Inside this folder is another folder of the same name. Take a copy of the internal folder and put it in your Visual Studio Project folder.

Go into folder....

YourProjectsFolder/open-zwave-master/dotnet/examples/OZWForm/build/vs2010

and take a copy of the solution and project files and paste these copies into the src folder.

eg...
yourProjectsFolder\open-zwave-master\dotnet\examples\OZWForm\src

Launch Visual Studio and open the solution file.

Visual Studio may ask you to upgrade the solution. Go ahead and say yes and load up the application.

Run the application.

Visual Studio may state that the projects are out of date. Go ahead and go with the suggestion to update them by building them.

Sit back and wait for the build to complete.

If successful you'll get a form window open up.

If you already have your z-stick plugged in AND you have fluked the coms port for it, you just might see the form get populated with previously-added devices. Including the stick!

If your not getting any activity do the following..

  • Stop the app.
  • Go to Windows Device Manager and check which Com port the stick is attached to. Disconnect and reconnect while observing.
  • Make a not of the Com port.
  • Head back to Visual Studio and load up the file...   MainForm.cs
  • Search for... m_driverPort
  • Edit the Com port to reflect the actual port that the zstick is attached to.
  • Re-run the application. Hopefully you will now get a list of devices...
Good luck!

You can also get the code from the openzwave website...


10 March 2017
I've just upgraded to Visual Studio 2017.
All of the above is the same except you'll get a compile error and it won't run.
The solution for me was to right click on each of the other two projects...

  • OpenZWave
  • OpenZWaveDotNet
and choose...
Retarget Projects

Then all worked as per normal.






Kotlin (Programming language)

Todo