Tuesday, March 13, 2012

Hiding elements from Blogger's Dynamic View Template

I've been playing a little with Blogger's Dynamic Views template in the past week, so far it seems pretty neat for photo based content.

One of the quirks of the new Dynamic Views is that, unlike standard Blogger templates, users cannot edit the HTML of the page. This is a pretty huge drawback but it is tempered by the fact that you can still modify the CSS using the template designer.

In order to make the blog I was working on a little less cluttered I wanted to hide a number of elements on the page. This may be useful to others so I have itemised my changes below.

  • Hide the search box (from the top right):
    /* Hide search */
    .header-bar #search{ display: none !important; }

  • Hide the Google Chrome feedback link (from the bottom right):
    /* Hide the google chrome feedback button */
    a.feedback  { display: none !important; }

  • Hide the "Home" button (from the pages list):
    Note: This assumes the home button is the first page in your list of pages.
    /* Hide the home button */
    #pages ul li:first-child  { display: none !important; }
    

  • Hide the "Sharing Controls" (Facebook, Twitter buttons etc):
    /* Hide the sharing controls */ 
    .share-controls { display: none !important; }
    

  • Hide the gadget dock (from the right hand side of the page):
    /* Hide the gadget Dock */
    #gadget-dock { display: none !important; }
    

  • Hide the views on the main page:
    /* Hide the views on the main page */
    #views  { display: none !important; }
    

  • Hide the dynamic view switcher:
    /* Hide the views on the main page */
    #views { display: none !important; }
    /*Hide the vertical bar from before the first page link */
    #pages::before { border-left-width: 0 !important;}

It is worth noting that these changes do not remove elements from the structure of the page (anyone reading the source of the page can still see the elements) but it does make the overall page a little cleaner.

You can see the results of my changes here and here.

Friday, February 10, 2012

Bash function to show the linked locations of a binary

The which command on Linux will show you the location, from your PATH, that a binary will be executed from.
trastle@w500:~$ which javac
/usr/bin/javac

This is very useful, however often you will find that the location in your PATH is actually a symbolic link to another location.
trastle@w500:~$ which java | xargs readlink $1
/etc/alternatives/java

This in turn can be another symbolic link:
trastle@w500:~$ which java | xargs readlink $1 | xargs readlink $1
/opt/ibm/java/ibm-java2-i386-60/bin/java

This means it can take a few commands to view all the links in play when a command is called. Oddly I find myself doing this quite often so I throw a small function in my .bashrc to help out:
function whichlink
{
  local loc=`/usr/bin/which $1`;
  echo "$loc"
  
  while [ -h "$loc" ]
  do
    loc=`/bin/readlink $loc`
    echo "--> $loc"
  done
}

The output is as follows:
trastle@w500:~$ whichlink javac
/usr/bin/javac
--> /etc/alternatives/javac
--> /opt/ibm/java/ibm-java2-i386-60/bin/java

Alternately if you don't want to print all of the links along the way and just want to know the final destination the following is useful:
trastle@w500:~$ readlink -f `which javac`
/opt/ibm/java/ibm-java2-i386-60/bin/javac

I am certain at some point I'll want to do this on another machine and text is more reliable than my long term memory. Enjoy.