IP 국가 리스트 편하기 검색하기
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 29 30 31 32 33 34 35 |
USE [ipv] GO /****** Object: Table [dbo].[ipv4_KR] Script Date: 2020-05-18 오후 5:12:30 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_PADDING ON GO CREATE TABLE [dbo].[ipv4_KR]( [IDX] [int] NOT NULL, [Standard_Date] [varchar](20) NOT NULL CONSTRAINT [DF_ipv4_KR_Standard_Date] DEFAULT (''), [Cuntry_Code] [varchar](10) NOT NULL CONSTRAINT [DF_ipv4_KR_Cuntry_Code] DEFAULT (''), [Start_IP_Number] [float] NOT NULL CONSTRAINT [DF_ipv4_KR_Start_IP_Number] DEFAULT ((0)), [End_IP_Number] [float] NOT NULL CONSTRAINT [DF_ipv4_KR_End_IP_Number] DEFAULT ((0)), [Start_IP] [varchar](20) NOT NULL CONSTRAINT [DF_ipv4_KR_Start_IP] DEFAULT (''), [End_IP] [varchar](20) NOT NULL CONSTRAINT [DF_ipv4_KR_End_IP] DEFAULT (''), [PREFIX] [varchar](20) NOT NULL CONSTRAINT [DF_ipv4_KR_PREFIX] DEFAULT (''), [Regi_Date] [varchar](20) NOT NULL CONSTRAINT [DF_ipv4_KR_Regi_Date] DEFAULT (''), CONSTRAINT [PK_ipv4_KR] PRIMARY KEY CLUSTERED ( [IDX] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] ) ON [PRIMARY] GO SET ANSI_PADDING OFF GO |
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 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
----------------------------------------------------------------------------------------------------------- -- Split 유형의 함수 -- 문자열에서 구분자(@iSeparator)로 몇번째 단어 가져오기 -- 예: SELECT 데이터베이스명.소유자명.fn_GetIdxDataLikeSplit('가-나-다',2,'-') --> '나' ----------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------- -- 프로시저 생성 ----------------------------------------------------------------------------------------------------------- Alter FUNCTION [dbo].[fn_GetIdxDataLikeSplit] ( @iText VARCHAR(200), @idx INT, @iSeparator VARCHAR(10) = '.' ) RETURNS VARCHAR(200) AS BEGIN DECLARE @wData VARCHAR(200) DECLARE @wText VARCHAR(200) DECLARE @wSeparator VARCHAR(10) DECLARE @wNum INT SET @wData = '' SET @wNum = 1; SET @wSeparator = LTRIM(RTRIM(@iSeparator)); SET @wText = LTRIM(RTRIM(@iText)) + @wSeparator; IF CHARINDEX(@wSeparator, @iText) > 0 BEGIN WHILE @idx >= @wNum BEGIN IF CHARINDEX(@wSeparator, @wText) > 0 BEGIN -- 문자열의 인덱스 위치의 요소를 반환 SET @wData = SUBSTRING(@wText, 1, CHARINDEX(@wSeparator, @wText) - 1); SET @wData = LTRIM(RTRIM(@wData)); -- 반환된 문자는 버린후 좌우공백 제거 SET @wText = LTRIM(RTRIM(RIGHT(@wText, LEN(@wText) - (LEN(@wData) + LEN(@iSeparator))))) END ELSE BEGIN SET @wData = '' END SET @wNum = @wNum + 1 END END ELSE BEGIN SET @wData = @iText END -- HEO ADd if Len(@wData) =1 begin Set @wData = '00' + @wData end else if(Len(@wData) =2) begin Set @wData = '0' + @wData end RETURN(@wData) END |
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 29 30 31 32 33 34 35 36 37 38 39 40 |
Declare @IDX int Declare @Start_IP varchar(20), @End_IP varchar(20) Declare @Start_IP_01 varchar(3),@Start_IP_02 varchar(3),@Start_IP_03 varchar(3),@Start_IP_04 varchar(3) Declare @End_IP_01 varchar(3),@End_IP_02 varchar(3),@End_IP_03 varchar(3),@End_IP_04 varchar(3) Declare con_cursor cursor for SELECT IDX, Start_IP, End_IP FROM [IBE_Basic_Code].[dbo].[ipv4_KR] open con_cursor --커스를 연다. fetch next from con_cursor into @IDX, @Start_IP, @End_IP while (@@fetch_status <>-1) begin if (@@fetch_status = -2) continue begin Set @Start_IP_01 = [dbo].[fn_GetIdxDataLikeSplit](@Start_IP,1,'.') Set @Start_IP_02 = [dbo].[fn_GetIdxDataLikeSplit](@Start_IP,2,'.') Set @Start_IP_03 = [dbo].[fn_GetIdxDataLikeSplit](@Start_IP,3,'.') Set @Start_IP_04 = [dbo].[fn_GetIdxDataLikeSplit](@Start_IP,4,'.') Set @End_IP_01 = [dbo].[fn_GetIdxDataLikeSplit](@End_IP,1,'.') Set @End_IP_02 = [dbo].[fn_GetIdxDataLikeSplit](@End_IP,2,'.') Set @End_IP_03 = [dbo].[fn_GetIdxDataLikeSplit](@End_IP,3,'.') Set @End_IP_04 = [dbo].[fn_GetIdxDataLikeSplit](@End_IP,4,'.') update [IBE_Basic_Code].[dbo].[ipv4_KR] set Start_IP_Number = CONVERT(numeric, @Start_IP_01 + @Start_IP_02 + @Start_IP_03 + @Start_IP_04) ,End_IP_Number = CONVERT(numeric, @End_IP_01 + @End_IP_02 + @End_IP_03 + @End_IP_04) where IDX = @IDX end fetch next from con_cursor into @IDX, @Start_IP, @End_IP end close con_cursor Deallocate con_cursor |
Java Build Path Error
이클립스 에러 Multiple annotations found at this line: – The superclass “javax.servlet.http.HttpServlet” was not found on the Java Build Path 진행중인 프로젝트 에서 속성-> Project Facts 에서 자바 runtime 을 톰켓버전에 맞추어 체크 한다.
XMLHttpRequest 호출
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 29 30 31 |
<!DOCTYPE html> <html> <body> <p>XMLHttpRequest sample </p> <p id="demo">dd</p> <script> function airline(code) { //var decode = code; var xmlHttp = new XMLHttpRequest(); xmlHttp.open( "GET", "https://code.auctpro.co.kr/airline.php?code=" + code, false ); xmlHttp.send( null ); document.getElementById("demo").innerHTML = xmlHttp.responseText; //decode = xmlHttp.responseText; //return decode; } airline('KE'); </script> </body> </html> |
New component 추가시 옵션 체크
string.Format(“{0:s}.{0:fff}
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
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 |
1 2 3 4 |
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) |
1 2 3 4 5 6 7 8 9 10 11 12 |
tring.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 In DateTimeFormatInfo there are defined standard patterns for the current culture. For example property ShortTimePattern is string that contains value h:mm tt for en-US culture and value HH:mm for de-DE culture. Following table shows patterns defined in DateTimeFormatInfo and their values for en-US culture. First column contains format specifiers… Read More »
MVC Download File and View
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 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 |
using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Http; using Microsoft.Extensions.Logging; using Microsoft.Extensions.DependencyInjection; using Microsoft.AspNetCore; using Microsoft.Extensions.Configuration; using Microsoft.AspNetCore.Mvc; using System.Net.Http.Headers; namespace StartupBasic { public class Startup { public Startup(IHostingEnvironment env, ILoggerFactory logger, IConfiguration configuration) { //These are three services available at constructor } public void ConfigureServices(IServiceCollection services) { services.AddMvcCore(). SetCompatibilityVersion(CompatibilityVersion.Version_2_1); } public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory logger, IConfiguration configuration) { app.UseMvc(routes => routes.MapRoute( name: "default_route", template: "{controller}/{action}/{id?}", defaults: new { controller = "Home", action = "Index" }) ); } } public class HomeController : Controller { IHostingEnvironment _env; public HomeController(IHostingEnvironment env) { _env = env; } public ActionResult Index() { return new ContentResult { Content = "<html><body><h1>Download File</h1>Download a copy of <a href=\"/home/hegel\">Hegel (pdf)</a></body></html>", ContentType = "text/html" }; } //public FileStreamResult Hegel() //{ // var pathToIdeas = System.IO.Path.Combine(_env.WebRootPath, "hegel.pdf"); // //This is a contrite example to demonstrate returning a stream. If you have a physical file on disk, just use PhySicalFileResult that takes a path. // return new FileStreamResult(System.IO.File.OpenRead(pathToIdeas), "application/pdf") // { // FileDownloadName = "hegel.pdf" // }; //} public PhysicalFileResult Hegel() { var pathToIdeas = System.IO.Path.Combine(_env.WebRootPath, "hegel.pdf"); return new PhysicalFileResult(pathToIdeas, "application/pdf"); } } public class Program { public static void Main(string[] args) { CreateWebHostBuilder(args).Build().Run(); } public static IWebHostBuilder CreateWebHostBuilder(string[] args) => WebHost.CreateDefaultBuilder(args) .UseStartup<Startup>() .UseEnvironment("Development"); } } |
결과 : Download File Download a copy of Hegel (pdf)
MVC routing-8
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 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 |
using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Http; using Microsoft.Extensions.Logging; using Microsoft.Extensions.DependencyInjection; using Microsoft.AspNetCore; using Microsoft.Extensions.Configuration; using Microsoft.AspNetCore.Mvc; namespace MvcRouting { public class Startup { public Startup(IHostingEnvironment env, ILoggerFactory logger, IConfiguration configuration) { //These are three services available at constructor } public void ConfigureServices(IServiceCollection services) { services.AddMvcCore(). SetCompatibilityVersion(CompatibilityVersion.Version_2_1); } public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory logger, IConfiguration configuration) { app.UseMvc(); } } [Route("[controller]/[action]")] public class HomeController : Controller { [HttpGet("/")] [HttpGet("")] public ActionResult Index() { return new ContentResult { Content = @" <html><body> <h1>[controller] and [action] replacement tokens examples</h1> <ul> <li><a href=""/"">/</a></li> <li><a href=""/home/index"">/home/index</a></li> <li><a href=""/home/about"">/home/about</a></li> <li><a href=""/about"">/about</a></li> </ul> </body></html>", ContentType = "text/html" }; } public ActionResult About() { return new ContentResult { Content = @" <html><body> <b>About Page</b </body></html>", ContentType = "text/html" }; } [HttpGet("/about")] public ActionResult About2() { return new ContentResult { Content = @" <html><body> <b>About Page 2</b </body></html>", ContentType = "text/html" }; } } public class Program { public static void Main(string[] args) { CreateWebHostBuilder(args).Build().Run(); } public static IWebHostBuilder CreateWebHostBuilder(string[] args) => WebHost.CreateDefaultBuilder(args) .UseStartup<Startup>() .UseEnvironment("Development"); } } |
결과 : [controller] replacement token examples •/ •/home/ •/home/about •/about
MVC routing-7
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 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 |
using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Http; using Microsoft.Extensions.Logging; using Microsoft.Extensions.DependencyInjection; using Microsoft.AspNetCore; using Microsoft.Extensions.Configuration; using Microsoft.AspNetCore.Mvc; namespace MvcRouting { public class Startup { public Startup(IHostingEnvironment env, ILoggerFactory logger, IConfiguration configuration) { //These are three services available at constructor } public void ConfigureServices(IServiceCollection services) { services.AddMvcCore(). SetCompatibilityVersion(CompatibilityVersion.Version_2_1); } public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory logger, IConfiguration configuration) { app.UseMvc(); } } [Route("[controller]")] public class HomeController : Controller { [HttpGet("/")] [HttpGet("")] //You have to do this otherwise /Home/Index won't work public ActionResult Index() { return new ContentResult { Content = @" <html><body> <h1>[controller] replacement token examples</h1> <ul> <li><a href=""/"">/</a></li> <li><a href=""/home/"">/home/</a></li> <li><a href=""/home/about"">/home/about</a></li> <li><a href=""/about"">/about</a></li> </ul> </body></html>", ContentType = "text/html" }; } [HttpGet("about")] public ActionResult About() { return new ContentResult { Content = @" <html><body> <b>About Page</b </body></html>", ContentType = "text/html" }; } [HttpGet("/about")] public ActionResult About2() { return new ContentResult { Content = @" <html><body> <b>About Page 2</b </body></html>", ContentType = "text/html" }; } } public class Program { public static void Main(string[] args) { CreateWebHostBuilder(args).Build().Run(); } public static IWebHostBuilder CreateWebHostBuilder(string[] args) => WebHost.CreateDefaultBuilder(args) .UseStartup<Startup>() .UseEnvironment("Development"); } } |
결과 : [controller] replacement token examples •/ •/home/ •/home/about •/about
MVC routing-1
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 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Http; using Microsoft.Extensions.Logging; using Microsoft.Extensions.DependencyInjection; using Microsoft.AspNetCore; using Microsoft.Extensions.Configuration; using Microsoft.AspNetCore.Mvc; namespace MvcRouting { public class Startup { public Startup(IHostingEnvironment env, ILoggerFactory logger, IConfiguration configuration) { //These are three services available at constructor } public void ConfigureServices(IServiceCollection services) { services.AddMvcCore(). SetCompatibilityVersion(CompatibilityVersion.Version_2_1); } public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory logger, IConfiguration configuration) { app.UseMvc(routes => { routes.MapRoute( name: "home", template: "/", defaults: new { controller = "Home", action = "Index" }); routes.MapRoute( name: "default", template: "{controller}/{action}", defaults: new { controller = "Home", action = "Index" }); }); } } public class HomeController : Controller { public ActionResult Index() { return new ContentResult { Content = @" <html><body> <b>Hello World</b> <br/><br/> The following links call the same controller and action. <ul> <li><a href=""/"">/</a></li> <li><a href=""/Home"">/Home</a></li> <li><a href=""/Home/index"">/Home/index</a></li> </ul> </body></html>", ContentType = "text/html" }; } } public class Program { public static void Main(string[] args) { CreateWebHostBuilder(args).Build().Run(); } public static IWebHostBuilder CreateWebHostBuilder(string[] args) => WebHost.CreateDefaultBuilder(args) .UseStartup<Startup>() .UseEnvironment("Development"); } } |
결과 : Hello World The following links call the same controller and action. •/ •/home •/home/index 동일 :
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 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
namespace MvcRouting { public class Startup { public Startup(IHostingEnvironment env, ILoggerFactory logger, IConfiguration configuration) { //These are three services available at constructor } public void ConfigureServices(IServiceCollection services) { services.AddMvcCore(). SetCompatibilityVersion(CompatibilityVersion.Version_2_1); } public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory logger, IConfiguration configuration) { app.UseMvc(); } } [Route("")] [Route("Home")] [Route("Home/Index")] public class HomeController : Controller { public ActionResult Index() { return new ContentResult { Content = @" <html><body> <b>Hello World</b> <br/><br/> The following links call the same controller and action. <ul> <li><a href=""/"">/</a></li> <li><a href=""/home"">/home</a></li> <li><a href=""/home/index"">/home/index</a></li> </ul> </body></html>", ContentType = "text/html" }; } } public class Program { public static void Main(string[] args) { CreateWebHostBuilder(args).Build().Run(); } public static IWebHostBuilder CreateWebHostBuilder(string[] args) => WebHost.CreateDefaultBuilder(args) .UseStartup<Startup>() .UseEnvironment("Development"); } } |