2014. 4. 30. 18:00

//URL에서 IP획득

string searchIpFromUrl = new System.Net.WebClient().DownloadString(("http://checkip.dyndns.org"));


//자를부분

        string EtcIpInfo = searchIpFromUrl.Substring(searchIpFromUrl.IndexOf("</body>"), searchIpFromUrl.Length - searchIpFromUrl.IndexOf("</body>"));


//전체에서 시작점~ 전체길이-앞뒤자를부분

        string serverIp = searchIpFromUrl.Substring(searchIpFromUrl.IndexOf(":") + 1, searchIpFromUrl.Length - searchIpFromUrl.IndexOf(":") - EtcIpInfo.Length - 1).Trim();

'ASP.NET' 카테고리의 다른 글

Visual Studio 단축키  (0) 2014.09.25
C# MailMessage - SMTP(smtp.gmail.com / 발신자 이메일 설정)  (0) 2014.08.28
DevExpress Gridview Update,Cancel버튼 숨기기  (0) 2014.03.26
C# 배열 선언,초기화  (0) 2014.03.25
C# 정규표현식  (0) 2014.03.20
Posted by YKYun
2014. 3. 27. 13:23
datetime

1753년 1월 1일에서 9999년 12월 31일까지 1/300초 또는 3.33밀리초의 정확성을 가진 날짜 및 시간 데이터.

smalldatetime

1900년 1월 1일에서 2079년 6월 6일까지 1분의 정확성을 가진 날짜 및 시간 데이터.

Posted by YKYun
2014. 3. 26. 10:13
protected void gridView_CommandButtonInitialize(object sender, ASPxGridViewCommandButtonEventArgs e) {
    if (e.ButtonType == ColumnCommandButtonType.Update || e.ButtonType == ColumnCommandButtonType.Cancel) {
        e.Visible = false;
    }
}


'ASP.NET' 카테고리의 다른 글

C# MailMessage - SMTP(smtp.gmail.com / 발신자 이메일 설정)  (0) 2014.08.28
C# 외부IP 획득하기  (0) 2014.04.30
C# 배열 선언,초기화  (0) 2014.03.25
C# 정규표현식  (0) 2014.03.20
C# string.format  (0) 2014.03.01
Posted by YKYun
2014. 3. 25. 13:35

■ 1차원 배열 선언 및 초기화

 

ex) 4개의 정수 값을 가지는 배열 생성

     [1,2,3,4]

 

#1. int [] nTemp = new int[] {1,2,3,4};

 

#2. int [] nTemp = new int[4] {1,2,3,4};

※ 주의 사항 : 배열의 개수를 명시적으로 입력 하였을 경우에 초기값 설정은 개수만큼 모두 입력 해야합니다.

#3 int [] nTemp = {1,2,3,4};

 

■  2차원 배열 선언 및 초기화

 

ex)  2 by 2의 2차원 정수 배열 생성

     [1,2]

     [3,4]

 

#1. int [,] nTemp = new int[,] {{1,2},{3,4}};

 

#2. int [,] nTemp = new int[2,2] {{1,2},{3,4}};

※ 주의 사항 : 1차원 배열 초기화와 마찬가지로 행렬을 명시적으로 입력했을 경우 초기화 값을 모두 입력 해야합니다.

#3 int [,] nTemp = {{1,2},{3,4}};


'ASP.NET' 카테고리의 다른 글

C# MailMessage - SMTP(smtp.gmail.com / 발신자 이메일 설정)  (0) 2014.08.28
C# 외부IP 획득하기  (0) 2014.04.30
DevExpress Gridview Update,Cancel버튼 숨기기  (0) 2014.03.26
C# 정규표현식  (0) 2014.03.20
C# string.format  (0) 2014.03.01
Posted by YKYun
2014. 3. 20. 17:42

■ 정규표현식
    정해진 패턴을 사용해서 패턴에 일치하는 데이터 검색을 지원하는 표현식

 

■ 정규표현식에 쓰이는 특수문자
   1. '.'
      임의의  문자
      ex) s.e -> sae, sbe, sce, sde ...
          .ce -> ace, kce, dce ...
 
   2. '*'
      바로 앞의 문자가 없거나 하나 이상
      ex) s*e -> e, se, see, ssse ...
          abc* -> ab, abc, abcc, abccc ...
          h*im -> im, him, hhim, hhhim ...

 

   3. '+'
      바로 앞의 문자가 하나 이상
      ex) s+e -> se, sse, ssse ...

 

   4. '?'
      바로 앞의 문자가 없거나 하나
      ex) th?e -> e, the 이 두가지표현이 유일하겠지.

 

   5. '^'      (문자열에 대한 녀석)
      바로 뒤의 문자열로 시작.
      ex) ^The.. 뒷부분부터 공백까지 검사. -> The girl is, Theather
          ^a?bc -> bc, abc ...
          ^.e -> he, me, request, settle ...
          ^s.e?.. e는 나와도 되고 안나와도 되고 -> sa, sae, sb, sbe ...

 

   6. '$'      (문자열에 대한 녀석)
      바로 앞의 문자열로 종료
      ex) a?bc$ -> eeabe, seebc, bc ..
          +.e$ -> onthetoe, bctae, appetittle ...
          s?c+$ -> e, se, ee, eee, seee, seee ...

 

   7. '[]'
      [] 안에 있는 문자 중 하나
      범위는 '-'로 지정
      ex) [ab]cd -> acd, bcd ..
          [a-z] -> 영문 소문자
          [a-zA-Z] -> 영문자........ 자바스크립트에서 어렵게 구현한 녀석들인데 간편하내~
          [0-9] -> 숫자
          ag[a-z] -> aga, agbcd, agzzz ...

          ^ab[cd]ef -> abcef, abdef ...
          ^[a-zA-Z] -> 영문자로 시작....
                       아이디 검사할 때 첫글자가 영문자와 '_' 만 쓰도록 할때는 ^[a-zA-Z_]
          ^[가-힣]  ->  한글로 시작해야 할 때
          [^a-zA-Z0-9]   ->   ^이 안으로 들어가면 제외의 의미가 된다는거~ 부정의 의미.. 영문자나 숫자로 시작 X
          [a-zA-Z0-9]$ -> 영문자나 숫자로 종료

          "[가-힣]"   ->  한글... 완성형만 가능해.. 가령, ㅋㅋㅋ 같은 녀석은 안된다는 거지.
          "[abc]"  ->   이 안에 있는 문자중에 하나. 즉, a b c 중에 하나의 문자란 말이지.
                        C#문법으로 치면 ("a" || "b" || "c")와 같은 개념이야..


    8. '{}'
       {} 앞의 문자나 문자열 출현 횟수, 스키마에서 min/maxoccur과 같은 개념으로 이해하렴.
       ex) a{2}b -> aab ... a가 꼭 2번 나와야 한다는 뜻.
           a{2,}b -> aab, aaab, aaaab ...  a가 최소 2번 이상 나오도록 하라는 뜻.
           a{2, 3}b -> aab, aaab   ... a는 최소 2번 최대 3번 나오도록 하라는 뜻.

 

    9. '()'
       ()안에 있는 문자를 그룹화
       ex) a(bc){2} -> abcbc  ... a다음 bc가 2번 나와야 한다는 뜻..
           a(bc)* -> abcbcbc ...  a다음 bc의 출현횟수는 무한대가 가능하다는 뜻.

 

    10. '|'
        or 연산자.......
        영어로만 아이디를 만들어라?      [a-zA-Z]+    공백이 없는 영어단어
        ex) he|she -> he, she is..
            (he|she)is -> heis, sheis ...


    11. 특수 문자 사용
        ^  []  $  ()  |  *  +  ?  {}  \
        앞에 \ 붙여서 사용
        ex) \*+  -> * 가 하나 이상 포함된 패턴...... * 나 ** 나 *** 별이 무한대로 계속도 가능하고 말야.

            \d : 순수한 숫자, 정수값, 0-9
            \d{2,3}-/d{3,4}-/d{4}  :   전화번호를 찾는 정규식이야... 여기서 하이퍼는 그냥 하이퍼(-)야.
                                       -? 하이퍼뒤에 물음표가 있으면 하이퍼가 있어도 되고 없어도 된다는 뜻.
            \D : 숫자가 아닌 나머지 모든 얘.
            \w : [a-zA-Z0-9] 의 줄임표현.
            \W : [^a-zA-Z0-9] 영문자와 숫자만 아니면 된다는 뜻.
            \s : 공백
            \S : 공백이 아닌 나머지 얘들.
      

 

     12. 문제
         1) 4.6% 라는 걸 찾겠다.
               [0-9]{1,3}\.?[0-9]*%

 

         2) 전화번호를 찾자.
                \d{2,3}-\d{3,4}-\d{4}
             [0-9]{2,3}-[0-9]{3,4}-[0-9]{4}

 

         3) url 주소를 가져와보자.
                http://([\w-]+\.)+[\w-]+(/[\w- ./?%&=]*)?

 

         4) 이름 : ( textBox    )
                [가-힣]{2,5}     ->   한글을 최소 2~5까지 입력가능하다는 뜻.

 

         5) 나이 : ( textBox    )
                [0-9]{1,2}       ->   숫자가 최소 1~2까지 입력가능하다는 뜻.
                1?[0-9]?[0-9]

 

         6) 민증번호
                [0-9]{6}-[0-9]{7}
             [0-9][0-9][01][0-9][0123][0-9]-[12][0-9]{6}
           

 

                 ▒

 


1. 자바에서의 유효성검사를 다시 기억해보자.
   function send()
   {
      var ex = /^[가-힣]{2,5}%;       --> " " 로 감싸면 X, 그럼 문자값이 되버리잖니..
               // 만약 위처럼 이름검사가 아닌 전화번호입력이라면..
                  var ex = /\d{2,3}-\d{3,4}-\d{4};

      if (ex.test(document.all.txtName.value))     --> 닷넷에서의 Match와 비슷한 test()함수
      {
           alert("ok");
      }
      else
      {
           alert("..");
      }
   }

'ASP.NET' 카테고리의 다른 글

C# MailMessage - SMTP(smtp.gmail.com / 발신자 이메일 설정)  (0) 2014.08.28
C# 외부IP 획득하기  (0) 2014.04.30
DevExpress Gridview Update,Cancel버튼 숨기기  (0) 2014.03.26
C# 배열 선언,초기화  (0) 2014.03.25
C# string.format  (0) 2014.03.01
Posted by YKYun
2014. 3. 3. 13:35

declare @RowCount int, @tablename varchar(100)


declare @Tables table (


                                    PK int IDENTITY(1,1),


                                    tablename varchar(100),


                                    processed bit


                                    )


INSERT into @Tables (tablename)


SELECT TABLE_NAME from INFORMATION_SCHEMA.TABLES where TABLE_TYPE = 'BASE TABLE' and TABLE_NAME not like 'dt%' order by TABLE_NAME asc


 


declare @Space table (


                              name varchar(100), 


                              rows nvarchar(100), 


                              reserved varchar(100), 


                              data varchar(100), 


                              index_size varchar(100), 


                              unused varchar(100)


                              )


 


select top 1 @tablename = tablename from @Tables where processed is null


 


SET @RowCount = 1


 


WHILE (@RowCount <> 0)


      BEGIN


      insert into @Space exec sp_spaceused @tablename


      update @Tables set processed = 1 where tablename = @tablename


      select top 1 @tablename = tablename from @Tables where processed is null


      SET @RowCount = @@RowCount


END


 


update @Space set data = replace(data, ' KB', '')


update @Space set data = convert(int, data)/1000


update @Space set data = data + ' MB'


update @Space set reserved = replace(reserved, ' KB', '')


update @Space set reserved = convert(int, reserved)/1000


update @Space set reserved = reserved + ' MB'


 


select * from @Space order by convert(int, replace(data, ' MB', '')) desc

Posted by YKYun
2014. 3. 1. 17:07

*********  로그정리

backup log DATABASE_NAME with truncate_only

dbcc shrinkdatabase(DATABASE_NAME, truncateonly)

dbcc shrinkdatabase(DATABASE_NAME, 500) 


ALTER INDEX ALL ON 테이블명 REBUILD WITH (PAD_INDEX = ON, FILLFACTOR = 90)


//파일삭제

forfiles /P E:\DB_BACKUP\ /D -14  /M *.bak /C "cmd /C echo copy: @file && del @file"



*********  2008 로그삭제


USE TestDB;

GO


-- Truncate the log by changing the database recovery model to SIMPLE.

ALTER DATABASE TestDB

SET RECOVERY SIMPLE;

GO


-- Shrink the truncated log file to 1 MB.

DBCC SHRINKFILE (TestDB_Log, 1);

GO


-- Reset the database recovery model.

ALTER DATABASE TestDB

SET RECOVERY FULL;

GO





********* 2008이상 cmd명령어 허용


-- To allow advanced options to be changed.

EXEC sp_configure 'show advanced options', 1

GO

-- To update the currently configured value for advanced options.

RECONFIGURE

GO

-- To enable the feature.

EXEC sp_configure 'xp_cmdshell', 1

GO

-- To update the currently configured value for this feature.

RECONFIGURE

GO






**** 계속 복원중인 DB 재복원

RESTORE DATABASE F40_SAMOH WITH RECOVERY



'SQL' 카테고리의 다른 글

MS-SQL 유용한 명령어  (0) 2018.03.21
SQL Datetime범위  (0) 2014.03.27
Send_Mail  (0) 2012.06.21
서버에있는 image형식 파일 다운로드  (0) 2012.06.21
SQL Backup Schedule root : NAS  (0) 2012.05.22
Posted by YKYun
2014. 3. 1. 16:45

int 예제

Add zeroes before number

String.Format("{0:00000}", 15); // "00015"
String.Format("{0:00000}", -15); // "-00015"

Align number to the right or left

String.Format("{0,5}", 15); // " 15"
String.Format("{0,-5}", 15); // "15 "
String.Format("{0,5:000}", 15); // " 015"
String.Format("{0,-5:000}", 15); // "015 "

Different formatting for negative numbers and zero

String.Format("{0:#;minus #}", 15); // "15"
String.Format("{0:#;minus #}", -15); // "minus 15"
String.Format("{0:#;minus #;zero}", 0); // "zero"

Custom number formatting (e.g. phone number)

String.Format("{0:+### ### ### ###}", 447900123456); // "+447 900 123 456"
String.Format("{0:##-####-####}", 8958712551); // "89-5871-2551"

double 예제

Digits after decimal point

// just two decimal places
String.Format("{0:0.00}", 123.4567); // "123.46"
String.Format("{0:0.00}", 123.4); // "123.40"
String.Format("{0:0.00}", 123.0); // "123.00"
// max. two decimal places
String.Format("{0:0.##}", 123.4567); // "123.46"
String.Format("{0:0.##}", 123.4); // "123.4"
String.Format("{0:0.##}", 123.0); // "123"

Digits before decimal point

// at least two digits before decimal point
String.Format("{0:00.0}", 123.4567); // "123.5"
String.Format("{0:00.0}", 23.4567); // "23.5"
String.Format("{0:00.0}", 3.4567); // "03.5"
String.Format("{0:00.0}", -3.4567); // "-03.5"

Thousands separator

String.Format("{0:0,0.0}", 12345.67); // "12,345.7"
String.Format("{0:0,0}", 12345.67); // "12,346"

Zero

String.Format("{0:0.0}", 0.0); // "0.0"
String.Format("{0:0.#}", 0.0); // "0"
String.Format("{0:#.0}", 0.0); // ".0"
String.Format("{0:#.#}", 0.0); // ""

Align numbers with spaces

String.Format("{0,10:0.0}", 123.4567); // " 123.5"
String.Format("{0,-10:0.0}", 123.4567); // "123.5 "
String.Format("{0,10:0.0}", -123.4567); // " -123.5"
String.Format("{0,-10:0.0}", -123.4567); // "-123.5 "

Custom formatting for negative numbers and zero

String.Format("{0:0.00;minus 0.00;zero}", 123.4567); // "123.46"
String.Format("{0:0.00;minus 0.00;zero}", -123.4567); // "minus 123.46"
String.Format("{0:0.00;minus 0.00;zero}", 0.0); // "zero"

Some funny examples

String.Format("{0:my number is 0.0}", 12.3); // "my number is 12.3"
String.Format("{0:0aaa.bbb0}", 12.3); // "12aaa.bbb3"

DateTime 예제

Custom DateTime Formatting

// create date time 2008-03-09 16:05:07.123
DateTime dt = new DateTime(2008, 3, 9, 16, 5, 7, 123);

String.Format("{0:y yy yyy yyyy}", dt); // "8 08 008 2008" year
String.Format("{0:M MM MMM MMMM}", dt); // "3 03 Mar March" month
String.Format("{0:d dd ddd dddd}", dt); // "9 09 Sun Sunday" day
String.Format("{0:h hh H HH}", dt); // "4 04 16 16" hour 12/24
String.Format("{0:m mm}", dt); // "5 05" minute
String.Format("{0:s ss}", dt); // "7 07" second
String.Format("{0:f ff fff ffff}", dt); // "1 12 123 1230" sec.fraction
String.Format("{0:F FF FFF FFFF}", dt); // "1 12 123 123" without zeroes
String.Format("{0:t tt}", dt); // "P PM" A.M. or P.M.
String.Format("{0:z zz zzz}", dt); // "-6 -06 -06:00" time zone


// date separator in german culture is "." (so "/" changes to ".")
String.Format("{0:d/M/yyyy HH:mm:ss}", dt); // "9/3/2008 16:05:07" - english (en-US)
String.Format("{0:d/M/yyyy HH:mm:ss}", dt); // "9.3.2008 16:05:07" - german (de-DE)

// month/day numbers without/with leading zeroes
String.Format("{0:M/d/yyyy}", dt); // "3/9/2008"
String.Format("{0:MM/dd/yyyy}", dt); // "03/09/2008"

// day/month names
String.Format("{0:ddd, MMM d, yyyy}", dt); // "Sun, Mar 9, 2008"
String.Format("{0:dddd, MMMM d, yyyy}", dt); // "Sunday, March 9, 2008"

// two/four digit year
String.Format("{0:MM/dd/yy}", dt); // "03/09/08"
String.Format("{0:MM/dd/yyyy}", dt); // "03/09/2008"

Standard DateTime Formatting

String.Format("{0:t}", dt); // "4:05 PM" ShortTime
String.Format("{0:d}", dt); // "3/9/2008" ShortDate
String.Format("{0:T}", dt); // "4:05:07 PM" LongTime
String.Format("{0:D}", dt); // "Sunday, March 09, 2008" LongDate
String.Format("{0:f}", dt); // "Sunday, March 09, 2008 4:05 PM" LongDate+ShortTime
String.Format("{0:F}", dt); // "Sunday, March 09, 2008 4:05:07 PM" FullDateTime
String.Format("{0:g}", dt); // "3/9/2008 4:05 PM" ShortDate+ShortTime
String.Format("{0:G}", dt); // "3/9/2008 4:05:07 PM" ShortDate+LongTime
String.Format("{0:m}", dt); // "March 09" MonthDay
String.Format("{0:y}", dt); // "March, 2008" YearMonth
String.Format("{0:r}", dt); // "Sun, 09 Mar 2008 16:05:07 GMT" RFC1123
String.Format("{0:s}", dt); // "2008-03-09T16:05:07" SortableDateTime
String.Format("{0:u}", dt); // "2008-03-09 16:05:07Z" UniversalSortableDateTime


Posted by YKYun
2012. 10. 30. 13:32

21,20 / 고유설정 포트에도 방화벽으로 인해 외부접근 차단.

 

방화벽 – 예외 – 프로그램에 windows\system32\inersrv\inetinfo.exe 추가.

Posted by YKYun
2012. 6. 21. 19:52

EXEC msdb.dbo.sp_send_dbmail
@profile_name = 'ygmail',
@recipients = 'yykwon@cyberwin.co.kr',
@subject = 'Automated Success Message',
@body = '메일을 받아라',
@body_format = 'text',
@file_attachments = 'c:\test.txt'



용량 수정하기 

msdb.dbo.sysmail_configure_sp 'MaxFileSize' , 10097152

 

-- OLE 기능 사용 수정

sp_configure 'show advanced options', 1;
GO
RECONFIGURE;
GO
sp_configure 'Ole Automation Procedures', 1;
GO
RECONFIGURE;
GO

'SQL' 카테고리의 다른 글

SQL Datetime범위  (0) 2014.03.27
DB 복원,로그 정리관련 명령어  (0) 2014.03.01
서버에있는 image형식 파일 다운로드  (0) 2012.06.21
SQL Backup Schedule root : NAS  (0) 2012.05.22
해당 SPID가 수행하고있는 쿼리보기  (0) 2012.05.09
Posted by YKYun