달력

22025  이전 다음

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28

월드컵 덕에 푸마가 이상한 이미지로 뜨고 있다~

내가 좋아하는 푸마가 이렇게 되다니~ ㅍ,ㅍ

펠레의 저주도 깨졌으니까~ 한국은 16강 진출 할꺼당~

그러는 한편, 스위스가 푸마 유니폼이니까 한국이 이겼으면 하는 바램도 있당~

 

아무튼 오래전부터 나돌아 댕기는 푸마 패러디 모음~

재미있어서 퍼왔다~

 

어쩜 이런걸 다 생각했을까~? ㅋㅋㅋ


----------------------------------------------------------------------





원래 푸마의 모양은 아시겠죠

초기 푸마의 모양을 약간 변형한 것들이 나타나기 시작했습니다.



방송을 탄 파마죠. ^^



담배를 피마~



다마.. 당구를 흔히 그렇게 얘기하죠...



비만... 심각한 사회적 문제입니다. 푸마에게도 예외는 없는 듯 하군요.


치마를 입은 푸마도 등장을 합니다.



오토바이를 타마...



펑크족 푸마



펌프를 하는 푸마



지금 자나?



컴맹... ^^;;;


우리의 좋은 전통이죠... 품앗이...



푸하.... 핫! ^^



푸쉬업, 푸샵... 재치있는 표현력입니다.



우리 모두 인사를 잘 합시다~



요리사 푸마인가요?



애국심의 발로인가요?

이제부턴 2인용입니다.




아까 그 치마가 엄마로군요...



임마! 너는 엄마만 찾아? 아빠인가요?



엄마가 아빠를 안마 해주네요.

성인용도 있네요.


절언 .... 불쌍한...



아... 비교되는 군요...

푸마가 아닌 것들도 등장합니다.



참치... 요즘은 아주 흔한 음식이죠.



푸들...



'추'자도 넣었다면 완벽할 텐데...




아마도 게임에 등장하는 캐릭터인가봅니다.



하마.. 빠질 수 없겠죠.



아... 기발합니다...

학구파 푸마인가요?



정말인지는 모르겠어요. ^^


저는 그럼 이만...

 

 

 

 

 

 

 

 

Posted by tornado
|

예전에 자바로 겁나 헤메던거 무지무지 간단하게 끝나네 그랴~


-- 출처 : http://www.codeproject.com/useritems/Audio_Player__with_Winmm.asp 


Note: This is an unedited contribution. If this article is inappropriate, needs attention or copies someone else's work without reference then please Report this article.

Sample Image - Audio_Player__with_Winmm.jpg

Introduction

After looking for a simple, yet free, mp3 player I deceided to make my own. I based myself on a commercial package that shall remain nameless [ Let's just say it that package was expensive considering it was importing the winmm.dll ]  Almost every example I found for playing audio file [in my case MP3s] using the winmm.dll only had play/stop capabilities (and sometimes pause). Which is fine, I just wanted a bit more, and still keep it simple. Of course, if I had wanted a full blown MP3 player, I propably would have download one of the many free application out there. That wasn't my purpose.
So the code is fairly simple. It uses the winmm.dll from Windows to play,stop,pause etc. As well as control the volume of the left/right channels (if there are more then 1). Also, I had fun trying my hand at parsing XML, so the application gets audio file infomartion from a Windows Media Playlist [Making one is easy, just use Windows Media Player].

Just please keep in mind, that I'm not a programmer by trade and this is my first contribution to the CodeProject. I know that I'm not re-inventing the wheel here, just hoping this will help someone somewhere.

The project has a couple of files:
-Player.cs [Which has all of the winmm.dll string commands]
more can be found here http://msdn.microsoft.com/library/default.asp?url=/library/en-us/multimed/htm/_win32_multimedia_command_strings.asp
Which in my opinion, is a pain to understand sometimes.
-readPlaylist.cs
This opens up a open dialog window and helps you select a *.wpl file
-MainPlayer.cs
Basically the buttons and click events etc etc.

Let's look at the Player.cs
Tried putting as many relevant comments in the code as I code with out going over board like I'm doing writting this acticle.

Collapse
using System; using System.Collections.Generic; using System.Runtime.InteropServices; using System.Text; namespace MP3player { class Player { private string Pcommand; private bool isOpen; [DllImport("winmm.dll")] private static extern long mciSendString(string strCommand, StringBuilder strReturn, int iReturnLength, int bla); /// <SUMMARY> /// Not much to conctruct here /// </SUMMARY> public Player() { } /// <SUMMARY> /// Stops currently playing audio file /// </SUMMARY> public void Close() { Pcommand = "close MediaFile"; mciSendString(Pcommand, null, 0, 0); isOpen = false; } /// <SUMMARY> /// Opens audio file to play /// </SUMMARY> /// This is the audio file's path and filename public void Open(string sFileName) { Pcommand = "open \"" + sFileName + "\" type mpegvideo alias MediaFile"; mciSendString(Pcommand, null, 0, 0); isOpen = true; } /// <SUMMARY> /// Plays selected audio file /// </SUMMARY> /// If True,audio file will repeat public void Play(bool loop) { if (isOpen) { Pcommand = "play MediaFile"; if (loop) Pcommand += " REPEAT"; mciSendString(Pcommand, null, 0, 0); } } /// <SUMMARY> /// Pauses currently playing audio file /// </SUMMARY> public void Pause() { Pcommand = "pause MediaFile"; mciSendString(Pcommand, null, 0, 0); } /// <SUMMARY> /// Returns the current status player: playing,paused,stopped etc. /// </SUMMARY> public string Status() { int i = 128; System.Text.StringBuilder stringBuilder = new System.Text.StringBuilder(i); mciSendString("status MediaFile mode", stringBuilder, i, 0); return stringBuilder.ToString(); } /// <SUMMARY> /// Get/Set Lelf Volume Factor /// </SUMMARY> public int LeftVolume { get { return 0; //Guess could be used to return Volume level: I don't need it } set { mciSendString(string.Concat("setaudio MediaFile left volume to ", value), null, 0, 0); } } /// <SUMMARY> /// Get/Set Right Volume Factor /// </SUMMARY> public int RightVolume { get { return 0; //Guess could be used to return Volume level: I don't need it } set { mciSendString(string.Concat("setaudio MediaFile right volume to ", value), null, 0, 0); } } /// <SUMMARY> /// Get/Set Main Volume Factor /// </SUMMARY> public int MasterVolume { get { return 0; //Guess could be used to return Volume level: I don't need it } set { mciSendString(string.Concat("setaudio MediaFile volume to ", value), null, 0, 0); } } /// <SUMMARY> /// Get/Set Bass Volume Factor /// </SUMMARY> public int Bass { get { return 0; } set { mciSendString(string.Concat("setaudio MediaFile bass to ", value), null, 0, 0); } } /// <SUMMARY> /// Get/Set Treble Volume Factor /// </SUMMARY> public int Treble { get { return 0; } set { mciSendString(string.Concat("setaudio MediaFile treble to ", value), null, 0, 0); } } } } 

 

Now for reading the .wpl file to get MP3s [or whatever] to play
readPlaylist.cs

Collapse
using System; using System.Collections; using System.Text; using System.Xml; namespace MP3player { class readPlaylist { private ArrayList name = new ArrayList(); private string m_xmlFile; /// <SUMMARY> /// The Windows Media Playlist Path xxx.wpl file /// </SUMMARY> public string playListPath { get { return m_xmlFile; } set { m_xmlFile = value; Makeplaylist(); } } /// <SUMMARY> /// Return an Arraylist of file found in Windows Media Playlist file /// </SUMMARY> public ArrayList PlayList { get { return name; } } /// <SUMMARY> /// Fills up an Arraylist with titles found in the Windows Media Playlist file. /// Using XmlTextReader /// </SUMMARY> private void Makeplaylist() { XmlTextReader readList = new XmlTextReader(m_xmlFile); while (readList.Read()) { if (readList.NodeType == XmlNodeType.Element) { if (readList.LocalName.Equals("media")) { name.Add(readList.GetAttribute(0).ToString()); } } } } } }

Let's use the code now.
Here's a part of the file with all the click event and so on.
So here's the start, make sure you got all our references...

MediaPlayer.cs

Collapse
using System; using System.Collections; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; namespace MP3player { public partial class MainPlayer : Form { ArrayList nowPlaylist = new ArrayList(); Player pl = new Player(); public MainPlayer() { InitializeComponent(); } private void btnOpen_Click(object sender, EventArgs e) { lstBoxPlayList.Items.Clear(); openPlaylistDialog.ShowDialog(); readPlaylist readList = new readPlaylist(); readList.playListPath = openPlaylistDialog.FileName; nowPlaylist = readList.PlayList; for (int x = 0; x < nowPlaylist.Count; x++) { lstBoxPlayList.Items.Add(nowPlaylist[x]); } lstBoxPlayList.SetSelected(0, true); } 


The above code is pretty straight foward. The btnOpen_click event will open a OpenFileDialog window. Get the selected .wpl file and send it to the readPlaylist class, which will in turn parse through it return an Arraylist with all the file names and there paths. Once that done, loop it to display it's content [in this case a listbox]. Now you have all your files ready to be played, all that's needed is to select one and press play. Or doudle-click on it start it (I won't show that part here).

To play the selected file in the listbox:

 private void btnPlay_Click(object sender, EventArgs e) { if (lstBoxPlayList.Items.Count > 0) { pl.Open(lstBoxPlayList.SelectedItem.ToString()); pl.Play(false); } } 

A simple way of checking that a file is really selected before playing.
Besides that, pretty simple. Of course, if you've never done this, it's not. It's called the learning process.
As mentionned above, I think the comments in the code are pretty good. That and the MSDN link that's at the top... you should do fine.

Another thing, also tried my hand at controlling the Bass/Treble. Don't know if it works, since my speaker system on my computer ain't great, and I'm hard of hearing [hence the reason my speaker system is crappy]. But if I read the MSDN right, it seems to work the same way as the volume control.

Guess that's about it, hope this little example will help someone out.

About loneferret


Studied English Teaching as a second language at university here in montreal(you wouldn't know it the way I type would ya), after that did some networking course with a bit of programming. Mostly working as a network admin these days.
I also like to write short stories, and draw..mostly black and white stuff...

Click here to view loneferret's online profile.

Posted by tornado
|

-- DB Server 감시 데몬 하나 만드는 중 --

-- 일본어 번역기로 돌렸음 --

-- http://www.atmarkit.co.jp/fdotnet/dotnettips/392notifyicon/notifyicon.html --



 Outlook (이)나MSN Messenger 등과 같이,Windows 어플리케이션에서는 시스템 트레이(task tray, 스테이터스 영역등이라고도 불린다)에 아이콘을 표시하고, 어플리케이션 상태를 나타내거나 어플리케이션의 폼을 표시하거나하기 위한 쇼트 컷으로서 이용할 수 있다.

 .NET Framework 의 클래스·라이브러리에는, 시스템 트레이에 아이콘을 표시하기 위한NotifyIcon 컴퍼넌트가 준비되어 있어 이것을 사용하는 것으로써, 상기와 같은 어플리케이션을 간단하게 작성할 수 있다.

 본고에서는, 이하와 같은 사양의 어플리케이션을 작성하면서,NotifyIcon 컴퍼넌트의 기본적인 이용 방법에 대해 정리한다.

  • 기동시에 폼과 동시에 시스템 트레이에 아이콘을 표시한다
  • 아이콘을 오른쪽 클릭해 표시되는 문맥·메뉴의[종료]로, 어플리케이션을 종료할 수 있다.
  • 폼의 우상구석에 있는[닫는]버튼의 클릭으로, 폼을 비표시로 한다(어플리케이션은 종료하지 않는다).
  • 아이콘의 더블 클릭으로 폼을 표시해, 한편 액티브하게 한다.

시스템 트레이에의 아이콘의 표시

 우선 어플리케이션의 기동시에, 시스템 트레이에 아이콘이 표시되도록 하자.

 Visual Studio .NET 그리고Windows 어플리케이션의 프로젝트를 신규 작성해,[툴 박스]윈도우로부터NotifyIcon 컴퍼넌트를 폼상에 드러그&드롭 한다.

 다음에,[프롭퍼티]윈도우에서,Icon 프롭퍼티로 적당한 아이콘·파일(.ico 파일)을 선택한다.여기서 지정한 아이콘이, 시스템 트레이에 표시되는 아이콘이 된다.이 설정을 실시하지 않으면, 어플리케이션을 실행해도 시스템 트레이에 아이콘은 표시되지 않는다.

 또,NotifyIcon 컴퍼넌트의Text 프롭퍼티에 문자열을 설정해 두면, 그것이 아이콘의 툴·힌트·텍스트로서 사용된다.이것은 마우스·커서를 아이콘상에 이동시켰을 때에 표시된다.

시스템 트레이·아이콘에 있어서의 문맥·메뉴의 표시

 계속 되어서는, 아이콘의 오른쪽 클릭에 의해[종료]메뉴를 표시해, 그것을 실행해 어플리케이션을 종료할 수 있도록 한다.

 이것에는,ContextMenu 컴퍼넌트를 폼상에 드러그&드롭 해,[종료]메뉴 항목을 추가한다.그리고[프롭퍼티]윈도우에서,NotifyIcon 컴퍼넌트의ContextMenu 프롭퍼티에, 지금 작성했다ContextMenu 컴퍼넌트를 설정한다.

[종료]메뉴의 항목을 추가했다ContextMenu 컴퍼넌트
여기에서는 폼의 메뉴로서 디자인하지만, 메뉴(이 화면에서는contextMenu1 )(을)를NotifyIcon 컴퍼넌트의ContextMenu 프롭퍼티로 설정하는 것으로써, 아이콘을 오른쪽 클릭했을 때에 표시되게 된다.□

아이콘의[종료]메뉴에 의한 어플리케이션의 종료

 다음에, 지금 추가한[종료]메뉴 항목을 더블 클릭 하고, 메뉴 항목의 선택시에 실행되는 이벤트·핸들러를 이하와 같이 기술한다.

private void menuItem1_Click(object sender, System.EventArgs e)
{
  notifyIcon1.Visible = false; // 아이콘을 트레이로부터 없앤다
  Application.Exit(); // 어플리케이션의 종료
}
Private Sub MenuItem1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItem1.Click
  NotifyIcon1.Visible = False ' 아이콘을 트레이로부터 없앤다
  Application.Exit() ' 어플리케이션의 종료
End Sub
문맥·메뉴의[종료]의 이벤트·핸들러의 기술(위:C# , 아래:VB.NET )

 통상,Windows 폼을 종료시킬 때는Close 메소드를 호출하지만, 이번 경우에서는 다음의 항목으로 말하고 있도록(듯이)Close 메소드 호출에 의해 발생한다Closing 이벤트를 캔슬해 버리므로, 여기에서는Application.Exit 메소드에 의해 어플리케이션을 강제적으로 종료시킨다.

 또, 어플리케이션의 종료시에는 시스템 트레이에 아이콘이 남아 버리는 일이 있으므로, 아이콘(NotifyIcon 오브젝트)의Visible 프롭퍼티를false (으)로 설정하고, 명시적으로 시스템 트레이로부터 지워 둔다.

 시스템 트레이·아이콘을 이용한 어플리케이션을 작성한 경우에는, 어플리케이션이 종료했음에도 불구하고 아이콘이 남아 버려, 그 아이콘을 마우스·커서로 덧써 주면 사라진다고 하는 현상이 이따금 발생하는 일이 있지만, 그러한 경우에는 이 방법을 시험해 주셨으면 한다.

폼이[닫는]버튼·클릭에 의한 폼의 비표시

 시스템 트레이·아이콘을 표시하는, 이른바 상주형의 어플리케이션에서는, 폼의 우상구석에 있는[닫는]버튼이 클릭되어도 어플리케이션을 종료시키지 않고 , 폼을 비표시로 할 만한 경우가 많다.

 이 동작을 실장하려면 , 폼을 닫으려고 했을 때에 발생한다Closing 이벤트의 이벤트·핸들러를 폼에 추가해, 다음과 같이 기술한다.

private void Form1_Closing(object sender, System.ComponentModel.CancelEventArgs e)
{
  e.Cancel = true; // 종료 처리의 캔슬
  this.Visible = false; // 폼의 비표시
}
Private Sub Form1_Closing(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles MyBase.Closing
  e.Cancel = True ' 종료 처리의 캔슬
  Me.Visible = False ' 폼의 비표시
End Sub
폼의Closing 이벤트·핸들러의 기술(위:C# , 아래:VB.NET )

 이 이벤트·핸들러에서는, 파라미터로 건네받는다CancelEventArgs 오브젝트의Cancel 프롭퍼티에true (을)를 설정하는 것으로써, 폼의 종료 처리를 캔슬할 수 있다.

 또 여기에서는, 폼의Visible 프롭퍼티에false (을)를 설정하는 것으로써, 폼을 비표시로 한다.

아이콘의 더블 클릭에 의한 폼의 표시

 마지막으로, 폼이[닫는]버튼에 의해 비표시가 된 폼을, 시스템 트레이의 아이콘을 더블 클릭 하는 것으로써 재차 표시되도록 하자.

 이것에는NotifyIcon 컴퍼넌트에DoubleClick 이벤트·핸들러를 추가해, 다음과 같이 기술한다.

private void notifyIcon1_DoubleClick(object sender, System.EventArgs e)
{
  this.Visible = true; // 폼의 표시
  if (this.WindowState == FormWindowState.Minimized)
    this.WindowState = FormWindowState.Normal; // 최소화를 그만둔다
  this.Activate(); // 폼을 액티브하게 한다
}
Private Sub NotifyIcon1_DoubleClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles NotifyIcon1.DoubleClick
  Me.Visible = True ' 폼의 표시
  If Me.WindowState = FormWindowState.Minimized Then
    Me.WindowState = FormWindowState.Normal ' 최소화를 그만둔다
  End If
  Me.Activate() ' 폼을 액티브하게 한다
End Sub
아이콘(NotifyIcon 컴퍼넌트)의DoubleClick 이벤트·핸들러의 기술(위:C# , 아래:VB.NET )

 여기에서는, 폼이 최소화되고 있는 경우에는, 폼의WindowState 프롭퍼티에FormWindowState.Normal (을)를 설정하는 것으로써, 폼의 통상 상태에 되돌리고 있다.

 또, 폼의Activate 메소드를 호출해 폼을 액티브하게 하고 있다.이것에 의해, 폼이 다른 윈도우에 숨어 있었을 경우에도, 맨 앞면에 표시되게 된다.End of Article

Posted by tornado
|

Firebug !!!

DHTML 2006. 12. 21. 17:03

'DHTML' 카테고리의 다른 글

[링크] dhtml grid control  (0) 2007.01.25
Painless JavaScript Using Prototype  (0) 2007.01.19
이미지 없이 둥근 모서리 박스 만드는 소스  (0) 2006.11.02
http://www.codingforums.com/  (0) 2006.01.26
드뎌 나왔군... Ajax in action  (0) 2005.10.17
Posted by tornado
|

[codeproject 펌]


http://www.codeproject.com/useritems/CrystalReport_DotNET2005.asp



Sample Image - ReportView.jpg

Introduction

In this article I have tried to cover a cycle of developing a web report using Crystal Report in .NET 2005. I haven't put any effort for the butification of the report. The report is just showing the Employee master data from the Northwind database of SQL Server.

The report is build on XML Schema and the data and binded the report at runtime.


Requirements

  1. Microsoft C#.NET 2005
  2. Windows 2000/2003/XP
  3. SQL Server 2000/2005(Optional). I have used SQL Server to fecth data. If in case SQL Server is not available then change the connection string in web.config and connection related syntax in Default.aspx.cs.


Creating your own Report

To start with Reports, you need start .NET 2005 Development Studio.

  1. Start a new ASP .NET Web site, Choose Location as "File System" and provide a path.
  2. Perform "Add New Item", choose "XML Schema".
       Add elements as the picture below.

Sample screenshot

         After saving the elements will look like this, in the XML Editor        


        <xs:element name="EmployeeID" type="xs:int" />
        <xs:element name="LastName" type="xs:string" />
        <xs:element name="FirstName" type="xs:string" />
        <xs:element name="Title" type="xs:string" />
        <xs:element name="BirthDate" type="xs:dateTime" />
        <xs:element name="Address" type="xs:string" />
        <xs:element name="City" type="xs:string" />
        <xs:element name="Region" type="xs:string" />
        <xs:element name="PostalCode" type="xs:string" />
        <xs:element name="Country" type="xs:string" />
        <xs:element name="HomePhone" type="xs:string" />
 

   3.  Perform "Add New Item", choose "Crystal Report".

    1. Give a name for the report.
    2. Choose -- Using the Report Wizard. -- OK.
    3. A Data window will appear, Click on "Create New Connection" and then "ADO .NET".
    4. A connection windows will appear. Provide the XML Schema file that u have created just now. Finish.
    5. The Schema will appear under the "ADO .NET" tag. Choose. And select using > button.
    6. Click Next. Fields windows will appear. Select all using >> button.
    7. Click Finish, for taking shortcut.

    4.  Open the Default.aspx in Design mode. Add CrystalReportViewer control in to it. The source will look like this.

 <CR:CrystalReportViewer ID="CrystalReportViewer1" runat="server" AutoDataBind="true" /> 

    5.  Open the Default.aspx.cs file and paste the following codes.
 

Collapse
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
//--SqlClient for SqlConnection and etc.
using System.Data.SqlClient;
//--for CrystalReports's ReportDocument.
using CrystalDecisions.CrystalReports.Engine;
public partial class _Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        //--Sql string
        String strCmd = "";
        strCmd += "Select EmployeeID, LastName, FirstName, Title, BirthDate, ";
        strCmd += "Address, City, Region, PostalCode, Country, HomePhone ";
        strCmd += "From Employees ";
        //--Opening Sql Connection
        string strConn = ConfigurationManager.AppSettings["connectionstring"];
        SqlConnection sqlConn = new SqlConnection(strConn);
        DataSet ds = new DataSet();
        SqlDataAdapter da = new SqlDataAdapter(strCmd, sqlConn);
        //--this statement is very important, here the table name should
        //--match with the XML Schema table name
        da.Fill(ds, "Employees");
        //--Closing Sql Connection
        sqlConn.Close();
        //--(Optional) I have used it to disable the properties
        CrystalReportViewer1.DisplayGroupTree = false;
        CrystalReportViewer1.HasCrystalLogo = false;
        //--Initializing CrystalReport
        ReportDocument myReportDocument;
        myReportDocument = new ReportDocument();
        myReportDocument.Load(Server.MapPath("Employees.rpt"));
        myReportDocument.SetDataSource(ds);
        //--Binding report with CrystalReportViewer
        CrystalReportViewer1.ReportSource = myReportDocument;
        CrystalReportViewer1.DataBind();
    }
}

    6.  Open the Web.config file and change the connection string under <appSettings> as per your machine (ip address, username, password).


<appSettings>
     <add key="connectionString" value="Data Source=9.182.223.80;Initial Catalog=Northwind;Persist Security Info=True;User ID=testUser;Password=password" />
    
 </appSettings>
   If in case the file is not available then perform "Add New Item", choose "Web Configuration File", and follow the same thing.

    7.  Using the script

Just to check wheather Employees master table is available with data
   . Open SQL Server Query Analyzer
   . Copy the scripts
   . Paste into Query Analyzer
   . Press F5 to execute

---------------------------------
-----Using Database
---------------------------------
Use Northwind;
---------------------------------
-----Selecting data from Table
---------------------------------
Select EmployeeID, LastName, FirstName, Title, BirthDate,
 Address, City, Region, PostalCode, Country, HomePhone
 From Employees;
    7.  Now build the Web project. Press F5/Ctrl F5 to view the report. Hope everything will go fine.


 

About Suranjan Nandi


Suranjan Nandi has 7 years of working experience in Software Development using Microsoft Technology. During this period he was involved with .NET Technologies, COM, Client Server Architecture, Multi-tier Architecture, Crystal Reports, Database Analysis & Designing in Microsoft Environment.

Click here to view Suranjan Nandi's online profile.


Other popular ASP.NET articles:

Posted by tornado
|

Spear Gladius-SP 사용기입니다.

 

기본적인 사양입니다.

 

Model Name Gladius-SP (Neck-thru)
Colors Natural Open Pore
Body Mahogany 40mm + Spalt Maple 5mm Top Wing
Neck Hard Maple 16mm + Mahogany 6mm 5PLY
Fingerboard Rosewood (End Section Square)
No. of Frets 24 Jumbo Fret R400
Pickups 2 Humbucker
M-Paf-N Monster Pole / M-Paf-B Monster Pole
Controls 1 Volume
1 Tone
5 Way Select S/W (Mega S/W)
Bridge Floyd Rose-II Trem
Machine Heads Diecasting EG F-Type Cosmo Black
Hardware Cosmo Black
Scale Length 25.5” (648 mm)

 

 

전형적인 슈퍼스트랫형 기타입니다.
쓰루넥에 스펄티드메이플탑이 특징인 기타구요...

해외에서는 상당히 인기있는 스펄티드메이플탑이라고 하네요...

 

넥은 아이바네즈와 비교해서 약간 더 둥그스름한 느낌이구요..

아주 슬림한사이즈보단 좀더 두터운형태의 넥을 선호하시면 잘 맞을듯합니다.

 

픽업을 보시면 몬스터픽업과 유사한 외관입니다.
사운드성향도 외관과 마찬가지로 몬스터픽업을 지향한듯합니다.

시원스럽게 뻗는 느낌보다는 단단하게 뭉쳐진 느낌의 픽업사운드로 아이바네즈등의 슈퍼스트랫과는 많이 다른 느낌의 사운드입니다.
이쁘장한 슈퍼스트랫사운드가 아닌 상당히 터프한 느낌이네요..

 

튜닝관련해서두 크게 불안하거나 한거없이 안정적으로 느껴집니다.

과격한 아밍플레이가 아니라면 튜닝이 쉽게 틀어지거나 그렇진않습니다.

 

외관은 벌탑으로 인해 상당히 고급스러워보입니다.

 

이 기타역시 브릿지정도의 업글만 한다면 상당한 퀄리티의 기타라고 여겨질듯합니다.

Posted by tornado
|

http://www.castleproject.org/


시간날때 다이나믹 프락시 점 봐야겠습니다.

Posted by tornado
|





< 출처 : youtube >

Posted by tornado
|

    런던보이스 - I'm Gonna Give My HeartI'm gonna give my heartI'm gonna give my heartI'm gonna give it,Never leave a teardrop in the darkI'm gonna take my prideThe trouble and the strifeThis time you'll find me standin' up and quietPrepared to fight내 마음을 줄께요내 마음을 줄께요내가 줄께요다시는 어두움 속에서 울지 않겠어요내 자존심을 지키겠어요불화와 투쟁이번엔 당신이 보게 될꺼에요싸우기 위해 당당히 서 있는 내 모습을요I'm gonna take you upI'm gonna take you downI'm gonna take step into your life and turn itRound an'roundI'm gonna kiss your lipsI'm gonna feel your hipsI'm gonna let your body melt into my fingertips난 당신을 들어 올렸다 내렸다 할꺼에요내가 당신의 삶 속으로 들어가서 당신을 정신 못차리게 하겠어요난 당신의 입술에 키스하겠어요당신의 몸을 만질 거에요내 손가락끝으로 당신의 몸을 녹아버리게 하겠어요Nothing ever lasts foreverNothing stays the samsIn the world you will discoverRainbows follow rain어떤것도 영원한건 없어요어떤것도 그대로 머물러 있지않아요비가 오고나면 무지개가 뜬다는걸 당신은 발견할 거예요I'm gonna give my heartGonna give it from the startGive it right from the startYes I'm gonna give my heartGonna give it all I gotAnd heaven knows I got a lot내 마음을 줄께요처음 시작부터 줄께요아주 처음부터 줄께요그래요.. 내 마음을 줄께요내가 가진 모든 것을 줄께요내가 많을것을 가졌다는걸 하늘은 알지요Gonna give my heartGonna give my heartI'm gonna give it all I gotGonna give my heartGonna give my heartI wanna give you all my love내 마음을 줄께요내 마음을 줄께요내가 가진 모든 것을 줄께요 내 마음을 줄께요내 마음을 줄께요내 모든 사랑을 당신에게 줄께요I'm gonna saddle updon't wanna settle up tonightWe're gonna paint the townNo matter what you sayNo matter how you prayI'm sick and tired of waitin' for you,Walkin' in the rain.말을 탈 거예요한 곳에 머물고 싶지 않아요오늘밤 결말을 낼 거예요우린 시내를 활보하며 다닐 거예요당신이 어떤 말을 한다 해도신에게 어떻게 간청한다 해도난 빗속을 걸으며 당신을 기다리는 것에 지쳐버렸어요

          Posted by tornado
          |
          [방문히트이벤트] 40000 히트를 잡아라!
          비실비실님이 당첨되었습니다.
          Posted by tornado
          |

          'DHTML > AJAX' 카테고리의 다른 글

          [참고할곳] http://www.endless.com/  (0) 2007.01.19
          The Lightbox Effect without Lightbox  (0) 2007.01.11
          [ajax] 우편번호 찾기 초보버전  (2) 2005.08.22
          [펌] AJAX (Asynchronous Javascript and XML)  (0) 2005.06.28
          ajax 볼것....  (0) 2005.06.28
          Posted by tornado
          |

          [msmvps.com 펌]

          http://msmvps.com/blogs/luisabreu/archive/2006/10/29/UpdatePanel_3A00_-having-fun-with-errors.aspx



          UpdatePanel: having fun with errors

          UpdatePanel has always given us some sort of error handling during partial postbacks (or, if you want to use the new official term, async postbacks). In previous CTPs, you could handle a page error event and perform your own error handling (which normally consisted in some form of logging). The problem previous versions had was related with the way that the error message was shown in the client side (by default, it showed an alert message box, though you could define a limited error template). The current release give us a lot more options as I'll show you in this post.

          If you don't do anything, when you get an error during partial postback you'll get a simple alert message box showing you the error message associated with the exception you had in the server. As we all agree, this is not the best info to show to our users; it's also not a good idea to show a standard error message. If we don't mind showing an alert message in the client, then we can start by handling the AsyncPostBackError event generated by the ScriptManager control in order to customize the error message returned from the server. Here's a simple page that shows this approach:

          <%@ Page Language="C#" %>
          <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
          <script runat="server">
          void handleClick(object sender, EventArgs e)
          {
             int a = 0;
              int res = 10 / a;
          }
          void HandleError(object sender, AsyncPostBackErrorEventArgs e)
          {
              //here we could log the error, and see which exception we're getting in order to set a specific error message
              //in this case, I'm just returning the current date/hour back
              manager.AsyncPostBackErrorMessage = "Ooops...error occurred:  " +
               DateTime.Now.ToString();
          }
          </script>
          <html xmlns="http://www.w3.org/1999/xhtml" >
             <head runat="server">
               <title>Untitled Page</title>
              </head>
          <body>
            <form id="form1" runat="server">
                  <asp:ScriptManager runat="server" ID="manager"
                         OnAsyncPostBackError="HandleError">
                  </asp:ScriptManager>
                  <asp:UpdatePanel runat="server" ID="panel">
                      <ContentTemplate>
                         <asp:Button runat="server" ID="bt" Text="gerar erro no servidor"
                          OnClick="handleClick" />
                      </ContentTemplate>
                   </asp:UpdatePanel>
             </form>
          </body>
          </html>

          As you can see, when the user clicks the button, he'll get a divide by zero exception error on the server side. The previous page shows how you could log the error and return a friendly error message back to the client (the AsyncPostBackErrorMessage was introduced in this version and lets us define the error message which is returned to the client when an exception occurs on the server side). If you run the page, you'll notice that you'll still get the alert message, but this time, it'll show our fridendly error message.

          If you want, you can drop the standard alert message and show the error in any way you see fit. To illustrate the steps necessary to perform this operation, I'll start by adding a DIV ccontrol that will be used as a place holder for showing the error returned from the server:

          <div id="err"></div>

          The next thing we need to do is to handle the endRequest event which is fired by the PageRequestManager object which is present in all the pages that use UpdatePanels:

          <script type="text/javascript">
             Sys.WebForms.PageRequestManager.getInstance().add_endRequest( endRequest );
             function endRequest( sender, e ) {
                  if( e.get_error() ){
                         document.getElementById("err").innerText =  e.get_error().description;
                         e.set_errorHandled( true );
                  }
             }
          </script>

          I start by adding a method that will handle the endRequest event by using the add_endRequest method over the Sys.WebForms.PageRequestManager global object. The method starts by checking if there's an error (by using the get_error method) and, when it finds one, it gets its description (through the description field) and sets the errorHandled field of the EventArgs object used to true so that the default alert message isn't shown to the user. Though the previous code is really simple, there's nothing preventing you from using the toolkit behaviors to get similar results to the ones that we had in the previous CTPS (btw, you can also stop processing the server side error event if you don't need logging and do everything in the client side: you're the one that need to decide on what's best here!).

          For those that want to show a default error page, then there's still one additional property exposed by ScriptManager which you'll like: AllowCustomerErrors. When you set this property to true, you're saying that ScriptManager should check for a custom error page associated with the current error an show it to the user. To illustrate its usage, lets start by adding the following to the web.config file:

          <customErrors mode="On">
               <error statusCode="404" redirect ="error.aspx"/>
          </customErrors>

          And now lets run the following page:

          <%@ Page Language="C#" %>
          <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
          <script runat="server">
          void HandleClick(object sender, EventArgs e)
          {
               this.Server.Transfer("nopage.aspx"); //don't do this in reall AJAX pages!!!!!
          }
          </script>
          <html xmlns="http://www.w3.org/1999/xhtml" >
            <head runat="server">
                <title>Untitled Page</title>
             </head>
          <body>
          <form id="form1" runat="server">
             <asp:ScriptManager runat="server" ID="manager"
                  AllowCustomErrors="true" />
             <asp:UpdatePanel runat="server" ID="panel">
                 <ContentTemplate>
                    <asp:Button runat="server" id="bt" Text="postback"
                         onclick="HandleClick" />
                </ContentTemplate>
              </asp:UpdatePanel>
          </form>
          </body>
          </html>

          First, you should note that you should never use a Server.Transfer instruction on an ajax page. I'm using it since it's simplest way I could think of getting a known 404 error. Now, back to the important things: the AllowCustoErrors property. Since i've set it to true, when ScriptManager handles an exception during an async postback, it'll read the config file and see if there's any error page associated with the current error. If there is, it'll just send an AJAX message to client which instructs the browser to redirect the user to the desired page.

          As you have seen, there's now a lot more control over the way exceptions are handled during a partial postback request. You do have to write more code than in the previous versions, but it's also true that the current release is a lot more flexible than the previous one.

          Posted by tornado
          |

          [ajax.asp.net 포럼에서 펌]


          atlas 에서는 <ErrorTemplate> 에다가 설정 해놨었는데, 조금 바뀌었습니다.

          예제에는 DIV 로 배경색 바꿔서 div 로 처리하는데

          저같은 경우는 masterPage 에다 ajaxToolkit 에 있는 ModalPopupExtender 으로

          처리했습니다.


          Customizing Error Handling for UpdatePanel Controls

          Introduction

          When an error occurs during partial-page updates in UpdatePanel controls, by default a script alert box is displayed with an error message. This tutorial shows you how to customize how the error is presented to the user and what information the message contains.

          You can see the code in action in this tutorial by clicking the Run It buttons. To implement the procedures in your own development environment you need:

          • Visual Web Developer Express Edition or Visual Studio 2005.

          • The latest release of Microsoft ASP.NET AJAX installed and configured. For more information, see Installing ASP.NET AJAX.

          • An ASP.NET AJAX Web site.

          To customize error handling in server code

          1. Create a new page and switch to Design view.

          2. In the AJAX Extensions tab of Toolbox, double-click the ScriptManager control and the UpdatePanel control to add them to the page.

          3. Add two TextBox controls, a Label control, a Button control, and some text inside of the UpdatePanel control. Set the text of the button to Calculate.

            Your page will look like the following:

            UpdatePanel Tutorial
          4. Double-click the Calculate button and add the following code for its event handler.

            CS

            protected void Button1_Click(object sender, EventArgs e){    try    {        int a = Int32.Parse(TextBox1.Text);        int b = Int32.Parse(TextBox2.Text);        int res = a / b;        Label1.Text = res.ToString();    }    catch (Exception ex)    {        if (TextBox1.Text.Length > 0 && TextBox2.Text.Length > 0)        {            ex.Data["ExtraInfo"] = " You can't divide " +                TextBox1.Text + " by " + TextBox2.Text + ".";        }        throw ex;    }        }

            VB

            Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs)    Try        Dim a As Int32        a = Int32.Parse(TextBox1.Text)        Dim b As Int32        b = Int32.Parse(TextBox2.Text)        Dim res As Int32 = a / b        Label1.Text = res.ToString()    Catch ex As Exception        If (TextBox1.Text.Length > 0 AndAlso TextBox2.Text.Length > 0) Then            ex.Data("ExtraInfo") = " You can't divide " & _              TextBox1.Text & " by " & TextBox2.Text & "."        End If        Throw ex    End TryEnd Sub

            The event handler code contains a try-catch statement. In the try block, the code divides the values from the text boxes. If the operation fails, code in the catch block adds the extra string information ExtraInfo to the exception and then rethrows the exception without handling it.

          5. Switch to Design view and select the ScriptManager control.

          6. In the toolbar of the Properties window, click the Events button and then double-click the AsyncPostBackError box to create a handler for that event.

            UpdatePanel Tutorial
          7. Add the following code to the AsyncPostBackError event handler.

            CS

            protected void ScriptManager1_AsyncPostBackError(object sender, AsyncPostBackErrorEventArgs e){    if (e.Exception.Data["ExtraInfo"] != null)    {        ScriptManager1.AsyncPostBackErrorMessage =            e.Exception.Message +            e.Exception.Data["ExtraInfo"].ToString();    }    else    {        ScriptManager1.AsyncPostBackErrorMessage =            "An unspecified error occurred.";    }}

            The code checks whether the ExtraInfo data item was defined for the exception. If so, the AsyncPostBackErrorMessage property is set to the string value. Otherwise, a default error message is created.

          8. Save your changes and then press CTRL+F5 view the page in a browser.

          9. Add a number greater than zero to each text box and click the Calculate button to demonstrate a successful postback.

          10. Change the second text box input to 0 and click the Calculate button to create an error condition.

            The browser displays a message box that contains the message set in the server code.

            UpdatePanel Tutorial
            note

            The style of the alert message box depends on what browser you are using, but the message is the same in all browsers.

            To see the full example in action, click the Run It button below.

          Using Client Script to Customize Error Handling

          The preceding procedure demonstrated how to customize errors during partial-page rendering by using setting properties of the server ScriptManager control. The following procedure builds on the customization by using the client PageRequestManager class to display the error in a <div> element instead of using the default browser alert message box.

          To customize error handling in client script

          1. In the page you created earlier, switch to Source view

          2. Add the following markup to the page:

            CS

                <div id="AlertDiv" language="javascript" onclick="return AlertDiv_onclick()">        <div id="AlertMessage">        </div>        <br />        <div id="AlertButtons">            <input id="OKButton" type="button" value="OK" runat="server" onclick="ClearErrorState()" />        </div>    </div></div>

            VB

                <div id="AlertDiv" language="javascript" onclick="return AlertDiv_onclick()">        <div id="AlertMessage">        </div>        <br />        <div id="AlertButtons">            <input id="OKButton" type="button" value="OK" runat="server" onclick="ClearErrorState()" />        </div>    </div></div>

            The markup includes elements that you can use to display partial-page rendering errors. It defines a <div> element named AlertDiv that contains two other <div> elements. One of the nested <div> elements contains an <input> control that will enable users to hide the <div>.

          3. Add the following style markup in the <head> element.

            CS

            <style type="text/css">#UpdatePanel1 {  width: 200px; height: 50px;  border: solid 1px gray;}#AlertDiv{left: 40%; top: 40%;position: absolute; width: 200px;padding: 12px; border: #000000 1px solid;background-color: white; text-align: left;visibility: hidden;z-index: 99;}#AlertButtons{position: absolute; right: 5%; bottom: 5%;}</style>

            VB

            <style type="text/css">#UpdatePanel1 {  width: 200px; height: 50px;  border: solid 1px gray;}#AlertDiv{left: 40%; top: 40%;position: absolute; width: 200px;padding: 12px; border: #000000 1px solid;background-color: white; text-align: left;visibility: hidden;z-index: 99;}#AlertButtons{position: absolute; right: 5%; bottom: 5%;}</style>

            The styles make the error information stand out visually from the rest of the page content.

          4. Switch to Design view and verify that your page looks like the following:

            UpdatePanel Tutorial
          5. In the drop-down list at the top of the Properties window, select the DOCUMENT element (which represents the <body> element on the page) and set its Id property to bodytag.

            UpdatePanel Tutorial
          6. Switch to Source view.

          7. Add the following <script> block anywhere after the <asp:ScriptManager> element.

            CS

            <script type="text/javascript" language="javascript">var divElem = 'AlertDiv';var messageElem = 'AlertMessage';var bodyTag = 'bodytag';Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler);function ToggleAlertDiv(visString){     if (visString == 'hidden')     {         $get(bodyTag).style.backgroundColor = 'white';                              }     else     {         $get(bodyTag).style.backgroundColor = 'gray';                              }     var adiv = $get(divElem);     adiv.style.visibility = visString;}function ClearErrorState() {     $get(messageElem).innerHTML = '';     ToggleAlertDiv('hidden');                     }function EndRequestHandler(sender, args){   if (args.get_error() != undefined)   {       var errorMessage;       if (args.get_response().get_statusCode() == '200')       {           errorMessage = args.get_error().message;       }       else       {           // Error occurred somewhere other than the server page.           errorMessage = 'An unspecified error occurred. ';       }       args.set_errorHandled(true);       ToggleAlertDiv('visible');       $get(messageElem).innerHTML = errorMessage;   }}</script>

            VB

            <script type="text/javascript" language="javascript">var divElem = 'AlertDiv';var messageElem = 'AlertMessage';var bodyTag = 'bodytag';Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler);function ToggleAlertDiv(visString){     if (visString == 'hidden')     {         $get(bodyTag).style.backgroundColor = 'white';                              }     else     {         $get(bodyTag).style.backgroundColor = 'gray';                              }     var adiv = $get(divElem);     adiv.style.visibility = visString;}function ClearErrorState() {     $get(messageElem).innerHTML = '';     ToggleAlertDiv('hidden');                     }function EndRequestHandler(sender, args){   if (args.get_error() != undefined)   {       var errorMessage;       if (args.get_response().get_statusCode() == '200')       {           errorMessage = args.get_error().message;       }       else       {           // Error occurred somewhere other than the server page.           errorMessage = 'An unspecified error occurred. ';       }       args.set_errorHandled(true);       ToggleAlertDiv('visible');       $get(messageElem).innerHTML = errorMessage;   }}</script>

            This script does the following:

            • Defines a handler for the endRequest event of the PageRequestManager class. In the handler, the code displays the AlertDiv<div> element if there is an error condition.

            • Defines the ToggleAlertDiv function, which hides or shows the AlertDiv element and changes the color of the page based if there was an error condition.

            • Defines the ClearErrorState function, which hides the error message UI.

          8. Save your changes and then press CTRL+F5 view the page in a browser.

          9. Add a number greater than zero to each text box and click the Calculate button to demonstrate a successful postback.

          10. Change the second text box input to 0 and click the Calculate button to demonstrate an error condition.

            The custom AlertDiv element is displayed instead of default alert message box. The following figure shows an example of the error condition.

            UpdatePanel Tutorial

            To see the full example in action, click the Run It button below.

          Review

          This tutorial showed ways you can extend error handling during partial-page rendering by writing JavaScript code. In server code you can customize error handling by using the AsyncPostBackErrorMessage property and the AsyncPostBackError event of the ScriptManager control. In client code you can customize error handing by using the endRequest event of the PageRequestManager class.

          This topic is ASP.NET AJAX pre-release documentation and is unsupported by Microsoft. Blank topics are included as placeholders and existing content is subject to change in future releases.

          Posted by tornado
          |

          제 블로그에 오시는 분들 그리 많지는 않지만, 대부분 링크 타고 오셔서

           

          열심히 펌질된 글들 보고 가시는게 대부분입니다.

           

          어차피 저의 펌질은 계속 되기때문에 이곳은 계속 펌질 블로그로 쓰고,

           

          개인적인 일상 및 개발에 관련되서 직접 작성하는 글들은 제 개인 태터툴즈에 올릴 예정입니다.

           

           

          예전에 사놨던 도메인이 하나 있는데 javarush.com 이라는 도메인입니다.

           

          지금은 닷넷으로 먹고살지만 예전에 자바로 먹고 살때 샀던 도메인입니다.

           

          2002년 월드컵 할때 샀으니까 한 4년 되었군요 ^^

           

          제 개인 태터툴스는 http://javarush.com 입니다.

           

           

          '이것저것 > 낙서장' 카테고리의 다른 글

          푸마 패러디 모음  (0) 2007.01.05
          40000 히트 이벤트!!!  (0) 2006.11.30
          태터툴스로 블로그를 시작하다  (6) 2006.11.17
          이율곡님의 사투리 땜시 황당한 임금  (0) 2006.08.31
          mr.blog...  (0) 2006.08.24
          Posted by tornado
          |

          Java 나 ASP.NET 은 계정 사용료가 비싼 관계로, 저렴한 가격의 PHP 호스팅(byus.net) 의 서비스를 이용하였다.

          일년에 이만원 ^^

          네이버 블로그는 펌질 블로그로 활용하고, 이곳은 제 일상 및 업무 관련 블로그로 활용해야겠습니다.

          '이것저것 > 낙서장' 카테고리의 다른 글

          40000 히트 이벤트!!!  (0) 2006.11.30
          TatterTools 설치했습니다.  (0) 2006.11.17
          이율곡님의 사투리 땜시 황당한 임금  (0) 2006.08.31
          mr.blog...  (0) 2006.08.24
          파이트클럽 / 페르시아 왕자  (0) 2006.08.18
          Posted by tornado
          |
          [MySQL] mysqld_multi 사용법
          
          - 작성자 : 김칠봉 <san2(at)linuxchannel.net>
          - 작성일 : 2002.02.09(오타수정, 보완)
                   : 2003.01.29
          - 분 류  : mysql
          - 수 준  : 초중급이상
          - 내 용  : 하나의 서버에서 여러개의 mysqld 데몬을 띄우는 방법
          - 키워드 : mysql, mysqld, mysqld_multi, safe_mysqld, mysqld_safe
          
          *주1)
          이 문서에 대한 최신 내용은 아래 URL에서 확인할 수 있습니다.
          
          http://www.linuxchannel.net/docs/mysqld_multi.txt
          
          *주2)
          이 문서의 내용은 같은 하나의 MySQL 서버에서 여러개의 mysqld 데몬을
          띄우는 방법에 대해서 설명합니다.
          mysql 설치나 실제 실무에서 다루는 고차원적이고 상세한 기술적인
          부분은 다루지 않습니다.
          
          *주3)
          `mysqld_multi` 프로그램은 MySQL 3.23.29 이상 버전용입니다.
          
          reference :
          - http://www.mysql.com/doc/en/mysqld_multi.html
          - http://www.mysql.com/doc/en/Multiple_servers.html
          
          ---------------------------------------------------------
          목차
          1. mysqld multi 란?
          2. 서로 다른 여러개의 mysqld를 띄우는 방법(기본)
          3. mysqld_multi 을 이용하여 여러개의 mysqld 띄우는 방법
          4. MySQL 3.23.x와 MySQL 4.0.x 을 동시에 구동하는 방법
          5. 공유한 하나의 DB에 랜덤하게 접속하는 방법
          6. 후기
          ---------------------------------------------------------
          
          1. mysqld multi 란?
          
          `mysqld_multi'라는 PERL 스크립트(3.23.29 이상)를 이용하여
          같은 서버에서 여러개의 독자적인 mysqld를 운영하는 방법을 말합니다.
          
          정확히 말해서, mysql 포트나 소켓을 서로 달리하여 여러개의 mysqld
          프로세스를 띄워 운영하는 방법을 말합니다.
          
          httpd에서 80, 8080 포트로 운영하는 것이나 또는 sendmail에서
          daemonport를 서로 달리하여 운영하는 방법과 비슷한 원리입니다.
          
          
          2. 서로 다른 여러개의 mysqld를 띄우는 방법(기본)
          
          <주의>
          이 절의 내용은 여러개의 mysqld 데몬을 띄우는 기본 사항에 대해서
          다룹니다. 실제로 이렇게 운영할 수도 있지만 약간 불편하기 때문에
          권장방법은 아닙니다.
          </주의>
          
          따로 mysql을 추가로 컴파일할 필요는 없습니다. 기존의 safe_mysqld
          스크립트를 이용하면 됩니다.
          
          이때 중요한 점은 반드시 최소한 pid-file, socket 위치를 서로 다르게
          지정해야 합니다.
          
          *반드시 다르게 설정해야할 옵션)
          
          --pid-file=
          --socket=
          --port= or --skip-network
          
          나머지 옵션은 mysql을 컴파일할때 기본값으로 사용하는 값을 따르거나
          my.cnf 파일의 [mysqld] 섹션에 설정한 옵션을 따릅니다.
          
          <팁> 외부 MySQL client에서 접속을 원천 봉쇄하려면?
          mysql.host 테이블과 상관없이 아예 mysql 포트를 열지않도록
          --skip-network 옵션을 주고 mysqld를 시작하면 됩니다.
          (`netstat -atnp`로 확인).
          </팁>
          
          이하 설명은 외부 mysql client에서 접속해 오는 경우가 아닌 내부 client
          에서 접속하는 경우로 가정하겠습니다.
          
          만약 외부 mysql client(대부분 웹서버)에서 접속해야만 하는 경우라면
          --skip-network 대신 --port=# 옵션으로 바꾸어야 합니다.
          
          
          [첫번째 mysqld 구동]
          
          shell> safe_mysqld &
          or
          shell> safe_mysqld --defaults-file=/root/.my.cnf &
          
          [두번째 추가적인 mysqld 구동]
          
          shell> safe_mysqld \
            --pid-file=/usr/local/mysql/var/`hostname`.pid2 \
            --socket=/tmp/mysql.sock2 \
            --skip-network & /*** or --port=3307 ***/
          or
          shell> safe_mysqld \
            --defaults-file=/root/.my.cnf \
            --pid-file=/usr/local/mysql/var/`hostname`.pid2 \
            --socket=/tmp/mysql.sock2 \
            --skip-network & /*** or --port=3307 ***/
          
          두번째 mysqld에서 사용되는 나머지 옵션은 첫번째 mysqld의 기본 옵션을
          그대로 따릅니다. 즉 basedir, datadir 와 같은 옵션을 따로 지정하지
          않았기 때문에 어떤 값을 사용하는지를 알아보려면 다음과 같이 확인해
          봅니다.
          
          [기본적으로 사용되는 값 알아보기]
          
          shell> /usr/local/mysql/libexec/mysqld --help
          ...
          basedir:     /usr/local/mysql/
          datadir:     /usr/local/mysql/var/
          tmpdir:      /tmp/
          language:    /usr/local/mysql/share/mysql/english/
          pid file:    /usr/local/mysql/var/home.pid
          TCP port:    3306
          Unix socket: /tmp/mysql.sock
          ...
          Possible variables for option --set-variable (-O) are:
          back_log              current value: 50
          binlog_cache_size     current value: 32768
          connect_timeout       current value: 5
          ...
          
          
          [두번째 mysqld에 접속해 보기]
          
          현재 두번째 mysqld의 datadir 옵션이 없기 때문에 첫번째 mysqld의 datadir
          와 같습니다. 즉 하나의 datadir를 공유한 셈이 됩니다.
          
          *프로세스 확인)
          shell> ps -ef --cols 400 | grep mysqld
          
          *소켓 확인)
          shell> ls /tmp/mysql.sock*
          /tmp/mysql.sock  /tmp/mysql.sock2
          
          *접속해 보기)
          shell> mysql -u username -p -S /tmp/mysql.sock2 db_name
          
          '-S'(또는 --socket) 옵션으로 두번째 mysqld의 소켓 위치를 입력해 주면
          됩니다.
          
          
          [두번째 mysqld 종료하기]
          
          이와 같이 두번째, 세번째 mysqld를 구동하는 방법은 매번 옵션을 적어줘야
          하는 불편함이 있습니다(또한 관리도 썩 매끄럽지 못하고).
          
          일단 두번째 mysqld 구동에 성공하고 접속 테스트까지 끝냈다면 이제는
          필요없으니 두번째 mysqld를 종료해 봅시다.
          
          종료도 간단합니다. 단지 소켓 위치만 추가 옵션을 주면 됩니다.
          
          shell> mysqladmin -u root -p -S /tmp/mysql.sock2 shutdown
          
          
          3. mysqld_multi 을 이용하여 여러개의 mysqld 띄우는 방법
          
          mysqld_multi 프로그램은 PERL로 짜여져 있으며, PREFIX/bin/mysqld_multi에
          위치합니다. (MySQL 3.23.29 버전부터 추가되었군요.)
          
          mysql.server 또는 safe_mysqld 스크립트는 기본적으로 /etc/my.cnf 또는
          ~/.my.cnf 또는 PREFIX/var/my.cnf 설정 파일에서 [mysqld] 섹션의 옵션 내용
          을 읽어들여 mysqld 를 구동합니다.
          
          <주의>
          MySQL 4.0.x 버전은 safe_mysqld가 아니라 mysqld_safe으로 스크립트 이름이
          변경되었습니다.
          </주의>
          
          이하 mysql 설정파일(my.cnf)은 /root/.my.cnf으로 통일합니다.
          
          반면 mysqld_multi 스크립트는 [mysqld_multi], [mysqld1], [mysqld2], ...,
          [mysqld] 의 섹션을 참고합니다.
          
          정리하면,
          
            `safe_mysqld'  <-- [mysqld] <-- defaults options
          
            `mysqld_multi' <-- [mysqld_multi]
                                 |-- [mysqld1] <-- ([mysqld]) <-- defaults options
                                 |-- [mysqld2] <-- ([mysqld]) <-- defaults options
                                 |-- [mysqld3] <-- ([mysqld]) <-- defaults options
                                 `-- [mysqld#] <-- ([mysqld]) <-- defaults options
          
          이와 같은 위계로 각 섹션을 참고하여 mysqld를 구동합니다.
          (괄호안의 섹션은 그 섹션이 있다면 참고한다는 옵션입니다.)
          
          mysqld_multi 를 사용하기 위해서 /root/.my.cnf 파일에 다음과 같이
          추가해야 합니다(없다면 파일 생성).
          
          shell> /usr/local/mysql/bin/mysqld_multi --example
          
          하면 그 예제가 출력됩니다.
          
          -- /root/.my.cnf 또는 /etc/my.cnf (수정전) ----------
          [client]
          password	= 안 갈쳐조오..
          host		= localhost
          
          [mysql]
          ignore-spaces
          
          [mysqld]
          default-character-set = euc_kr
          safe-show-database
          skip-name-resolve
          #port		= 3306
          skip-network
          log
          #log-update
          user		= mysql
          set-variable 	= key_buffer=256M
          set-variable 	= thread_cache_size=8
          set-variable 	= table_cache=256
          
          [myisamchk]
          set-variable 	= key_buffer=100M
          set-variable 	= sort_buffer=100M
          set-variable 	= read_buffer=3M
          set-variable 	= write_buffer=3M
          #set-variable 	= sort_key_blocks=20
          #set-variable 	= decode_bits=10
          
          [mysqladmin]
          #set-variable 	= connect_timeout=100
          #set-variable 	= shutdown_timeout=1
          
          [mysqldump]
          user		= root
          -----------------------------------------------------
          
          -- /root/.my.cnf 또는 /etc/my.cnf (수정후) ----------
          [client]
          (생략)...
          
          [mysql]
          (생략)...
          
          [mysqld]
          default-character-set = euc_kr
          skip-name-resolve
          skip-network	## only localhost access
          language	= /usr/local/mysql/share/mysql/english
          (생략)...
          
          [mysqld_multi]
          mysqld		= /usr/local/mysql/bin/safe_mysqld
          mysqladmin	= /usr/local/mysql/bin/mysqladmin
          #user		= root
          
          [mysqld1]
          socket		= /tmp/mysql.sock1
          #port		= 3307
          pid-file	= /usr/local/mysql/var/mysqld1.pid
          datadir		= /usr/local/mysql/var
          log		= /usr/local/mysql/var/mysqld1.log
          user		= mysql
          
          [mysqld2]
          socket		= /tmp/mysql.sock2
          #port		= 3308
          pid-file	= /usr/local/mysql/var2/mysqld2.pid
          datadir		= /usr/local/mysql/var2
          log		= /usr/local/mysql/var2/mysqld2.log
          user		= mysql
          
          [myisamchk]
          (생략)...
          
          [mysqladmin]
          (생략)...
          
          [mysqldump]
          (생략)...
          -----------------------------------------------------
          
          앞의 설정에서 [mysqld1]은 datadir이 기존의 [mysqld] 섹션과 동일하므로
          하나의 datadir을 공유하겠다는 의미입니다.
          
          [mysqld2]의 datadir은 서로 다르므로 아주 독자적인 데이터베이스를 운영
          하겠다는 의미입니다.
          
          예) [mysqld2]용 datadir 만들기
          shell> mkdir /usr/local/mysql/var2
          shell> /usr/local/mysql/bin/mysql_install_db \
            --datadir=/usr/local/mysql/var2
          shell> chown mysql.mysql -R /usr/local/mysql/var2
          
          이와 같이 기본 mysql 데이터베이스를 만들어 주면 됩니다.
          
          MySQL 영문 매뉴얼에 의하면 [mysqld_multi] 섹션에 multi_admin 유저를
          다음과 같이 기존의 MySQL에 추가하여 관리하도록 하는 예제가 있습니다.
          
          shell> mysql -u root -S /tmp/mysql.sock -proot_password -e \
            "GRANT SHUTDOWN ON *.* TO multi_admin@localhost \
            IDENTIFIED BY 'multipass'"
          
          그러나 반드시 이와 같이 multi_admin 유저를 추가할 필요는 없고
          기존의 root 유저를 이용하면 그만입니다.
          
          <참고>
          [mysqld1] 섹션에서 user는 해당 mysqld의 프로세스 유저를
          의미합니다. /etc/passwd 파일에 존재한 다른 유저로도 설정가능합니다.
          만약 하나의 유저에 대한 어떤 제한(ulimt)이 있다면 mysql 유저 대신
          다른 유저를 /etc/passwd 파일에 추가하고 해당 유저를 사용하면 됩니다.
          </참고>
          
          그럼 두번째 [mysqld1], 세번째 [mysqld2] mysqld를 구동해 봅시다.
          
          shell> /usr/local/mysql/bin/mysqld_multi --help
          ...
          Usage: mysqld_multi [OPTIONS] {start|stop|report} [GNR,GNR,GNR...]
          or     mysqld_multi [OPTIONS] {start|stop|report} [GNR-GNR,GNR,GNR-GNR,...]
          ..
          
          GNR은 'Group NumbeR'를 의미하며 [mysqld#]에서 # 부분을 말합니다.
          즉 정수 단위로 1부터 가능하며 GNR 옵션이 없다면 모든 GNR을 기본값으로
          사용합니다.
          
          *mysqld 구동하기)
          shell> /usr/local/mysql/bin/mysqld_multi start
          or
          shell> /usr/local/mysql/bin/mysqld_multi start 1,2
          
          *구동확인)
          shell> /usr/local/mysql/bin/mysqld_multi report
          Reporting MySQL servers
          MySQL server from group: mysqld1 is running
          MySQL server from group: mysqld2 is running
          
          *두번째 mysqld에 접속하기
          shell> mysql [OPTIONS] -S /tmp/mysql.sock1 db_name
          
          *세번째 mysqld에 접속하기
          shell> mysql [OPTIONS] -S /tmp/mysql.sock2 db_name
          
          *두번째 mysqld 종료하기)
          shell> /usr/local/mysql/bin/mysqld_multi stop 1
          
          *두번째, 세번째 mysqld 종료하기)
          shell> /usr/local/mysql/bin/mysqld_multi stop 1,2
          
          *모든 mysqld multi 종료하기)
          shell> /usr/local/mysql/bin/mysqld_multi stop
          or
          shell> /usr/local/mysql/bin/mysqld_multi stop 1,2
          
          mysqld_multi는 safe_mysqld와 별개입니다. 어떤 옵션을 주고 구동하느냐에
          따라서 두개가 서로 연계를 갖을 수 있지만 정확히 말하면 두개의 독립된 별개의
          mysqld 입니다.
          
          즉,
          
          shell> safe_mysqld &
          shell> mysqld_multi start
          shell> mysqladmin shutdown
          shell> mysqld_multi stop
          
          이와 같이 별도로 각각 구별하여 시작/종료할 수 있습니다.
          
          만약 이와 같이 각각 서로 구별하여 운영하고 싶지 않다면
          기존의 safe_mysql의 [mysqld] 섹션을 mysqld_multi 용의 [mysqld1]으로
          수정하여 기본 mysqld로 운영할 수 있습니다.
          
          <참고> 부팅시 자동 시작하기(/etc/rc.d/rc.local)
          /usr/local/mysql/bin/mysqld_multi \
            --defaults-file=/root/.my.cnf start
          </참고>
          
          
          4. MySQL 3.23.x와 MySQL 4.0.x 을 동시에 구동하는 방법
          
          지금까지의 내용을 이해했다면 두개의 서로 다른 MySQL 버전을 구동하는
          방법은 아주 쉽습니다.
          
            MySQL 3.23.x : /usr/local/mysql
            MySQL 4.0.x  : /usr/local/mysql4
          
          에 각각 설치했다는 가정입니다.
          
          <주의>
          MySQL 4.0.x 버전은 safe_mysqld가 아니라 mysqld_safe으로 스크립트 이름이
          변경되었습니다.
          </주의>
          
          -- /root/.my.cnf 또는 /etc/my.cnf ----------------
          [client]
          (생략)...
          
          [mysql]
          (생략)...
          
          [mysqld]
          (생략)...
          
          [mysqld_multi]
          mysqld		= /usr/local/mysql4/bin/mysqld_safe ## <-- 주의
          mysqladmin	= /usr/local/mysql4/bin/mysqladmin
          #user		= root
          
          [mysqld1]
          socket		= /tmp/mysql4.sock1
          #port		= 3307
          skip-name-resolve
          skip-network	## only localhost access
          default-character-set = euc_kr
          pid-file	= /usr/local/mysql4/var/mysqld1.pid
          datadir		= /usr/local/mysql4/var
          language	= /usr/local/mysql4/share/mysql/english
          log		= /usr/local/mysql4/var/mysqld1.log
          user		= mysql
          
          [myisamchk]
          (생략)...
          
          [mysqladmin]
          (생략)...
          
          [mysqldump]
          (생략)...
          -----------------------------------------------------
          
          *MySQL 3.23.x 구동
          shell> safe_mysqld &
          
          *MySQL 4.0.x 구동
          shell> mysqld_multi start
          
          필자가 이 방법을 소개한 이유는 MySQL 4.0.x 버전으로 업그레이드할 경우
          관리자가 조용하게(?) 테스트해 보아, 이상이 없다면 아무도 모르게(?)
          조용하게 업그레이드할 수 있다는 점입니다.
          
          물론 다음의 URL을 먼저 알아두어야 합니다.
          
            - http://www.mysql.com/doc/en/Upgrading-from-3.23.html
          
          
          5. 공유한 하나의 DB에 랜덤하게 접속하는 방법
          
          이 방법의 서로 다른 여러개의 mysqld 데몬의 datadir을 모두 동일하게
          설정하여 운영하는 방법입니다.
          
          여러개의 mysqld 데몬을 띄어야 하므로 시스템에 충분한 메모리가 있어야
          합니다(512M 이상).
          
          *권장 하는 경우)
          1. 시스템 부하가 극도로 높지 않는 경우.
          2. 하나(socket)의 mysqld로 시스템을 운영하기에는 자원이 남는 경우
          3. 하나의 mysqld로 서비스가 포화 상태인 경우
          4. 기타 테스트로 전보다 낫은 성능을 낼 경우
          
          
          <주의>
          필자가 테스트해 본 바로는 시스템 부하(CPU 사용량 95%이상)가 심한
          경우, 좋은 대안이 될 수 없습니다(큰 효과가 없음).
          (여러개의 mysqld 데몬을 띄우지 않아도 얼마든지 높은 퍼포먼스를
          낼 수 있습니다)
          다만, 이 방법은 여러가지 더 많은 테스트를 해보아, 전보다 좀더 낫은
          성능을 낼 경우에만 사용하도록 하세요.
          </주의>
          
          -- /root/.my.cnf 또는 /etc/my.cnf ----------------
          [client]
          (생략)...
          
          [mysql]
          (생략)...
          
          [mysqld]
          default-character-set = euc_kr
          skip-name-resolve
          skip-network	## only localhost access
          datadir		= /usr/local/mysql/var
          language	= /usr/local/mysql/share/mysql/english
          user		= mysql
          (생략)...
          
          [mysqld_multi]
          mysqld		= /usr/local/mysql/bin/safe_mysqld
          mysqladmin	= /usr/local/mysql/bin/mysqladmin
          #user		= root
          
          [mysqld1]
          socket		= /tmp/mysql.sock1
          #port		= 3307
          pid-file	= /usr/local/mysql/var/mysqld1.pid
          log		= /usr/local/mysql/var/mysqld1.log
          
          [mysqld2]
          socket		= /tmp/mysql.sock2
          #port		= 3308
          pid-file	= /usr/local/mysql/var/mysqld2.pid
          log		= /usr/local/mysql/var/mysqld2.log
          
          [mysqld3]
          socket		= /tmp/mysql.sock3
          #port		= 3309
          pid-file	= /usr/local/mysql/var/mysqld3.pid
          log		= /usr/local/mysql/var/mysqld3.log
          
          [myisamchk]
          (생략)...
          
          [mysqladmin]
          (생략)...
          
          [mysqldump]
          (생략)...
          -----------------------------------------------------
          
          앞의 설정을 요약하면 각 그룹 [mysqld#]는 datadir 옵션이 없으므로
          [mysqld] 섹션의 datadir를 그대로 따릅니다.
          즉 모두 같은 하나의 datadir을 공유하는 결과가 됩니다.
          
          또한 log 옵션을 생략하면 기본 [mysqld] 섹션의 log 옵션을 따릅니다.
          앞의 예제는 접속 확인을 알아보기 위해서 각각 다른 log 파일에 기록
          하도록 했을 뿐입니다.
          
          만약 하나의 유저로 모두 구동하고 싶지 않다면 각 [mysqld#] 섹션에
          해당 user 옵션을 설정해 주면 됩니다.
          (하나의 유저당 파일 제한수가 적을 경우)
          
          shell> mysqld_multi start
          
          이렇게 명령어를 내리면 추가로 3개의 각각 독립된 mysqld가 구동되며,
          모두 동일한 하나의 datadir를 공유합니다.
          
          만약 1, 2번 mysqld만 시작하도록 하고 싶다면
          
          shell> mysqld_multi start 1,2
          
          이렇게 추가 옵션을 주면 됩니다.
          
          shell> mysqld_multi report
          
          앞의 명령어로 3개 모두 구동하는지 확인해 보도록 하세요.
          
          이제는 랜덤하게 1, 2, 3번에 접속하도록 socket 파일만 랜덤하게 선택해
          주면 됩니다.
          
          만약 PHP로 접근한다면(검색에만 적용),
          
          ----------------------------------------------------
          <?php
          ##
          ## 검색모드에만 적용
          if('검색모드인경우') {
            $sock = '/tmp/mysql.sock' . rand(1,3);
            ini_set('mysql.default_socket',$sock);
          }
          
          (생략: 나머지는 기존과 동일)
          
          ?>
          ----------------------------------------------------
          
          이렇게 접속하는 기본 socket 파일 위치를 랜덤하게 만들어 주면 됩니다.
          
          만약 각각 datadir이 서로 다르고 독자적으로 모두 별개의 MySQL 서비스를
          한다면, 관리자 측면에서 다음과 같이 설정할 수 있습니다.
          
          -- httpd.conf --------------------------------------
          ...
          <VirtualHost xxxx>
            ...
            php_value mysql.default_socket "/tmp/mysql.sock1"
          </VirtualHost>
          
          <VirtualHost xxxx>
            ...
            php_value mysql.default_socket "/tmp/mysql.sock2"
          </VirtualHost>
          
          <VirtualHost xxxx>
            ...
            php_value mysql.default_socket "/tmp/mysql.sock3"
          </VirtualHost>
          ----------------------------------------------------
          
          or
          
          -- DOCUMENT_ROOT/.htaccess -------------------------
          ...
          php_value mysql.default_socket "/tmp/mysql.sock2"
          ----------------------------------------------------
          
          
          6. 후기
          
          (생략)
          
          
          EOF
          

          'SQL > MySQL' 카테고리의 다른 글

          [MySQL] hierarchical Data 표현...  (0) 2009.02.11
          [MySQL] Got error 28 from storage engine  (0) 2008.03.03
          mysql 관리 툴 EMS  (0) 2006.09.30
          [Mysql] GRANT로 사용자 추가하기  (0) 2006.08.28
          replication 사용하기.. version - 4.0.17  (0) 2004.07.06
          Posted by tornado
          |

          펌 : 미니위니

          by : 제민 (siopo)



          소스


          <style type="text/css">
           .rtop, .rbottom{display:block; background: #FFFFFF;}
           .rtop *, .rbottom *{display: block; height: 1px; overflow: hidden; }

           .r { text-align: center; width: 120px; font: bold 9px tahoma; }
           .r1 { margin: 0 5px; background: #DEDEDE; height: 1px; }
           .r2 { margin: 0 3px; border: solid #DEDEDE; border-width: 0 2px; }
           .r3 { margin: 0 2px; border: solid #DEDEDE; border-width: 0 1px; }
           .r4 { margin: 0 1px; border: solid #DEDEDE; border-width: 0 1px;  height: 2px}
           
           .r5 {margin: 0 2px; background: #DEDEDE; height: 1px}
           .r6 {margin: 0 1px; background: #FFFFFF; border: solid #DEDEDE; border-width: 0 1px;  height: 1px}
           
           .rc { border: solid #DEDEDE; border-width: 0 1px; }
          </style>

          <div class="r">
           <b class="rtop"><b class="r1"></b><b class="r2"></b><b class="r3"></b><b class="r4"></b></b>
           <div class="rc">
            Round Table 1
           </div>
           <b class="rbottom"><b class="r4"></b><b class="r3"></b> <b class="r2"></b><b class="r1"></b></b>
          </div>

          <br />

          <div class="r">
           <b class="rtop"><b class="r5"></b><b class="r6"></b></b>
           <div class="rc">
            Round Table 2
           </div>
           <b class="rbottom"><b class="r6"></b><b class="r5"></b></b>
          </div>



          결과

          'DHTML' 카테고리의 다른 글

          Painless JavaScript Using Prototype  (0) 2007.01.19
          Firebug !!!  (0) 2006.12.21
          http://www.codingforums.com/  (0) 2006.01.26
          드뎌 나왔군... Ajax in action  (0) 2005.10.17
          [펌] 동적 테이블 생성 샘플 DHTML  (0) 2005.09.06
          Posted by tornado
          |

          http://xfire.codehaus.org/


          Codehaus XFire is a next-generation java SOAP framework. Codehaus XFire makes service oriented development approachable through its easy to use API and support for standards. It is also highly performant since it is built on a low memory StAX based model.

          Posted by tornado
          |

          Javascript로 구현한 UTF-8 URLEncoding


          <SCRIPT LANGUAGE="JavaScript">

           

          /*  Function Equivalent to java.net.URLEncoder.encode(String, "UTF-8")

              Copyright (C) 2002, Cresc Corp.

              Version: 1.0

          */

          function encodeURL(str){

              var s0, i, s, u;

              s0 = "";                // encoded str

              for (i = 0; i < str.length; i++){   // scan the source

                  s = str.charAt(i);

                  u = str.charCodeAt(i);          // get unicode of the char

                  if (s == " "){s0 += "+";}       // SP should be converted to "+"

                  else {

                      if ( u == 0x2a || u == 0x2d || u == 0x2e || u == 0x5f || ((u >= 0x30) && (u <= 0x39)) || ((u >= 0x41) && (u <= 0x5a)) || ((u >= 0x61) && (u <= 0x7a))){       // check for escape

                          s0 = s0 + s;            // don't escape

                      }

                      else {                  // escape

                          if ((u >= 0x0) && (u <= 0x7f)){     // single byte format

                              s = "0"+u.toString(16);

                              s0 += "%"+ s.substr(s.length-2);

                          }

                          else if (u > 0x1fffff){     // quaternary byte format (extended)

                              s0 += "%" + (oxf0 + ((u & 0x1c0000) >> 18)).toString(16);

                              s0 += "%" + (0x80 + ((u & 0x3f000) >> 12)).toString(16);

                              s0 += "%" + (0x80 + ((u & 0xfc0) >> 6)).toString(16);

                              s0 += "%" + (0x80 + (u & 0x3f)).toString(16);

                          }

                          else if (u > 0x7ff){        // triple byte format

                              s0 += "%" + (0xe0 + ((u & 0xf000) >> 12)).toString(16);

                              s0 += "%" + (0x80 + ((u & 0xfc0) >> 6)).toString(16);

                              s0 += "%" + (0x80 + (u & 0x3f)).toString(16);

                          }

                          else {                      // double byte format

                              s0 += "%" + (0xc0 + ((u & 0x7c0) >> 6)).toString(16);

                              s0 += "%" + (0x80 + (u & 0x3f)).toString(16);

                          }

                      }

                  }

              }

              return s0;

          }

           

          /*  Function Equivalent to java.net.URLDecoder.decode(String, "UTF-8")

              Copyright (C) 2002, Cresc Corp.

              Version: 1.0

          */

          function decodeURL(str){

              var s0, i, j, s, ss, u, n, f;

              s0 = "";                // decoded str

              for (i = 0; i < str.length; i++){   // scan the source str

                  s = str.charAt(i);

                  if (s == "+"){s0 += " ";}       // "+" should be changed to SP

                  else {

                      if (s != "%"){s0 += s;}     // add an unescaped char

                      else{               // escape sequence decoding

                          u = 0;          // unicode of the character

                          f = 1;          // escape flag, zero means end of this sequence

                          while (true) {

                              ss = "";        // local str to parse as int

                                  for (j = 0; j < 2; j++ ) {  // get two maximum hex characters for parse

                                      sss = str.charAt(++i);

                                      if (((sss >= "0") && (sss <= "9")) || ((sss >= "a") && (sss <= "f"))  || ((sss >= "A") && (sss <= "F"))) {

                                          ss += sss;      // if hex, add the hex character

                                      } else {--i; break;}    // not a hex char., exit the loop

                                  }

                              n = parseInt(ss, 16);           // parse the hex str as byte

                              if (n <= 0x7f){u = n; f = 1;}   // single byte format

                              if ((n >= 0xc0) && (n <= 0xdf)){u = n & 0x1f; f = 2;}   // double byte format

                              if ((n >= 0xe0) && (n <= 0xef)){u = n & 0x0f; f = 3;}   // triple byte format

                              if ((n >= 0xf0) && (n <= 0xf7)){u = n & 0x07; f = 4;}   // quaternary byte format (extended)

                              if ((n >= 0x80) && (n <= 0xbf)){u = (u << 6) + (n & 0x3f); --f;}         // not a first, shift and add 6 lower bits

                              if (f <= 1){break;}         // end of the utf byte sequence

                              if (str.charAt(i + 1) == "%"){ i++ ;}                   // test for the next shift byte

                              else {break;}                   // abnormal, format error

                          }

                      s0 += String.fromCharCode(u);           // add the escaped character

                      }

                  }

              }

              return s0;

          }

          </SCRIPT>

          Posted by tornado
          |

          grails site

          JAVA/Grails 2006. 10. 14. 12:52
          Posted by tornado
          |