My Grandfather’s Recollections as Grand Jury Member that Indicted Clay Shaw on the Assignation of John F Kennedy

Before he died, on one of my yearly pilgrimages back to my home town (New Orleans), my grandfather gave me this document along with all his historical and personal memorabilia.

 

Click here to download the Full Text of Ted’s “Grand Jury & Garrison Investigation Bremen Rotary Club Speech, November 30, 1967”

 

First page sample of the above document:

 

April 21, 2017

intalling watir headless chrome on Ubuntu 16

 
apt-get update
apt-get install ruby
apt-get install ruby-dev
apt-get install xvfb
gem install watir
gem install headless
wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add -
sudo sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list'
apt-get update
apt-get install google-chrome-stable
apt-get install unzip
wget -N http://chromedriver.storage.googleapis.com/2.26/chromedriver_linux64.zip
unzip chromedriver_linux64.zip
chmod +x chromedriver
echo $PATH
mv chromedriver /usr/local/sbin/

March 18, 2017

Using QtCreator for generic c and c++ projects

QtCreator is an excellent IDE and it works great for generic c and c++ projects. There is no need to use Qt libraries at all when using QtCreator. Here is a sample template for a non-Qt program. The c_template.pro file specifies the project and explicitely removes any linkage to Qt libraries. QtCreator typically finds the native gcc/g++ compiler by default.

qt_plain_c_template.tar

 

June 18, 2014

WPF 3D Video Example using DiffuseMaterial and MediaElement

This was supposed to be so easy according to the books and examples provided by microsoft. Just add a MediaElement and specify the video source. Only it took me 6 hours to figure out what I got nothing on the screen but no errors reported. Additionally, when I implemented this with a media player class and called its “hasVideo()” method, the method always returned false. I tried half a dozen video files I had, re-converted the codecs and containers to all the popular formats, and still no video. But it always played just fine with the windows media player stand-alone application. I finally stumbled on the solution : my video’s were non-standard sizes. This only works with (I am guessing) standard width by height formatted videos, such as 720×480, as opposed to something like 854×480 which was one of my videos. So I used ffmpeg to crop my videos down to standard sizes and now its as easy as it supposed to be.

The code-behind C# method of using a media player object. diffuseMat is the x:Name given to the DiffuseMaterial object in the xaml code.

February 18, 2013

ffmpeg examples

http://ffmpeg.org/

Below are a few samples that I use on a regular basis.

Sample 1. Convert an avi file to an flv file (flash). ‘-sameq’ means keep same quality as source. in this example, the video file is G.avi. ‘-i’ means the input file follows. The output file is always the last file on the line.

Sample 2. Cut some time out of a video cut time out of a video (what I use to make 1 second long videos, can omit the start time)

Sample 3. the following will extract the bitmaps from the avi file and name them as images/000001.bmp and so on. the ‘%6d’ is a special character set that says make a number with a pattern of six digits. in this example a subfolder called ‘images’ has the bitmap files.

Sample 4.make a movie from individual bitmap frames with high quality using the bit rate control the frames are in the subfolder ‘movie’. the ‘0%d’ is a special character set thats look for files names that start with a zero followed by a number. For example movie/0001.png movie/0002.png.The ‘-b:v 4000k’ means set the encoding bit rate to variable with a peak rate of 4 megabits/second. to make the file size smaller, drop down below 4mpbs, the lower the number the more lossy. to make the file size larger, and less lossy, increase the peak bit rate.

Sample 5. crop to 720×480 with upper left stating at position 67,67, force video codec to h264

February 18, 2013

Implementation of a Laplacian filter

A Laplacian filter is a first derivative of the spatial values, often used to detect edges and features.

In this implementation of a sharpening filter, an image is filtered with the resulting values placed into an output matrix.

This particular filter is not a pure Laplacian, but custom designed to enhance edges in a particular image.

filter

This code is design for speed and not for flexibility:

December 24, 2012

Extract pixel values from a bitmap in Qt

The first step in writing an image processing program is usually extracting the image data from a file container such as a bitmap or jpeg file. Using Qt, the QImage class makes this easy. The QImage can open/save directly to bmp, jpeg, and other common container formats. Once a file has been opened into an instance of a QImage, the RGB pixel values can be extracted into a luminance array for processing.

Here is a code example for extraction. In this case, an array of 32-bit value is used for storage even though only the lower byte has a value.
The RGB values are mapped to the luminance vector of the YUV color space.

December 24, 2012

David’s Principles of Software Development

1. Have extremely well understood goals for the software functionality.

2. Have a robust design upfront – even if that means prototyping first, discarding the prototype, then designing.

3. Each developer has a chunk of functionality he owns. Each developer is associated with a functional module. A development team is associated with large product or large library.

4. Have well defined interfaces between modules and hence between developers.

5. Avoid meaningless and ridiculous schedules – they are huge de-motivators.

6. Have an architect that supervises the design and does little to no coding.

September 1, 2012

Pitfalls of Qt Signals and Slots in embedded real-time systems

Qt Signals and slots can be very useful. Together with a model-view-controller framework, where the model emits signals to views and controllers, a very clean and logical system can unfold. However, one must be aware of a couple of pitfalls.

First, there is no control over the order in which slots are called from signals. This is true in both Queued connections and Direct connections. In complex systems, with many developers, there is a tendency for control to proliferate, and then multiple controllers are watching a signal. Then dependencies can develop between the outputs of these various controllers, sometimes with dire consequences.

The second problem is that once this disconnected architecture is in place, there is a tendency to write multiple signal observers without regard to other observers. So a developer may fire a signal, unaware that two other developers have slots watching those signals, and those slots may consume a lot of computational resources. For example one slot may drive a UI element to be created, while another slots starts a real-time process. So you may fire your signal expecting your slot to execute right away, and become bewildered when your slot code does not fire for 200 ms or longer.

There are no execution flow controls built-in to the Qt signal slot system, so the system architects must keep tabs on the signal flow. I find that its best to separate the model, the controllers, and the viewers into separate threads, then develop an asynchronous closed loop communication and synchronization scheme on all channels (with a managed memory scheme). When intentionally designing this type of communication between asynchronous elements, one is forced to wait for events to complete, and design with the expectation that execution times vary. Events that cannot be separated by an asynchronous gaps in time are collected together into a single thread context to gain determinism. This makes for a more robust design.

July 27, 2012

Deleting Qt Threads without crashing

I have an image processing application that needs to take advantage of multi-core processors, and as much parallelism efficiency as possible. So I wrote a worker thread class and a controlling class. The controlling class creates the worker threads, assigns them their jobs, then starts them. It then waits for all the workers to complete, deletes them, then moves on to the next phase of processing and repeats the cycle with new set of worker threads.

But my program would crash randomly. The entire processing job would take two hours on my 6 core machine, tens of thousands of threads would start and complete, and randomly it would all come crashing down. Sometimes a few minutes after start, sometimes an hour after.

This bug was frustrating. It turned out to be how and when I deleted the completed threads. I used the thread’s finished() signal to indicate that it was finished, and then deleted it. But it turns out this signal does not really mean finished. It means the code has returned from the run() call, but not all code is completed. Namely, a
mutex has not been released. So deleting the thread while that mutex was open, not a good thing. And deleteLater() did not make things better (did not investigate this).

So the fix is to use a new signal I created in the worker thread – completed() – that emits when the work is done, to tell my controller that the thread has done its job. Then I use the thread’s built in signal finshed() to call the thread deletion code:

This code checks the isFinished() method, which unlike the signal, does not return true until after the internal mutex is released. The call to wait() gives it chance to release that mutex before deletion. Now the program does not crash.

July 27, 2012


Archives