Skip to content
accelerando

Tag Archives: Tipps

Firefox 3 Mouse Wheel Zoom

08-Jul-08

Zooming with the CTRL+Mouse Wheel Up/Down has been in inversed in Firefox 3. In version 2 you zoomed in (enlarged the text) with CTRL+Mouse Wheel Down and zoomed out with CTRL+Mouse Wheel Up, its now in Firefox 3 the other way round.

The revert back to the old behaviour, change

mousewheel.withcontrolkey.numlines = 1

to

mousewheel.withcontrolkey.numlines = -1

in about config.

To me “pulling” the page towards myself always felt much more natural to me than the other way round, but that’s just me.

Hibernate and Inheritance Mapping

27-May-08

Hibernate supports multiple types of inheritance mapping, some of them (Table per class, Table per subclass) using a discriminator column to decide the class.

The type of the discriminator can be one of

string, character, integer, byte, short, boolean, yes_no, true_false

In case you need to use any other than string or character, i.e. integer, you have to give the base class a default discriminator-value like 0 or -1 or whatever fits, otherwise you’ll end up with a an exception like:

org.hibernate.MappingException: Could not format discriminator value to SQL string

as Hibernate uses the class name of the base class to derive a default value.

JDBC: Autogenerated keys revisited.

02-Apr-08

Some months ago i wrote about retrieving auto generated values with JDBC from an Oracle Database: JDBC: Get autogenerated keys on a Oracle DB.

The solution i presented in the previous article doesn’t run in a Oracle Java Stored Procedure.

To accomplish this, use a callable statement like this:

final String sql = "BEGIN INSERT INTO foobar(id, b) VALUES (id.nextval, ?) RETURNING id INTO ?; END;";
CallableStatement cs = connection.prepareCall(sql);
stmt.setString(1, "bar");
stmt.registerOutParameter(2, Types.INTEGER);
stmt.executeUpdate();		
rv = rs.getInt(2);

This way you get the id generated by the sequence id without first selecting and then using it.

Safari Webinspektor

08-Jan-08

Vor fast 1.5 Jahren schrieb ich im Zusammenhang mit Daily Fratze on rails über den Safari Inspektor, der damals nur in den Nightlies verfügbar war: Damaliges Daily Fratze Preview.

Leider habe ich den Inspektor im aktuellen Safari 3 nie mehr gesehen, bis ich vor ein paar Tagen auf das SülzOMat Blog stieß. Einfach im Terminal folgenden Befehl absetzen:

defaults write com.apple.Safari WebKitDeveloperExtras -bool true

Safari neu starten und man hat über das Kontextmenü den neuen Punkt “Element-Informationen”, der den Inspektor startet, der dem beliebten Plugin “Firebug” für Firefox in kaum etwas mehr nachsteht.

Vielen Dank für diesen Beitrag!

Copy and paste within cmd (command interpreter under Windows)

13-Dec-07

Under Windows 2k and XP exists no keyboard shortcut in cmd.exe to copy and past text. You need not only use your mouse but hit the proximity icon in the top left and choose edit|mark, edit|copy and so on.

cmd has a special mode named QuickEdit which can be enabled via the following command

REG.EXE add HKCU\Console /v QuickEdit /t REG_DWORD /d 1 /

all new cmd windows will now be in QuickEdit mode. Text can be selected with the left mouse button, copied via right mouse button and pasted via right mouse button.

Found on a msdn blog. Thanks!

Disable Ruby On Rails Sessions

20-Nov-07

Just a reminder to myself, but maybe it’s usefull for others as well.

Some days ago i stumpled upon the fact, that one can turn off session support in controllers in rails: HowtoChangeSessionOptions (see Disabling Sessions) or HowtoPerActionSessionOptions.

I found it particularly useful and convenient for my Feed controller, which is dedicated entirely to feed generation (yeah, i know about about REST and especially respond_to, but i wouldn’t get rid of thousands of useless sessions without an explicit controller:

class FeedsController < ApplicationController
  session :disabled => true
end

Java: Creating a Stream on a ByteBuffer

18-Oct-07

This example is plain wrong. The InputStream will cause an endless loop as it always returns a value >= 0. Working code as follows:

private static InputStream _newInputStream(final ByteBuffer buf) {
	return new InputStream() {
		public synchronized int read() throws IOException {				
			return buf.hasRemaining() ? buf.get() : -1;
		}
 
		public synchronized int read(byte[] bytes, int off, int len) throws IOException {			
			int rv = Math.min(len, buf.remaining());				
			buf.get(bytes, off, rv);
			return rv == 0 ? -1 : rv;
		}
	};
}

A muzzle for WordPress 2.3 and the Akismet Plugin

26-Sep-07

As reported here and elsewhere, Dexter is somewhat talkative.

I recommend the following 2 steps program:

Stop sending your url

If you already have used WordPress 2.3, use the 123 Anonymer Versionscheck 0.10. It will anonymize your data, but a minimum of 1 request with personal data will happen, that is while using the plugin page.

If you do a fresh install of WordPress 2.3, i’d go with the my-hacks.php solution, because that way, no personal info will be send.

Lots of unnecessary Akismet informations

After finding the update problem this morning at Lumières dans la nuit, i read the following group. To my surprise i’ve learned, that the Akismet Spamchecker sends all of the $_SERVER environment variables from your server to the Akismet server. W T F?? I myself use Akismet in a custom project, there is absolutely no need to send this information. To stop sending this information, open akismet.php in your favorite editor, search and remove the following lines:

foreach ( $_SERVER as $key => $value )
    if ( !in_array( $key, $ignore ) )
        $comment["$key"] = $value;

WordPress uptodate checker

26-Sep-07

Yesterday i’ve installed WordPress 2.3 without too much problems. The new uptodate check for plugins is nice, out of question, but already yesterday i thought: hm, everybody is whining about Microsoft products phoning home, nobody gives a shit about wordpress doing the same.

The Nighwatchman has an in depth analysis about the data transferred to api.wordpress.org, read it here: Datenschutzproblem in WordPress 2.3 (Privacyproblem in WordPress 2.3).

I will use the following hack to omit my URL. Alternatively, uptodate checking can be completely disabled with this plugin.

Upgrading to WordPress 2.3 “Dexter”

25-Sep-07

In the first place, i wanted to wait to here some more news about the latest release of WordPress, called “Dexter” (I don’t think about some saxophonist, but about Dexter Morgan). But, as you know, curiosity killed the cat, i couldn’t wait and with the announcement yesterday, i created a patch file (they forgot the link at wordpress.org) and patched my blog.

As danger is my second name, i didn’t backup or anything especially for upgrading (ok, honestly i have a nightly cron’ed backup) and run the patch with

patch -p2  diff-from-tags_2.2.3-r6166-to-tags_2.3-r6166.diff.txt

from my install dir and boom, i had 2.3 (get the patch file at the wordpress trac (for upgrading 2.2.3 to 2.3)).

Things, that didn’t work but didn’t break the blog either were: Ultimate Tag Warrior. It’s still there and still working. Things that didn’t work were my theme and the Extended Live Archives by Sons Of Skadi.

For testing purpose, i completely disabled wp-cache.

Luckily, someone had already patched ELA, you can download a modified version here, see it in action here. Be aware, you also need the original release from above. Before this thingy works, you need to clean it’s cache. Otherwise you’ll get some weird error messages.

Things i need to fix in my theme were UTW related. I imported my tags into the new taxonomic scheme and finally, dumped the warrior. The import worked well, but it killed the blanks in tags and replaced them with underscores. Thanks for that :/

I did the following replacement in my theme:

Purpose UTW WP
Show the current selected tag in archive view
UTW_ShowCurrentTagSet
single_tag_title('');
Show the tags for the current post
UTW_ShowTagsForCurrentPost("commalist")
the_tags('',', ');
Create a tag cloud
UTW_ShowWeightedTagSet("sizedtagcloud")
wp_tag_cloud('smallest=70&largest=130&unit=%&orderby=count&order=DESC');

The arguments to the functions corresponds with my former UTW settings. Speaking of which: WordPress 2.3 tagging system is completely naked. There are no settings and what is worse, there is no such thing as a dropdown thingy while writing, just a plain text field. As a first solution, i’ve tried the Advanced Tag Entry WordPress Plugin. Seems to work fine, but not as comfortable like UTW.

All other plugins i use, seem to work fine:

Advanced Tag Entry 1.02
Akismet 2.0.2
Chunk Urls for WordPress 2.0
Extended Live Archives 0.10beta-r18 (patched version)
FeedStats 3.0
Google Adsense widget 1.0
Google XML Sitemaps 3.0
Math Comment Spam Protection 2.1
Related Posts 2.04
Share This 1.4
Simple Trackback Validation 2.1
Subscribe To Comments 2.1.1
Tag cloud widget 1.0a (modified by myself)
Time Zone 2.2
wp-cache 2.1.2
WP-Syntax 0.6

In the meantime, i have the impression that 2.3 is somewhat slower than 2.2.3, but i can be wrong.

I’m in doubt about upgrading my other blog planet-punk.de. I like and do use tags a lot, but for the time being, the greatest db scheme doesn’t help a somewhat unusable ui. Don’t get me wrong, i really like the changes in the scheme going on, but for now, i see little benefit.

Another nice post with the same title as mine has some suggestions for people who ran into problems: read it at the Weblog Tools Collection.

Close
E-mail It