Memorize this: . ^ $ * + ? ( ) [ { | [backslash]


This is a really good set of symbols to memorize because if you are writing a Perl-compatible regular expression (PCRE) then these are the symbols which if they occur as literals within expressions (and outside of character classes), they need to be escaped. [Sorry WordPress is messing up the backslash character in the title]

PCRE’s are used in languages including PHP, Python, and Java. And of course they are used in Perl.

Remember that character classes are enclosed in square brackets [], for example:
[a-z0-9] is a character class consisting of the range of lowercase letters and digits 0 through 9.

The symbols which must be escaped inside character classes are intuitive so don’t really need to be memorized. They include – which is used for ranges (as above), the \ character itself, and the right square bracket ] as well as the caret ^ which negates or inverts a character class.

Reference & credit: What special characters must be escaped in regular expressions?

Cool historical concept of the {time_interval}: Phoenician

As I was reading one of my computer science textbooks on my laptop something made me think about languages in general and alphabets. The whole idea of an alphabet – symbols to represent phonetic sounds which can be re-used and combined to form words – all began with Phoenician.

Phoenician is where it all began. We all owe some major credit to where it is due: With the brilliant person or people who started the first alphabet several thousands of years ago.

As a computer science student I have come to a special appreciation for symbols and writing. As neat as Java, Python, SQL, PHP, etc. are I’m still fascinated by how it all began thousands of years ago and who the brilliant genius or geniuses were who developed it.

I imagine what it would have been like in the ancient world to be a trader or traveler visiting an exotic, distant place and to encounter a written alphabet for the first time. Nowadays we get excited about so many things. Imagine seeing written text for the first time and being blown away at the sheer genius of it.

I can easily imagine some people being so blown away by it that they would have stopped everything – completely dropped everything else they were doing – in order to learn this amazing new inscription system.

If you look carefully at the symbols of the Phoenician alphabet you will notice that many if not most of them closely resemble their Greek and/or Latin equivalents.

Phoenician. Love it!

Great Blue Angels video

Love this video. It shows many if not most of their major stunts and formations. While this video is good its nothing compared to seeing them in real life, to things like seeing 5 or 6 fighter aircraft whip past the roof of your apartment only a stone’s throw away, or whip over your head as you’re bicycling along a city street.

What you don’t see in this video is the “sky art” aspect of their flying which can be spectacular.

I love the Blue Angels. I see them every year. Its so exciting it almost makes me cry!

Today at the performance I met a man who is a visiting student in aircraft engineering from China. He said that the Chinese have something similar to the Blue Angels. One day I would love to see them also.

One thing we discussed was how the efforts of so many thousands and thousands of people goes into making such amazing aircraft. Some of the technology is the result of 20 or more years of intensive development.

The Blue Angels inspire me to do my best with my computer science courses. Just like each team member is doing their part, and all the thousands and thousands of people who create and maintain the amazing technology that is behind them, I feel that by studying hard in my classes I am doing my part. That is my way to be a part of the team.

Amazing Vim tip of the {time_interval}: Commenting blocks of text

If you have multiple lines of code that you want to comment out, here is an easy and fast way to do it in Vim:

From command mode, with the cursor placed on the first line of the block that you want to comment, type Ctrl-v to enter visual-block mode.

Move the cursor down to the last row of the block.

Enter insert mode: Shift-I (note it has to be capital I, not lowercase as one would normally enter insert mode from command mode).

Type the comment character (for example #) then press escape to exit insert mode. Automatically the entire block of lines will be commented.

Note that I tried to use this same procedure to uncomment a block and unfortunately it doesn’t work…

UPDATE: Here is another way to comment and uncomment blocks using Shift-v (visual-line mode) instead of Ctrl-v: #26 You could add the following mapping to your .vimrc

UPDATE2: This is even cooler: #1 Ctrl + k for comment (Visual Mode)

One you add the two lines to your .vimrc and you are editing a file, in command mode you just press “v” to go into visual mode, then move the cursor down to select a block, then press either Ctrl-k to comment the block or press Ctrl-u to uncomment the block. Very simple!

I think regular visual mode in this last example is easier than visual-block mode in the first one or than visual-line mode in the second one.

Credits & thanks: Vim: Comment a Block of Code

Ubuntu 16.10 “Yakkety” is coming closer, but…

Ubuntu’s next releast 16.10 “Yakkety” is coming closer. That’s a great thing, but I always like to wait a while after any Ubuntu release before installing it.

It is likely that in the first weeks or even months after an official release there will still be a significant amount of updates. I like to play it safe and wait a while. Let everyone use it for a while. If there are any serious issues they will get noticed and fixed. After things calm down a bit then I like to install it.

I’ve always found not being in a hurry to be much more beneficial in the long term.

Then again, I might be so eager to switch to KDE Plasma 5.7 (and ultimately to 5.8 via backport) that I will be impulsive and switch right away!

Also, one wonders if they will be going with the predictable “Zebra” for 17.04? Zebu might be more interesting.

Really cool Vim tip of the {time_interval}

I just discovered this today and its really useful when writing code.

To indent multiple lines, from command mode in Vim just enter the number of lines to indent and then >>.

So to indent 10 lines you would just enter 10>>

At the beginning of the semester everyone was discussing what IDE they use. I don’t know, I’m still really loving Vim. I would really miss it if I had to leave it. I know IntelliJ IDEA has a Vim mode which is cool but its still not the same as Vim in a terminal. Ok maybe it is the same but I still love plain old Vim 🙂

I guess part of it though is that I actually really like using console windows. I use a tabbed console program – right now I use Konsole although there are other good ones. So it wouldn’t be accurate to say that Vim is my IDE because Vim is only one component of it. My true IDE is a Linux BASH environment using the Vim editor. The BASH environment provides me with a lot of other powerful tools which I regularly use: rsync and scp to sync/transfer code between machines. cp and mv. chmod. less which I use frequently. And grep or egrep (actually I have a bash alias to a function which greps through source code folders for each class I take which is extremely useful when looking for bits of code).

I love Java so much I could cry

Its such a cool language. Its not just about memorizing syntax and names of components, but learning an entire architectural process to build and develop things.

I’m also loving Python. After years of using BASH to do scripting, the ease, simplicity, and power of scripting with Python is like manna from heaven!

I’ve been reading about the use of Python to replace the standard Linux/Unix shell environment. I really hope something like this happens because it would be such a big improvement.

Some cool references: Python Scripts as a Replacement for Bash Utility Scripts Cutting and slicing strings in Python Will iPython replace Bash? s/bash/ipython/g

KDE Plasma 5.8 has been released!

KDE Plasma 5.8 has been released.

I don’t know if it will make it into Kubuntu 16.10 “Yakkety” but maybe it will at least be available as a backport.

Page 19 of 103« First...10...1718192021...304050...Last »