001. How to refer to outer class object in inner class?
002. How to place a dialog in the main Gimp window?
003. How to get rid of ads on theserverside.com?
004. How to change font on java.net?
005. How to configure Thunderbird to open links in Opera?
006. How to get rid of ads on www.di.com.pl?
007. How to increase font size of hits in google?
008. ERROR 1005 (HY000) at line XXX: Can't create table './XXX.frm' (errno: 150)?
009. How to add fonts to X server path without restarting the server?
010. How to change width of page tabs in Opera?
011. How to cope with: "bash.exe", "fatal error", "couldn't allocate heap" problem in Cygwin?
012. After shutdown fan is still working on IBM T42 (using Debian)
013. Xlib: connection to ":0.0" refused by server; Xlib: No protocol specified
013. (ethereal:30713): Gtk-WARNING **: cannot open display:
014. How to write method in Java that creates MD5 hash of some data?
015. How to convert pdf so it has two or three original pages on one?
016. How to make Opera, Firefox, Thunderbird, OpenOffice2, Azureus have font of the same size?
017. What is IP address of chrome.pl?
018. I have an applet with multiple jars. How should html file look like?
019. What are the rules for InetAddress.getLocalHost().getHostAddress() in case of multiple interfaces?
020. How to resolve "Unable to install hw params" problem with USB sound cards?
021. How to compile a kernel?
022. How to get rid of initial connection delay in ProFTPd?
023. How to configure Opera so she opens mailto links in Thunderbird?
024. "Starting MTA" takes sooo loooong. How to solve this?
025. How to install new fonts?
026. xserver-xorg postinst warning: not updating /etc/X11/X; file has been customized
027. Eclipse shows "Element must be declared" error while using <taskdef> and <xmlbean>
028. After installing QuantumDB plugin it doesn't show anywhere
029. alsa-space: xrun of at least 0.008 msecs. resetting stream
030. Where are .desktop files in KDE?
031. How to convert *.ape files?
032. How to configure polish dictionary in OpenOffice?

001. How to refer to outer class object in inner class?
(From "Thinking in Java") If you need to produce the reference to the outer class object, you name the outer class followed by a dot and this.

public class Outer {
   public void g() {
   
   }
   private class Inner {
      public void f() {
         Outer.this.g();
      }
   }
}

002. How to place a dialog in the main Gimp window?
Open a dialog you want to place in the main Gimp window, click on its title bar and drag onto thin bar on the bottom of the main Gimp window.

003. How to get rid of ads on theserverside.com?

  1. Follow instructions on http://nontroppo.org/wiki/StylingWebPages
  2. Add the following text to user.css:
    html.mycss.theserverside.com table.head td.right,
    /*html.mycss.theserverside.com table[width="130"][align="left"],*/
    html.mycss.theserverside.com td[colspan="2"] table[cellpadding="0"][align="left"],
    /*html.mycss.theserverside.com td.rightbartable,*/
    html.mycss.theserverside.com span#nointelliTXT span#nointelliTXT {
        display: none !important;
    }
    html.mycss.theserverside.com span#nointelliTXT table.box { margin-top: -4px !important; }
    

004. How to change font on java.net?

  1. Follow instructions on http://nontroppo.org/wiki/StylingWebPages
  2. Add the following text to user.css:
    html.mycss.java.net body,
    html.mycss.java.net th,
    html.mycss.java.net td,
    html.mycss.java.net p,
    html.mycss.java.net div,
    html.mycss.java.net input,
    html.mycss.java.net select,
    html.mycss.java.net textarea,
    html.mycss.java.net li,
    html.mycss.java.net dl,
    html.mycss.java.net h1,
    html.mycss.java.net h2,
    html.mycss.java.net h3,
    html.mycss.java.net h4,
    html.mycss.java.net h5,
    html.mycss.java.net h6,
    html.mycss.java.net blockquote {
        font-family: arial,sans-serif !important
    }
    

005. How to configure Thunderbird to open links in Opera?
Add/modify this line in ~/.thunderbird/<profile>/prefs.js:

user_pref("network.protocol-handler.app.http", "opera_newpage.sh");

where opera_newpage.sh is:

#!/bin/bash

opera -newpage "${*}"

006. How to get rid of ads on www.di.com.pl?

  1. Follow instructions on http://nontroppo.org/wiki/StylingWebPages
  2. Add the following text to user.css:
    html.mycss.di.com.pl table[border="0"][cellpadding="3"][cellspacing="0"][align="right"][width="300"],
    html.mycss.di.com.pl table[width="100%"][border="0"][cellspacing="0"][cellpadding="4"],
    html.mycss.di.com.pl td[width="200"][valign="top"][bgcolor="#F9F9F9"],
    html.mycss.di.com.pl td[width="181"][valign="top"][bgcolor="#F9F9F9"] {
        display: none !important;
    }
    html.mycss.di.com.pl table[class="maintable"] {
        width: 60% !important;
    }
    

007. How to increase font size of hits in google?

  1. Follow instructions on http://nontroppo.org/wiki/StylingWebPages
  2. Add the following text to user.css:
    html.mycss.google.com td.j font {
        font-size: 1.1em !important;
    }
    html.mycss.google.com p.g {
        font-size: 1.2em !important;
    }
    

008. ERROR 1005 (HY000) at line XXX: Can't create table './XXX.frm' (errno: 150)?
While restoring database form dump file (created with mysqdump) this error can happen if you have some key constraints on tables. Solution:

mysql> SET FOREIGN_KEY_CHECKS = 0;
mysql> SOURCE dump_file_name;
mysql> SET FOREIGN_KEY_CHECKS = 1;

009. How to add fonts to X server path without restarting the server
For details see Font_HOWTO-4.html

xset fp+ directory
xset fp rehash

010. How to change width of page tabs in Opera?
You have to put following lines in skin.ini file:

[Options]
Pagebar max button width                = 140
Pagebar min button width                = 140

More info on Opera7Skinning and AdvancedSkingGuide

011. How to cope with: "bash.exe", "fatal error", "couldn't allocate heap" problem in Cygwin?
According to threads.html#00173 "Logitech Process Monitor" service is responsible for all the troubles. Disabling this service solves the problem. This service description is "Webcam Effects Helper" so I guess one can live without it.

012. After shutdown fan is still working on IBM T42 (using Debian)
According to debian-laptop mailing list and then thinkpad notes you have to recompile your kernel with CONFIG_X86_UP_APIC option disabled.

013. Xlib: connection to ":0.0" refused by server; Xlib: No protocol specified

bash]$ xhost local:
or http://linux.derkeiler.com/Mailing-Lists/Debian/2006-01/msg03127.html

014. How to write method in Java that creates MD5 hash of some data

public static String md5encode(String input)
{
    MessageDigest md = null;
    byte[] inputAsBytes = null;
    try
    {
        inputAsBytes = input.getBytes("8859_1");
        md = MessageDigest.getInstance("MD5");
    }
    catch (UnsupportedEncodingException e)
    {
        LOG.error("Error while converting to bytes array", e);
        return null;
    }
    catch (NoSuchAlgorithmException e)
    {
        LOG.error("Error while creating MessageDigest object", e);
        return null;
    }
    md.update(inputAsBytes);
    String retVal = hex(md.digest());
    return retVal;
}
    
private static String hex(byte[] array)
{
    StringBuffer sb = new StringBuffer();
    for (int i = 0; i < array.length; ++i)
    {
        sb.append(Integer.toHexString((array[i] & 0xFF) | 0x100).substring(1, 3));
    }
    return sb.toString();
}

015. How to convert pdf so it has two or three original pages on one?

danadam@peasant18]$ cat ~/bin/pdf_three_pages.sh
#!/bin/bash
echo "Converting to ps..."
pdftops -paper A4 "${1}.pdf" "${1}.ps"

echo "Modyfying..."
pstops -pa4 '3:0L@.45(16.5cm,1cm)+1L@.45(16.5cm,9.55cm)+2L@.45(16.5cm,18.1cm)' "${1}.ps" "${1}3pages.ps"
rm "${1}.ps"

echo "Converting to pdf..."
ps2pdf14 "${1}3pages.ps" "${1}3pages.pdf"
rm "${1}3pages.ps"

echo "Done!"

danadam@peasant18]$ cat ~/bin/pdf_two_pages.sh
#!/bin/bash
pdftops -paper A4 "${1}.pdf" "${1}.ps"
pstops -pa4 '2:0L@.75(21.5cm,0cm)+1L@.75(21.5cm,12.85cm)' "${1}.ps" "${1}2pages.ps"
rm "${1}.ps"
ps2pdf14 "${1}2pages.ps" "${1}2pages.pdf"
rm "${1}2pages.ps"

016. How to make Opera, Firefox, Thunderbird, OpenOffice2, Azureus have font of the same size?
First of all start X with appropriate DPI. In order to do that copy /etc/X11/xinit/xserverrc to your home directory and rename it to .xserverrc. Edit this file and change -dpi argument to correct value (ie. on my laptop it is 117):

#!/bin/sh
exec /usr/bin/X11/X -dpi 117 -nolisten tcp
Now it's time to set dpi value for Xft. Edit .Xresources file in your home directory and add:
 Xft.dpi: 96
It might look weird that we set it to 96, while our real DPI is 117 but it works for me :-). And the last thing as far as general configuration is concerned: fontconfig. Edit /etc/fonts/local.conf and set your real DPI there:
<match target="pattern">
    <edit name="dpi" mode="assign"><double>117</double></edit>
</match>

Restart X and start to configure applications:

017. What is IP address of chrome.pl?
217.173.160.48

018. I have an applet with multiple jars. How should html file look like?

<applet code="com.danadam.applet.Applet.class"
        codebase="lib"
        archive="applet.jar, commons-codec-1.1.jar, commons-logging.jar, xmlrpc-2.0.jar"
        width="640" height="480">

       <param name="proxyHandler" value="proxy">
       <param name="proxyHandlerUrl" value="http://localhost:6669/proxy/proxy">

Your browser is completely ignoring the <APPLET> tag!
<applet>

019. What are the rules for InetAddress.getLocalHost().getHostAddress() in case of multiple interfaces?
This method returns first address found in /etc/hosts which isn't localhost.

020. How to resolve "Unable to install hw params" problem with USB sound cards?
After plugging card to USB port:

danadam@peasant18]$ aplay -l
card 2: default [C-Media USB Headphone Set  ], device 0: USB Audio [USB Audio]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

danadam@peasant18]$ aplay -D hw:2,0 01_Firefly-MainTitle.wav
Playing WAVE '01_Firefly-MainTitle.wav' : Signed 16 bit Little Endian, Rate
44100 Hz, Stereo
aplay: set_params:885: Unable to install hw params:
ACCESS:  RW_INTERLEAVED
FORMAT:  S16_LE
SUBFORMAT:  STD
SAMPLE_BITS: 16
FRAME_BITS: 32
CHANNELS: 2
RATE: 44100
PERIOD_TIME: (125011 125012)
PERIOD_SIZE: 5513
PERIOD_BYTES: 22052
PERIODS: (3 4)
BUFFER_TIME: 500000
BUFFER_SIZE: 22050
BUFFER_BYTES: 88200
TICK_TIME: 4000
The solution is to disable CONFIG_USB_BANDWITH option and recompile the kernel. Some more information about this problem:

021. How to compile a kernel?

fakeroot make-kpkg -revision laptop.1.0 clean
fakeroot make-kpkg -revision laptop.1.0 -initrd kernel_image

ls -1 pool/main | sed 's/_.*$/ optional local/' | uniq > override
dpkg-scanpackages pool override > dists/unstable/main/binary-i386/Packages

rm -rf /lib/modules/2.6.15.old
mv /lib/modules/2.6.15 /lib/modules/2.6.15.old

022. How to get rid of initial connection delay in ProFTPd?
Add to these lines to /etc/proftpd/proftpd.conf

DelayEngine  off
IdentLookups off

023. How to configure Opera so she opens mailto links in Thunderbird?
According to www.ubuntuforums.org: In "Prefs → Advanced → Programs → Protocol mailto" select "Open with other application" and write in textfield:

mozilla-thunderbird -compose %w

024. "Starting MTA" takes sooo loooong. How to solve this?

024. "Starting MTA" takes sooo loooong. How to solve this?
According to /usr/share/doc/exim4-base/README.Debian.gz (section 6.6 Why does take such a long time to start?), edit /etc/exim4/update-exim4.conf.conf and set dc_minimaldns='true'

025. How to install new fonts?
Use dfontmgr Luke! (description)

026. xserver-xorg postinst warning: not updating /etc/X11/X; file has been customized
According to this bug report:

rm /etx/X11/xorg.conf
sh -c "readlink /etc/X11/X | md5sum > /var/lib/x11/X.md5sum"
vi /var/lib/dpkg/info/xserver-xorg.postinst
    # Comment out the following line as well as matching else and endif.
    # if [ -z "$UPGRADE" ] || dpkg --compare-versions "$2" le "1:7.0.14"; then

027. Eclipse shows "Element must be declared" error while using <taskdef> and <xmlbean>
Most probably XMLBuddy is installed and its editor shows that error. If you edit build.xml using Ant Editor there will be no problem.

028. After installing QuantumDB plugin it doesn't show anywhere
Make shure that GEF and MEF are also installed. If it still doesn't appear in Preferences or Perspective go to Help → Software Updates → Manage Configuration and enable QauntumDB plugin.

029. alsa-space: xrun of at least 0.008 msecs. resetting stream
Add -srate 44100 or -srate 48000 command option (from mplayer list).

030. Where are .desktop files in KDE?
From this email:

25. Sep 06:47:02, ~/
danadam@pcuj]$ kde-config --path xdgdata-apps
/home/danadam/.local/share/applications/:/usr/share/applications/:/usr/local/share/applications/

Additional information here.

031. How to convert *.ape files?
Download and instal mac and bchunk. Then:

mac infile.ape outfile.wav -d
bchunk -w outfile.wav image.cue prefix

Additional information here.

032. How to configure polish dictionary in OpenOffice?
Make sure you have installed myspell-pl package. Then run OpenOffice and go to Tools/Options/Language Settings/Language and in Default language for documents set Polish.