Thursday, April 26, 2018

My favorite Music



Ludwig Van Beethoven
   Symphony No. 5 in C minor ("Fate") (composed 1804–08, premièred 1808)
   Sonata N° 14 'moonlight'
   Fur Elisa
   Himno de la alegria
   Turkish March  (Adapted by Chavo del 8 program, in intro)


Wolfgang Amadeus Mozart
  Turkish March
  Réquiem

Antonio Vivaldi
  Storm
  La Stravaganza  Four Season:Spring

Johan Sebastian Bach
 Toccata and Fugue Ave maria
  Passacaglia
Frédéric Chopin
  Waltz rain
  Spring waltz (Mariage d'Amour)


Antonín Dvořák
  Symphony no. 9 - 4th movement - Allegro con fuoco

Wednesday, April 25, 2018

C++ equivalent to getch() and getche() from conio.h



#include <iostream>
#include <termios.h> //TCSANOW, ICANON, ..
#include <unistd.h>  //STDIN_FILENO ..
#include <stdio.h>  //getchar

using namespace std;

char getch(void)
{
  struct termios oldattr, newattr;
  char ch;
  tcgetattr( STDIN_FILENO, &oldattr );
  newattr = oldattr;
  newattr.c_lflag &= ~( ICANON | ECHO );
  tcsetattr( STDIN_FILENO, TCSANOW, &newattr );
  ch = getchar();
  tcsetattr( STDIN_FILENO, TCSANOW, &oldattr );
  return ch;
}

char getche(void) //with ECHO
{
  struct termios oldattr, newattr;
  int ch;
  tcgetattr( STDIN_FILENO, &oldattr );
  newattr = oldattr;
  newattr.c_lflag &= ~( ICANON );
  tcsetattr( STDIN_FILENO, TCSANOW, &newattr );
  ch = getchar();
  tcsetattr( STDIN_FILENO, TCSANOW, &oldattr );
  return ch;
}

int main(int argc,char *argv[])
{
  char ch1=getch();
  char ch2=getche();
  cout << "\nFirst : " << ch1
       << "\nSecond: " << ch2 << endl;
  return 0;
}
//g++ getchx.cpp -o getchx

References
[1] https://www.daniweb.com/programming/software-development/threads/410155/gcc-equivalent-for-getch

Sunday, April 22, 2018

Monday, April 09, 2018

Linux Microphone doesn't working


Try to reload drivers
$sudo alsa force-reload
restart device and check if sound is workin? if it doesnt do this:
$sudo apt-get remove --purge alsa-base pulseaudio
$sudo apt-get install alsa-base pulseaudio 
 
References:
[1] https://askubuntu.com/questions/508221/sound-input-device-microphone-not-working

Saturday, April 07, 2018

Fedora/CentOS Change ports of Apache Web Server (httpd)


1) In file /etc/httpd/conf/httpd.conf

Listen 80
Listen 8079

This till your server to listen to the port 8079

2) virtual host file  /etc/httpd/conf.d/vhost.conf

<VirtualHost *:8079>
 DocumentRoot /var/www/html/api_folder
 ServerName example.com
 ServerAlias www.example.com
 ServerAdmin root@example.com 
 ErrorLog logs/www.example.com-error_log
 CustomLog logs/www.example.com-access_log common
</VirtualHost>

This mean when you go to your www.example.com:8079 redirect to
/var/www/html/api_folder

3) Restart the service

$sudo service httpd restart
$systemctl restart httpd.service
references:
[1] https://httpd.apache.org/docs/2.4/bind.html


Wednesday, April 04, 2018

Call using Internet (Brasil - Perú)


https://www.poptox.com/Peru
https://www.spytox.com/whose-number-is-calling-me

Firefox open multiple private window

    /opt/firefox/firefox-bin --profile $(mktemp -d) --private-window www.google.com www.bing.com