Thunderbird 3: Changing the toolbar back to the old settings

So I've installed Thunderbird 3 (on my parent's computer as a test mule) to try out the new features. So far so good, migration was smooth and I haven't noticed anything that has been lost.

The new toolbar? Gotta say I'm not a fan. They've removed a bunch of stuff that I use (like err, Reply and Forward) from the main toolbar and moved it into the details pane.

image
Trusty old and useful toolbar.

image 
The new not-so-useful 3.0 toolbar.

image
The new details pane containing the email action buttons.

Making the search more prominent is great, but moving the other stuff isnt. Why? Because I've gotta use a touchpad and it really sucks moving the mouse cursor around so much (if I didn't feel like using the keyboard shortcuts I mean) especially with a widescreen resolution where folders would be on the left and reply button on the far right.

Luckily, Mozilla have included a little tab to help haters like me migrate from one version to another.

image 
The Migration Assistant tab.

The first time you open Thunderbird 3, it'll display a "Migration Assistant" tab to give you some options. If you've still got it open, then click on "Use original toolbar" under the "New toolbar" heading.

If you've already closed it, you can find the assistant under the "Help" menu.

CSS: Make floated elements to push down items below it

Floating is a nice way of positioning elements, but most of the time you dont want it to have no weight on the page that elements below it will try to take up its display space.

For example:

<div>
  <ul class="list_wrap">
    <li style="float: left;">FLOAT A </li>
    <li style="float: left;">FLOAT B </li>
    <li style="float: left;">FLOAT C </li>
  </ul>
  <p>Content thats pushed up</p>
</div>

Will give you:

  • FLOAT A
  • FLOAT B
  • FLOAT C
Content thats pushed up

Example of retarded floating.

To fix that, its really simple! Just add "overflow: auto; width: 100%;" to "ul.list_wrap" and you've got yourself a winner!

  • FLOAT A
  • FLOAT B
  • FLOAT C

Content thats pushed up

Not so retarded floating.

[ Source ]

Disable Windows Live Messenger Web Bar" from Automatically Signing In

While viewing windowslive.ninemsn.com.au, I noticed a little notification showing me that I've signed in from somewhere else.

image

Thinking that I forgot to untick the "save my password" on another computer, I took a quick look to see where it was from.

image

OK, WTF? Since when do sites start logging me into MSN?

Scrolling down to the bottom of the page showed me this.

image

Despite being a small bar, I'd hate to have this load on EVERY PAGE that I viewed. It signed me in automatically on every news article page that I opened on that site, meaning if I viewed 3 articles in 3 tabs, I'd be signed into Messenger 4 times!

image

This is fucken stupid! Not to mention the bandwidth wasted when loading my contacts EVERY TIME I LOADED A PAGE!

So far, I have not been able to find an option to disable it. Although logging out does work, it also logs me out of my email (which I like to logged in at home).

I do hope that Microsoft add an option for disabling this web bar. It may be useful for some, but not me.

Using AdBlockPlus to Disable Messenger Web Bar

Viewing the dev site for the web API, I've found the file required to run this service.

http://www.wlmessenger.net/api/3.5/loader.js

Using AdBlockPlus on Firefox, block anything from "http://www.wlmessenger.net/*" and do not restrict it to the current domain.

image
Right click on the icon and select "Open blockable items".

image
Search for "loader" and it'll help you find this item.

image 
Select that filter and click "Add Filter".

That should do the trick fine.

[ Sources ]

Django: Automatically fill information into template context

Sometimes you need a variable in your templates thats required for every page in your site.

Inserting it into every return statement in every view is a bit too troublesome.

Its much easier to add it into a "Context Processor". This will automatically insert the data you specify into every template rendered.

So in your app, create a file called "context_processor.py" and define the processors you need.

def custom_info(request):  
  return { 'MY_CUSTOM_INFO' : 'blah blah blah', }

Now in your settings, include the preprocessor.

TEMPLATE_CONTEXT_PROCESSORS = (  
  'django.core.context_processors.request',  
  'myapp.context_processors.custom_info',  
)

In your template, use it like normal without needing to load anything.

<div>Data: {{ MY_CUSTOM_INFO }}</div>

Postgres SQL: phpPgAdmin comes up with "Login disallowed for security reasons"

blah

Edit "conf/config.inc.php" and search through the file for:

$conf['extra_login_security'] = true;

Set the value to "false" and logins should now work.

PHP: Get the longest string (or length) in an array

To quickly get the longest string in an array, use the following function.

function longest_string_in_array($array) {
  $mapping = array_combine($array, array_map('strlen', $array));
  return array_keys($mapping, max($mapping));
}

If you need the length of the longest string, use this little snippet.

$maxlen = max(array_map('strlen', $array));

[ Sources ]

Eclipse: Hide *.svn-base in Open Resource dialog

If you're using SVN to version control the source you're working with, you may notice in Eclipse v3.5 that the Open Resource dialog now shows you LOTS of *.svn-base files.

This is due to the filtering configuration in the plugins system has changed and plugins need to be updated.

The easiest way to hide those SVN files is to install Subclipse 1.6.x, which has been updated to work with the right filter configuration.

Drupal: Highlight errors in fieldset with form_set_error()

Using form_set_error() to display error messages, the first argument is the name of a field.

$form['height'] = array(
  '#type' => 'textfield',
  '#title' => 'Height',
);

Along with:

form_set_error('height', 'Error with height.');

image

Normally this is simple to define, but when using nested form items within fieldsets, this doesn't highlight the right item.

If the form was changed to nest the items:

$form['new'] = array(
  '#type' => 'fieldset',
  '#title' => 'New Image Size',
  '#tree' => true,
);

$form['new']['height'] = array(
  '#type' => 'textfield',
  '#title' => 'Height',
);

Using:

form_set_error('height', 'Error with height.');

image

Notice the height is no longer highlighted?

The reason is that the field argument requires some formatting to make it work with nested forms.

Using a stupid '][' to tokenise the fieldname, we can specify which item to highlight.

form_set_error('new][height', 'Error with nested height.');

image

This gives us the proper feedback we wanted.

[ Source ]

Regex: Remove Double Spacing

Example given in PHP, but since its regex it could be applied to other languages too.

$cleaned = preg_replace('/\s+/', ' ', $input);

This changes any double (or triple, quadrupal, etc) spacing into a single space.

 
Copyright © Twig's Tech Tips
Theme by BloggerThemes & TopWPThemes Sponsored by iBlogtoBlog