Guide: Post Code To Blogger
How to post code to Blogger?Vietnamese: Làm thế nào để viết code lên Blogger?
English: Go To Template >> insert into code:
VietNamese: Vào Template chèn đoạn code:
Code:
<link href="http://alexgorbatchev.com/pub/sh/current/styles/shThemeEclipse.css" rel="stylesheet" type="text/css"></link> <script src="http://alexgorbatchev.com/pub/sh/current/scripts/shCore.js" type="text/javascript"> <script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushJava.js' type='text/javascript'/> <script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushXml.js' type='text/javascript'/> <script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushCsharp.js' type='text/javascript'/> <script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushPython.js' type='text/javascript'/> <script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushSql.js' type='text/javascript'/> <script language='javascript' type='text/javascript'> SyntaxHighlighter.config.bloggerMode = true; SyntaxHighlighter.all(); </script>
English: How to use?
Once you have the code with escaped characters, you can copy it on your blogger post inside <pre> tags. In the title you can choose a title for the code block and in the class you choose the code template to use.
Vietnamese: để sử dụng các bạn sử dụng thẻ <pre> và trong class là tên ngôn ngữ muốn hiện:
ví dụ ngôn ngữ cần hiện là XML thì class="brush:xml;" hoặc csharp: class="brush:csharp;"
Code:
<pre title="here goes a title" class="brush:xml;">
...
</pre>
Code Demo a code Csharp:
Code:
public static Point LatLongToPixel(double latitude, double longitude, double zoom) { Point point = new Point(); double centerPoint = Math.Pow(2, zoom + 7); double totalPixels = 2 * centerPoint; double pixelsPerLngDegree = totalPixels / 360; double pixelsPerLngRadian = totalPixels / (2 * Math.PI); double siny = Math.Min(Math.Max(Math.Sin(latitude * (Math.PI / 180)), -0.9999), 0.9999); point = new Point((int)Math.Round(centerPoint + longitude * pixelsPerLngDegree), (int)Math.Round(centerPoint - 0.5 * Math.Log((1 + siny) / (1 - siny)) * pixelsPerLngRadian)); return point; }