Thursday

LibreOffice Writer: Generate random text

Steps:

Download and install LibreOffice's Main Installer from
www.libreoffice.org/download/

Open LibreOffice Writer

Type "dt"
dt stands for dummy text or random text

Press F3.

Dummy text output:
````
He heard quiet steps behind him. That didn't bode well. Who could be following him this late at night and in this deadbeat part of town? And at this particular moment, just after he pulled off the big time and was making off with the greenbacks. Was there another crook who'd had the same idea, and was now watching him and waiting for a chance to grab the fruit of his labor? Or did the steps behind him mean that one of many law officers in town was on to him and just waiting to pounce and snap those cuffs on his wrists? He nervously looked all around. Suddenly he saw the alley. Like lightning he darted off to the left and disappeared between the two warehouses almost falling over the trash can lying in the middle of the sidewalk. He tried to nervously tap his way along in the inky darkness and suddenly stiffened: it was a dead-end, he would have to go back the way he had come. The steps got louder and louder, he saw the black outline of a figure coming around the corner. Is this the end of the line? he thought pressing himself back against the wall trying to make himself invisible in the dark, was all that planning and energy wasted? He was dripping with sweat now, cold and wet, he could smell the fear coming off his clothes. Suddenly next to him, with a barely noticeable squeak, a door swung quietly to and fro in the night's breeze. Could this be the haven he'd prayed for? Slowly he slid toward the door, pressing himself more and more into the wall, into the dark, away from his enemy. Would this door save his hide?
````

LibreOffice: How to position picture correctly?

To position the picture correctly in LibreOffice:

1. Insert a picture on a blank line

2. Right-click on the image > Anchor > As Character

Tuesday

Getting started with C++ 2011 in Eclipse IDE

Download Eclipse IDE for C/C++ Developers Windows 32-bit at
http://www.eclipse.org/downloads/
http://www.eclipse.org/downloads/download.php?file=/technology/epp/downloads/release/luna/SR2/eclipse-cpp-luna-SR2-win32.zip

Extract the zip file to
C:\eclipse-cpp-luna-SR2-win32
Don't name the folder as eclipse only

Create the following executable file shortcut on the desktop
C:\eclipse-cpp-luna-SR2-win32\eclipse.exe
Name the shortcut link as eclipse-cpp-luna-SR2-win32

Download and install CodeBlocks v13.12
http://www.codeblocks.org/downloads/
http://sourceforge.net/projects/codeblocks/files/Binaries/13.12/Windows/codeblocks-13.12mingw-setup.exe

Copy MinGW folder from
C:\Program Files (x86)\CodeBlocks\MinGW
to
C:\MinGW

Open Eclipse C++ IDE
Workspace: D:\my_cpp_2011
Tick the box "Use this as the default and do not ask again"
Click button OK
Click the Workbench curve down icon to start C++ programming

Eclipse Menu > Window > Preferences

Left menu > General > Editors > Text Editors
Tick the box "Insert spaces for tabs"
Tick the box "Show line numbers"
Click the button Apply

Left menu > C/C++ > Editor > Folding
Tick the box "Enable folding of preprocessor branches (#if/#endif)"
Tick the box "Enable folding of control flow statements (if/else, do/while, for, switch)"
Untick the box "Header Comments"
Click the button Apply

Left menu > C/C++ > New C/C++ Project Wizard
Check if you are on "Preferred Toolchains" tab
Go to "Project type" section box
Select "Empty Project" under Executable
Go to Toolchains section box
Select MinGW GCC row
Click the button "Make toolchain(s) preferred"
Click the button Apply

Click the button OK

Eclipse Menu > New > C++ Project
Project name: prjCpp3
Project type: Hello World C++ Project
Toolchains: MinGW GCC
Click button Finish

Go to Project Explorer frame
Right-click the prjCpp3 project folder > select "Build Project"
Right-click the prjCpp3 project folder > Run As > "1 Local C/C++ Application"

You can view the C++ code output in the Console frame

Replace the entire file content of prjCpp3.cpp with the following.
File name: prjCpp3.cpp
File content:
/**********/
/*
Output:
6 7 8
8
123
*/

#include <iostream>
#include <vector>
#include <string>
#include <cstdlib> //for atoi
#include <sstream> //for sringstream

using namespace std;

int main(int argc, char* argv[])
{
    //vector initialization list
    vector<int> vec = {6, 7, 8};

    //auto data type, range-based for loop using colon
    for(auto elt : vec)
    {
        cout << elt << " ";
    }
    cout << endl;

    //convert from int to string
    //error: 'to_string' function is not available yet
    //string s1 = to_string(vec[2]);
    stringstream ss;
    ss << vec[2];
    string s1 = ss.str();
    cout << s1 << endl;

    //convert from string to int
    //error: 'stoi' function is not available yet
    string s2 = "123";
    //int i = stoi(s2);
    int i = atoi(s2.c_str());
    cout << i << endl;

    return 0;
}
/**********/


Go to Project Explorer frame
Right-click the project and go to Properties
Left menu > C/C++ Build > Settings > Tool Settings tab
Left menu > GCC C++ Compiler > Miscellaneous
Textfield: Other Flags: put "-std=c++11" at the end
Click button OK

Toolbar > click Run button

Close Eclipse C++ IDE

Monday

Getting Started with C++ 2014

Steps are as follows:

Download gcc v5.1.0 32-bit from
ftp://ftp.equation.com/gcc/gcc-5.1.0-32.exe
Install gcc v5.1.0 32-bit to "C:\gcc-5.1.0-32"

Download and install Notepad++ from
https://notepad-plus-plus.org/download/

The Path environment variable to run C++ 2014 on Windows 7 is configured automatically.
If not, open the Environment Variables frame through "Control Panel\System and Security\System".
Hit the end key to scroll to the end of the variable value textbox of variable name Path.
Then, type a semicolon at the end of the existing path, followed by the gcc executable binary directory, which is as follows:
;C:\gcc-5.1.0-32\bin;C:\gcc-5.1.0-32\libexec\gcc\i686-pc-mingw32\5.1.0

Restart your computer because of the installation of gcc v5.1.0 32-bit.

Open Notepad++
Save the new file as "cpp2014_no1.cpp"

File name: cpp2014_no1.cpp
File content:
/**********/
#include <iostream>

using namespace std;

int main(int argc, char* argv[])
{
    //binary literal
    auto binary_literal = 0b0001'1111;
    cout << binary_literal << endl;
   
    //digit separators
    auto integer_literal = 1'000'000;
    cout << integer_literal << endl;
   
    //generic lambda function
    auto lambda = [](auto x, auto y) {return x + y;};
    auto sum = lambda(1.2, 3.4);
    cout << sum << endl;
   
    return 0;
}
/**********/

Output:
C:\my_folder_path>g++ -std=c++14 cpp2014_no1.cpp -o a.exe

C:\my_folder_path>a
31
1000000
4.6

Step to uninstall GCC downloaded from 
http://www.equation.com/servlet/equation.cmd?fa=fortran
- Open the system path of Environment Variables frame
- Delete the system variable name EQ_LIBRARY_PATH which contains the following variable value
c:\gcc-5.1.0-32\i686-pc-mingw32\lib;
- Edit to delete only the following two system paths from the variable name Path:
--- c:\gcc-5.1.0-32\bin;
--- c:\gcc-5.1.0-32\libexec\gcc\i686-pc-mingw32\5.1.0;
- Delete the folder at C:\gcc-5.1.0-32

If a hater attacked your age and not the goodness of you

Whether young or old, I've always been known what endures. I've known the very idea of people that were all created equal and deserv...