검색결과 리스트
프로그램/- .Net에 해당되는 글 8건
- 2013.05.08 Request.Url
- 2013.05.08 String.Format
- 2013.05.08 초성 얻어오기
- 2013.05.08 안드로이드 마켓 바로가기 링크
- 2013.05.08 iframe 쿠키사용 P3P 규약
- 2013.05.08 웹페이지 한글깨짐 현상
- 2012.01.13 C# 이미지 합성
- 2011.11.14 Java, C# 간에 라인달 128비트 암호화
글
|
'프로그램 > - .Net' 카테고리의 다른 글
String.Format (0) | 2013.05.08 |
---|---|
초성 얻어오기 (0) | 2013.05.08 |
안드로이드 마켓 바로가기 링크 (0) | 2013.05.08 |
iframe 쿠키사용 P3P 규약 (0) | 2013.05.08 |
웹페이지 한글깨짐 현상 (0) | 2013.05.08 |
설정
트랙백
댓글
글
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
'프로그램 > - .Net' 카테고리의 다른 글
Request.Url (0) | 2013.05.08 |
---|---|
초성 얻어오기 (0) | 2013.05.08 |
안드로이드 마켓 바로가기 링크 (0) | 2013.05.08 |
iframe 쿠키사용 P3P 규약 (0) | 2013.05.08 |
웹페이지 한글깨짐 현상 (0) | 2013.05.08 |
설정
트랙백
댓글
글
{
const int MiddleNumber = 21;//중성 수
const int EndNumber = 28;//종성 수
const int UnicodeHanGulStart = 0xac00;//유니코드 한글 시작
const int ChosungStart = 0x1100;//초성시작
char rtnval = new char();
int HangulLocal = hangul - UnicodeHanGulStart;
rtnval = (char)(ChosungStart + HangulLocal / (MiddleNumber * EndNumber));// 초성을 얻어낸다.
return rtnval;
}
'프로그램 > - .Net' 카테고리의 다른 글
Request.Url (0) | 2013.05.08 |
---|---|
String.Format (0) | 2013.05.08 |
안드로이드 마켓 바로가기 링크 (0) | 2013.05.08 |
iframe 쿠키사용 P3P 규약 (0) | 2013.05.08 |
웹페이지 한글깨짐 현상 (0) | 2013.05.08 |
설정
트랙백
댓글
글
'프로그램 > - .Net' 카테고리의 다른 글
String.Format (0) | 2013.05.08 |
---|---|
초성 얻어오기 (0) | 2013.05.08 |
iframe 쿠키사용 P3P 규약 (0) | 2013.05.08 |
웹페이지 한글깨짐 현상 (0) | 2013.05.08 |
C# 이미지 합성 (0) | 2012.01.13 |
설정
트랙백
댓글
글
iframe페이지 내에서 쿠키 사용시 적용이 안되는경우 이는 P3P 규약에 의해 적용되지 않는것이다.
처리방법 : Iframe의 페이지 헤더에 아래 코드를 추가해준다.
-Asp.Net
HttpContext.Current.Response.AddHeader("p3p","CP=\"IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT\"");
-PHP
header('P3P:CP="IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT"');
-JSP
response.addHeader("P3P","CP=\"IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT\"");
P3P(Platform for Privacy Preferences)
'P3P'는 해당 웹사이트가 이용자의 개인정보에 대하여 수집하고자 하는 항목, 수집 목적, 수집 후 보유기간, 개인정보관리책임자 등을 설정한 '프라이버시 보호 정책'을 평가하여 네트워크상에서 컴퓨터가 기계적으로 판독이 가능하도록 XML파일을 생성한 후 자동적으로 그 파일과 이용자가 요구하는 개인정보 보호 수준을 실시간으로 대조해 이용자의 웹브라우저에서 경고 메시지를 띄우게 된다.
'프로그램 > - .Net' 카테고리의 다른 글
초성 얻어오기 (0) | 2013.05.08 |
---|---|
안드로이드 마켓 바로가기 링크 (0) | 2013.05.08 |
웹페이지 한글깨짐 현상 (0) | 2013.05.08 |
C# 이미지 합성 (0) | 2012.01.13 |
Java, C# 간에 라인달 128비트 암호화 (0) | 2011.11.14 |
설정
트랙백
댓글
글
<meta http-equiv="Content-Type" content="text/html; charset=euc-kr"/>
UTF-8
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
Response.ChaRset = "EUC-KR"
- 0 : ANSI (기본값)
- 949 : 한국어 (EUC-KR)
- 65001 : 유니코드 (UTF-8)
- 65535 : 유니코드 (UTF-16)
중국어 사이트를 케릭터셋 UTF-8을 이용하여 제작중입니다. 그런데 IIS 오류메세지의 글꼴이 깨져 보여서 당췌 무슨 오류인지 알 수가 없네요. 어떻게 하면 오류메세지를 정상적으로 볼 수 있을까요?
A.
C:\WINDOWS\Help\iisHelp\common\
'프로그램 > - .Net' 카테고리의 다른 글
초성 얻어오기 (0) | 2013.05.08 |
---|---|
안드로이드 마켓 바로가기 링크 (0) | 2013.05.08 |
iframe 쿠키사용 P3P 규약 (0) | 2013.05.08 |
C# 이미지 합성 (0) | 2012.01.13 |
Java, C# 간에 라인달 128비트 암호화 (0) | 2011.11.14 |
설정
트랙백
댓글
글
@using System.Drawing
@{
string
fileUrl = Request.QueryString.ToString("fileUrl");
string
coverImageUrl = (String.IsNullOrEmpty(Request.QueryString["coverImageUrl"]) ? "icon_recommend.png" :
Request.QueryString.ToString("coverImageUrl"));
//
소스이미지
Bitmap
sourceImage = new Bitmap(Server.MapPath(fileUrl));
Bitmap
starImage = new Bitmap(Server.MapPath("/Resource/Image/" + coverImageUrl));
Bitmap
outputImage = new Bitmap(sourceImage.Width,
sourceImage.Height);
Graphics
g = Graphics.FromImage(outputImage);
g.InterpolationMode =
System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic;
g.DrawImage(sourceImage,
0, 0, sourceImage.Width, sourceImage.Height);
g.DrawImage(starImage, 0,
0, starImage.Width, starImage.Height);
Response.ContentType = "image/jpeg";
outputImage.Save(Response.OutputStream, System.Drawing.Imaging.ImageFormat.Png);
starImage.Dispose();
sourceImage.Dispose();
outputImage.Dispose();
g.Dispose();
}
'프로그램 > - .Net' 카테고리의 다른 글
초성 얻어오기 (0) | 2013.05.08 |
---|---|
안드로이드 마켓 바로가기 링크 (0) | 2013.05.08 |
iframe 쿠키사용 P3P 규약 (0) | 2013.05.08 |
웹페이지 한글깨짐 현상 (0) | 2013.05.08 |
Java, C# 간에 라인달 128비트 암호화 (0) | 2011.11.14 |
설정
트랙백
댓글
글
JAVA
import javax.crypto.*;
import javax.crypto.spec.*;
import java.io.*;
import sun.misc.BASE64Decoder;
import sun.misc.BASE64Encoder;
class JavaEnCryto
{
public static void main(String[] args)
{
try
{
System.out.println(Encrypt("abc@naver.com","_dhqxlak2010_"));
}
catch (Exception ex)
{
System.out.println("오류");
}
}
public static String Decrypt(String text, String key) throws Exception
{
Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding");
byte[] keyBytes= new byte[16];
byte[] b= key.getBytes("UTF-8");
int len= b.length;
if (len > keyBytes.length) len = keyBytes.length;
System.arraycopy(b, 0, keyBytes, 0, len);
SecretKeySpec keySpec = new SecretKeySpec(keyBytes, "AES");
IvParameterSpec ivSpec = new IvParameterSpec(keyBytes);
cipher.init(Cipher.DECRYPT_MODE,keySpec,ivSpec);
BASE64Decoder decoder = new BASE64Decoder();
byte [] results = cipher.doFinal(decoder.decodeBuffer(text));
return new String(results,"UTF-8");
}
public static String Encrypt(String text, String key) throws Exception
{
Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding");
byte[] keyBytes= new byte[16];
byte[] b= key.getBytes("UTF-8");
int len= b.length;
if (len > keyBytes.length) len = keyBytes.length;
System.arraycopy(b, 0, keyBytes, 0, len);
SecretKeySpec keySpec = new SecretKeySpec(keyBytes, "AES");
IvParameterSpec ivSpec = new IvParameterSpec(keyBytes);
cipher.init(Cipher.ENCRYPT_MODE,keySpec,ivSpec);
byte[] results = cipher.doFinal(text.getBytes("UTF-8"));
BASE64Encoder encoder = new BASE64Encoder();
return encoder.encode(results);
}
}
C#
using System;
using System.IO;
using System.Text;
using System.Security.Cryptography;
namespace AESWithJava.Con
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine(Encrypt("abc@naver.com", "_dhqxlak2010_"));
}
public static string Decrypt(string textToDecrypt, string key)
{
RijndaelManaged rijndaelCipher = new RijndaelManaged();
rijndaelCipher.Mode = CipherMode.CBC;
rijndaelCipher.Padding = PaddingMode.PKCS7;
rijndaelCipher.KeySize = 128;
rijndaelCipher.BlockSize = 128;
byte[] encryptedData = Convert.FromBase64String(textToDecrypt);
byte[] pwdBytes = Encoding.UTF8.GetBytes(key);
byte[] keyBytes = new byte[16];
int len = pwdBytes.Length;
if (len > keyBytes.Length)
{
len = keyBytes.Length;
}
Array.Copy(pwdBytes, keyBytes, len);
rijndaelCipher.Key = keyBytes;
rijndaelCipher.IV = keyBytes;
byte[] plainText = rijndaelCipher.CreateDecryptor().TransformFinalBlock(encryptedData, 0, encryptedData.Length);
return Encoding.UTF8.GetString(plainText);
}
public static string Encrypt(string textToEncrypt, string key)
{
RijndaelManaged rijndaelCipher = new RijndaelManaged();
rijndaelCipher.Mode = CipherMode.CBC;
rijndaelCipher.Padding = PaddingMode.PKCS7;
rijndaelCipher.KeySize = 128;
rijndaelCipher.BlockSize = 128;
byte[] pwdBytes = Encoding.UTF8.GetBytes(key);
byte[] keyBytes = new byte[16];
int len = pwdBytes.Length;
if (len > keyBytes.Length)
{
len = keyBytes.Length;
}
Array.Copy(pwdBytes, keyBytes, len);
rijndaelCipher.Key = keyBytes;
rijndaelCipher.IV = keyBytes;
ICryptoTransform transform = rijndaelCipher.CreateEncryptor();
byte[] plainText = Encoding.UTF8.GetBytes(textToEncrypt);
return Convert.ToBase64String(transform.TransformFinalBlock(plainText, 0, plainText.Length));
}
}
}
'프로그램 > - .Net' 카테고리의 다른 글
초성 얻어오기 (0) | 2013.05.08 |
---|---|
안드로이드 마켓 바로가기 링크 (0) | 2013.05.08 |
iframe 쿠키사용 P3P 규약 (0) | 2013.05.08 |
웹페이지 한글깨짐 현상 (0) | 2013.05.08 |
C# 이미지 합성 (0) | 2012.01.13 |
RECENT COMMENT