Tag Archives: Linux

What is vim recording?

vim with recording turned on

Recording is a really useful feature of Vim. 

You start recording by pressing “Q” key followed by any other letter keystroke, and you can end it by typing “Q” again. 

It records everything you type. You can then replay it simply by typing “@“ followed by the letter. 

Record search, movement, replacement…

This is one of the best features of Vim.

One more thing to note is that you can hit any number before the “@“ to replay the recording that many times like (100@<letter>) will play your recorded actions 100 times. 

A discussion about fclose(); Max number of open files allowed in a program

To close a file, use the fclose() function. 

The function flushes any data still pending in the buffer to the file, closes the file, and releases any memory used for the stream’s input and output buffers. The fclose() function returns zero on success, or EOF if an error occurs. 

When the program exits, all open field are closed automatically. Nonetheless, you should always close any file that you have finished processing. Otherwise, you risk losing data in the case of an abnormal program termination. Furthermore, there is a limit to the number of files that a program may have open at one time; the number of allowed open files is the value of the constant FOPEN_MAX. 

To check out this value. we can do : 

The program returns 16 on my platform. 

Understanding Linux Directory Structure (File System Structure)

NewImage

For more detailed explanation: refer to theGeekStuff blog

The most convenient way to know what each directory is about is to open Terminal and type this command:

man hier

Notes:
/bin: where binary programs live.
/boot: special programs that start the system when you turn the machine on
/dev: all the “device” listings for hardware of every conceivable flavor, along with some “imaginary” devices

Source: http://www.linuxquestions.org/questions/linux-general-1/what-does-etc-stand-for-337575/

How to add application to Ubuntu Launcher

For most of the times, chances are that you can launch one application and right click on the icon in Launcher and click “Lock to Launcher” to make the application icon stay in Launcher for easy access. 

However, there are a few programs that does not support Launcher. 

After researching for a while, I found the answer on StackOverflow, but can’t locate the original post. 

Here are the steps to manually make it happen. 

First, create a .desktop file to the application (eclipse for example) in the applications directory:

gedit ~/.local/share/applications/eclipse.desktop

Then, paste the following inside (don’t forget to edit Icon and Exec values):

[Desktop Entry]
Type=Application
Name=Eclipse
Comment=Eclipse Integrated Development Environment
Icon=** something like /opt/eclipse/icon.xpm **
Exec= ** something like /opt/eclipse/eclipse **
Terminal=false
Categories=Development;IDE;Java;
StartupWMClass=Eclipse

Note: to locate your eclipse, issue this command:
which eclipse

Finally, drag the .desktop file onto the launcher.

Now you have it. Cheers!