A guide to compiling the contrib modules of OpenCV on Windows -
https://putuyuwono.wordpress.com/2015/04/23/building-and-installing-opencv-3-0-on-windows-7-64-bit/
Mostly work related stuff which I would've entered into my "Log book". Instead of hosting it on an intranet site, outsourcing the hosting to blogger!
Wednesday, May 16, 2018
opencv contrib modules need compiling on Windows
Friday, May 11, 2018
Linux Mint Live CD / DVD
- username is mint, and no password.
- sudo does not ask for password.
- to take a backup, can do sudo cp -R /source/folder /destination/folder
- to switch between screens, Ctrl+Alt+F2 or Ctrl+Alt+F7 etc - need to press Fn also on Mac keyboard.
web hosting on github
https://help.github.com/articl
https://pages.github.com/
The limits are quite generous - https://help.github.com/
"GitHub Pages sites are subject to the following usage limits:
- GitHub Pages source repositories have a recommended limit of 1GB .
- Published GitHub Pages sites may be no larger than 1 GB.
- GitHub Pages sites have a soft bandwidth limit of 100GB per month.
- GitHub Pages sites have a soft limit of 10 builds per hour."
Sunday, May 06, 2018
C++ programming - using fstream in a cross-platform manner
Some notes about making use of fstream in cross-platform code -
Some interesting methods are discussed at
https://stackoverflow.com/questions/9739948/write-a-file-in-a-specific-path-in-c/40980510#40980510
In Visual Studio,
disable deprecation, use _CRT_SECURE_NO_WARNINGS -
Configuration Properties >> C/C++ >> Preporocessor >> Preprocessor Definitions >> _CRT_SECURE_NO_WARNINGS
A working code snippet -
char path[80];
char foldername[80];
sprintf(path,"homeuser/file.txt");
sprintf(foldername, "homeuser");
CreateDirectoryA(foldername, NULL);
std::ofstream file(path); //open in constructor
std::string data("data to write to file");
file << data;
Friday, May 04, 2018
making an alexa skill
There was already a Radio Sai skill, but that one was missing AfriStream and AsiaStream. So, decided to try to implement this skill, with some improvements, as an official radiosai skill.
Changes in the user interface - the screenshots given here are no longer similar to Amazon's AWS console or the Skills console. Instead of uploading the sample utterances as a text file, I manually created the utterances in the Skill console using the wizard. Also added some confirmation before playing each stream, like
var message = 'Playing Bhajan Stream.'; this.response.speak(message); this.attributes['stream'] = 'BhajanStream'; controller.play.call(this);
and also added a stop call to the AudioPlayer -
'AMAZON.CancelIntent' : function () {
// adding the line below to stop the audio player
controller.stop.call(this);
//////////////
var message = 'Good bye.';
this.response.speak(message);
this.emit(':responseReady');
}
It looks like only the playModeIntentHandlers are active - the others don't seem to be called. Have submitted for being made available to the public.
Edit: Update May 11 -
1. Bug fixes by the owner of this repository, looks like the SDK had some changes so the zip file needed to be changed.
2. How to build an Alexa audio streaming skill from a template - YouTube video - lots of similar resources available
3. Audio player skill sample from Amazon, for multiple streams.
Wednesday, April 25, 2018
free alternatives to Zemax
https://www.quora.com/What-are-some-open-source-free-Optical-design-software-packages-similar-to-Zemax-CodeV-available-for-Windows
"My experience with free software gives me the impression that they are good enough to learn about lens design and optics, but not good enough to do serious (=paid) work."
lightmachinery.com/optical-
Saturday, April 21, 2018
free video editor - DaVinci Resolve
https://www.reddit.com/r/AskReddit/comments/8dp8ui/whats_the_best_free_software_out_there_that_you/
A video editor with lots of features - DaVinci Resolve, and also, of course, Blender.
Tuesday, April 17, 2018
Notes on compiling software lockin amplifier
Friday, April 13, 2018
USB to TTL link dump
A collection of links about communicating with serial control lines over USB - Arduino etc -
- Communicating via the USB-to-TTL-Serial Adapter - https://www.pololu.com/docs/0J36/6
- https://www.xanthium.in/Serial-Port-Programming-on-Linux
- Using CTS / DSR - last part of https://stackoverflow.com/questions/209603/steps-to-make-a-led-blink-from-a-c-c-program
- https://stackoverflow.com/questions/957337/what-is-the-difference-between-dtr-dsr-and-rts-cts-flow-control
- No RTS pins for low cost board - need FTDI board - detailed tech info -
https://www.adafruit.com/product/954 via the quora link below, - https://www.quora.com/What-is-a-TTL-signal-in-communication-and-when-using-a-USB-port-why-do-we-use-a-USB-to-TTL-converter - "The so-called USB to TTL converter is actually a USB Serial Port to CMOS Logic-Level Serial Port converter."
- Using select() for microsecond delay -
https://www.experts-exchange.com/questions/20556300/how-insert-a-delay-in-microseconds-in-C-under-VC.html
https://stackoverflow.com/questions/1157209/is-there-an-alternative-sleep-function-in-c-to-milliseconds
https://pubs.opengroup.org/onlinepubs/000095399/functions/select.html - Processing.org - interesting resource for graphing the output, even from an Arduino. Tutorial -
https://itp.nyu.edu/physcomp/labs/labs-serial-communication/serial-output-from-an-arduino/ - libusb.info - crossplatform
- https://playground.arduino.cc/Interfacing/LinuxTTY - interesting shell tricks
- https://chrisheydrick.com/2012/06/13/how-to-read-serial-data-from-an-arduino-in-linux-with-c-part-2/ links to
- "Tod Kurt’s blog has an excellent write-up and fantastic example program for reading and writing serial data to/from an Arduino." - and http://todbot.com/blog/2013/04/29/arduino-serial-updated/
- Things to try if tty is not writable - https://ubuntuforums.org/showthread.php?t=2333167
Tuesday, April 10, 2018
bouncing emails in google groups
Maintaining google group by deleting bounced emails. And if needed, re-adding them.
https://support.google.com/a/answer/7552660?hl=en
Edit: Users can reset their bounce status by going to https://groups.google.com/bounced?pli=1 or https://groups.google.com/a/example.com/groups/bounced?pli=1
next to Bounce Status, email status -> Reset bounce status. (which appears only if it is bouncing.)
Monday, April 09, 2018
Arduino IDE on Linux Mint
From https://playground.arduino.cc/Linux/Mint/ -
we should probably not use
sudo apt install arduino
because it is outdated or non-standard, and we should instead use the 64 bit binary from
https://www.arduino.cc/en/Main/Software
Saturday, April 07, 2018
email slowdown and possible fixes
1. For some gmail emails, the server was trying the ipv6 address, and not able to reach it - like
Mar 25 09:34:15 krishna postfix/smtp[19788]: connect to gmail-smtp-in.l.google.com[2404:6800:4003:c03::1b]:25: Network is unreachable
Mar 25 09:34:28 krishna postfix/smtp[20163]: connect to ASPMX.L.GOOGLE.COM[2404:6800:4003:c02::1b]:25: Network is unreachable
This was probably due to a router change at the Studio.
Did this -
https://support.plesk.com/hc/en-us/articles/213398289-Specifying-Postfix-configuration-of-IPv4-IPv6-protocol-support
ie
adding the option:
inet_protocols=ipv4
to the /etc/postfix/main.cf Postfix configuration file. And then as root,
# postfix reload
# service postfix restart
That worked, the emails went out. But the email sending rate was only around 1000 emails per hour, as reported by
# qshape incoming active deferred
2. A lot of mails were being deferred instead of bounced by gmail, OverQuotaTemp.
cat /var/log/mail.log | grep OverQuotaTemp | wc -l
5878
PB unconfirmed those emails using
cat /var/log/mail.log | grep OverQuotaTemp | grep 'to=' | grep -o '[[:alnum:]+\.\_\-]*@[[:alnum:]+\.\_\-]*' | sort | uniq -i
Then also for bouncing emails, like
cat /var/log/mail.log | grep "does not exist"
cat /var/log/mail.log.1 | grep "does not exist"
cat /var/log/mail.log.1 | grep "553 Mail from 111.93.16.162 not allowed"
cat /var/log/mail.log | grep "status=bounced"
cat /var/log/mail.log.1 | grep "status=bounced"
3. Mails were still going out slowly, with the usage on the internet port being like
Thursday, April 05, 2018
notes on startup / shutdown times
Linux vs Windows 7 brief speed test
Thursday, March 29, 2018
finding ip ranges via ASN
https://www.quora.com/How-can-
https://www.peeringdb.com/net/1903 has Airtel's ASN.
Then, we can use that ASN in this whois query -
whois -h whois.radb.net -- '-i origin AS9498' | grep -Eo "([0-9.]+){4}/[0-9]+" > airtel.txt
whois -h whois.radb.net -- '-i origin AS9829' | grep -Eo "([0-9.]+){4}/[0-9]+" > bsnl.txt
Wednesday, March 28, 2018
boot from grub - link dump
root (hd0,0)
makeactive
chainloader --force +1
boot
But grub 2 is different.
https://www.linux.com/learn/how-rescue-non-booting-grub-2-Linux
grub> set root=(hd0,1)
grub> linux /vmlinuz root=/dev/sda1
grub> initrd /initrd.img
grub> boot
set prefix=(hd1,1)/grub
set root=(hd1,1)
insmod normal
normal
https://www.aioboot.com/en/boot-windows-grub2/
from grub rescue prompt,
search -s root -f /NTDETECT.COM
drivemap -s hd0 $root
ntldr /ntldr
boot
https://www.gnu.org/software/grub/manual/grub/grub.html#DOS_002fWindows
parttool (hd0,1) hidden-
parttool (hd0,2) hidden+
set root=(hd0,1)
chainloader +1
parttool ${root} boot+
boot
https://www.aioboot.com/en/boot-windows-grub2/
http://forums.justlinux.com/showthread.php?153121-Fun-with-GPT-partitioning
unable to make XP boot from a cloned volume on Intel Mac
Just a few lines of notes - trying making other partitions hidden to make XP boot - doesn't work, since partition is GPT, grub says hidden - unknown argument or whatever.
using dd to clone a usb drive
From
https://www.garron.me/en/bits/convert-store-copy-bootable-usb-iso-file-another-usb.html
- use df to find the device name, then
- dd if=/src/dev/path of=/dest/dev/path conv=notrunc
for example dest can be a file also -
dd if=/dev/sdc of=/home/user/backup-usb.dd conv=notrunc
(notrunc is useful only when writing to a file, https://stackoverflow.com/questions/20526198/why-using-conv-notrunc-when-cloning-a-disk-with-dd )
Tuesday, March 27, 2018
Linux Mint 18.1 not booting - solved
apt remove virtualbox-guest*
and rebooted OK.
Monday, March 26, 2018
link dump - ALSA etc - for software lock-in amplifier
QApplication and Qwidgets derived classes are in widgets module in Qt 5 so to fix that you need to add QT += widgets in the .pro file and run qmake and also use #include <QApplication> instead of #include <QtGui/QApplication> (and the code becomes compatible with both Qt 4 and 5), you can read more here
https://help.ubuntu.com/


