Nobu's blog

Reversing the direction of wheel scroll to match with Mac OS X Lion

I have been using MacBook Air with Lion. To match with the touch pad behavior, Apple decided to reverse the direction of mouse wheel. Now that I get used to wheel up to make the content to scroll up.

I wanted the same behavior on Windows 7. Here's how to do it.

Easiest way to print stack trace in Java

in

In a common method that is called from many difference places in the code, sometimes you want to know which one is calling it (and causing a problem).

This is just one line of code to show the stack trace.

new Exception().printStackTrace();

Simple, and no need to deal with an array of StackTraceElement.

How to specify the thumbnail image for a 'Liked' page on Facebook

Here's the answer.

http://afjohnston.blogspot.com/2011/03/how-to-change-facebook-like-button.html

The gist of that is

  1. Use a meta tag to specify the image
  2. <meta property=”og:image” content=”your image url here”/>

  3. Use Facebook Debugger to update the image, if necessary.

How to create a menu item to a views page that is for only one language

in

The following link explains how to create a menu item to a views page that happens to be available only one language.

http://www.computerminds.co.uk/multilingual-views-drupal-when-using-i18n...

How to customize 'Submitted by' format on Drupal 6 with internationalization in mind

in

Usually, the way to customize is explained 'oh, just add the following code in template.php'.

function phptemplate_node_submitted($node) {
  return
t('Posted by !username, !datetime',
    array(
     
'!username' => theme('username', $node),
     
'!datetime' => format_date($node->created, 'custom', 'M d, Y @ g:i A')
    ));
}

Invalid MS-DOS Function Error while copying files from Mac to Windows

Lately I bought a Mac Mini to use as a file and internal web server. To regularly backup files on the Mac Mini, I've set up a task schedule that runs Robocopy to mirror the server folder.

It runs mostly fine, but only for a certain file (or maybe a folder), I get the following error.

Invalid MS-DOS Function

Translating the front page

in

See the link below for how to translate the front page that contains a node.

http://drupal-translation.com/content/setting-front-page-language

How to translate Title in Views

in

I got stuck on this for a while. Views modules doesn't support translation for its title (at least natively). There seems solutions using additional modules, but what I did is NOT to use title, but rather header

In the header section, choose PHP code filter for the input format, then write the following.

<?php global $language;

How to use sendmail (SMTP) on Windows XAMPP

XAMPP comes with sendmail, but it's not configured out of the box on Windows system. Here's how to set up sendmail with authentication for Drupal. This is useful when you have a test Druapl server locally.

  1. Configure php.ini
  2. Locate your php.ini. In my case, it was C:\XAMPP\PHP\php.ini. In the [mail function] section, edit like this.

    [mail function]
    ; For Win32 only.

How to automatically sync Outlook data with IMAP folder

By default, when you set up an e-mail account as IMAP on Outlook, it download the mail contents when you see the mail. But you usually want to download all the mail because you might have read already using a web browser.

To automatically download all mails, follow the steps below.

Syndicate content