Skip to main content

Posts

Showing posts from June, 2016

Ubuntu /etc/hosts

When no internet connection my vhost apache can't not access. I found that there were no record for this 127.0.0.1 test.local.dev in  /etc/hosts When I added this record, without Internet conn it work. From virtual machine (like Virtualbox) it still work because it has different hosts name DNS file. Why when in connection on Internet, Ubuntu do not need /etc/hosts to domain name translate. Update 1: 2016/07/06 Firefox trên Ubuntu 14.04 bỏ qua file /etc/hosts. Muốn chạy các site local thì cần vô DNS của FF chình về 127.0.0.1. Chi tiết coi tại  https://support.mozilla.org/en-US/questions/1011327 và  http://stackoverflow.com/questions/6184808/firefox-work-offline-with-virtual-host Khi chỉnh như vậy thì ko vô internet được, chỉ trong localhost vhost domain. Ai có cách chỉnh thì xin hướng dẫn.

Linux bash get timestamp date -d @1482073199

[Link refer here] Dùng hàm date trên linux để lấy ra time dạng UNIX. Ngược lại tính ngày từ UNIX time date +"%s" hay date +"%D" để lấy time. Tính ngược ngày từ timestamp: nickfarow:src$ date -d @1482073199 Chủ nhật, 18 Tháng mười hai năm 2016 21:59:59 ICT Rảnh thì viết 1 bash để tính tự động (ít gõ lệnh hơn) nickfarow:src$ cat ~/bin/timestamp.sh #!/bin/bash # Define a timestamp function timestamp() {   date +"%T" } datetime() {   date +"%D" } # TODO use variable # do something... timestamp # print timestamp # do something else... datetime # print another timestamp # continue... timestamp2() {   date +"%s" } timestamp2 Run: nickfarow:src$ ~/bin/timestamp.sh 14:19:45 06/24/16 1466752785 Update 1 2016/07/12 https://blog.serverdensity.com/handling-timezone-conversion-with-php-datetime/ $date = new DateTime(null, new DateTimeZone(date_default_timezone_get())); // Because we call this fun

Firefox VirtualHost not working

Youtube legal proof

https://productforums.google.com/forum/#!topic/monetization-on-youtube/ZeRaORW85wI http://www.riotgames.com/legal-jibber-jabber Dear You Tube Team , I have made the video explaining certain aspect For original audio: ---- The video has been done using my own headcam, so I think there is no commercial use rights for the audio content. I do not use any audio-editing software to edit this audio content. For original video: I used my head cam, an SJ5000 Wifi model to record this video. The original file has still in my micro SDcard. I do not use any visual editing software to edit this video, I've uploaded raw content. I think it would be fair if you can kindly review &accept my application for monetisation .! https://support.google.com/youtube/answer/2490020?hl=en&rd=1 Video với lượng view nhỏ thì cũng ko nên y/c feedback làm chi vì thứ nhất ko đc bn $, thứ 2 hàng chờ đc review lại sẽ lầu vì tiêu chí view cũng liên quan. Nếu bị block monetize thì đợi vài thá

Mysql show current selected DB, Dump from host with condition

SELECT DATABASE() FROM DUAL; or SELECT DATABASE(); http://stackoverflow.com/questions/19376104/how-to-clear-screen-in-mysql Clear: Ctrl + L or on OSX Command + K ? Update 1: 27/07/2016: Dump bình thường mysqldump -u root -p -h 192.168.x.xxx db_name tbl_name  > note_proj_17.sql Dump với điều kiện WHERE: mysqldump -u root -p -h 192.168.x.xxx db_name  tbl_name --where="items_id like '%017'" > note_proj_17.sql Dump sql với INSERT tách ra: mysqldump -u root -p -h 192.168.x.xxx db_name tbl_name --extended-insert=FALSE   --where="items_id like '%017'" > note_proj_17.sql Lưu ý thay user mysql root bằng user bạn muốn login để dump. ip 192 thay bằng IP host bạn cần truy cập.  Điều kiện WHERE để lọc bớt KQ dump cũng tùy y/c logic bạn cần... Ngoài ra bạn có thể dump từng cột dữ liệu mà bạn cần chứ ko nhất thiết dump cả bảng. Mình có note ở đâu đó sẽ update vô đây sau.

Tint2 taskbar

When start Ub (Ubuntu) sometime tint2 do not start (although it has been set to auto startup). Then manual open tint2 in terminal. But it can't click, wheel ... => Stop by ctrl-C => nothing change, tint2 still remain but blank. => ps aux |grep tint2 and voila => some other process. => sudo kill all tint2 then restart tint2 => ok.

Browser Stack

This service is really useful when we need to test on iOS, IE ... Trial ver only allow 30 minutes a day (or only 30 m ?). IE9 has a huge VM file (3.5G vbox) and work well. Not only Live simulator, it can Inspect (for Developer). Still lag (like vm OS on browser).

Ubuntu slow startup

Sometime and/or everytime  when ubuntu startup, it take a huge amount of time to boot n startup. Why ? Here some syslog show what is time eater: Jun  6 11:09:43 nickfarrow-SMBIOS NetworkManager[1102]: <info> WiFi hardware radio set enabled Jun  6 11:09:46 nickfarrow-SMBIOS dbus[819]: [system] Activating service name='org.freedesktop.Accounts' (using servicehelper) /etc/mysql/debian-start[1885]: Upgrading MySQL tables if necessary. Mysql take 11s to some task. WiFi radio take 2 seconds ... I note some task take more than 2 s. My PC has not wifi so why radio MySQL has some DB with about < 20MB in size. n other. May be need some tool to see log better : syslog ng or analyzer http://terraltech.com/syslog-server-with-rsyslog-and-loganalyzer/ https://www.balabit.com/network-security/syslog-ng Another annoying problem with ubuntu is often hang on. My PC and other in my com. ubuntu often crash. Mobo is MSI or ... My laptop is ok, it rarely happened.