2015-12-12

Tox chat


For me it's amazing Christmas gift from Open Source!


Quote: 

"A New Kind of Instant Messaging

With the rise of government monitoring programs, Tox provides an easy to use application that allows you to connect with friends and family without anyone else listening in. While other big-name services require you to pay for features, Tox is totally free and comes without advertising."

https://tox.chat/

https://github.com/tux3/qTox

This is what I really subscribe for! Thank you!


2015-10-12

Qt: Dynamic Copy File in the Thread example, requires Wraparound class


  • Wraparound class


ThreadCopyFile::ThreadCopyFile(QObject *parent) : QObject(parent)
{
    qDebug() << this << "Created";

    this->v_thread = new QThread();
    this->v_copyFile = new CopyFile();
     

    connect(v_thread,SIGNAL(started()),v_copyFile,SLOT(Copy()));
    connect(v_copyFile,SIGNAL(done()),v_thread,SLOT(quit()));
    connect(v_thread,SIGNAL(finished()),this,SLOT(finished()));

    this->v_copyFile->moveToThread(this->v_thread);
    this->v_thread->start();

}

ThreadCopyFile::~ThreadCopyFile()
{
    delete this->v_thread;
    delete this->v_copyFile;
}

public slots:


void ThreadCopyFile::finished()
{
    qDebug() << this << "Finished";
    this->~ThreadCopyFile();
    qDebug() << this << "Destroyed";
}



  • Class for actual work


CopyFile::CopyFile(QObject *parent) : QObject(parent)
{
    qDebug() << this << "Created";


}

CopyFile::~CopyFile()
{
    qDebug() << this << "Destroyed";
}


signals:


    void done();

public slots:

void CopyFile::Copy(void)
{

    QString src = "/media/data/torrent/linuxmint-17.2-mate-32bit.iso";
    QString dst = "/tmp/linuxmint-17.2-mate-32bit.iso";

    if(QFile::exists(dst))
    {

        qDebug() << "file exists";

        if(QFile::remove(dst))
        {
            qDebug() << "Files removed";
        }
        else
        {
            qDebug() << "Files  fail to remove";
        }
    }

    qDebug() << "Copy File started";

    if(QFile::copy(src,dst))
    {
        qDebug() << "Copy File finished";
    }
    else
    {
        qDebug() << "Copy File fail";
    }

    emit done();
}



UI runs on other thread, everything work nicely :)


2015-10-10

Update Linux Kernel on Mint or Ubuntu


for upgrade you need three packages, depending on you architecture:

linux-headers ... ... ... amd64.deb
linux-headers ... ... ... all.deb
linux-image   ... ... ... amd64.deb

if you use Ubuntu based Linux distro, you can pick one of these: 


for example:

$ sudo update-grub


If for some reason you want to downgrade the kernel, it loads the newest kernel by default, so just uninstall new one (three packages that I mentioned) and it will load second on the list after reboot. Make sure you have at least one kernel installed! :)




2015-10-02

GIT ANNEX on RASPBIAN JESSIE

https://github.com/tradloff/git-annex-RPi

Problem:

git-annex: error while loading shared libraries: libgnutls.so.26: cannot open shared object file: No such file or directory
fatal: 'annex' appears to be a git command, but we were not
able to execute it. Maybe git-annex is broken?

Solution:

sudo ln -s /usr/lib/arm-linux-gnueabihf/libgnutls.so /usr/lib/arm-linux-gnueabihf/libgnutls.so.26


2015-09-19

QT UI for youtube-dl








Downloads

There is some obvious things should be fix'ed, but is't usable right now... and more convenient then terminal.

 



2015-06-27

Linux Mint 17 on Laptop Acer Aspire-E5-571G PART4



  • Using Microphone

Run 
$ alsamixer 
Press F6 select sound card...  Set Mic Boost to 20 and disable Auto-Mute M (use arrow buttons)




Check audio device for capture audio from mic, by

$ cat /proc/asound/devices

  1:        : sequencer
  2: [ 0- 8]: digital audio playback
  3: [ 0- 7]: digital audio playback
  4: [ 0- 3]: digital audio playback
  5: [ 0- 0]: hardware dependent
  6: [ 0]   : control
  7: [ 1- 0]: digital audio playback
  8: [ 1- 0]: digital audio capture
  9: [ 1- 0]: hardware dependent
 10: [ 1]   : control
 33:        : timer

Try record for 20 seconds

arecord -f cd -D hw:1,0 -d 20 test.wav

It worked for me, I able to hear myself. 

Graphical "Sound Preferences" looks like not handle the device properly. To use mic with graphical apps you probably have to select the capture device manually.

  





2015-06-13

Internet connection sharing with Raspberry Pi via Ethernet

My laptop is connected to internet via WiFi and I want to connect raspberrypi via Ethernet cable. I want to be able connect to raspberrypi via ssh and I also want for raspberrypi to be able access the internet. I have basic understanding about networks. And I think this task should event easier then setup a router. Bud it is not! Unless you know exactly what to do! You can find tips with a million terminal commands... You  can study advanced networks... bridging or nat and then run dhcp server... If you running a server this is all great! On a laptop you do not need all this...


Click Edit!

Change to "Shared to other computers"



Just my local network connection information, no voodoo magic!

First time I set this up! It did not work! Solution is: RESET laptop after configuration is done!

To find out raspberrypi IP:

rolas@Aspire-E5-571G ~ $ cat /var/lib/misc/dnsmasq.leases
1434209461 b8:27:eb:75:89:01 10.42.0.79 raspberrypi ff:eb:75:89:01:00:01:00:01:1c:dd:60:6a:b8:27:eb:75:89:01


https://www.youtube.com/watch?v=ZK-JHfJqmkY

2015-05-14

Changing password on Linux


If You set password only once during the installation and later on decided to change your password it can be confusing. What you have to know is during installation it sets the same password for your user and for root.

For example you enter the same password when you install some thing as root:

$ sudo apt-get install audacious         

and  when connecting to your machine via ssh as user:

$ ssh user@192.168.0.101

If you want to keep it that way with new password, you have to change it for both user and root:

$ sudo passwd
$ passwd

If you wondering what is a good password , check this link:

https://blog.kaspersky.com/password-check/

After playing with this site a come to conclusion that it can be two types of good passwords:

  • relativity short password (9 characters) containing combination of  lower case letters, capital letters,  numbers and symbols. What could be harder to remember.
  • longer password (18 characters) containing only lower case Latin letters, but in this case You can use sentence in foreign language. It can be much easier to remember. Perhaps you can use a bit longer sentence in English as well.    




2015-05-02

Linux Mint 17 on Laptop Acer Aspire-E5-571G PART3

Automatic brightness control very very annoying, it dims down almost random, so you have to set it couple times...


To disable improper automatic brightness control, uncheck this:




To control brightness manually from 0% to 100% , install xbacklight

$ sudo apt-get install xbacklight

Don't know how to overwrite functional keys for brightness, so I made two new shortcuts for brightness control, with commands:

$ xbacklight -inc 5
$ xbacklight -dec 5

For non 60 fps videos, mplayer works pretty well with this config:

$ cat ~/.mplayer/config
# Write your default config options here!

vo=gl_nosw
af=equalizer=0:-1:-2:-3:-4:-4:-3:-2:-1:0
cache=8192
cache-min=4
nosub=1
framedrop=1












2015-02-15

GIT ANNEX

  • Installing latest git version

https://launchpad.net/~git-core/+archive/ubuntu/ppa

$ sudo add-apt-repository ppa:git-core/ppa

$ apt-get update && apt-get --only-upgrade install git

$ apt-get install git-annex
 
$ git --version
git version 2.3.0

$ git annex version
git-annex version: 5.20140412ubuntu1

https://git-annex.branchable.com/walkthrough/


  • Git-annex binary for Raspberry-pi


https://github.com/tradloff/git-annex-RPi

  • Windows version


https://downloads.kitenet.net/git-annex/windows/current/
















2015-02-14

Installing Texmaker

http://www.xm1math.net/texmaker/index.html
  • Linux

$ sudo apt-get install texlive-full texmaker

To see the result press F6 to convert  and then press blue arrow next to "View PDF".

  •   Windows

http://www.howtotex.com/howto/installing-latex-on-windows/


  • Gray background with white letters

\documentclass{article}
\usepackage{xcolor}

\pagecolor[rgb]{0.15,0.15,0.15}
\color[rgb]{1,1,1}
\begin{document}

Hello \clearpage
World

\end{document}


2015-01-25

Digital background color


I think in the old days, white screen with black letters was design to make an impression of sheet of paper. Now it still exists.
On Smart Phones and Tablets it's changing cause less white light means longer battery life. On the Desktop not a lot of normal people care. Unless that’s your style and You want to be unique.

My digital background's turning black not only cause its environment friendly, but the main reason is how it effects my eyes. I noticed that dark background while programming are less intense for my eyes.

It worth mention that, the room where you work also sloud be similre lighting as your computer screen. You also shloud look at the monitor a fiew degrees down and don't forget blink. This way your eyes will be less dray.  About blinking it's easier to say than done! :)

If you do tee or coffee break, to give your eyes a break you should look throw the window far far away.

I do not ware glasses!  At least Yet!

I have one weaker eye then the other. My vision changing during the week. If I would do eye test , ware you cover one eye and then have to see and say letters or animal names watching form the distance, on a Friday after intensive work week I most likely failed, but on Monday after a weekend in the village away and away from PC, I most likely pass the test.



So it's great that Qt-Creator can have a dark skin!

https://github.com/alexpana/qt-creator-wombat-theme





And "Sublime text" it's great by default. If You did not try yet, It's a great editor, definitely should try out!

http://www.sublimetext.com/



Keep your eyes healthy :) and have fun programming!



2015-01-17

Linux Mint 17 on Laptop Acer Aspire-E5-571G PART2

Linux Mint 17 on Laptop Acer Aspire-E5-571G PART1
  • Nvidia driver

I added this PPA
https://launchpad.net/~xorg-edgers/+archive/ubuntu/ppa
And install Nvidia-343 driver
I find out that prismusrun is alternative to optirun
  • Avoiding Video tearing while watching 60 fps video

VLC useless
Mplayer works only with Intel vaapi
$ export VDPAU_DRIVER=va_gl &&  mplayer -cache 8192 file.mkv 
XBMC kodi can use both Nvidia or Intel vaapi (default)
$ prismusrun kodi
$ kodi
Totem works with Nvidia
$ prismusrun totem
  • Gaming

I Instaled Wine1.7 and using prismus StartCraft II works!
$ prismusrun wine /path/to/StarCraft-II-Setup-enGB.exe
  • Resource

http://askubuntu.com/questions/305305/running-xbmc-on-bumblebee-nvidia
http://ubuntuforums.org/showthread.php?t=2121749
  • Note

Hard drive on this laptop is large 1TB, but not very fast. Thats why mplayer better works with bigger cache option. I came to conclusion that most of the lag is hard drive retailed. So I made a few more settings. Set swappiness to 1 (how to) ant added "noatime" to FSTAB.


2015-01-02

Web chat on Raspberry Pi using nodejs


  • Writing image to SD card

 sudo dd bs=1M if=./2014-12-24-wheezy-raspbian.img of=/dev/sdc

  • Installing nodejs and modules

http://doctorbin.tumblr.com/post/53991508909/how-to-install-the-latest-version-of-nodejs-npm

I used this version: http://nodejs.org/dist/v0.11.7/
Newer versions "npm" not working, throws "Illegal instruction". 

  • Working chat app example

https://github.com/Automattic/socket.io/tree/master/examples/chat




  • Javascript & JQuery tutorial

https://www.youtube.com/playlist?list=PLoYCgNOIyGACnrXwo5HMCfOH9VT05znGv