2014년 7월 28일 월요일
prevent mouse cursor move when double click on web page
$('*').dblclick(function(event) { event.preventDefault(); return false; });
2014년 7월 27일 일요일
텍스트 파일 병합 펄 스크립트
$name = "name.txt";
$formular = "formular.txt";
$A = "A.txt";
$B = "B.txt";
$C = "C.txt";
open $fh_name, '<', $name or die "Cannot open $name: $!";
open $fh_formular, '<', $formular or die "Cannot open $formular: $!";
open $fh_A, '<', $A or die "Cannot open $A: $!";
open $fh_B, '<', $B or die "Cannot open $B: $!";
open $fh_C, '<', $C or die "Cannot open $C: $!";
open $table, '>table.txt';
my $n = @{[<$fh_name>]};
seek $fh_name,0,0;
for ($i=1; $i<= $n; $i++){
$l_name = <$fh_name>;
chomp($l_name);
$l_formular = <$fh_formular>;
chomp($l_formular);
$l_A = <$fh_A>;
chomp($l_A);
$l_B = <$fh_B>;
chomp($l_B);
$l_C = <$fh_C>;
chomp($l_C);
print $table "$l_name\t$l_formular\t$l_A\t$l_B\t$l_C\n";
}
2014년 7월 23일 수요일
이클립스 프로젝트 SWT 예제
1.[File]-[New]-[Java Project]
[New]-[Class]
2. [Project]-[Java Build Path]-[Libraries]-[Add External JARs]
[New]-[Class]
소스코드 입력
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.layout.RowLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
/**
* @author Steven Holzner
*
*/
public class SWTButtonExampleDemo {
public static void main(String[] args) {
Display display = new Display();
Shell shell = new Shell(display);
shell.setSize(300, 200);
shell.setText("Button Example");
shell.setLayout(new RowLayout());
final Button button = new Button(shell, SWT.PUSH);
button.setText("Click Me");
final Text text = new Text(shell, SWT.SHADOW_IN);
button.addSelectionListener(new SelectionListener() {
public void widgetSelected(SelectionEvent event) {
text.setText("No worries!");
}
public void widgetDefaultSelected(SelectionEvent event) {
text.setText("No worries!");
}
});
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch())
display.sleep();
}
display.dispose();
}
}
2. [Project]-[Java Build Path]-[Libraries]-[Add External JARs]
2014년 7월 8일 화요일
[c#] 엑셀 파일 읽기
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Excel = Microsoft.Office.Interop.Excel;
namespace ReadExcel
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
Excel.Application xlApp = new Excel.Application();
Excel.Workbook xlWorkbook = xlApp.Workbooks.Open(@"C:\\C.xlsx");
Excel._Worksheet xlWorksheet = xlWorkbook.Sheets[1];
Excel.Range xlRange = xlWorksheet.UsedRange;
int rowCount = xlRange.Rows.Count;
int colCount = xlRange.Columns.Count;
for (int i = 1; i <= rowCount; i++)
{
for (int j = 1; j <= colCount; j++)
{
MessageBox.Show(xlRange.Cells[i, j].Value2.ToString());
}
}
}
private void Form1_Load(object sender, EventArgs e)
{
}
}
}
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Excel = Microsoft.Office.Interop.Excel;
namespace ReadExcel
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
Excel.Application xlApp = new Excel.Application();
Excel.Workbook xlWorkbook = xlApp.Workbooks.Open(@"C:\\C.xlsx");
Excel._Worksheet xlWorksheet = xlWorkbook.Sheets[1];
Excel.Range xlRange = xlWorksheet.UsedRange;
int rowCount = xlRange.Rows.Count;
int colCount = xlRange.Columns.Count;
for (int i = 1; i <= rowCount; i++)
{
for (int j = 1; j <= colCount; j++)
{
MessageBox.Show(xlRange.Cells[i, j].Value2.ToString());
}
}
}
private void Form1_Load(object sender, EventArgs e)
{
}
}
}
클릭하면 div를 보여주는 jquery 소스
<button>Toggle</button>
<div id="select" style="display: none">
<p>Such interesting text, eh?</p>
</div>
<div>this is second para</div>
</body>
<script>
$( "button" ).click(function() {
$('#select').toggle( "slow" );
});
</script>
<div id="select" style="display: none">
<p>Such interesting text, eh?</p>
</div>
<div>this is second para</div>
</body>
<script>
$( "button" ).click(function() {
$('#select').toggle( "slow" );
});
</script>
2014년 6월 28일 토요일
[c#]1분 간격으로 이벤트 실행
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Timers;
namespace sendgmail
{
public partial class Form1 : Form
{
static System.Windows.Forms.Timer timer = new System.Windows.Forms.Timer();
public Form1()
{
InitializeComponent();
timer.Tick += new EventHandler(timer_Tick); // Everytime timer ticks, timer_Tick will be called
timer.Interval = 60 * 1000;
timer.Enabled = true; // Enable the timer
timer.Start();
}
// 쓰레드풀의 작업쓰레드가 지정된 시간 간격으로
// 아래 이벤트 핸들러 실행
private void timer_Tick(object sender, EventArgs e)
{
// MessageBox.Show("timer success");
}
}
}
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Timers;
namespace sendgmail
{
public partial class Form1 : Form
{
static System.Windows.Forms.Timer timer = new System.Windows.Forms.Timer();
public Form1()
{
InitializeComponent();
timer.Tick += new EventHandler(timer_Tick); // Everytime timer ticks, timer_Tick will be called
timer.Interval = 60 * 1000;
timer.Enabled = true; // Enable the timer
timer.Start();
}
// 쓰레드풀의 작업쓰레드가 지정된 시간 간격으로
// 아래 이벤트 핸들러 실행
private void timer_Tick(object sender, EventArgs e)
{
// MessageBox.Show("timer success");
}
}
}
2014년 6월 27일 금요일
피드 구독하기:
글 (Atom)



