Wednesday, October 26, 2016
Guide Post Code To Blogger
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;
}
Available link for download