[Liferay] AutoLogin and Redirect

2013. 1. 14. 16:13 | Posted by WiseBell

Liferay에서 AutoLogin을 처리하는 방법은 2가지가 있다.

1. http://server/c/portal/login?login=계정&password=비밀번호

2. http://server/path?parameterAutoLoginLogin=계정&parameterAutoLoginPassword=비밀번호&기타 파라메터

2번을 사용하기 위해서는 auto.login.hooks 프로퍼티에 com.liferay.portal.security.auth.ParameterAutoLogin 값이 추가로 설정되어 있어야 한다.

 

'Study' 카테고리의 다른 글

이상형을 찾아서~  (6) 2009.12.16
NUnit  (0) 2009.09.09
Call Level Interface (CLI)  (2) 2009.04.15
Visual C# .NET 에서 Word 문서 생성  (0) 2008.07.25
스트링객체 성능 올리는법  (2) 2008.05.14

이상형을 찾아서~

2009. 12. 16. 21:07 | Posted by WiseBell


 

방송중에 "이상형 월드컵" 이라는 게임이 있다.
Wise.IdealType은 이 게임을 흉내내 만들어 보았다.
이미지들은 일단 "초상권" 문제가 있을수 있으니 실행파일만 첨부하였다.

[실행 방법]

1. Wise.IdealType.exe 와 동일 경로에 "Pictures" 라는 폴더를 생성한다.
2. Pictures 폴더에 확장자가 "JPG" 인 파일들을 준비하여 복사해 놓는다.
3. Wise.IdealType.exe를 실행한다.
4. 메뉴에서 File => Load Images => Default Directory 메뉴를 클릭하여 선수(사진들)을 불러온다.
5. 화면 우측 하단의 Participant(참가자) 숫자를 설정하고 Start 버튼을 눌러 게임을 시작한다.
6. 대전 목록을 표시되고 대전 목록 화면 하단의 "Start" 버튼을 누르면 경기가 시작된다.
7. 대전 목록 순서대로 대전(선택)이 진행된다.
8. 대전은 화면에서 좌측 혹은 우측의 사진을 클릭하면 선택된 사진이 승자가 되고 다음 대전이 이어진다.
9. 대전 목록의 모든 대전이 진행되고 나면 대전의 승자들로 다시 다음 대전 목록을 구성하여 보여준다.
10. 최종 1명의 승자가 나올때까지 대전이 진행된다.
11. 최종 승자가 표시되고 나면 하단의 "Close"의 버튼을 눌러 게임을 종료 하고 선수 대기 화면으로 돌아간다.


[기타 설명]

* 메뉴에서 File => Load Images => Select Directory 메뉴를 클릭하면 폴더를 지정하여 선수(사진들)을 불러온다.
* 이미지 파일의 이름이 선수의 이름으로 활용되므로 이미지 파일을 준비할 때 파일 이름에도 신경을 쓰자.





실행

 

이미지 로드


게임 시작

대전중

'Study' 카테고리의 다른 글

[Liferay] AutoLogin and Redirect  (0) 2013.01.14
NUnit  (0) 2009.09.09
Call Level Interface (CLI)  (2) 2009.04.15
Visual C# .NET 에서 Word 문서 생성  (0) 2008.07.25
스트링객체 성능 올리는법  (2) 2008.05.14

NUnit

2009. 9. 9. 13:16 | Posted by WiseBell

http://www.nunit.org/index.php

[NUnit]

NUnit 은 Microsoft .NET을 위한 오픈소스의 단위 테스팅 프레임워크이다.
이것은 JUnit이 Java에서 사용되는 목적과 동일한 역할을 하며, 수많은 xUnit 패밀리중에 하나이다.

[Unit Testing]

소프트웨어 확인 및 검증 방법으로 프로그래머가 소스코드의 개별 유닛들이 사용에 적합한지 테스트 하는 것이다.
하나의 유닛은 어플리케이션에서 테스트가 가능한 최소 단위이다.

[xUnit]

수많은 code-driven 테스트 프레임워크들을 집합적으로 일컬어 xUnit으로 알려졌다.

(표 출처 : http://www.nunit.org/index.php?p=platformSupport)

'Study' 카테고리의 다른 글

[Liferay] AutoLogin and Redirect  (0) 2013.01.14
이상형을 찾아서~  (6) 2009.12.16
Call Level Interface (CLI)  (2) 2009.04.15
Visual C# .NET 에서 Word 문서 생성  (0) 2008.07.25
스트링객체 성능 올리는법  (2) 2008.05.14

Call Level Interface (CLI)

2009. 4. 15. 10:31 | Posted by WiseBell

CLI는 ISO/IEC 9075-3:2003에 정의된 소프트웨어 표준이다. 이것은 프로그램이 SQL 질의들을 어떻게 DBMS 보내고, 반환된 레코드셋들을 어플리케이션이 어떻게 일관된 방법으로 다룰지에 대해서 정의하고 있다. 1990년대 초반에 개발된 이 API는 C와 COBOL 프로그래밍 언어만을 위해 정의되어 있다.

이 인터페이스는 Open Group이  Commin Application Environment로 참조하고 있는 것들중 일부이다. Commin Application Environment는 공개 어플리케이션들을 위한 광범위한 표준으로, 서로 다른 프로그래밍 팀과 서로 다른 공급자들의 어플리케이션간의 상호작용을 효과적인 방법으로 수행하기위한 표준이다. SQL/CLI 는 SQL 데이터베이스에 접근하는 국제표준의 구현 독립적인 CLI를 제공한다.  클라이언트-서버 형식의 툴들이 동적 링크 라이브러리를 통해 쉽게 데이터베이스에 접근할 수 있다. 이것은 풍부한 클라이언트-서버 툴들을 지원 장려하고 있다.

가장 널리 사용된 CLI 표준 사용법은 ODBC(Open Database Connectivity) 로, 서로 다른 공급자들의 데이터베이스 시스템에 어플리케이션들이 접근하도록 허용하는데 널리 사용되었다.

현재 버전의 API와 ODBC 3.52는 ISO와 X/Open 표준 모두의 특징들을 통합하고 있다.

참조
http://en.wikipedia.org/wiki/Call_Level_Interface
http://www.opengroup.org/products/publications/catalog/c451.htm

'Study' 카테고리의 다른 글

이상형을 찾아서~  (6) 2009.12.16
NUnit  (0) 2009.09.09
Visual C# .NET 에서 Word 문서 생성  (0) 2008.07.25
스트링객체 성능 올리는법  (2) 2008.05.14
C#에서 동일한 프로그램에 중복 실행을 방지하는 방법  (2) 2008.01.31

Visual C# .NET 에서 Word 문서 생성

2008. 7. 25. 10:41 | Posted by WiseBell
using Word = Microsoft.Office.Interop.Word;
using System.Reflection;


object oMissing = System.Reflection.Missing.Value;
object oEndOfDoc = "\\endofdoc"; /* \endofdoc is a predefined bookmark */

//Start Word and create a new document.
Word._Application oWord;
Word._Document oDoc;
oWord = new Word.Application();
oWord.Visible = true;
oDoc = oWord.Documents.Add(ref oMissing, ref oMissing,
ref oMissing, ref oMissing);

//Insert a paragraph at the beginning of the document.
Word.Paragraph oPara1;
oPara1 = oDoc.Content.Paragraphs.Add(ref oMissing);
oPara1.Range.Text = "Heading 1";
oPara1.Range.Font.Bold = 1;
oPara1.Format.SpaceAfter = 24;    //24 pt spacing after paragraph.
oPara1.Range.InsertParagraphAfter();

//Insert a paragraph at the end of the document.
Word.Paragraph oPara2;
object oRng = oDoc.Bookmarks.get_Item(ref oEndOfDoc).Range;
oPara2 = oDoc.Content.Paragraphs.Add(ref oRng);
oPara2.Range.Text = "Heading 2";
oPara2.Format.SpaceAfter = 6;
oPara2.Range.InsertParagraphAfter();

//Insert another paragraph.
Word.Paragraph oPara3;
oRng = oDoc.Bookmarks.get_Item(ref oEndOfDoc).Range;
oPara3 = oDoc.Content.Paragraphs.Add(ref oRng);
oPara3.Range.Text = "This is a sentence of normal text. Now here is a table:";
oPara3.Range.Font.Bold = 0;
oPara3.Format.SpaceAfter = 24;
oPara3.Range.InsertParagraphAfter();

//Insert a 3 x 5 table, fill it with data, and make the first row
//bold and italic.
Word.Table oTable;
Word.Range wrdRng = oDoc.Bookmarks.get_Item(ref oEndOfDoc).Range;
oTable = oDoc.Tables.Add(wrdRng, 3, 5, ref oMissing, ref oMissing);
oTable.Range.ParagraphFormat.SpaceAfter = 6;
int r, c;
string strText;
for(r = 1; r <= 3; r++)
for(c = 1; c <= 5; c++)
{
strText = "r" + r + "c" + c;
oTable.Cell(r, c).Range.Text = strText;
}
oTable.Rows[1].Range.Font.Bold = 1;
oTable.Rows[1].Range.Font.Italic = 1;

//Add some text after the table.
Word.Paragraph oPara4;
oRng = oDoc.Bookmarks.get_Item(ref oEndOfDoc).Range;
oPara4 = oDoc.Content.Paragraphs.Add(ref oRng);
oPara4.Range.InsertParagraphBefore();
oPara4.Range.Text = "And here's another table:";
oPara4.Format.SpaceAfter = 24;
oPara4.Range.InsertParagraphAfter();

//Insert a 5 x 2 table, fill it with data, and change the column widths.
wrdRng = oDoc.Bookmarks.get_Item(ref oEndOfDoc).Range;
oTable = oDoc.Tables.Add(wrdRng, 5, 2, ref oMissing, ref oMissing);
oTable.Range.ParagraphFormat.SpaceAfter = 6;
for(r = 1; r <= 5; r++)
for(c = 1; c <= 2; c++)
{
strText = "r" + r + "c" + c;
oTable.Cell(r, c).Range.Text = strText;
}
oTable.Columns[1].Width = oWord.InchesToPoints(2); //Change width of columns 1 & 2
oTable.Columns[2].Width = oWord.InchesToPoints(3);

//Keep inserting text. When you get to 7 inches from top of the
//document, insert a hard page break.
object oPos;
double dPos = oWord.InchesToPoints(7);
oDoc.Bookmarks.get_Item(ref oEndOfDoc).Range.InsertParagraphAfter();
do
{
wrdRng = oDoc.Bookmarks.get_Item(ref oEndOfDoc).Range;
wrdRng.ParagraphFormat.SpaceAfter = 6;
wrdRng.InsertAfter("A line of text");
wrdRng.InsertParagraphAfter();
oPos = wrdRng.get_Information
                       (Word.WdInformation.wdVerticalPositionRelativeToPage);
}
while(dPos >= Convert.ToDouble(oPos));
object oCollapseEnd = Word.WdCollapseDirection.wdCollapseEnd;
object oPageBreak = Word.WdBreakType.wdPageBreak;
wrdRng.Collapse(ref oCollapseEnd);
wrdRng.InsertBreak(ref oPageBreak);
wrdRng.Collapse(ref oCollapseEnd);
wrdRng.InsertAfter("We're now on page 2. Here's my chart:");
wrdRng.InsertParagraphAfter();

//Insert a chart.
Word.InlineShape oShape;
object oClassType = "MSGraph.Chart.8";
wrdRng = oDoc.Bookmarks.get_Item(ref oEndOfDoc).Range;
oShape = wrdRng.InlineShapes.AddOLEObject(ref oClassType, ref oMissing,
ref oMissing, ref oMissing, ref oMissing,
ref oMissing, ref oMissing, ref oMissing);

//Demonstrate use of late bound oChart and oChartApp objects to
//manipulate the chart object with MSGraph.
object oChart;
object oChartApp;
oChart = oShape.OLEFormat.Object;
oChartApp = oChart.GetType().InvokeMember("Application",
BindingFlags.GetProperty, null, oChart, null);

//Change the chart type to Line.
object[] Parameters = new Object[1];
Parameters[0] = 4; //xlLine = 4
oChart.GetType().InvokeMember("ChartType", BindingFlags.SetProperty,
null, oChart, Parameters);

//Update the chart image and quit MSGraph.
oChartApp.GetType().InvokeMember("Update",
BindingFlags.InvokeMethod, null, oChartApp, null);
oChartApp.GetType().InvokeMember("Quit",
BindingFlags.InvokeMethod, null, oChartApp, null);
//... If desired, you can proceed from here using the Microsoft Graph
//Object model on the oChart and oChartApp objects to make additional
//changes to the chart.

//Set the width of the chart.
oShape.Width = oWord.InchesToPoints(6.25f);
oShape.Height = oWord.InchesToPoints(3.57f);

//Add text after the chart.
wrdRng = oDoc.Bookmarks.get_Item(ref oEndOfDoc).Range;
wrdRng.InsertParagraphAfter();
wrdRng.InsertAfter("THE END.");


출처 : http://support.microsoft.com/?kbid=316384
참고 : http://msdn.microsoft.com/en-us/library/bb244515.aspx

'Study' 카테고리의 다른 글

이상형을 찾아서~  (6) 2009.12.16
NUnit  (0) 2009.09.09
Call Level Interface (CLI)  (2) 2009.04.15
스트링객체 성능 올리는법  (2) 2008.05.14
C#에서 동일한 프로그램에 중복 실행을 방지하는 방법  (2) 2008.01.31

스트링객체 성능 올리는법

2008. 5. 14. 11:00 | Posted by WiseBell

StringBuilder

Any "tips and tricks" presentation on the .NET Base Class Libraries will tell you that StringBuilder is better than String::Concat. Here's how that looks:

void StringBuild::build(int loops)
{
    String* block = "123456789012345678901234567890";
    StringBuilder* result = new StringBuilder();

    for (int i=0; i<loops;i++)
        result->Append(block);
    String* realresult = result->ToString();
    Console::WriteLine(realresult->Length.ToString());
    return;
}

The only hassle is remembering to call ToString() on the StringBuilder when you've finished building it. The code is simple to write and to read, and it's much much faster than the String::Concat() case. But it's not the fastest, at least not always.

Hand-allocating a buffer

StringBuilder works by allocating more memory than you need, and by tacking the new strings into that buffer. Every time you need the buffer to enlarge, it doubles in size. That approach was chosen as a trade-off between allocating too much memory and wasting a lot of time allocating little extra bits over and over again. The starting size is implementation-specific, but in most cases it's 16 characters. You can pass an integer to the StringBuilder constructor to bump up the initial allocation if you know what you'll need: That will save you the extra allocations but it won't save you all the testing to see whether you've exceeded your capacity or not.

So, because this is C++ after all, let's do something they can't do in VB and play with pointers a little. Look at this code:

void StringBuffer::build(int loops)
{
    char* block = "123456789012345678901234567890";
    int delta = strlen(block);
    char* buffer = new char[loops*strlen(block)+1];

    char* p = buffer;
    for (int i=0; i<loops;i++)
    {
        strcpy(p,block);
        p += delta; 
    }

    String* result = buffer;
    Console::WriteLine(result->Length.ToString());
    return;
}

Whenever you work with char* strings, you have to remember when to add an extra character for the \0 or when to move past it or before it or whatever. In this code, the delta, how much we move forward each time, is deliberately set to exactly the strlen of block—normally you would add 1 to allow room for the \0, but I want the first character of the next append to overwrite the \0 so we have one long, contiguous string at the end.

This code works, and it is faster than StringBuilder. That's not surprising, because I don't have to test to see whether I am exceeding my capacity, and I don't have to allocate more memory. Because I'm steering clear of the managed heap except for the final string, I'm probably not exercising the garbage collector either. So what is surprising is that's it's not very much faster than StringBuilder: about 10-20% less time for the same number of loops. And this is for a special case where I knew the exact length of the buffer in the end. For the general case where you're gluing together an unknown number of strings, each of an unknown length, you're not going to beat StringBuilder with something you write yourself. That's worth knowing, isn't it?

'Study' 카테고리의 다른 글

이상형을 찾아서~  (6) 2009.12.16
NUnit  (0) 2009.09.09
Call Level Interface (CLI)  (2) 2009.04.15
Visual C# .NET 에서 Word 문서 생성  (0) 2008.07.25
C#에서 동일한 프로그램에 중복 실행을 방지하는 방법  (2) 2008.01.31

Program.cs에 다음과 같이 코드 추가

using System.Threading;

        static void Main()
        {            bool createdNew;
            Mutex dup = new Mutex(true,"Mu", out createdNew);             

            if (createdNew)
            {
                Application.Run(new From());
                dup.ReleaseMutex();
            }
            else
            {
                MessageBox.Show("이미 프로그램이 실행중입니다.");
            }           
        }

'Study' 카테고리의 다른 글

이상형을 찾아서~  (6) 2009.12.16
NUnit  (0) 2009.09.09
Call Level Interface (CLI)  (2) 2009.04.15
Visual C# .NET 에서 Word 문서 생성  (0) 2008.07.25
스트링객체 성능 올리는법  (2) 2008.05.14
이전 1 다음