파이썬 파일이 다른 파일에서 import 되는 것이 아닌 직접 실행되는 경우에만 수행할 코드는 아래 코드 이후에 작성.
if __name__ == "__main__":
#-*- coding: utf-8 -*- print "항상 출력 됨" if __name__ == "__main__": print "python sample.py 처럼 직접 실행되는 경우에만 출력됨"
파이썬 파일이 다른 파일에서 import 되는 것이 아닌 직접 실행되는 경우에만 수행할 코드는 아래 코드 이후에 작성.
if __name__ == "__main__":
#-*- coding: utf-8 -*- print "항상 출력 됨" if __name__ == "__main__": print "python sample.py 처럼 직접 실행되는 경우에만 출력됨"
파이썬2의 기본 인코딩은 ascii인데 이것을 UTF-8로 변경하기 위해서는 파이썬 파일 최상단에 아래와 같은 코드 삽입.
(기본 인코딩 사용시 코드상에 한글 등 ascii 범위를 넘어가는 문자 사용시 오류 발생)
#-*- coding: utf-8 -*-
청남대
string.Format(@"Value : {0}", 123);
string str = string.Format(@"function() {alert({0});}", @"Alert Message");
string str = string.Format(@"function() {{alert({0});}}", @"Alert Message");
SystemTray.IsVisible = false; this.ApplicationBar.IsVisible = false;
// Obtain transform information based off root element GeneralTransform gt = element.TransformToVisual(Application.Current.RootVisual); // Find the four corners of the element Point topLeft = gt.Transform(new Point(0, 0)); Point topRight = gt.Transform(new Point(element.RenderSize.Width, 0)); Point bottomLeft = gt.Transform(new Point(0, element.RenderSize.Height)); Point bottomRight = gt.Transform(new Point(element.RenderSize.Width, element.RenderSize.Height));
RotateTransform transform = new RotateTransform(); transform.Angle = 90d; popup.RenderTransform = transform; popup.VerticalOffset = 300 - 480; popup.HorizontalOffset = 300;
Portrait
LandscapeLeft
LandscapeRight
public partial class MainPage : PhoneApplicationPage { public MainPage() { InitializeComponent(); //Add EventHandler this.OrientationChanged += new EventHandler(MainPage_OrientationChanged); } void MainPage_OrientationChanged(object sender, OrientationChangedEventArgs e) { PageOrientation orientation = e.Orientation; //Check current orientation if ((orientation & PageOrientation.Portrait) == (PageOrientation.Portrait)) { // Portrait } else { // Landscape } } PageOrientation GetCurrentOrientation() { return this.Orientation; } }
//xaml SupportedOrientations="Portrait" SupportedOrientations="Landscape" SupportedOrientations="PortraitOrLandscape" //Behind code(C#) this.SupportedOrientations = SupportedPageOrientation.Portrait; this.SupportedOrientations = SupportedPageOrientation.Landscape; this.SupportedOrientations = SupportedPageOrientation.PortraitOrLandscape;
var stream = TitleContainer.OpenStream("FileName.wav"); var effect = SoundEffect.FromStream(stream); FrameworkDispatcher.Update(); effect.Play();