Archiwum kategorii 'Krótkie'

Jul 28 2010

[en] Fixing Ubuntu boot process after restoring tar backups to newly formatted disk (with UUID changed)

Napisał(a) Grzegorz w kategorii English, Informatyka, Krótkie, Porady

Mostly note to my self for future reference.

What they don’t tell You in the tar backup tutorial is that it’s not enough to edit /etc/fstab (and their instructions for grub are for grub-legacy).

Because after restoring you probably have new partition UUIDs, you must:

  • boot livecd
  • mount your root fs
  • mount -B /dev /rootfs/dev, etc. (with proc and sys at least) to be able to chroot from livecd to your root fs
  • chroot /rootfs
  • edit /etc/fstab and change UUIDs there (new ones you can get using blkid
  • do sudo dpkg-reconfigure -plow grub-pc to automatically upgrade grub config files, just let it install to the drive(s) it was on
  • do update-initramfs -u so UUID stored inside initramfs get updated, too

Then you should be able to boot it.

Brak komentarzy

Jul 08 2010

[en] Fixing VirtualBox 3.1, 3.2 (and others?) slowness for Ubuntu host and Windows XP guest

Napisał(a) Grzegorz w kategorii English, Informatyka, Krótkie, Porady

Install VirtualBox Guest Additions in Windows’ safe-mode so system file protection doesn’t interfere with the installation, it’s that simple and fixed all my VirtualBox performance problems.

Brak komentarzy

Jun 26 2009

[en] Fix PNG images dark in IE

Napisał(a) Grzegorz w kategorii English, Informatyka, Krótkie, Porady

IE can’t do anything right. If you save some graphical elements to PNG, and try to put them on an area with CSS-defined color, there will be a difference even if you used the same color in the PNG — IE renders PNGs darker than it should. The reason for this is misinterpretation of gAMA frame saved in PNGs that makes it possible to better color-match pictures. The fix is to remove this frame, and doing it on Ubuntu is as easy as:

aptitude install pngcrush
cd your-graphics-directory
mkdir fixed
find . -type f -exec pngcrush -d fixed -rem cHRM -rem gAMA -rem iCCP -rem sRGB {} \;

Now you have a “fixed” directory where you have PNGs that will work properly in IE (and are a bit smaller which is a nice side effect). If you’re sure they’re ok, just do

mv fixed/* ./
rmdir fixed

That’s all.

Brak komentarzy

Nov 29 2008

dostaje automatycznie “display: none” w Firefoksie?

Napisał(a) Grzegorz w kategorii Informatyka, Krótkie, Porady

Straciłem nad tym więcej czasu niż chcę się przyznać; miałem dodać mały element graficzny o nazwie pliku zspon.png do strony jednego z Klientów i jakimś cudem nie pojawiał się on nigdy na stronie, a Firebug pokazywał że ma on “display: none”, choć żadnego CSSa nie przypisywałem.

Okazało się, że Adblock z filtrami Filterset.g wycina mi obrazki które mają w nazwie “spon” :> Wyłączenie Adblocka na czas developmentu to dobry pomysł, choć ja zostawiam włączony - jak ktoś będzie go używał to wolę zawczasu wiedzieć co mu zniknie i zmienić nazwę pliku :) zs-pon.png się wyświetla :D

Brak komentarzy

Nov 27 2008

[en] How to word wrap text in Graphics2D.drawString in Java

Napisał(a) Grzegorz w kategorii English, Informatyka, Krótkie, Porady

Google wasn’t awfully helpful while I was searching for solution to word wrapping a text when drawing in Java, so let’s teach Google this: ;)

    private void drawStringRect(Graphics2D graphics, int x1, int y1, int x2, int y2, 
        float interline, String txt) {
        AttributedString as = new AttributedString(txt);
        as.addAttribute(TextAttribute.FOREGROUND, graphics.getPaint());
        as.addAttribute(TextAttribute.FONT, graphics.getFont());
        AttributedCharacterIterator aci = as.getIterator();
        FontRenderContext frc = new FontRenderContext(null, true, false);
        LineBreakMeasurer lbm = new LineBreakMeasurer(aci, frc);
        float width = x2 - x1;

        while (lbm.getPosition() < txt.length()) {
            TextLayout tl = lbm.nextLayout(width);
            y1 += tl.getAscent();
            tl.draw(graphics, x1, y1);
            y1 += tl.getDescent() + tl.getLeading() + (interline - 1.0f) * tl.getAscent();
            if (y1 > y2) {
                break;
            }
        }
    }

Brak komentarzy

Następne »