Posts

Showing posts from December, 2011

Using konqueror to navigate through man pages

Image
If you are a KDE user you can use Konqueror for MAN pages navigation, just add "man:" prefix before interested command. For instance enter  man:ssh-copy-id to Konqueror's address bar and enjoy nicely rendered MAN page entry and all browser's features like search results highlighting, hyperlinks to the related MAN entries (yay!). I wrote simple bash script that utilizes man binary functionality but displays MAN page in Konqueror. Put this code to the /usr/local/bin/kman file: #!/bin/sh #Su'ed root console support if [ $UID = 0 ]; then     su - $LOGNAME -c "env DISPLAY=:0 konqueror man:$@" 2>/dev/null & else      konqueror man:$@ 2>/dev/null & fi For autocompletion support add this to the /etc/bash.bashrc.local file: #konqueror man complete ${_def} -F _man_ ${_file} kman Run  kman   ssh-copy-id and have a fun. Tested only in Opensuse.

PHP associative arrays or hashes: in-depth look

Image
Before you start reading i warn you: this article won't help you in every day PHP developing in any way. But if you are naturally interested, like me, in how things work you're welcome to spend your precious time on reading and understanding this article. Still here? Great. Lets try to stay sane after all this low level mumbo-jumbo and start. PHP array or in other terms hash is a combination of the data storing methods called "vector" and "linked list". Vector is a nice aligned structure in the memory, simplest and fastest way to store and access linked pieces of the data because accessing vector offsets functionality is baked right into the modern CPU's. I'm referring to the assembler's offset calculating functionality like MOV [BASE+OFFSET], DATA. Think of the vectors as a numerically indexed PHP array. If you need to access array member you just pass offset to it like this: $array = array("a", "b", "c"); ...