[255193 views]

[]

Odi's astoundingly incomplete notes

New entries

Code

back | next

PCMCIA vs Express Card

This week I learned about new expansion cards for laptops the hard way. I have a laptop with one of these slots. And I wanted a second network port. The lspci command shows the driver is already installed, so should be fine:
46:06.4 CardBus bridge: Ricoh Co Ltd RL5c476 II (rev bb)
        Subsystem: Hewlett-Packard Company Device 1521
        Kernel driver in use: yenta_cardbus
So I thought I'll just order a PCMCIA/Cardbus card (D-Link DGE-660TD for Cardbus, Realtek Chip inside). Done.

After trying to get it to work for a whole day I had to give up. I turned to a collleague and, to my horror, he discovered that the pins on the interior of the slot didn't quite look like to connector of the card! So that PC Card fits into the slot but doesn't actually connect. No wonder there was no way to get it to work. So what is this slot then?

By looking at the laptop's data sheet I finally found that this is called an Express Card. First time I ever heard of this. I still wonder why it uses the same form factor as PCMCIA. So I ordered another card: Exsys EX-6087 Express Card also with a Realtek Chip inside.

Funny enough it has a bit of a different form factor: it's only half as wide as a PCMCIA card, although the slot is full-width. It comes with a funky adapter, which is nothing more than a piece of plastic clipped to the side of the card, to fill in the remaining space.

I put the card in. This time it seemed to really connect. But nothing in the kernel log. And lspcmcia still doesn't display anything. After googling for an hour or so, I found the missing piece of information: Express Cards have nothing to do with PCMCIA whatsoever! Express Cards are basically directly connected to a PCI Express lane. There is no intermediate bridge! All you need is the PCIe Hotplug driver (HOTPLUG_PCI_PCIE).

If that driver is present (and the driver for the actual hardware on the card) it will show up on the PCIe bus directly:
03:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd.
 RTL8111/8168B PCI Express Gigabit Ethernet controller (rev 02)
        Subsystem: Realtek Semiconductor Co., Ltd. RTL8111/8168B
 PCI Express Gigabit Ethernet controller
It still eludes me why the two types of cards use a slot that looks identical. It's a trap.

Express Card on the left, PCMCIA/Cardbus on the right

posted on 2011-10-03 15:04 UTC in Code | 0 comments | permalink

The cut W slant of the Liberation Sans typeface

Look at that snippet of my Eclipse Menu bar. Especially the W of the Window menu.

Looks familiar? It's cut off at its left side! It must be a bug in the font metrics of Liberation Sans. So lets work around this.

I'll just use a different default GTK+ font. Edit your ~/.gtkrc-2.0:
style "eclipse"
{
        font_name="Tahoma Sans 8"
}
class "GtkWidget" style "eclipse"
That should do the trick:


posted on 2011-09-29 17:58 UTC in Code | 0 comments | permalink

Memory use of the JBoss DB statement cache

JBoss *-ds.xml files let you define a statement cache for PreparedStatement objects:
<prepared-statement-cache-size>16</prepared-statement-cache-size>
Be not too adventurous with the value you set there! In one of my production systems I had a pool of 50 Oracle connections and 256 statement cache (per connection). That leads to 12'800 cached statements. Those statement objects must be surprisingly large, as cutting the value down to 16 from 256 immediately led to 1GB less heap use! That gives around 90KB per statment object.

The tricky thing is that the memory will not be used until your server uses many connections. That means when your load is high. That's exactly the situation when you simply can't spend memory on silly caches.

posted on 2011-09-21 16:02 UTC in Code | 0 comments | permalink

annotations can break document literal wrapped WSDL style

It's best practice for interoperability to write your WSDL in document literal wrapped style. The "wrapped" is merely a convention imposed upon the document literal style. The linked article above outlines these conventions.

Be very carful about this one especially:
An input wrapper element must be defined as a complex type that is a sequence of elements.

The Wsdl2Java tool from Axis 1.4 is sensitive even on <xsd:annotation> elements within the complexType and will subsequently generate the Style DOCUMENT instead of WRAPPED . So the operation name will be ommitted from your SOAP messages! Whether it is offically correct to interprete the specification that much by the letter or not, I don't know. But from experience at least SAP PI and TIBCO seem to behave the same way.

posted on 2011-08-09 17:36 UTC in Code | 0 comments | permalink

The ugly D of the Georgia typeface

Does the uppercase letter D of the Georgia font look ugly on your screen? In certain font sizes only maybe? Then anti-aliasing is to blame. Here are some letters in the Georgia typeface: DDDD
ugly rendering
On Linux you can disable anti-aliasing for this font, by adding a fontconfig script:
<match target="font">
  <test name="family" qual="any">
    <string>Georgia</string>
  </test>
  <edit name="antialias" mode="assign">
    <bool>false</bool>
  </edit>
</match>
After that the font is no longer anti-aliased but the D doesn't look ugly:
without AA

Alternatively replace Georgia with Times New Roman completely:
<match target="pattern">
    <test name="family" qual="any" >
        <string>Georgia</string>
    </test>
    <edit name="family" mode="assign">
        <string>Times New Roman</string>
    </edit>
</match>
which renders like so:


Next I'm going to tackle the problem of the cut off left slant of the upper case W.

posted on 2011-08-09 14:44 UTC in Code | 0 comments | permalink

IPv6 with Hurricane Electric

I have written about connecting to the IPv6 Internet in the past. At that time I was using an automatic 6to4 gateway over a IPv4 connection with dynamic IP. And I was using ZoneEdit as a dynamic DNS provider.

That setup however had some severe shortcomings:
After the World IPv6 Day I decided that it was time to clean up. I found that Hurricane Electric provides a fully v6 reachable dynamic DNS service. Plus it offers 6 in 4 tunneling.

The tunneling setup in Gentoo is just as simple as the 6to4 setup and is documented also on HE's tunneling site. But you get a static prefix. No more routing update scripts!

The DNS web interface is very nice and simple. Also the dynamic update is much simpler: instead of ddclient, a simple curl call is sufficient.

Still when your dynamic IP changes you have to update the new IP in the webinterface of their tunnel configuration. So better have a cron job that detects when your IP has changed.

On the client side, recent dhcpcd versions can handle the DNS information from radvd to update /etc/resolv.conf.

posted on 2011-06-13 13:15 UTC in Code | 0 comments | permalink

Redhat maps hostname to loopback interface

This is typical on Redhat systems:
/etc/hosts:
127.0.0.1 h1234.example.com h1234 localhost.localdomain localhost
This maps the host name to the loopback interface address. I don't find this particularly amusing. It's really bad practice. Because it leads to the following inconsistency:
user@h1234 $ host h1234
h1234.example.com has address 10.1.2.3
user@h1234$ telnet h1234 80
Trying 127.0.0.1...
It gets especially in your way if you have services that bind to specific addresses only:
user@h1234 $ netstat -lnt
Active Internet connections (only servers)
Proto Local Address  Foreign Address State
tcp   10.1.2.3:80    0.0.0.0:*       LISTEN

posted on 2011-02-22 11:58 UTC in Code | 0 comments | permalink

impressive hardware

Trying to show per CPU load:
top - 15:52:34 up 22 days,  2:34,  5 users,  load average: 0.00, 0.01, 0.00
Tasks: 669 total,   1 running, 668 sleeping,   0 stopped,   0 zombie
Cpu(s):  0.0%us,  0.1%sy,  0.0%ni, 99.9%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Mem:  32947688k total, 20767664k used, 12180024k free,   661920k buffers
Swap: 16386292k total,        0k used, 16386292k free, 18932708k cached
 Sorry, terminal is not big enough 
  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND                                                
 8843 oracle    15   0 13132 1560  828 R  1.9  0.0   0:00.73 top                                                    
    1 root      15   0 10344  640  544 S  0.0  0.0   0:06.89 init                                                   
mmmmh... increasing terminal size... try again:
top - 15:55:15 up 22 days,  2:36,  5 users,  load average: 0.05, 0.04, 0.01
Tasks: 671 total,   1 running, 670 sleeping,   0 stopped,   0 zombie
Cpu0  :  1.0%us,  1.0%sy,  0.0%ni, 98.1%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Cpu1  :  0.0%us,  0.0%sy,  0.0%ni,100.0%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Cpu2  :  0.0%us,  0.0%sy,  0.0%ni,100.0%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Cpu3  :  0.0%us,  0.0%sy,  0.0%ni,100.0%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Cpu4  :  0.0%us,  0.0%sy,  0.0%ni,100.0%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Cpu5  :  0.0%us,  0.0%sy,  0.0%ni,100.0%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Cpu6  :  0.0%us,  0.0%sy,  0.0%ni,100.0%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Cpu7  :  0.0%us,  0.0%sy,  0.0%ni,100.0%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Cpu8  :  0.0%us,  0.0%sy,  0.0%ni,100.0%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Cpu9  :  0.0%us,  0.0%sy,  0.0%ni,100.0%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Cpu10 :  0.0%us,  0.0%sy,  0.0%ni,100.0%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Cpu11 :  0.0%us,  0.0%sy,  0.0%ni,100.0%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Cpu12 :  0.0%us,  0.0%sy,  0.0%ni,100.0%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Cpu13 :  0.0%us,  0.0%sy,  0.0%ni,100.0%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Cpu14 :  0.0%us,  0.0%sy,  0.0%ni,100.0%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Cpu15 :  0.0%us,  0.0%sy,  0.0%ni,100.0%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Cpu16 :  0.0%us,  0.0%sy,  0.0%ni,100.0%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Cpu17 :  0.0%us,  0.0%sy,  0.0%ni,100.0%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Cpu18 :  0.0%us,  0.0%sy,  0.0%ni,100.0%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Cpu19 :  0.0%us,  0.0%sy,  0.0%ni,100.0%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Cpu20 :  0.0%us,  0.0%sy,  0.0%ni,100.0%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Cpu21 :  0.0%us,  0.0%sy,  0.0%ni,100.0%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Cpu22 :  0.0%us,  0.0%sy,  0.0%ni,100.0%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Cpu23 :  0.0%us,  0.0%sy,  0.0%ni,100.0%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Cpu24 :  0.0%us,  1.0%sy,  0.0%ni, 99.0%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Cpu25 :  0.0%us,  0.0%sy,  0.0%ni,100.0%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Cpu26 :  0.0%us,  0.0%sy,  0.0%ni,100.0%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Cpu27 :  0.0%us,  0.0%sy,  0.0%ni,100.0%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Cpu28 :  0.0%us,  0.0%sy,  0.0%ni,100.0%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Cpu29 :  0.0%us,  0.0%sy,  0.0%ni,100.0%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Cpu30 :  0.0%us,  0.0%sy,  0.0%ni,100.0%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Cpu31 :  0.0%us,  0.0%sy,  0.0%ni,100.0%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Cpu32 :  0.0%us,  0.0%sy,  0.0%ni,100.0%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Cpu33 :  0.0%us,  0.0%sy,  0.0%ni,100.0%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Cpu34 :  0.0%us,  0.0%sy,  0.0%ni,100.0%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Cpu35 :  0.0%us,  0.0%sy,  0.0%ni,100.0%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Cpu36 :  0.0%us,  0.0%sy,  0.0%ni,100.0%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Cpu37 :  0.0%us,  0.0%sy,  0.0%ni,100.0%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Cpu38 :  0.0%us,  0.0%sy,  0.0%ni,100.0%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Cpu39 :  0.0%us,  0.0%sy,  0.0%ni,100.0%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Cpu40 :  0.0%us,  0.0%sy,  0.0%ni,100.0%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Cpu41 :  0.0%us,  0.0%sy,  0.0%ni,100.0%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Cpu42 :  0.0%us,  0.0%sy,  0.0%ni,100.0%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Cpu43 :  0.0%us,  0.0%sy,  0.0%ni,100.0%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Cpu44 :  0.0%us,  0.0%sy,  0.0%ni,100.0%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Cpu45 :  0.0%us,  0.0%sy,  0.0%ni,100.0%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Cpu46 :  0.0%us,  0.0%sy,  0.0%ni,100.0%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Cpu47 :  0.0%us,  0.0%sy,  0.0%ni,100.0%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Mem:  32947688k total, 20772256k used, 12175432k free,   661928k buffers
Swap: 16386292k total,        0k used, 16386292k free, 18932708k cached

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND                                                                                                                                                                        
 8843 oracle    15   0 13132 1580  828 R  3.9  0.0   0:00.96 top                                                                                                                                                                            
    1 root      15   0 10344  640  544 S  0.0  0.0   0:06.89 init                                                      

duuuuuh!!! we're NOT gonna need that many CPUs...
posted on 2011-02-11 14:53 UTC in Code | 0 comments | permalink

Ant builds in Linux vs. Windows 7

My new work laptop arrived. An HP EliteBook 8540w. Core i7 with 8GB RAM. Of course it's running Gentoo Linux: 2.6.37 with ext4 filesystem. The Windows installation has been banned to a KVM virtual machine (I must use some software that is available for Windows only).

My colleague has the same machine running under Windows 7 with NTFS. Of course we compared "spears". In our case the spear is the Ant build of our main product, a J2EE application. The load is very filesystem intensive. It merely unzips and zips some jar archives and copies files around. No actual compiling is done. We ran each build twice to see the effect of filesystem chaches.

Old HP laptop Windows XP: first run 84s, second run 71s
New laptop Windows 7: first run 36s, second run 21s
New laptop Linux: first run 12s, second run 8s

Impressive.


posted on 2011-02-04 13:56 UTC in Code | 1 comments | permalink
Bet your tests wont show the same speedup though,
-stevel

Oracle 10g em

If the Oracle Enterprise Manager breaks, here is how to completely reinstall it:
# if you have changed the hostname, provide the old name here
# and make sure to map its IP to this host via /etc/hosts
export ORACLE_HOSTNAME=myoldname
emca -deconfig dbcontrol db -repos drop
unset ORACLE_HOSTNAME
emca -config dbcontrol db -repos create
emctl upload
emctl start dbconsole
When asked for the SID always enter lower case!

So far so good, but 10.2.0.1 EM is seriously broken on x86_64 Linux. Consider to upgrade to the latest patch level right after installation. Or you will see 100% CPU issues now or in a few months.

And then even 10.2.0.5 contains a certificate that has expired end of 2010. You need to apply another small patch manually after that. See Metalink.


posted on 2011-01-25 21:31 UTC in Code | 1 comments | permalink
thanks man really neat
just used it ;)
back | next