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

java swing: Ustawienie tooltipa na każdej z komórek tabelki

<code>

  1. JTable table = new JTable() {
  2.                 public Component prepareRenderer(TableCellRenderer renderer,
  3.                         int rowIndex, int vColIndex) {
  4.                     Component c = super.prepareRenderer(renderer, rowIndex,
  5.                             vColIndex);
  6.                     if (c instanceof JComponent) {
  7.                         JComponent jc = (JComponent) c;
  8.                         jc.setToolTipText((String) getValueAt(rowIndex,
  9.                                 vColIndex));
  10.                     }
  11.                     return c;
  12.                 }
  13.             };

</code>

java swing obsługa zadań czasochłonnych i notyfikacja komponentów postępu

Jakoś po angielski lepszy do tych określeń.

Zadanie: Jest do wykonania czasochłonna operacja, chcemy pokazywać postęp bez blokowania całego GUI.

Definicja przycisku który wykonuje akcję:

<code>

  1. jButton = new JButton();
  2.             jButton.setText(“Perform Test”);
  3.             jButton.setMnemonic(KeyEvent.VK_ENTER);
  4.             jButton.setToolTipText(“Press me!”);
  5.             jButton.addActionListener(new java.awt.event.ActionListener() {
  6.                 public void actionPerformed(java.awt.event.ActionEvent e) {
  7.                     performTestButtonAction(e);
  8.                 }
  9.             });

</code>

obsługa zadania jest w metodzie performTestButtonAction

<code>

  1. private void performTestButtonAction(java.awt.event.ActionEvent e) {
  2.         final SwingWorker worker = new SwingWorker() {
  3.             public Object construct() {
  4. /* pokaż komponent postępu */

  5.                 jProgressBar.setVisible(true); 
  6.                     for (int j = 0; j <= 100; j += 10) {
  7. /* aktualizacja wartości w komponencie postępu */

  8.                     jProgressBar.setValue(j);
  9. /* symulacja że coś robimy – tu wstawiamy kod do wykonania*/

  10.                     try {Thread.sleep(250);}catch (Exception e) {e.printStackTrace();}     
  11.                     }   
  12.                 }
  13. /* zgaś komponent postępu */

  14.                 jProgressBar.setVisible(false);
  15. /* zwracam ewentualny wynik */

  16.                 return null;
  17.             }
  18.         };
  19. /* start zadania do wykonania */

  20.         worker.start();
  21.     }

</code>

Materiały źródłowe
How to use Threads
Opis SwingWorker
Klasa SwingWorker do ściągnięcia

koszty szczepień w Warszawie 2008

Poniżej koszty szczepienia niemowlaka w różnych prywatnych placówkach w Warszawie.

Rotarix – szczepionka na rota wirusa

Infanrix Hexa – szczepionka skojarzona

medicover
- własne
szczepionki
Medicover Lim – Mariot enel-med

Blue City

Babka
Medica
wizyta 160 160 100 140 120
rotarix 346.87 360 400 340 350
infanrix hexa 209.16 242 225 180 200
suma 716.03 762 725 660 670

how to add leading zeros to numbers in filenames perl

This one-line command
- creates new  folder  – ‘new’ in current working folder
- process all files which contains numbers in file name
- number is substitute with missing zeros (maximum 3 zeros)

mkdir new;  perl -e ‘foreach (<*>){ if (/(\d+)/) {;  $name=sprintf “%03d“, $1; $f=$_; $f=~s/(\d+)/$name/; `cp “$_” “new/$f”`}}’

weblogic cluster multicast tets

java -cp ../../../server/lib/weblogic.jar utils.MulticastTest -P 7001 -A 239.192.0.0 -N srv1

-P port
-A multicast address
-N message send to other members

support patterns found:

https://support.bea.com/application_content/product_portlets/support_patterns/wls/MulticastErrorsPattern.html

How to browser Weblogic’s embeddedLDAP

first change EmbeddedLDAP password (i.e. weblogic) from console.

ldapsearch -x -w weblogic -D “cn=Admin” -b “dc=test” -h localhost -p 7001 uid=weblogic

where -w weblogic – EmbeddedLDAP administrator password

-x            – selects simple authentication method
-D “cn=Admin” – we are binding LDAP Administrator
-b dc=test    – where ‘test’ – domainname
-h localhost  – Weblogic’s listen address
-p 7001       – Welogic’s listen port
uid=weblogic  – search filter – here we are looking for weblogic entry

full ldap search:

ldapsearch -x -w weblogic -D “cn=Admin” -b “dc=test” -h localhost -p 7001 *

« Starsze wpisy Nowsze wpisy »