Older blog entries for johnnyb (starting at number 167)

Absolute Positioning and z-index on IE (Internet Explorer)

I come up with a new reason to hate IE every day. It turns out that using a position: absolute; creates a new layering context which means that z-index only works within the absolutely positioned elements and not anywhere else. In my own case, to fix it I just needed to bump out the z-index of the parent, which put the z-index of the child in the right place.

Problem with Rails, FastCGI, and Apache

It turns out that FastCGI (and I think both for mod_fastcgi and mod_fcgid) doesn't play well with many of the default Linux setups. fcgid sets up a directory in /var/log/httpd/fcgidsock (mod_fastcgi may be a slightly different directory). The problem is not that the permissions are wrong, but that the permissions of the parent directory are wrong. More to the point, the permissions of the parent directory are made for standard Linux security purposes, not for the purposes of running FastCGI.

The fix is simple. In my case it was a simple chmod 755 /var/log/httpd, which allows Apache to actually read its log directory! Before the change, I was getting "Service Unavailable" with a log error of [warn] mod_fcgid: can't apply process slot for [dispatch.fcgi full path]. Now it works!

Getting http and https connections to work on a blackberry with J2ME

If you are trying to run J2ME apps on the blackberry without the Blackberry Enterprise Server, there are several things you need to do to your blackberry first.

First of all, you need to setup TCP/IP. Once this is done, you can perform http (but not https) connections on your Blackberry. Here is a list of current gateways by cellular provider.

To setup, go into Options -> Advanced -> TCP

For HTTPS connections, you need to go into:

Options -> Security Options -> TLS

Then change the value of "TLS Default" from "Proxy" to "Handheld".

For anyone who is a cyclist or enjoys watching cyclists, you should check out Tulsa Tough.

Stupid things to avoid when coding for the Cell BE

I just spent about 8 hours trying to diagnose these problems, so I'll try to avoid someone else similar pain:

1) DO NOT perform DMA transfers _into_ read-only memory in the PPE. And remember, string constants get put in read-only memory. Apparently, this only triggers a bus error under certain conditions, and in others it works just fine. Also, it is nearly impossible to debug, because the "-g" flag makes the string areas read-write!

2) If the contents of your DMA transfers look like you got multiple buffers crossed, look to see if you are going out-of-bounds in your buffers in the SPU. This looks very much like a DMA problem, but its not, and it produces no errors.

3) Be careful of 32-bit/64-bit discrepancies in PPE/SPE communication. Use unsigned long long for pointers that are passed to SPE code. This will make your code easier to switch between 32-bit and 64-bit mode, as the memory layout will be the same.

And, for something positive:

If you want aligned data, try memalign or posix_memalign.

WANTED: A Registrar that DOESN'T SUCK!

I want a registrar that:

  • Doesn't cost over $15/yr
  • Includes DNS Service (a REAL DNS service -- modify A records and MX records -- and lots of them -- and doesn't treat me like a two-year-old)
  • Allows me to give access to my customers to individual domains when/if we sever ties or if they just want more control.
  • Has an interface that doesn't make me want to scream and kick things.
Does anyone know of a registrar like that?
Red Hat Archives

Someone on IRC just gave me this link: Red Hat Archives. It goes back to every release of Red Hat Linux that RH ever produced (i.e. through 9).

I had an issue on an old RH8 server that I needed to reinstall RPMs, and this worked fabulously. Thanks, RedHat!

And, if you want to know what RH looked like when it started, it goes all the way back to 1.0!

23 Jan 2007 (updated 22 May 2007 at 01:45 UTC) »
onchange and Remote Forms in Rails

The problem with remote forms is that they use onsubmit to submit them. Unfortunately, Javascript does not fire onsubmit() when submit() is called :(

This causes problems with form_remote_tag in Rails, because that uses the onsubmit handler to work its Ajax magic. However, if you try to use Javascript to submit these forms (which I like to do from onchange handlers in select boxes), the onsubmit() function doesn't get fired.

Therefore, to work around, I use the following code:

collection_select("objname", :key_method, the_collection,
:id_accessor, :text_accessor, {}, {:onchange =>
"if(onsubmit()) { submit(); }"})

I haven't tested this beyond FireFox, but it seems to be working so far.

UPDATE: A more cross-browser version of the last parameter is shown below (submitted by a reader):

{ :onchange => "var f = document.forms['#{form_id}'];
f.onsubmit();" }
PS3 Linux

For those of you interested in Linux on the PS3, I just started a new article series at IBM DeveloperWorks describing how to program the PS3 under Linux. Here is the first article:

Programming high-performance applications on the Cell BE processor, Part 1

Just figured out a cool little metaprogramming trick for ruby on rails. In application.rb, put the following code:

        def self.pages(*pgs, &block)
                if block == nil
                        pgs.each do |pg|
                                class_eval <<-EOF
                                        def #{pg}
                        pgs.each do |pg|
                                define_method pg, &block
Now you can define actions much, much easier. For example, if I have pages with no actions, I can just do page :index, :another_page, :another_page2 rather than def/end'ing each method. In addition, if you have a common action for a controller (in my case, initializing the @user variable) you can just do:

        pages :edit, :show, :whatever_other_action_i_want do
          @user = User.find(params[:id])
And viola! Instant actions automatically defined!

158 older entries...

New Advogato Features

New HTML Parser: The long-awaited libxml2 based HTML parser code is live. It needs further work but already handles most markup better than the original parser.

Keep up with the latest Advogato features by reading the Advogato status blog.

If you're a C programmer with some spare time, take a look at the mod_virgule project page and help us with one of the tasks on the ToDo list!