Wednesday, November 21, 2012

Firefox tab close button on all tabs

Visibility of tab's close button can be set by modifying browser.tabs.closeButtons through about:config. The values are:
// Where to show tab close buttons:
// 0  on active tab only
// 1  on all tabs until tabClipWidth is reached, then active tab only
// 2  no close buttons at all
// 3  at the end of the tabstrip
The problem is, that when browser.tabs.closeButtons is set to 1 the close button visibility depends on the opened tab number. If there are more tabs than the tabbar can show it goes into overflow mode and thus the tab close buttons are gone. This can be fixed by adding a few lines to your userChrome.css:
.tab-close-button { display: -moz-box !important; }
.tabbrowser-tab[pinned] .tab-close-button { display: none !important; } /* hide close buttons on app (pinned) tabs */

Labels: , , , , ,

Wednesday, September 19, 2012

How to fix Joomla jtablesession::store failed DB error

The last time I saw jtablesession::store failed error it was caused by some bad data in jos_session table in Joomla database. Here's how you can fix it given that the table name is jos_session:

  1. Go to your hosting cPanel, DirectAdmin, etc.
  2. Go to phpMyAdmin
  3. Select your joomla website database
  4. Check the table jos_session in the table list
  5. At the bottom of the table list from the drop-down list select the option repair the table
More info here.

Labels: , , , , ,

Sunday, August 12, 2012

Photoshop pixel perfect resizing

When resizing with the transform tool one has to select reference point accordingly in the transform toolbar. It defaults to center.

Another way is to add half of pixel.

Labels: , , ,

Friday, August 10, 2012

Backup your KeePass 2 database before saving it

KeePass 2 has a trigger system which you can use to backup your database before saving it. Here's how. Open KeePass window, select Tools -> Triggers... Click Add... Type in the name (like "Backup database on save"). On Events tab, click Add... and choose Saving database file from the dropdown menu. You can skip Conditions tab. On Actions tab click Add... again. Leave Execute command line / URL selected.
File/URL: %comspec%

Arguments: /c mkdir "C:\Users\username\Backup"

Wait for exit: Yes
This trigger will try to create a backup folder. You can specify whatever location you want for this. Click Add...again.
File/URL: %comspec%

Arguments: /c copy "{DB_PATH}" "C:\Users\username\Backup\{DB_BASENAME}.kdbx_{DT_SIMPLE}"

Wait for exit: Yes
This trigger will copy your database file to the backup folder with a timestamp appended. Now to avoid having thousands of database copies in a long time we can specify a trigger which will delete oldest copies. The one below will leave 10 backup files and delete the rest. You can change it to whatever number you like (orange number). So, on Actions tab click Add... again.
File/URL: %comspec%

Arguments: /c for /f "skip=10 tokens=*" %X in ('dir "C:\Users\username\Backup\{DB_BASENAME}.*" /b /o:-d') do del "C:\Users\username\Backup\%X"
Thanks to KeePass website. You can find more useful examples there.

Labels: , , , ,

Remove custom items from Firefox bookmark menu

If you want your Firefox bookmark menu to display only your own bookmarks without all those "Bookmark This Page" items, go to %AppData%/Mozilla/Firefox/Profiles/profilename/chrome and edit userChrome.css. If it's not there, just create it. Now paste this:
#menu_bookmarkThisPage,
#subscribeToPageMenuitem,
#subscribeToPageMenupopup,
#menu_bookmarkAllTabs,
#bookmarksShowAll, #organizeBookmarksSeparator,
#bookmarksToolbarFolderMenu,
#bookmarksToolbarFolderMenu+menuseparator,
#bookmarksMenuPopup menuseparator[builder="end"],
#menu_unsortedBookmarks { display: none !important; }

#BMB_viewBookmarksToolbar, #BMB_viewBookmarksToolbar+menuseparator,
#BMB_bookmarksShowAll, #BMB_bookmarksShowAll+menuseparator,
#BMB_bookmarkThisPage,
#BMB_subscribeToPageMenuitem,
#BMB_subscribeToPageMenupopup, #BMB_subscribeToPageMenupopup+menuseparator,
#BMB_bookmarksToolbar, #BMB_bookmarksToolbar+menuseparator,
#BMB_bookmarksPopup menuseparator[builder="end"],
#BMB_unsortedBookmarks { display: none !important; }

#appmenu_showAllBookmarks, #appmenu_showAllBookmarks+menuseparator,
#appmenu_bookmarkThisPage,
#appmenu_subscribeToPage,
#appmenu_subscribeToPageMenu,
#appmenu_subscribeToPageMenupopup, #appmenu_subscribeToPageMenupopup+menuseparator,
#appmenu_bookmarksPopup menuseparator[builder="end"],
#appmenu_unsortedBookmarks { display: none !important; }
The last part (in orange) will hide default items in Firefox appmenu bookmarks as well, so leave it out if you want to customize bookmark menu in  a toolbar only.

Labels: , , , , ,

Tuesday, July 17, 2012

Hide native element inspector in Firefox 13+

I don't know why but Mozilla decided to not allow Firefox users to disable their native element inspector. It really gets in the way if you are using Firebug. Fortunately, Firebug allows us to hide it in the about:config page. Just change this value to false:
extensions.firebug.hideDefaultInspector

Labels: , , , ,

Monday, July 16, 2012

Disqus on Blogger

Installing Disqus comments into your Blogger is fairly easy following official guide here (if you are using the new template system) or if you prefer classic templates like me you can follow universal code guide here. The problem is that Disqus is using full url to identify your discussion threads by default. You can use disqus_identifier to solve it like this:
<script type="text/javascript">
  var disqus_shortname = 'blobdot';
  var disqus_identifier = "<$BlogItemTitle$>";

  (function() {
    var dsq = document.createElement('script'); dsq.type = 'text/javascript';
    dsq.async = true;
    dsq.src = 'http://' + disqus_shortname + '.disqus.com/embed.js';
    (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
  })();
</script>

This will make a unique identifier by using your post name like "Best vacation ever" instead of full url. Now to get the correct comment count you have to retrieve them with this new unique identifier. Put this where you have your Disqus comment link:
<a class="comment-link" href="<$BlogItemPermalinkUrl$>#disqus_thread" data-disqus-identifier="<$BlogItemTitle$>"></a>

This is not the best way to identify your posts since you can have several with the same name. This was the quickest solution for my blog.

Labels: , , , ,