lipiec 6, 2009 @ 11:49 am (komputer, tips)
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 b31fa494b952390070d409890a314cfb
then on new user:
> xauth add server/unix:10 MIT-MAGIC-COOKIE-1 b31fa494b952390070d409890a314cfb
Leave a Comment
czerwiec 28, 2009 @ 11:19 pm (tips)
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.
Leave a Comment
maj 26, 2009 @ 11:21 am (tips)
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>
Leave a Comment
maj 19, 2009 @ 8:58 am (londyn)
kaalai vanakkam – dzień dobry po tamilsku. To w zapisie angielskim. Właściwie oznacza to good morning.
Leave a Comment
maj 7, 2009 @ 9:55 am (komputer, tips)
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
Leave a Comment
kwiecień 23, 2009 @ 12:03 pm (komunikacja, linux, tips)
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.
Leave a Comment
luty 12, 2009 @ 9:53 am (tips)
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>
Leave a Comment
styczeń 26, 2009 @ 1:49 pm (artysta)
pgp –verify file_with_certificate
Leave a Comment
styczeń 16, 2009 @ 2:32 pm (tips)
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>
- Sub Macro()
- RowIndex = 1
- Do
- Sheets(”Sheet1″).Select
- With Sheets(”Sheet1″)
- Range(.Cells(RowIndex, 1), .Cells(RowIndex + 3, 1)).Select
- End With
- Selection.Copy
- Sheets(”Sheet2″).Select
- RowIndexPaste = Round(RowIndex / 4) + 1
- With Sheets(”Sheet2″)
- Range(.Cells(RowIndexPaste, 1), .Cells(RowIndexPaste, 1)).Select
- End With
- Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlNone, SkipBlanks:= _
- False, Transpose:=True
- RowIndex = RowIndex + 4
- Loop While Sheets(”Sheet1″).Cells(RowIndex, 1).Value <> “”
- End Sub
</code>
Macro check until check empty line.
If you know easiest way to resolve this task, let me know!
Leave a Comment
styczeń 13, 2009 @ 4:06 pm (tips)
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
Leave a Comment