Archive

Archive for January, 2010

Custom Qt Creator color scheme location

January 27th, 2010 No comments

Custom Qt Creator color scheme location is:

Windows XP

 C:\Documents and Settings\<user_name>\Application Data\Nokia\qtcreator\styles

Windows 7

C:\Users\<user_name>\AppData\Roaming\Nokia\qtcreator\styles
Tags:

Load a file to a string list

January 22nd, 2010 No comments
#include <vector>
#include <string>
#include <iostream>
#include <fstream>
#include <algorithm>
#include <iterator>

int main(int argc, char* argv[])
{
    std::vector<std::string> v;
    std::ifstream f("e:/test.txt");
    if(f.is_open())
    {
        std::copy(std::istream_iterator<std::string>(f),
                  std::istream_iterator<std::string>(),
                  std::back_inserter(v));
    }
    // проверка
    std::copy(v.begin(), v.end(),
              std::ostream_iterator<std::string>(std::cout, "\n"));

    return 0;
}

rsdn.ru

Convert __DATE__ to unsigned int

January 21st, 2010 No comments
#define YEAR ((((__DATE__ [7] - '0') * 10 + (__DATE__ [8] - '0')) * 10 \
              + (__DATE__ [9] - '0')) * 10 + (__DATE__ [10] - '0'))

#define MONTH (__DATE__ [2] == 'n' ? 0 \
               : __DATE__ [2] == 'b' ? 1 \
               : __DATE__ [2] == 'r' ? (__DATE__ [0] == 'M' ? 2 : 3) \
               : __DATE__ [2] == 'y' ? 4 \
               : __DATE__ [2] == 'n' ? 5 \
               : __DATE__ [2] == 'l' ? 6 \
               : __DATE__ [2] == 'g' ? 7 \
               : __DATE__ [2] == 'p' ? 8 \
               : __DATE__ [2] == 't' ? 9 \
               : __DATE__ [2] == 'v' ? 10 : 11)

#define DAY ((__DATE__ [4] == ' ' ? 0 : __DATE__ [4] - '0') * 10 + (__DATE__ [5] - '0'))

#define DATE_AS_INT (((YEAR - 2000) * 12 + MONTH) * 31 + DAY)

int main (void)
{
  printf ("%d-%02d-%02d = %d\n", YEAR, MONTH + 1, DAY, DATE_AS_INT);
  return 0;
}

List of algorithms

January 21st, 2010 No comments

The following is a list of algorithms described in Wikipedia. This list is manually updated and additions of links to existing pages are welcome. See also the list of data structures, list of algorithm general topics and list of terms relating to algorithms and data structures.

Tags:

Qt Creator reference card

January 21st, 2010 No comments

The QT Creator reference card is a handy reference designed to assist your use of Qt Creator. It is available in Windows/Linux as well as Mac versions and for ease of printing comes in A4 and US letter formats.

Tags: , ,

Customize the Windows 7 “Send To” Menu

January 16th, 2010 No comments

To get to the SendTo folder, you’ll need to open up an Explorer window, and then paste in the following to the address bar.

%APPDATA%\Microsoft\Windows\SendTo

%APPDATA% is an environment variable that actually maps to something like C:\users\<username>\AppData\Roaming.

Also, common “SendTo” menu is located here: C:\Users\Default\AppData\Roaming\Microsoft\Windows\SendTo

Tags: ,

Wireshark

January 16th, 2010 No comments

Wireshark is the world’s foremost network protocol analyzer, and is the de facto (and often de jure) standard across many industries and educational institutions.

Read more…