Saturday, February 29, 2020

Could not find module FindOpenCV.cmake

This link discusses this issue while building the project with cmake - 
https://stackoverflow.com/questions/8711109/could-not-find-module-findopencv-cmake-error-in-configuration-process

In my case, the problem was that I was setting the wrong environment variable, which is case-sensitive. Set
OpenCV_DIR, not OPENCV_DIR

Then cmake is able to find opencv.

Wednesday, February 26, 2020

remmina and RDP to Windows 10

I could not connect via RDP to the Azure Win 10 instances using the distro-supplied Remmina on Ubuntu 16.04 based Linux Mint 18.1. Found that a later version of Remmina is needed.
https://remmina.org/how-to-install-remmina/

First tried installing flatpak - that failed. Then went the ppa route, success.

Found the procedure to transfer files via RDP, by Edit connection, Share folder, and also choosing sound as local, file transfers were quite slow, 27 seconds for 7 MB in my case - 4 seconds per MB. For me, with Azure, it was faster to use wetransfer.com - faster than 1 MB / sec upload at my end, 10 sec to download a 200 MB file to the Azure VM.

Timezone bug in our code

PB corrected our schedule page code which was showing Australia NSW as GMT +10 instead of +11. Copy-pasting his solution - 

The countries which have DST spanning across the years have this issue. (Found 4 such countries) ...

I have set the dstStartMonth to January of this year as a temporary solution. ...

Modified the code to add the required condition 


FROM
if(($curMonth > $dstStartMonth && $curMonth < $dstEndMonth) ||
($curMonth == $dstStartMonth && $curDay >= $dstStartDay) ||
($curMonth == $dstEndMonth && $curDay <= $dstEndDay))
$offsetGmt= $offsetDst;
TO
if(($curMonth > $dstStartMonth && $curMonth < $dstEndMonth) ||
($curMonth < $dstStartMonth && $curMonth < $dstEndMonth &&  $dstStartMonth > $dstEndMonth) ||
($curMonth == $dstStartMonth && $curDay >= $dstStartDay) ||
($curMonth == $dstEndMonth && $curDay <= $dstEndDay))
$offsetGmt= $offsetDst;

Then restored the DST timings for the four countries.

Tuesday, February 25, 2020

enabling https for our dl domain also

The Listen Now feature, which uses playlists with http links to mp3 files, was not working on Chrome. Enabled https on our dl domain also as I'd done for our main domain, with self-signed certificates and proxying on cloudflare. Turns out I had already edited /etc/apache2/sites-enabled/ourdldomain.tld-ssl.conf

Only needed to do
a2ensite ourdldomain.tld-ssl
service apache2 reload

Once https was working for the mp3 links, the Listen Now feature started working again. 

And the workaround for the streams (which are only http at the moment) not working on Chrome might be to use the direct links to stream URLs like http://ourstream.tld:8002/ with a _target=”_blank” attribute to open them in new windows or tabs.


Thursday, February 20, 2020

a tale of two cities

This is one of my infrequent travel posts. Some earlier examples are

  1. https://hnsws.blogspot.com/2017/09/updated-budget-airline-flying-experience.html
  2. http://hnsws.blogspot.com/2007/01/flying-air-deccan.html
I'd been to Pune and Chennai recently, visiting family and also hand-carrying some items needed for our lab here. 

Both Chennai and Pune seemed to be less congested than Bangalore, the traffic jams were less severe. Also rode the Chennai Metro and was favourably impressed. Not as crowded as Bangalore's Namma Metro, since there were many more coaches - 6 vs 3 - per rake. And the interior was quieter too, during the run. The lines for token vending machines in Chennai Metro stations were relatively shorter than the lines for human assistance counters. And as expected, travelling by Metro across town was faster than travelling by car. Just half an hour to reach the airport from Annanagar, including time taken to buy tokens, wait for train, etc. 

Pune's green spaces also impressed me. Went for a couple of walks in a gated community's park and in the University campus. Apparently, some hills nearby are also preserved from tree-cutting, and offer a haven for wildlife. 

Tried out AC 1st class train travel. Comparing with AC 2-tier, the berths are somewhat wider, longer and more padded. Is it worth three times the AC 3-tier cost? Doubtful, unless you are four of a group and want the privacy of a lockable cabin. In the coach I travelled, there were 3 1st class cabins - A, B and C - occupying half of the carriage, and the other half of the bogey had AC 2 tier passengers. There were 2 toilets (one Indian, one Western) on the 1st class side, but no sink/mirror outside the toilets. Except for an initial stink when the AC was turned on, no adverse issues. Power sockets worked etc. The power sockets in the AC 2-tier cabins I travelled in for these trips also worked fine. But there was a problem with the water in the toilets running out for the Pune-Bangalore train. 

I also had my first flying experience with low-cost carrier Indigo, Chennai - Bangalore. It was an A320, VT-IZZ according to flightradar24, less than one year old. Favourably impressed by aircraft cleanliness, crew and on-time performance. They ask passengers to be at the gate 25 minutes before departure, so that everyone gets on quickly, and they have the freedom to push back early. In this case, "flying conditions at Bangalore airport" delayed the push back from 1 pm till 1.25 pm, but still reached BLR before the scheduled 2 pm since flying time was only 30 minutes and not the scheduled 1 hour. Probably the "flying conditions" were strong crosswinds. Even when we landed, the windsock was blowing right across the landing path. Boarding at Chennai used an airbridge, while de-boarding at BLR was on the tarmac, followed by a 10 minute bus ride to the terminal. This air ticket was only 30% in cash, rest in points using HDFC SmartBuy. So, I paid only around Rs. 500 out of pocket.



While at Chennai airport, I also had my first airport lounge visit, complimentary with my credit card. Access to the Travel Club lounge seemed to be only via a couple of lifts, which were quite busy. The restrooms were located outside the lounge, and hand wash was available only in the restrooms (!) so after you eat something, you have to go out and come back. But the lady in the reception desk doesn't say anything, in fact, she was the one who guided me to the restrooms outside. At 11.30 am, there were some breakfast items like idli and salads, and also aloo paratha with rajma which was my choice. A nice apron view, aircon and a place to eat. A bit cramped, so at busy times may get very crowded. 



 


build issues with appveyor

The working appveyor yml file is at
https://github.com/hn-88/ViewportSavercWin64/blob/master/appveyor.yml

The post-build artifact (exe file) can be downloaded from the Appveyor site due to the addition of the last "artifacts" section in the yml file.

The build issues were probably due to missing the OpenCV.props in some build configurations in
https://github.com/hn-88/ViewportSavercWin64/blob/master/ViewportSaverc.vcxproj

For example, line 72 has
<Import Project="qhy.props" />
<Import Project="OpenCV.props" />
while line 77 only has
<Import Project="qhy.props" />
 


building Windows binaries on the cloud - AppVeyor instead of Azure

Instead of relying on a virtual machine which will expire in 60 days, explored other solutions like an Azure free trial (one year) virtual machine. I wanted to try a build with VS2015, since the OpenCV build which I have used and is known to be working was built with an older VS than the current VS2019. Also the current VS2019 had other build issues. But when I tried an Azure VM with a VS2015 image, I got the platform image not found error as in this page,
https://medium.com/@rafique82.ai/azure-virtual-machine-visual-studio-platform-image-not-found-4234fe058317

Instead of trying to troubleshoot this, since this is available only for a year, thought of CI tools like Travis, but for Windows. Googling found that AppVeyor was more stable for Windows CI.

Googling the docs and support forums, finally got a project using QHY camera SDK and OpenCV to build - the appveyor.yml gives the detailed syntax.
https://github.com/hn-88/ViewportSavercWin64/blob/master/appveyor.yml.

I also needed to tweak the paths in the project file, in this case set using a property page qhy.props, to match the values set in the yml file. 

Wednesday, February 19, 2020

deployment issue for Visual Studio VM image in Azure

This post on Medium gives the solution for Platform Image Not Found error on Azure. Basically this is a bug in Azure deployment, I guess. 

In short, download the resource template using "Download a template for automation" from our failed VM, search for the value which gives the error. Then run inside cloud shell:
az vm image list --all --sku vs-2019-comm-latest-win10-n
(or whichever image was giving the error.)

In the case of the medium post above, it was the version which had the error. Once the template was corrected and it was redeployed, the error was not seen. 

Tuesday, February 11, 2020

using Visual Studio on Windows 10 virtualbox image

  1. Visual Studio 2019 Community edition - 20 GB download from Microsoft.
  2. On my system, 45 minutes to unzip the file, since I was using a 3 TB USB external drive which was not very fast. 
  3. Then 45 minutes to import the OVA file into virtualbox.
  4. More downloads and installs - the default Visual Studio 2019 does not have the 'develop for desktop' SDK and tools needed for C++ console apps - 45 minutes more.
  5. Spent quite a while troubleshooting why the shared folders were not visible in Win10 - turns out that sharing and discovery is turned off by default, have to enable them in Network and Sharing from the control panel.
  6. Finally it turns out that projects which need earlier versions of the toolkit - like Spinnaker SDK which needs the VS2015 toolkit - won't work, complaining that the required SDK is not found. Even downloading the oldest available SDK shown for install doesn't solve the problem. Further, lots of errors with QHYCCD SDK, like
    1>J:\qhy\include\stdint_windows.h(28,1): error C2144: syntax error: 'signed char' should be preceded by ';'
    1>J:\qhy\include\stdint_windows.h(28,21): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    1>J:\qhy\include\stdint_windows.h(70,26): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    1>J:\qhy\include\stdint_windows.h(70,19): error C2146: syntax error: missing ';' before identifier 'int64_t'
    1>J:\qhy\include\stdint_windows.h(71,28): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    
  7. So now I'm trying the VS2015 DVD download, which is another 7.1 GB, 90 minutes. 
  8. Edit - update - 45 minutes to uninstall VS 2019. 
  9. Three hours forty-five minutes !! to install VS2015 from virtual DVD drive in virtualbox.
  10. Then the projects compiled without too much trouble, as "Win32 console project" though I was compiling it for an x64 Release target. Will probably upload the project and solution files, along with the property pages which I created, to the github repo.
  11. Just like Windows on underpowered machines, the virtualbox Win10 takes around 2 minutes to boot, around a minute to shut down, around 5 seconds after a click in order to start opening an app, and so on. On my configuration, just 2 GB RAM for the virtualbox, and it runs from an external USB drive. But things do get done.

Edit - a better solution might be to build on the cloud - my later post

Monday, February 10, 2020

steps to create ebook friendly pdf file from LaTEX

Recommended pdf file was with a5 papersize, 0.5 cm margins, and 14 point doublespaced text. In order to achieve that, had to follow these,
https://www.overleaf.com/learn/latex/Questions/How_do_I_adjust_the_font_size%3F
https://tex.stackexchange.com/questions/402009/exam-with-18pt-main-font

in my case, by adding the line
\usepackage[14pt]{extsizes}

and later
\documentclass[
14pt

etc.

And afterwards, needed to resize some figures to make them fit in the smaller page size, and also make text tiny in tables to make them fit.
https://tex.stackexchange.com/questions/374757/how-to-make-font-size-small-in-a-tabular-environment

\centering
\tiny
\begin{tabular}

aborted attempt to create html / doc / rtf file from LaTEX

The recommended way to export LaTEX from overleaf to epub or such ebook formats is to create a html / doc / rtf file first. But both latex2rtf as well as htlatex failed to convert my document out of the box.

latex2rtf was easy to install with apt-get install, but it aborted the conversion with Error! Could not find <\end{refsection}>.

htlatex - gave a few errors, which were corrected by installing the required packages as below. But the final output html still had jumbled equations. Not prettily bitmapped ones. In short,

gave
which pointed to

"A command of the form ‘htlatex filename "html,word" "symbol/!" "-cvalidate"’ asks for HTML output tuned toward MicroSoft Word. Such a format, however, relies on bitmaps for mathematical formulas."

texlive-latex-base
LaTeX Error: File `etoolbox.sty' not found
sudo apt-get install texlive-latex-extra

sudo apt-get install texlive-science




sudo apt-get install texlive-fonts-recommended

Package minted Error: You must invoke LaTeX with the -shell-escape flag.




self-publishing a book

My experience with self-publishing a book, with Lambert and Notion Press.

  1. Interestingly, both experiences were quite quick and easy.
  2. Lambert charges nearly 10 times more, but do worldwide distribution. Notion Press does India-only distribution, but will do worldwide if you buy 50 author copies. Which comes to nearly the same amount of money as buying 3 copies from Lambert!
  3. Both publishers accepted the print-ready PDF from overleaf. Lambert sized the page down to fit, from US letter to 5.5 x 8.5 inches. Notion Press wanted US letter size. Notion Press cover designer was quite nice.
  4. Notion Press online sales page at notionpress.com/store/ was much more polished than Lambert's morebooks.shop
  5. Ebook publishing with Kindle Direct Publishing, or with Draft2Digital and so on - did not work, since the equations in my pdf did not convert correctly from pdf to epub / mobi with their online tools. But text only content in doc/rtf format works fine with their tools.
  6. The recommended way to create epub / mobi was via tools to convert to html or rtf first, but the tools stuttered and I did not pursue it further. Details in another post
  7. Finally just created a pdf file with A5 size, which is reasonably well formatted to read on a Kindle or other ebook reader, as detailed in another post.


Friday, February 07, 2020

multipe displays with old macbook pro, manual mode setting

On the Macbook pro with GT 330 M graphics (circa 2010?), running Ubuntu and Linux Mint - Mint could easily detect a TV which was capable of 1366x768 display connected via a VGA adapter to the mini-displayport, and could start a secondary display on it. But it could not force 1080p out of the box. Mirroring the display caused the resolution to drop to 1024x768.

Ubuntu 18.04 - the mirroring option was not visible on the Display applet. But as per this page, was able to hit Command+p and mirror. Unfortunately, the mirroring did not automatically choose a supported resolution, so display was garbled on built-in display.

On MacOS, interestingly enough, neither the TV nor an older VGA monitor could be displayed - enabling the secondary display caused the OS to crash (or at least blank the display completely).

A detailed post on how to set desired modes:
https://unix.stackexchange.com/questions/227876/how-to-set-custom-resolution-using-xrandr-when-the-resolution-is-not-available-i