사용자 삽입 이미지
Posted by zennken

SWT Template

Eclipse/SWT 2010. 12. 8. 16:41
// Composite
Composite composite = new Composite(tabFolder, SWT.NONE); 
composite.setLayout(new GridLayout(1, false)); 
composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
...
composite.setTabList(new Control[] {...});
Posted by zennken
전 sed 대신 Perl 로..~ (ex : html 화일에 대해 EUC_KR 을 UTF-8 로 일괄 치환) find . -name '*.html' -exec perl -pi -e 's/EUC_KR/UTF-8/g' {} \; From free1002
Posted by zennken
출처: http://pangate.com/185

다음 예제는 *.c 파일 속에 있는 $1 문자열을 $2 문자열로 바꾼다.

ls_lst=`ls *.c`
for ls_one in ${ls_lst};  do
   echo '=[ '$ls_one' ]'

   sed -e "s%$1%$2%" $ls_one > $ls_one.temp
   sed -e "s%$1%$2%" $ls_one.temp > $ls_one
   rm -f $ls_one.temp
done

echo ' E N D'
Posted by zennken
http://www.vinoth.me/2010/07/16/creative-inspiring-unique-macro-photography-examples/
Posted by zennken

ProgressMonitor with UI

Eclipse 2010. 8. 11. 18:03

IRunnableWithProgress runnable = new IRunnableWithProgress()
{

 public void run(IProgressMonitor progressMonitor)
 {

  ...
  progressMonitor.beginTask("Generating DDL(s)", count);

  ...

  }

  progressMonitor.done();
 }
};

progressMonitor.run(false, true, runnable); <- fork should be false

* void org.eclipse.jface.dialogs.ProgressMonitorDialog.run(boolean fork, boolean cancelable, IRunnableWithProgress runnable) throws InvocationTargetException, InterruptedException

If fork is set to false, the runnable will run in the UI thread and it is the runnable's responsibility to call Display.readAndDispatch() to ensure UI responsiveness.

Posted by zennken
public static String getCellString4Clipboard(Grid aGrid)
{
StringBuffer result = new StringBuffer();
int prevRow, curRow; // For new-line inserting
int i, size;
Point[] selCells = aGrid.getCellSelection();
size = selCells.length;
// For the first selected cell
i = 0;
result.append(aGrid.getItem(selCells[i].y).getText(selCells[i].x));
prevRow = selCells[i].y;
// Remains
for(i = 1; i < size; i++)
{
curRow = selCells[i].y;
if (prevRow != curRow)
result.append(System.getProperty("line.separator"));
else 
result.append("\t");

result.append(aGrid.getItem(selCells[i].y).getText(selCells[i].x));

prevRow = curRow;
}
return result.toString();
}
Posted by zennken
From: http://www.cpuug.org/index.php?topic=132.0

#!/bin/sh
#=====================================================
#
# newdf - An improved human readable display of the HP-UX
# display filesystems command.
#
# Version 1.1
# Author: Scott Buffington
#
# Change History:
# Scott Buffington - 10/30/2006 - Created
# Scott Buffington - 03/18/2008 - Fixed Linewrap issue.
#
# License: GPL, http://www.gnu.org/copyleft/gpl.html
#
#=====================================================

awkscript="/tmp/newdf.$$"

trap "rm -f $awkscript" EXIT

cat << 'EOF' > $awkscript
function showunit(size)
{ mb = size / 1024; prettymb=(int(mb * 100)) / 100;
  gb = mb / 1024; prettygb=(int(gb * 100)) / 100;

  if ( substr(size,1,1) !~ "[0-9]" ||
       substr(size,2,1) !~ "[0-9]" ) { return size }
  else if ( mb < 1) { return size "K" }
  else if ( gb < 1) { return prettymb "M" }
  else              { return prettygb "G" }
}

BEGIN {
  printf "%-27s %8s %8s %8s %8s  %-s\n",
        "Filesystem", "Size", "Used", "Avail", "Capacity", "Mounted"
}

!/Filesystem/ {

  size=showunit($2);
  used=showunit($3);
  avail=showunit($4);

  printf "%-27s %8s %8s %8s %8s  %-s\n",
        $1, size, used, avail, $5, $6
}
EOF

df -Pk | grep -v "libc_psr.so.1" | sed -e :a -e '$!N;s/\n / /;ta' -e 'P;D' | awk -f $awkscript

Posted by zennken

Busy cursor in Eclipse

Eclipse 2010. 2. 5. 00:14
        Runnable runnable = new Runnable() {
            public void run() {
                // code to execute
            }
        };       
        org.eclipse.swt.custom.BusyIndicator.showWhile(null, runnable);

http://dev.eclipse.org/newslists/news.eclipse.tools/msg40810.html
Posted by zennken

http://blog.elitecoderz.net/category/development/java/eclipse-java-development/

The usefull information in this special case is: org.apache.commons.lang.exception.NestableError: Java Model Exception: Java Model Status [src/net/project/windows [in project] does not exist] for any reason, eclipse can not open a special file on the workbench. After several tries I found a way to solve this problem:

  • Make a backup of your “.metadata“-folder (very important!!)
  • navigate into the “.plugins“-folder located inside “.metadata
  • delete the folder “org.eclipse.ui.workbench
  • startup eclipse again and check if there is still everything you need
Posted by zennken

zennken

달력