Monthly Archives: August 2006

Multiple row toolbar in Firefox

I had been trying to turn my single-row bookmarks toolbar in Firefox into a multiple row. I wanted to basically expand the toolbar vertically. Thanks to lifehacker, I found out how.

You need to create userChrome.css by copying the userChrome.css under your profiles directory.

/* Multi-row bookmarks toolbar */
#bookmarks-ptf {display:block}
#bookmarks-ptf toolbarseparator { display:inline }

Voila, your bookmarks folder now has multiple rows!

I did have some minor glitches, though. It didn’t work with any other theme other than the default theme. Also, the first entry on a new row had to be a bookmark and not a bookmark folder. If I tried to add a bookmark folder at the beginning of the row, it went back to its old style of single row and “>>” which would conceal the rest of the folders.

Update:

Chris has posted the code which works with Firefox 2.0.

/* Multi-row bookmarks toolbar */
#bookmarks-ptf {display:block !important; }
#bookmarks-ptf toolbarseparator {display:inline !important; }
#bookmarks-ptf .bookmark-item { visibility: visible !important;}
#overflow-padder { width: auto !important; } /* this controls the
length of the bookmarks */
#bookmarks-chevron { display: none !important; }

Update 2:

John tells us how to control the maximum height of the toolbar.

#PersonalToolbar {max-height:999px !important;}

Replace 999 with the desired height and you are all set.

Update 3:

Some people found Meri's code really helpful. See if this works for you.


#bookmarks-ptf {display:block; line-height:25px; }
#bookmarks-ptf toolbarbutton { font-family: Verdana !important; font-size: 11px !important; color: #5D6469 !important; margin: 0 1px !important; }
#bookmarks-ptf toolbarbutton:hover {height:15px; color: maroon !important; }
#bookmarks-ptf toolbarseparator { display:inline }

Update 4:

My multiple row toolbar broke after I installed Firefox 3.0. None of the above tricks worked. Finally I found the below code on this site. The code sets the toolbar height to 35px which gave me a scrollbar. I changed it to 50px and I like this better without the scrollbar.


/* Multi-row bookmarks toolbar for Fx3b5pre*/
#bookmarksBarContent
{display:block !important;}
.places-toolbar-items
{display:block !important;
height: 35px !important; /* I changed this to 50px */
overflow-y:auto !important;}
#bookmarksBarContent toolbarseparator
{display:inline !important;}
#bookmarksBarContent .bookmark-item
{visibility: visible !important;}
.chevron {height: 0px !important;}

Path tweaking

There are a couple of useful methods in the Path class of System.IO namespace. If you ever wanted to find out the full path to a file, get the file name without an extension or combine two paths, this class gives you all the weapons needed for it. So, here is a compilation of the methods found in the Path class. Note: This is not complete. I haven’t covered all the methods.For the complete list, visit the msdn page.

Have: C:\mydocs\file.txt
Want: C:\mydocs\file.doc
Method to use: ChangeExtension

Have: C:\mydocs and personal\file.doc
Want: C:\mydocs\personal\file.doc
Method to useCombine

Have: C:\mydocs\personal\file.doc
Want: C:\mydocs\personal
Method to use: GetDirectoryName

Have: C:\mydocs\personal\file.doc
Want: .doc
Method to use: GetExtension

Have: C:\mydocs\personal\file.doc
Want: file.doc
Method to use: GetFileName

Have: C:\mydocs\personal\file.doc
Want: file
Method to use: GetFileNameWithoutExtension

Have: file.doc
Want: C:\mydocs\personal\file.doc
Method to use: GetFullPath

Have: C:\mydocs\personal\file.doc
Want: C:\
Method to use: GetPathRoot

Note: The output of certain Uses depend on the current working directory. Ensure that the Use returns what you expect.

C# and typedef

Problem statement:
Typedef int to Tick and use it in three classes which are defined in three different files.
Files are: class1.cs, class2.cs and class3.cs

Solution 1:

Add this statement in all three files: class*.cs

using Tick = System.Int32

Disadvantage: If you choose to rename Tick to ClockTick, you need to change at three different places. You are violating the golden rule of one version of the truth.

Solution 2:

Derive out of the type you want to typedef’ed and use this instead.

Define a class Tick and derive it from Int32.

Disadvantage: This won’t work for non-user defined types like int, char, etc. It can work with ‘classes’.
For eg, this will work

public class TickList : List<int>

whereas this will not

public class Tick : System.Int32

Solution 3:

Create a wrapper around the type you want to be typedef’ed.

Disdvantage: It’s like using a saw to open a pack of biscuits. The solution is too much work compared to the problem. You need a typedef, and you should get a typedef and not a new class altogether!

public class Tick
{
int m_tick;
// Declare property here.
}

Conclusion:

C# does not support typedef, atleast not in the tradition C/C++ sense. Actually, this problem has an elegant solution in C/C++ (add this typedef in a .h file and include that file in all three source class*.c* files) because they have a concept of header files. C# removed header files and many useful features too.

The world at night

This is a collaged photograph of the world in the night. A NASA satellite took several photographs over a span of 24 hours and this is the resulting collage. Earth really looks beautiful. It’s very evident from the photograp which are the developed countries and which are not.

Microsoft to help Mozilla to port Firefox to Vista

Sam Ramji, the Director of the Open Source Software Lab, Microsoft has posted a message in the Mozilla’s planning forum and has extended a helping hand to Mozilla to port Firefox and Thunderbird to Vista.

The complete message can be read here.

When I read it, the first thing that came to my mind was:

1. What?

2. Microsoft has an open source lab? Do those two words go together?

Looks like the conversation is going on away from the glaring public view. Let’s wait and watch how this will turn out.

Closed doors and Windows

Mission:
List all shared folders on my machine.

Solution:
Click on Start, then Run and type in ‘fsmgmt.msc’.
Or Windows+R and then type in ‘fsmgmt.msc’.

Time it took to find the solution:
5 minutes.

Frustration level:
8 on 10.

Conclusion:
If there is a simple way to do something, M$ will complicate it and then will not reveal how to do it.

EXE, COM, DLL, .NET assembly

I found a good article on Code Project which compares and contrasts the above said entitiies. Though the article is quite old, it’s quite relevant to our age.

Can your programming language do this?

Joel Spolsky has a very good article on programming languagues, more of comparing the functional programming languages and what the other languages lack. Iit’s a good read.

Humor for geeks

Here are some quotes  from the geek world to bring a little smile on your face.

Follow

Get every new post delivered to your Inbox.