-- get lastest record of every instance SELECT * FROM [HISTORY] H WHERE [CREATEDTIME] = ( SELECT MAX([CREATEDTIME]) FROM [HISTORY] M WHERE M.[PROCESSINSTANCEID] = H.[PROCESSINSTANCEID] AND M.[EVENTTYPE] = H.[EVENTTYPE] ) ORDER BY [PROCESSINSTANCEID]
-- get lastest record of every instance SELECT * FROM [HISTORY] H WHERE [CREATEDTIME] = ( SELECT MAX([CREATEDTIME]) FROM [HISTORY] M WHERE M.[PROCESSINSTANCEID] = H.[PROCESSINSTANCEID] AND M.[EVENTTYPE] = H.[EVENTTYPE] ) ORDER BY [PROCESSINSTANCEID]
class Program
{
static void Main(string[] args)
{
Console.WriteLine(StringExtension.UrlEncodeMethod("中文"));
Console.WriteLine("中文".UrlEncode());
Console.Read();
}
}
static class StringExtension
{
public static string UrlEncodeMethod(string s)
{
return HttpUtility.UrlEncode(s);
}
public static string UrlEncode(this string s)
{
return HttpUtility.UrlEncode(s);
}
}
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JOptionPane;
public class TestAction extends JFrame {
public TestAction() {
this.setTitle("Test Click action");
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
this.setSize(300, 300);
this.setLocation(200, 200);
JButton button = new JButton("click me");
button.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
JOptionPane.showMessageDialog(TestAction.this, TestAction.this.getTitle());
}
});
this.getContentPane().add(button);
this.setVisible(true);
}
public static void main(String[] args) {
new TestAction();
}
}
using System;
using System.ComponentModel;
using System.ComponentModel.Design;
using System.Collections;
using System.Drawing;
using System.Linq;
using System.Workflow.ComponentModel.Compiler;
using System.Workflow.ComponentModel.Serialization;
using System.Workflow.ComponentModel;
using System.Workflow.ComponentModel.Design;
using System.Workflow.Runtime;
using System.Workflow.Activities;
using System.Workflow.Activities.Rules;
namespace wfConsole
{
delegate void PrintLine();
delegate void PrintContent(string s, int count);
public sealed partial class Workflow1 : SequentialWorkflowActivity
{
public Workflow1()
{
InitializeComponent();
}
private void ReviewDelegate_ExecuteCode(object sender, EventArgs e)
{
// 委派 C# 1.0
PrintLine pl = new PrintLine(this.WriteLine);
PrintContent pc = new PrintContent(this.WriteContent);
pl.Invoke();
pc.Invoke("C# 1.0", 5);
// 委派 C# 2.0
PrintLine pl2 = delegate()
{
Console.WriteLine("********************");
};
PrintContent pc2 = delegate(string s, int count)
{
for (int i = 0; i < count; i++)
{
Console.Write("{0:00} ", i + 1);
Console.WriteLine(s);
}
};
pl2.Invoke();
pc2.Invoke("C# 2.0", 5);
// 委派 C# 3.0
PrintLine pl3 = () =>
{
Console.WriteLine("----------------------");
};
PrintContent pc3 = (string s, int count) =>
{
for (int i = 0; i < count; i++)
{
Console.Write("{0:00} ", i + 1);
Console.WriteLine(s);
}
};
pl3.Invoke();
pc3.Invoke("C# 3.0", 5);
Console.Read();
}
private void WriteLine()
{
Console.WriteLine("=========================");
}
private void WriteContent(string s, int count)
{
for (int i = 0; i < count; i++)
{
Console.Write("{0:00} ", i + 1);
Console.WriteLine(s);
}
}
}
}
netsh interface set interface <interface name> DISABLED netsh interface set interface <interface name> ENABLEDlinux:
ifconfig eth1 down ifconfig eth1 up
Visual SVN http://www.visualsvn.com/ TortoiseSVN http://tortoisesvn.net/ AnkhSVN http://ankhsvn.open.collab.net/
ツール >> AnkhSVN >> Edit the AnkhSVN configuration DiffExePath "C:\Program Files\WinMerge\WinMergeU.exe" -e -x -ub "%base" "%mine" MergeExePath "C:\Program Files\TortoiseSVN\bin\TortoiseMerge.exe" /base:"%base" /theirs:"%theirs" /mine:"%mine" /merged:"%merged"refernect : http://d.hatena.ne.jp/MillyC/20071010/1192006340
從原有的Subversion (svn)備份出來,並還原到新的Subversion Server 上。 備份Subversion 的repository 並將備份檔傳到要還原的機器上。 1. svnadmin dump /path/to/project/ >/tmp/project.dump 2. scp -rp /tmp/project.dump user@192.168.1.1:/tmp/ 還原 1. mkdir -p /path/to 2. svnadmin create /path/to/project 3. svnadmin load /path/to/project < /tmp/project.dump 4. chmod own.own /path/to/project -R
import java.io.File;
import java.io.RandomAccessFile;
import java.nio.MappedByteBuffer;
import java.nio.channels.FileChannel;
import java.nio.channels.FileChannel.MapMode;
import java.text.SimpleDateFormat;
import java.util.Date;
public class SmWrite {
public static void main(String[] args) throws Exception {
File file = new File("c:/mem.txt");
int length = (int) file.length();
String mode = "rw";
FileChannel fc = new RandomAccessFile(file, mode).getChannel();
MappedByteBuffer mbb = fc.map(MapMode.READ_WRITE, 0, length);
String format = "yyyy/MM/dd HH:mm:ss";
SimpleDateFormat sdf = new SimpleDateFormat(format);
while (true) {
String now = sdf.format(new Date());
byte[] b = now.getBytes();
mbb.rewind();
mbb.put(b, 0, b.length);
mbb.force();
Thread.sleep(1000);
}
}
}
import java.io.File;
import java.io.RandomAccessFile;
import java.nio.MappedByteBuffer;
import java.nio.channels.FileChannel;
import java.nio.channels.FileChannel.MapMode;
import java.text.SimpleDateFormat;
public class SmRead {
public static void main(String[] args) throws Exception {
File file = new File("c:/mem.txt");
int length = (int) file.length();
String mode = "rw";
FileChannel fc = new RandomAccessFile(file, mode).getChannel();
MappedByteBuffer mbb = fc.map(MapMode.READ_WRITE, 0, length);
String format = "yyyy/MM/dd HH:mm:ss";
SimpleDateFormat sdf = new SimpleDateFormat(format);
byte[] b = new byte[format.length()];
while (true) {
mbb.rewind();
mbb.get(b, 0, b.length);
String now = new String(b);
System.out.println(now);
Thread.sleep(1000);
}
}
}
reference : http://www.javaworld.com.tw/jute/post/view?bid=29&id=273887
BEGIN BEGIN TRANSACTION BEGIN TRY // QUERY HERE END TRY BEGIN CATCH PRINT ERROR_MESSAGE(); ROLLBACK END CATCH END
Thread t = new Thread(() =>
{
while (true)
{
Console.WriteLine(DateTime.Now);
Thread.Sleep(1000);
}
}
);
t.Start();
reference : http://diditwith.net/2007/02/09/WhatsInAClosure.aspx
<html>
<style>
p {
border:1px solid red;
max-width:30em;
width:expression(
document.body.clientWidth > (500/12) *
parseInt(document.body.currentStyle.fontSize)?
"30em":
"auto" );
}
</style>
<body>
<p>
[alot of text]
</p>
</body>
</html>
reference : http://www.svendtofte.com/code/max_width_in_ie/