zaterdag 22 juli 2017

Polymorphism and inheritance

Inheritance refers to using the structure and behaviour of a super class in a subclass.
Polymorphism refers to changing the behaviour of a super class in the subclass.
https://stackoverflow.com/questions/6308178/what-is-the-main-difference-between-inheritance-and-polymorphism

vrijdag 14 juli 2017

Regex match until you find letter

WhatMShallTweMdoT

/^.+?(?=M)/g

(.+?) makes the regex non-greedy.
(?=M) is the condition. This is a postive lookahead assertion.

What is matched is: What

For more information:
https://stackoverflow.com/questions/7124778/how-to-match-anything-up-until-this-sequence-of-characters-in-a-regular-expres

For the regex engine:
http://regexr.com

dinsdag 11 juli 2017

zaterdag 8 juli 2017

Ranger: BELANGRIJK

Use in the program Ranger the command :filter to make selections of certain files.
For instance:
:filter .mp4

To undo the filter, just type :filter to empty it.

New style for Libreoffice Writer

Creating a new style for Libreoffice Writer:
1. Style/New Style/
Give a name to the new style.
Then Modify and assign values to it in Font.

2. Assign a new shortcut for it by Tools/Customize/Keyboard/Styles/Paragraph/Monaco.
And then Modify: F4


maandag 26 juni 2017

Putting brackets around words

What shall we do with the drunken sailor early in the morning

"What", "shall", "we", "do", "with", "the", "drunken", "sailor", "early", "in", "the", "morning",

And it can be done in Vim with this command:
%s/\w\+/"&",/g

dinsdag 13 juni 2017

Selecting text from SVG files

  1. :vnew is more effcient than :vsplit followed by :enew.
  2. yit is more efficient than vit followed by y.
  3. Okay I'm being facetious. Sorry. To actually answer your question, macros (:help complex-repeats) can playback commands that move the cursor to other windows, so you can use them for this sort of task. You might need to tweak this to work with the contents of your file, but the basic steps are:
    1. /tspan<cr>: Search for the first tag.
    2. f>l: Jump into the element contents.
    3. qq: Start recording into the q register.
    4. yit : Yank the text.
    5. ctrl-w w: Move cursor to your other window.
    6. p: Paste the yanked text.
    7. ctrl-w p: Move cursor back into the first window.
    8. n: Jump to start of next tag.
    9. q: Stop recording and save the macro.

    You can then play the macro back 31 times with the command: 31@q.
  4. You could probably also do it with a :global command.

    https://vi.stackexchange.com/questions/12619/more-efficient-way-of-yanking-text-out-of-tags

Enlarging Libreoffice window completely with command

 You can open the LibreOffice window completely by pressing the CTRL+Shift+J keys together.