Special search characters in Firefox

In Firefox, I use the InstantFox add-on to combine address bar and search bar into one item – like in Google Chrome.

But even without this add-on, Firefox allows you to restrict your search by adding a character in front of the search terms, like so:

firefox-search.jpg

Notice the * in front of the search term bugs. This restricts the search to bookmarks.

Here’s a list of the most important restrictions:

Character Restriction
* Bookmarks
^ History
% Open Tabs
+ Tags (in bookmarks)
# Search in titles only
@ Search in URLs only

All these shortcuts can be edited in about:config under browser.urlbar.

Click to play for plugins (Flash, Java) in Firefox

In Google Chrome, there is an option to enable “Click to Play” for plugins, such as Flash, Java, or Silverlight. This makes the browser safer (especially after all the Java security vulnerability in the last time) and a little bit fast. Today, I found out that this option exists in Firefox too – although its a little bit hidden.

To enable “Click to Play” in Firefox…

  1. go to about:config and click on “I’ll be careful, I promise!”
  2. search for plugins.click_to_play and set it to true (by double-clicking the entry)

click_to_play_settings.jpg

After that, when you get to a page that contains Flash (videos), Java, or any other plugin, you’ll get a “Click to Play” message for the plugin.

click_to_play_message.jpg

Plotting graphs with R

I recently stumbled over R, a programming language for data analysis. R is open-source and available on all major platforms (Windows, Linux, Mac).

This post is about how to display (draw) a mathematical function with R.

Side note: There’s a very nice and interactive tutorial for R available over at codeschool.com. It’s free and takes about 3 – 4 hours to complete.

Read more →

Python ist krass

Momentan bin ich “gezwungen”, Software in Python zu schreiben. Und nach einigen Programmierer-Tagen bin ich immer mir noch nicht sicher, ob ich Python mag oder nicht. Einige Sachen sind cool, andere nicht und allzu häufig muss ich feststellen, dass Python ein riesiger Flickenteppich ist. (Allein schon, dass es “alte” und “neue” Klassen gibt – von der Syntax her – und dass diese nicht kompatibel sind, spricht Bände.)

Heute bin ich dafür mal wieder auf ein Konstrukt gestoßen, dass krass und cool zugleich ist:

for i in foo:
  ...
else:
  ...

Es gibt hier also for-Schleifen mit else-Block. Und zwar wird der else-Block ausgeführt, wenn die Schleife komplett durchgelaufen ist (d.h. nicht durch ein break vorzeitig beendet wurde). Ziemlich praktisch.

Referenz

Group box panel with GWT

I’m currently participating on a software development project using the Google Web Toolkit (GWT). While developing the GUI for a certain part of this project, I came across the need of a group box panel.

For those who don’t know what a group box is; here is an example:

groupbox.jpg

Fortunately this type of panel is directly supported by HTML throught the <fieldset> tag. Unfortunately it isn’t supported by GWT (yet). However, it’s very simple to implement this using the SimplePanel class provided by GWT.

import com.google.gwt.user.client.DOM;
import com.google.gwt.user.client.Element;
import com.google.gwt.user.client.ui.SimplePanel;

/**
 * A group box panel (i.e. a frame where to which a caption can be
 * attached). The caption can be set via {@link #setCaption(String)}. 
 * The content can be set via {@link SimplePanel#setWidget()}.
 *
 * @author Sebastian Krysmanski
 */
public class GroupBoxPanel
  extends SimplePanel {

  private final Element m_caption = DOM.createLegend();
  
  public GroupBoxPanelImpl() {
    super(DOM.createFieldSet());

    DOM.appendChild(getContainerElement(), this.m_caption);
  }

  public GroupBoxPanelImpl(String caption) {
    this();
    setCaption(caption);
  }

  public String getCaption() {
    return DOM.getInnerText(this.m_caption);
  }

  public void setCaption(String caption) {
    DOM.setInnerText(this.m_caption, caption);
  }
}

This code is released as public domain.