Sunday, October 14, 2012

Delete Space After Link in HTML

Have you noticed that sometimes you have white space included in your link in the end when you use <a href=""><a/> tag?

Here is an example: Weird Link .

If you look closer you will see white space after the link although I didn't include any in HTML (sorry for the link formatting, it is probably hard to see). I wanted to fix it using CSS but after 15 minutes recognized that it goes away if you put the closing tag </a>  right after the text and not on the next line.

So, this is the same link but with the closing tag on the same line: OK Link.

May be it is intended to be like that but it is still strange that Next Line character is treated like a Space character.

Change Boot Order in GNU GRUB

If you installed Ubuntu then you probably got GNU GRUB 2 with it. It is this thing that allows you to choose what operating system (or tool) you want to boot. Default option is usually your new Ubuntu installation and you have 10 seconds by default to boot something else.

In case if you want to use Windows as your primary operating system and just got Ubuntu for some special case (e.g. I just wanted to play with EXT4 file system), booting Ubuntu by default is not the best option for you. Sometimes you are just not near your computer to choose another OS during this 10 seconds period (happened kind of a lot with me). So, let's change that.

  1. Count the number of the entry you want to boot by default (its row number in GNU GRUB) when you machine starts. 
  2. Load Ubuntu and start Terminal.
  3. Type sudo gedit /etc/default/grub.
  4. Change GRUB_DEFAULT to the number of the entry you want to boot by default (0 is the first entry (row), 1 is the second, etc.). I have 7 entries and want to load the last one, so  GRUB_DEFAULT=6.
  5. You can change GRUB_TIMEOUT to change how much time (in seconds) the system will wait before loading the default option.
  6. Type sudo update-grub in terminal to update GRUB configuration.
  7. Restart Ubuntu and enjoy.

Thursday, October 4, 2012

UNIX Permissions (chmod Tips)

Some basic useful stuff on UNIX permissions and chmod command:
  1. 'ls' command outputs permissions for the specified file. It outputs permissions for all the files and directories in the current directory if you don't specify FILE_NAME:
    ls -lg FILE_NAME
  2. If you want to set permission for particular files or directories then you can use find + exec. The first command will change permission of all the directories. The second one specifies the search pattern - all .HTM files.
    find . -type d -exec chmod 755 {} \;
    find . -type f -name '*.htm*' -exec chmod 755 {} \;
    755 here is the permissions code.

Saturday, September 29, 2012

Pause Console Application in the End

If you want to pause your Visual Studio console application in the end, there is no need to insert something like Console.ReadKey(). If you run your application with Ctrl-F5 (Run without Debug) then Visual Studio creates and runs a batch file that look something like that:
your_program.exe
@pause
So, command line will pause with "Press any key to continue..." message when your program is done and you will be able to examine the output.

Input Arguments for Console Application in VS

If you want to run your console application from Visual Studio (Ctrl-F5) and you need some input arguments that you need to specify them in Project -> Properties -> Debug -> Start Options -> Command line arguments.

Friday, September 28, 2012

Why science TV programs suck

We, all saw a lot of popular science programs on TV. BBC, Discovery and others show them all the time. And somehow all the programs about nature are interesting and amazing and all the science programs suck. They try to explain very interesting things but immediately fail because of stupid effects or science guys who look ridiculous trying to explain the universe looking at the spider web or playing a piano and saying: "OK, this has nothing to do with this web/piano, but I will still proceed." I understand that networks just need ratings and it causes weird decisions. But are there a lot of guys who would love to watch something solid and serious, who would love not to be treated like all they want is entertainment. I would totally pay extra for that.

Windows Command Prompt Tips

1. Copy/Past to the Command Prompt
Not very convenient but still easy. You can Right-click on top of the command prompt window (top window bar) and choose Edit menu. There you can copy text from the command prompt and past into it.

2. Open Command Prompt in Current Directory
Discovered this feature only recently. It made my life much easier. Right-click somewhere in directory (not on the file or menu) with the Shift button down. You will see a new option "Open command windows here" that will open Command Prompt in the current directory. This feature does not work inside Libraries (Documents, Pictures, etc.) in Windows 7. Don't really know why. May be path to the directory is ambiguous because you can add a lot of directories to your library. Although, paths in sub directories are well defined but this feature still does not work.