Saturday, January 2, 2016

Vi Error 'E185: Cannot find color scheme 'morning' in freshly installed ubuntu 14.04.3

Copied all ~/.vim folder to newly installed ubuntu box. But vi is complaining on start up. "E185: Cannot find color scheme 'morning'" Because at default it's using vim.tiny. qyang@ubuntu:~$ ll /etc/alternatives/vi lrwxrwxrwx 1 root root 17 Dec 6 13:24 /etc/alternatives/vi -> /usr/bin/vim.tiny* In old ubuntu box: qyang@lgm-pc:~$ ll /etc/alternatives/vi lrwxrwxrwx 1 root root 18 Jun 15 2015 /etc/alternatives/vi -> /usr/bin/vim.gnome Installing vim-gnome fixed this issue. ($sudo apt-get install vim-gnome)

Thursday, December 10, 2015

Install Playonlinux from command line to accept the license by Tab -> Enter

This POST addressed how to accept license when clicking enter doesn't respond the OK display when installing playonlinux from command line.
Solution:
Hit  key, then hit  to accept the license. 

That is it. So easy, just switching among buttons, to highlight button. Same like in windows.

Ubuntu apt mirror access error.


http://askubuntu.com/questions/553765/failed-to-fetch-update-on-ubuntu-14-04-lts-trusty-tahr


This post addressed one issue I had tonight.


W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/trusty-backports/Release.gpg  Unable to connect to us.archive.ubuntu.com:http:

Solution
sudo rm /var/lib/apt/lists/* -vf
sudo apt-get update

Or switch apt mirror from this link
http://askubuntu.com/questions/37753/how-can-i-get-apt-to-use-a-mirror-close-to-me-or-choose-a-faster-mirror

Friday, November 20, 2015

Cron and Anacron to schedule jobs in Linux


ref https://tecadmin.net/crontab-in-linux-with-20-examples-of-cron-schedule/

$crontab -e   to edit
$crontab -l   to list
$crontab -l -u username   to list cron jobs of username


anacron

runs commands periodically. Unlike cron(8), it does not assume that the machine is running continuously. Hence, it can be used on machines that aren't running 24 hours a day, to control daily, weekly, and monthly jobs that are usually controlled by cron.
qyang@lubuntu-laptop:~$ service anacron start
qyang@lubuntu-laptop:~$ service anacron status
● anacron.service - Run anacron jobs
   Loaded: loaded (/lib/systemd/system/anacron.service; enabled; vendor preset: enabled)
   Active: active (running) since Sat 2015-11-21 09:19:57 AEDT; 4s ago
 Main PID: 10233 (anacron)
   CGroup: /system.slice/anacron.service
           └─10233 /usr/sbin/anacron -dsq

Nov 21 09:19:57 lubuntu-laptop systemd[1]: Started Run anacron jobs.
Nov 21 09:19:57 lubuntu-laptop systemd[1]: Starting Run anacron jobs...
Nov 21 09:19:57 lubuntu-laptop anacron[10233]: Anacron 2.3 started on 2015-11-21
Nov 21 09:19:57 lubuntu-laptop anacron[10233]: Will run job `cron.daily' in 5 min.
Nov 21 09:19:57 lubuntu-laptop anacron[10233]: Will run job `svnsyncPQAFW.daily' in 15 min.
Nov 21 09:19:57 lubuntu-laptop anacron[10233]: Jobs will be executed sequentially

cron

Sample of downloading data regularly using cron Changing crontab
root@trac ~# cat /etc/crontab
# /etc/crontab: system-wide crontab
# Unlike any other crontab you don't have to run the `crontab'
# command to install the new version when you edit this file
# and files in /etc/cron.d. These files also have username fields,
# that none of the other crontabs do.

SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin

# m h dom mon dow user command
17 * * * * root    cd / && run-parts --report /etc/cron.hourly
25 6 * * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )
47 6 * * 7 root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.weekly )
52 6 1 * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.monthly )
#25 6 * * * root test -x /usr/sbin/anacron || ( cd /root/AuctionResults && run-parts --report /root/AuctionResults)
00 12  * * 7 root test -x /usr/sbin/anacron || ( cd /root/AuctionResults && run-parts --report /root/AuctionResults)
#
Run any executable files,eg.runpython under nominated folder AuctionResults
root@trac ~# ls -al ~/AuctionResults
total 852
drwxr-xr-x  2 root root   4096 Nov 15 12:00 .
drwx------ 11 root root   4096 Sep  9 00:41 ..
-rwxr-xr-x  1 root root   1105 Jul 14 13:48 file-retrieve-via-url.py
-rwxr-xr-x  1 root root     39 Jun  9 22:43 runpython
qyang@lubuntu-laptop:~/Svn_Local_Personal/A_001_Notes$ locate cron |grep bin
/usr/bin/crontab
/usr/sbin/anacron
/usr/sbin/cron
/etc/cron.daily/.placeholder
/etc/cron.daily/0anacron
/etc/cron.daily/apport
/etc/cron.daily/apt
/etc/cron.daily/bsdmainutils
/etc/cron.daily/dpkg
/etc/cron.daily/logrotate
/etc/cron.daily/man-db
/etc/cron.daily/mlocate
/etc/cron.daily/ntp
/etc/cron.daily/passwd
/etc/cron.daily/popularity-contest
/etc/cron.daily/update-notifier-common
/etc/cron.hourly/.placeholder
/etc/cron.monthly/.placeholder
/etc/cron.monthly/0anacron
/etc/cron.weekly/.placeholder
/etc/cron.weekly/0anacron
/etc/cron.weekly/fstrim
/etc/cron.weekly/man-db
/etc/cron.weekly/update-notifier-common
/etc/default/anacron
/etc/default/cron
/etc/init/anacron.conf
/etc/init/cron.conf
/etc/init.d/anacron
/etc/init.d/cron

service control in debian/lubuntu/ubuntu - sysv-rc-conf


[1] wiki.debian.org

Install sysv-rc-conf via apt.
$sudo sysv-rc-conf


Aliasing Automatic Gain Control and FFT

Aliasing

A filter chosen in anticipation of a certain sample frequency is called an anti-aliasing filterAliasing on wiki. A real anti-aliasing filter trades off between bandwidth andaliasing
Undersampling, which causes aliasing.
Without an anti-aliasing filter, frequencies higher than the Nyquist frequency will influence the samples in a way that is misinterpreted by the interpolation process. Ref
  • Paper(pdf) from National Instruments on Aliasing and Sampling at Frequencies Above the Nyquist Frequency.
  • Notes:
    R (sampling rate) = 100MS/s
    fs (signal being sampled = 70MHz
    fN (the Nyquist frequency) = 50MHz
    fa (aliased frequency) = 30MHz
    The frequency of the aliased signal can be found from the following simple equation:
    fa = |R*n - fs|
    
    Although sampling at twice the Nyquist frequency will ensure that you measure the correct frequency of your signal, it will not be sufficient to capture the shape of the waveform. If the shape of the waveform is desired, you should sample at a rate approximately 10 times the Nyquist theory.
If known input frequency range, then sample rate more than 2*InputFreqRange? will remove aliasing. However, real input signal could include signal frequency higher than wanted frequency range, these high frequency signal will cause aliasing at pre-designed smapling rate. (high freq signal and low freq signal end up with same sampling points at lower (than required) sampling rate.) That's the whole reason u need anti-aliasing filter in the front end to filter out unsupported high frequency signals.

Automatic gain control - (AGC)

Finite Impulse Response (FIR) filter

FFT