вторник, 25 апреля 2017 г.

MYSQL Optimize

Do Not ORDER BY RAND()

This is one of those tricks that sound cool at first, and many rookie programmers fall for this trap. You may not realize what kind of terrible bottleneck you can create once you start using this in your queries.

If you really need random rows out of your results, there are much better ways of doing it. Granted it takes additional code, but you will prevent a bottleneck that gets exponentially worse as your data grows. The problem is, MySQL will have to perform RAND() operation (which takes processing power) for every single row in the table before sorting it and giving you just 1 row.


// what NOT to do:
$r = mysql_query("SELECT username FROM user ORDER BY RAND() LIMIT 1");


// much better:

$r = mysql_query("SELECT count(*) FROM user");
$d = mysql_fetch_row($r);
$rand = mt_rand(0,$d[0] - 1);

$r = mysql_query("SELECT username FROM user LIMIT $rand, 1");
So you pick a random number less than the number of results and use that as the offset in your LIMIT clause.

Отблагодарить можно через форму справа "Donate" ... )

To reward you via the form on the right "Donate" ... )

:)

среда, 12 апреля 2017 г.

Подключение и настройка microMinimosd на базе MWOSD


Для прошивки microMinimosd

Скачиваем Arduino IDE
https://www.arduino.cc/en/main/software
Скачиваем MWOSD
http://www.mwosd.com/

Открываем в ардуино файл MW_OSD.ino
разкоменчиваем нужные строки в config (PIXHAWK, microMinimosd и т.д)
заливаем (с помощью программматора Usb-UART CP2102)
И заново настраиваем


Инструкции по подключению PIXHAWK / APM / MAVLINK OSD

See other guides for installing Arduino and uploading MWOSD:

https://github.com/ShikOfTheRa/scarab-osd/blob/master/OTHER/DOCUMENTATION/FirmwareFlashing.md

Step 1: prepare your config.h file

Select the GPS chip type by removing the comments:

//#define PIXHAWK
Select the aircraft type:

//#define ROTORCRAFT
//#define FIXEDWING
Step 2: Upload

https://github.com/ShikOfTheRa/scarab-osd/blob/master/OTHER/DOCUMENTATION/FirmwareFlashing.md

Step 3: Change GUI speed to match OSD - usually 57600

Step 4: Upload fontfile using GUI

Step 5: Configure OSD using GUI

Step 6: Configure the MAVLINK settings

Connect to Mission Planner
Go to config/tuning
Locate parameters in parameter list
Enter / verify the following parameters and save
If you are connecting OSD to telemetry 1 port

SERIAL1_BAUD, 57 (telemetry output at 57600)
SR1_EXT_STAT, 2 ( 2hz for waypoints, GPS raw, fence data, current waypoint, etc)
SR1_EXTRA1, 5 ( 5hz for attitude and simulation state)
SR1_EXTRA2, 2 ( 2hz for VFR_Hud data )
SR1_EXTRA3, 3 ( 3hz for AHRS, Hardware Status, Wind )
SR1_POSITION, 2 ( 2hz for location data )
SR1_RAW_SENS, 2 ( 2hz for raw imu sensor data )
SR1_RC_CHAN, 5 ( 5hz for radio input or radio output data )
If you are connecting OSD to telemetry 2 port:

SERIAL2_BAUD, 57 (telemetry output at 57600)
SR2_EXT_STAT, 2 ( 2hz for waypoints, GPS raw, fence data, current waypoint, etc)
SR2_EXTRA1, 5 ( 5hz for attitude and simulation state)
SR2_EXTRA2, 2 ( 2hz for VFR_Hud data )
SR2_EXTRA3, 3 ( 3hz for AHRS, Hardware Status, Wind )
SR2_POSITION, 2 ( 2hz for location data )
SR2_RAW_SENS, 2 ( 2hz for raw imu sensor data )
SR2_RC_CHAN, 5 ( 5hz for radio input or radio output data )
Notes:

57600 is default serial buad rate recommended when selecting APM / PIXHAWK in config.h
Baud rate in OSD and APM/PIXHAWK must match.
Always try 57600 and 115200 if no data
Use debug screen to verify: RX > 0 means there is data. PKT > 0 means there is valid data.
If no valid data, likely incorrect baud rate

Отблагодарить можно через форму справа "Donate" ... )

To reward you via the form on the right "Donate" ... )

:)

воскресенье, 2 апреля 2017 г.

четверг, 16 марта 2017 г.

Устанавливаем Chromium в Ubuntu


Можно установить из репозитория Убунту, используя Центр приложений, либо через Терминал, выполнив команду:

sudo apt-get install chromium-browser


Для поддержки HTML5 и других форматов нужно выполнить команду:

sudo apt-get install chromium-codecs-ffmpeg-extra


Запуск из консоли
chromium-browser --kiosk http://example.com --display=:0

Отблагодарить можно через форму справа "Donate" ... )

To reward you via the form on the right "Donate" ... )

:)

четверг, 2 марта 2017 г.

Форматы видео YouTube, по тегу itag


  • Format 5: (Basic Youtube Default)
    • Download Video Format: flv
    • Video Resolution: 400 x 240
    • Video Frame Rate: 25 fps
    • Video Output Format: FLV1 H.263
    • Audio: Stereo, 22.05 KHz 64.0 Kbps
    • Audio Format: MP3 (MPEG Audio)
  • Format 6:
    • Download Video Format: flv
    • Video Resolution: 450 x 270
  • Format 13: (Mobile phones, iPod friendly)
    • Download Video Format: 3gp
  • Format 17:
    • Download Video Format: 3gp
    • Video Resolution: 176 x 144
    • Video Frame Rate: 12 fps
    • Video Output Format: MPEG-4
    • Audio: Mono 22.05 KHz 24.0 - 25.6 Kbps
    • Audio Format: AAC
  • Format 18: Medium Quality [360p]
    • Download Video Format: mp4
    • Video Resolution: 640 x 360
    • Video Frame Rate: 25 fps
    • Video Output Format: AVC (MPEG4 H.264)
    • Audio: Stereo, 44.1 KHz 96.0 - 100 Kbps
    • Audio Format: AAC
  • Format 22: HD High Quality [720p]
    • Download Video Format: mp4
    • Video Resolution: 1280 x 720
    • Video Frame Rate: 25 fps
    • Video Output Format: AVC (MPEG4 H.264)
    • Audio: Stereo, 44.1 KHz 192.0 - 201 Kbps
    • Audio Format: AAC
  • Format 34: [360p]
    • Download Video Format: flv
    • Video Resolution: 640 x 360
  • Format 35: [480p]
    • Download Video Format: flv
    • Video Resolution: 854 x 480
  • Format 36: [240p]
    • Download Video Format: 3gp
    • Video Resolution: 320 x 240
    • Video Frame Rate: 25 fps
    • Video Output Format: MPEG4 H.263
    • Audio: Mono, 22.05 KHz 32.0 - 34.2 Kbps
    • Audio Format: AAC
  • Format 37: HD High Quality [1080p]
    • Download Video Format: mp4
    • Video Resolution: 1920 x 1080
  • Format 38: HD High Quality [3072p]
    • Download Video Format: mp4
    • Video Resolution: 4096 x 3072
  • Format 43: Medium Quality [360p]
    • Download Video Format: webm
    • Video Resolution: 640 x 360
    • Video Frame Rate: 24.194 fps
    • Video Output Format: VP8
    • Audio: Stereo, 44.1 KHz 128 Kbps
    • Audio Format: Vorbis
  • Format 44: [480p]
    • Download Video Format: webm
    • Video Resolution: 854 x 480
  • Format 45: [720p]
    • Download Video Format: webm
    • Video Resolution: 1280 x 720
  • Format 46: [1080p]
    • Download Video Format: webm
    • Video Resolution: 1920 x 1080

3d Videos

These videos requires special medium to enjoy the depth of the video. These are also available in different flavours
  • Format 82:
    • Download Video Format: mp4
    • Video Resolution: 640 x 360 [3D]
    • Video Frame Rate: 25 fps
    • Video Output Format: AVC (MPEG4 H.264)
    • Audio: Stereo, 44.1 KHz 128 - 134 Kbps
    • Audio Format: AAC
  • Format 83:
    • Download Video Format: mp4
    • Video Resolution: 854 x 480 [3D]
  • Format 84:
    • Download Video Format: mp4
    • Video Resolution: 1280 x 720 [3D]
    • Video Frame Rate: 25 fps
    • Video Output Format: AVC (MPEG4 H.264)
    • Audio: Stereo, 44.1 KHz 192 - 201 Kbps
    • Audio Format: AAC
  • Format 85:
    • Download Video Format: mp4
    • Video Resolution: 1920 x 1080p [3D]
  • Format 100:
    • Download Video Format: webm
    • Video Resolution: 640 x 360 [3D]
    • Video Frame Rate: 24.194 fps
    • Video Output Format: VP8
    • Audio: Stereo, 44.1 KHz 128 Kbps
    • Audio Format: AAC
  • Format 101:
    • Download Video Format: webm
    • Video Resolution: 854 x 480 [3D]
  • Format 102:
    • Download Video Format: webm
    • Video Resolution: 1280 x 720 [3D]

Apple HTTP Live Streaming (HLS)

  • Format 92:
    • Download Video Format: mp4
    • Video Resolution: 320 x 240
    • Streaming Protocol: HLS
  • Format 93:
    • Download Video Format: mp4
    • Video Resolution: 640 x 360
    • Streaming Protocol: HLS
  • Format 94:
    • Download Video Format: mp4
    • Video Resolution: 854 x 480
    • Streaming Protocol: HLS
  • Format 95:
    • Download Video Format: mp4
    • Video Resolution: 1280 x 720
    • Streaming Protocol: HLS
  • Format 96:
    • Download Video Format: mp4
    • Video Resolution: 1920 x 1080
    • Streaming Protocol: HLS
  • Format 132:
    • Download Video Format: mp4
    • Video Resolution: 320 x 240
    • Streaming Protocol: HLS
  • Format 151:
    • Download Video Format: mp4
    • Video Resolution: * x 72
    • Streaming Protocol: HLS

DASH MP4 video

  • Format 133:
    • Download Video Format: mp4
    • Video Resolution: 320 x 240
    • Video Format: DASH video
    • Audio: none
  • Format 134:
    • Download Video Format: mp4
    • Video Resolution: 640 x 360
    • Video Format: DASH video
    • Audio: none
  • Format 135:
    • Download Video Format: mp4
    • Video Resolution: 854 x 480
    • Video Format: DASH video
    • Audio: none
  • Format 136:
    • Download Video Format: mp4
    • Video Resolution: 1280 x 720
    • Video Format: DASH video
    • Audio: none
  • Format 137:
    • Download Video Format: mp4
    • Video Resolution: 1920 x 1080
    • Video Format: DASH video
    • Audio: none
  • Format 138:
    • Download Video Format: mp4
    • Video Resolution: * x 2160 (not fix)
    • Video Format: DASH video
    • Audio: none
  • Format 160:
    • Download Video Format: mp4
    • Video Resolution: 176 x 144
    • Video Format: DASH video
    • Audio: none
  • Format 264:
    • Download Video Format: mp4
    • Video Resolution: 176 x 1440
    • Video Format: DASH video
    • Audio: none
  • Format 298:
    • Download Video Format: mp4
    • Video Resolution: 1280 x 720
    • Video Frame Rate: 60 fps
    • Video Format: DASH video H.264
    • Audio: none
  • Format 299:
    • Download Video Format: mp4
    • Video Resolution: 1920 x 1080
    • Video Frame Rate: 60 fps
    • Video Format: DASH video H.264
    • Audio: none
  • Format 266:
    • Download Video Format: mp4
    • Video Resolution: * x 2160
    • Video Frame Rate: 60 fps
    • Video Format: DASH video H.264
    • Audio: none

Dash MP4 Audio

  • Format 139:
    • Download Audio Format: m4a
    • Audio: Stereo, 44.1 KHz 48 Kbps
    • Audio Format: AAC [DASH audio]
    • Video: none
  • Format 140:
    • Download Audio Format: m4a
    • Audio: Stereo, 44.1 KHz 128 Kbps
    • Audio Format: AAC [DASH audio]
    • Video: none
  • Format 141:
    • Download Audio Format: m4a
    • Audio: Stereo, 44.1 KHz 256 Kbps
    • Audio Format: AAC [DASH audio]
    • Video: none

Dash WEBM Video

  • Format 167:
    • Download Video Format: webm
    • Video Resolution: 640 x 360
    • Video Format: VP8 DASH video
    • Audio: none
  • Format 168:
    • Download Video Format: webm
    • Video Resolution: 854 x 480
    • Video Format: VP8 DASH video
    • Audio: none
  • Format 169:
    • Download Video Format: webm
    • Video Resolution: 1280 x 720
    • Video Format: VP8 DASH video
    • Audio: none
  • Format 170:
    • Download Video Format: webm
    • Video Resolution: 1920 x 1080
    • Video Format: VP8 DASH video
    • Audio: none
  • Format 218:
    • Download Video Format: webm
    • Video Resolution: 854 x 480
    • Video Format: VP8 DASH video
    • Audio: none
  • Format 219:
    • Download Video Format: webm
    • Video Resolution: 854 x 480
    • Video Format: VP8 DASH video
    • Audio: none
  • Format 219:
    • Download Video Format: webm
    • Video Resolution: * x 144
    • Video Format: VP9 DASH video
    • Audio: none
  • Format 242:
    • Download Video Format: webm
    • Video Resolution: 320 x 240
    • Video Format: VP8 DASH video
    • Audio: none
  • Format 243:
    • Download Video Format: webm
    • Video Resolution: 640 x 360
    • Video Format: VP8 DASH video
    • Audio: none
  • Format 244:
    • Download Video Format: webm
    • Video Resolution: 854 x 480
    • Video Format: VP8 DASH video
    • Audio: none
  • Format 245:
    • Download Video Format: webm
    • Video Resolution: 854 x 480
    • Video Format: VP8 DASH video
    • Audio: none
  • Format 246:
    • Download Video Format: webm
    • Video Resolution: 854 x 480
    • Video Format: VP8 DASH video
    • Audio: none
  • Format 247:
    • Download Video Format: webm
    • Video Resolution: 1280 x 720
    • Video Format: VP8 DASH video
    • Audio: none
  • Format 248:
    • Download Video Format: webm
    • Video Resolution: 1920 x 1080
    • Video Format: VP8 DASH video
    • Audio: none
  • Format 271:
    • Download Video Format: webm
    • Video Resolution: 176 x 1440
    • Video Format: VP8 DASH video
    • Audio: none
  • Format 272:
    • Download Video Format: webm
    • Video Resolution: * x 2160
    • Video Format: VP8 DASH video
    • Audio: none
  • Format 302:
    • Download Video Format: webm
    • Video Resolution: * x 2160
    • Video Frame Rate: 60 fps
    • Video Format: VP9 DASH video
    • Audio: none
  • Format 303:
    • Download Video Format: webm
    • Video Resolution: 1920 x 1080
    • Video Frame Rate: 60 fps
    • Video Format: VP9 DASH video
    • Audio: none
  • Format 308:
    • Download Video Format: webm
    • Video Resolution: 176 x 1440
    • Video Frame Rate: 60 fps
    • Video Format: VP9 DASH video
    • Audio: none
  • Format 313:
    • Download Video Format: webm
    • Video Resolution: * x 2160
    • Video Frame Rate: 60 fps
    • Video Format: VP9 DASH video
    • Audio: none
  • Format 315:
    • Download Video Format: webm
    • Video Resolution: * x 2160
    • Video Frame Rate: 60 fps
    • Video Format: VP9 DASH video
    • Audio: none

Dash WEBM Audio

  • Format 171:
    • Download Audio Format: webm
    • Audio: Stereo, 44.1 KHz 128 Kbps
    • Audio Format: AAC [DASH audio]
    • Video: none
  • Format 172:
    • Download Audio Format: webm
    • Audio: Stereo, 44.1 KHz 256 Kbps
    • Audio Format: AAC [DASH audio]
    • Video: none

Отблагодарить можно через форму справа "Donate" ... )

To reward you via the form on the right "Donate" ... )

:)

среда, 15 февраля 2017 г.

Ubuntu 16.04 LTS "xenial" + php7 + nginx + mariadb


sudo apt-get install php7.0-fpm
sudo apt-get install nginx
sudo apt-get install php7.0-mbstring
sudo apt-get install php7.0-mysql
sudo apt-get install php7.0-curl
sudo apt-get install php7.0-xml
sudo apt-get install php-imagick
sudo apt-get install sendmail
 sudo apt-get install php7.0-imap

sudo apt-get install mariadb-server mariadb-client

/etc/init.d/php7.0-fpm restart

sudo /etc/init.d/nginx restart

если вываливается ошибк аконекта с базой мариа
error connection

check this file:

/etc/mysql/mariadb.conf.d $ nano mysqld.cnf

verify if exist this line:

plugin-load-add = auth_socket.so

then go to MariaDB

sudo mysql -u root

and make this:

MariaDB [(none)]>use mysql;
MariaDB [(none)]>update user set plugin=' ' where User='root';
MariaDB [(none)]>flush privileges;
MariaDB [(none)]>exit

Отблагодарить можно через форму справа "Donate" ... )

To reward you via the form on the right "Donate" ... )

:)

друзья )

Сохраняйте и делитесь желаниями, и не забывайте о важных датах! парсинг центр