Sunday, October 14, 2012

Как засечь время выполения. C++

#include <iostream>
#include <time.h>  // нужно для clock()
using std::cout;

int main(void)
{
   // начальное время 
   clock_t t1 = clock(); 
   for(int i=0; i<1000000000; i++); 

   // время окончания
   clock_t t2 = clock(); 

   // время выполнения в секундах 
   cout << "Time: " << (double) (t2-t1) / (double)CLOCKS_PER_SEC << '\n'; 
   std::cin.get();
   return 0;
}

Tuesday, September 25, 2012

Фишка Vim'a этого дня! CTRL-R !


Посмотрел  :help i_CTRL-R ... это круто!
 Клацая CTRL-R в insert mode Vim входит в режим "ожидания имени регистра" и, когда получает его, вставляет содержимое регистра, не выходя из insert mode.

apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName


Возможно вы тоже столкнётьсь с такой проблемой, делая restart Apache.
:~$ sudo service apache2 restart
* Restarting web server apache2
apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
Решение проблемы: поправить httpd.conf . Откройте терминал и введите
sudo nano /etc/apache2/httpd.conf
По умолчанию httpd.conf пустой. Просто добавьте строку в файл. ServerName localhost Сохраните и, наконец, перезапустите сервер.
sudo service apache2 restart

Sunday, September 23, 2012

Friday, September 21, 2012

Installation Wireshark on Ubuntu

Wireshark is a free and open-source packet analyzer. It is used for network troubleshooting, analysis, software and communications protocol development, and education. It is a very good helper of a network administrator and it rescued my network many times. You can install it on Ubuntu by running following commands in terminal:

sudo add-apt-repository ppa:n-muench/programs-ppa
sudo apt-get update
sudo apt-get install wireshark

Wednesday, September 19, 2012

D-Link DES-3550 ACL configuration

To disable users with ip-addresses from subnet 192.168.0.0/16

 create access_profile ip source_ip_mask 255.255.0.0 profile_id 1
 config access_profile profile_id 1 add access_id 1 ip source_ip 192.168.0.0 port 1 deny
 config access_profile profile_id 1 add access_id 2 ip source_ip 192.168.0.0 port 2 deny