X11 forwarding problems

If you setup X11 forwarding in putty. Then after SSH to server and user change via su then error could ocurr.

Xlib: connection to “localhost:10.0″ refused by server
Xlib: PuTTY X11 proxy: wrong authentication protocol attempted xterm Xt error: Can’t open display: localhost:10.0

To solve, back to oryginal user:

issue:

>xauth list
localhost:10  MIT-MAGIC-COOKIE-1  b31fa494b952390070d409890a3
14cfb

then on new user:

> xauth add server/unix:10  MIT-MAGIC-COOKIE-1  b31fa494b952390070d409890a314cfb

nieoczekiwane problemy z rozdzielczością Dell SP2309w i NVIDIA 6600GT

Na kabalku DVI maksimum jakie można wyciągnać to 1680×1050. Za to na VGA D-SUB rodzielczności do koloru do wyboru.
Natywna rozdzielczość 2048×1152 dla Dell’a SP2309w  osiąga bez problemu.

Ustawienie większej rozdzielności na DVI skutkuje stworzeniem wirtualnego dużego ekranu którego wydzimy tylko kawalek w oknie 1680×1050. Co jest dziwne bo zodnie ze specyfikacją DVI – single powinno pójść nawet i 1920×1200 – wtedy dostajemy obraz w rozdzielności VGA.

how to extract part of log

Simple perl script below gets as arguments
1. Start pattern (could be regexp in single quotes)
2. End pattern (could be regexp in single quotes)
3. File path

It is opening file and prints  everything between Start and End pattern.

<code>

#!/usr/bin/perl

die “Usage: start_pattern end_pattern file [$#ARGV]” if $#ARGV<2;

open FI, $ARGV[2] || die “Problem with opening file [$ARGV[2]] [$!]\n”;
$START=$ARGV[0];
$END=$ARGV[1];

$in=0;
foreach (<FI>) {
        $in=1 if /$START/;
        print $_ if $in;
        $in=0 if /$END/;

}
close FI;

</code>

rozmowy z kolegami

kaalai vanakkam  – dzień dobry po tamilsku. To w zapisie angielskim. Właściwie oznacza to good morning.

CURL and no Cache test throgh proxy

 

i=0; while true; do let i=$i+1; curl  -H “Pragma: no-cache”  -H “Cache-Control: no-cache” -I -x proxy_host:proxy_port http://site_to_be_tested/index.html; echo  $i; sleep 1; done

copying files unde Unix with perms and ACLs (cpio)

The easiest way is to use cpio command as tar does not copy ACL from filesystem.
<code>

mkdir /desitnation/folder
cd /source/folder/path
find . -depth -print | cpio -dumpPv  /desitnation/folder

</code>

‘-P’ – switch is important – copies ACLs

In other case you have to use hand made script which uses getfacl and setfacl commands.
For permissions processing best would be perl which use ’stat’ – for files properties and chmod/chown commands.

antialiasing in Java swing

Method Described at:

http://www.javalobby.org/forums/thread.jspa?forumID=61&threadID=14179
<code>
import java.awt.Graphics;

import java.awt.Graphics2D;
import java.awt.RenderingHints;
 
import javax.swing.JTextPane;
 
public class AntiAliasedTextPane extends JTextPane {
    public void paintComponent(Graphics g) {
        Graphics2D g2 = (Graphics2D) g;
        g2.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,
          RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
        g2.setRenderingHint(RenderingHints.KEY_RENDERING,
          RenderingHints.VALUE_RENDER_QUALITY);
        super.paintComponent(g2);
    }
}
</code>

pgp windows version. checking what is inside certificate

pgp –verify file_with_certificate

VisualBasic transpose macro

Assumption: We have list of values in excel sheet1
row1: A1
row2: A2
row3: A3
row4: A4
row5: B1
row6: B2
row7: B3
row8: B4

Task: We want to transpose this data in excel sheet2 into form.

row1: A1A2A3A4
row2: B1B2B3B4

So every four cells in four rows is transposed to one row with four columns

It could be done using following Visual Basic Macro:
<code>

  1. Sub Macro()
  2.     RowIndex = 1
  3.     Do
  4.     Sheets(”Sheet1″).Select
  5.     With Sheets(”Sheet1″)
  6.         Range(.Cells(RowIndex, 1), .Cells(RowIndex + 3, 1)).Select
  7.     End With 
  8.     Selection.Copy
  9.     Sheets(”Sheet2″).Select
  10.     RowIndexPaste = Round(RowIndex / 4) + 1
  11.     With Sheets(”Sheet2″)
  12.         Range(.Cells(RowIndexPaste, 1), .Cells(RowIndexPaste, 1)).Select
  13.     End With
  14.     Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlNone, SkipBlanks:= _
  15.         False, Transpose:=True
  16.     RowIndex = RowIndex + 4
  17.     Loop While Sheets(”Sheet1″).Cells(RowIndex, 1).Value <> “”
  18. End Sub

</code>

Macro check until check empty line.

If you know easiest way to resolve this task, let me know!

otwieranie domyslna aplikacja pliku ze sciezki ktora ma spacje.

Należy użyć krótkiej nazwy katalogu.

opis:

Re[3]: How do I convert long to short pathnames?
Topic: IO
Rick LaFleur, Jun 22, 2004  [replies:2]

Caution, I think there may be a problem with this solution (not that I know a better one) or at least there was when I looked into this last.

First is handling spaces … you need to know to drop em. So if you create a folder called “this is the first test” it will have a short name of THISIS~1.

The second issue though is more tricky. If originally there were three folders called:

"this is the first test"
"this is the second test"
"this is the third test"

They would have short names of THISIS~1, THISIS~2, and THISIS~3. So far, fine.

But, what happens if the “this is the first test” folder is deleted? On my system I show the two remaining folders listed as THISIS~2 and THISIS~3. That is, the short name seems to be cooked in when the folder is created.

Which you might think is good if you are hard coding the path name into your application.

However, if you come along later and see only the two folders, you might assume they were ~1 and ~2, not ~2 and ~3, and using the ~2 to access the ’second’ directory would result in the wrong one.

Worse, if you create a new folder called “this is the fourth test” it’s short name is THISIS~1, not ~4. You can just imagine what that would do to your application.

Confusing, huh?

Best solution I’ve found (and hope there is a better one) is the dumb dir /X command and parse results.

z http://www.jguru.com/faq/viewquestion.jsp?EID=768691

« Wcześniejsze wpisy Następna strona » Następna strona »