Skip to main content

Post Scripts in blogs

Posting scripts in the blogs is not straightforward. I came across some ways to do so:
Method #1: Simple Approach:

This will display the script as follows:


Method#2: Better Approach:
1. Login to your Blogger account.
2. Goto Design and then Edit HTML. Then you will see the script for your current blog template.
3. Backup your current template by clicking at "Download Full Template". You may skip this step if you are confident that you do not need it afterwards.
4. Find ]]></b:skin> in the code and add the following code just before ]]></b:skin>:

.code {color: #006AB0; border : 1px solpd #DfADADA;padding : 5px 5px;font-family : Consolas, "Courier New", Courier, mono, serif;font-size : 12px;background-color : #fAfAfA; width : 90%;overflow : auto;margin : 10px 0 10px 10px; border-left : 20px solid #DADADA;max-height : 500px;min-height : 16px;line-height : 16px;}
.code:hover {background-color : #f3f3f3;}

5. Save the template.

To post code in the blog just follow this example(NO Spaces within the div tag):

This will display as follows:

Print("This is my code in codebox");

But sometimes you may require to do more things if you want to display symbols like "<" , ">" ,"&", etc. In that case you have to used the following:
for < use & lt; (no spaces between & and lt)
for > use & gt; (no spaces between & and gt)
for & use & amp; (no spaces between & and amp)
for " use & quot; (no spaces between & and quot)
for space use & nbsp; (no spaces between & and nbsp)
for ± use & plusmn; (no spaces between & and plusmn)

[Sources:mainly from http://bit.ly/zpC2RX ]

Comments

Popular posts from this blog

Python : split any file (binary) to different pieces and join them

This python program takes an input file and then splits it into different smaller chunks. Next it can collect all the different chunks and join it to get the original file. -------------------------------------------------------- # define the function to split the file into smaller chunks def splitFile(inputFile,chunkSize): #read the contents of the file f = open(inputFile, 'rb') data = f.read() # read the entire content of the file f.close() # get the length of data, ie size of the input file in bytes bytes = len(data) #calculate the number of chunks to be created noOfChunks= bytes/chunkSize if(bytes%chunkSize): noOfChunks+=1 #create a info.txt file for writing metadata f = open('info.txt', 'w') f.write(inputFile+','+'chunk,'+str(noOfChunks)+','+str(chunkSize)) f.close() chunkNames = [] for i in range(0, bytes+1, chunkSize): fn1 = "chunk%s...

calculate hop count in a graph using python

The following program finds out the hop count of the nodes in a connected network. Hop Count means the number of point to point connections in a graph of network. For example, in the graph shown below the hop count from node a to node b is one, node b to node c is two, etc. This program assumes the graph given above. usage : getHopCount(dictNeigh, node1,node2) Where:   dictNeigh : dictionary of list of neighbor of each node in the network node1 and node2 are the nodes for which hop count is calculated by the program Exception: if the nodes are not connected then it returns Zero import copy dictNeigh = dict() # dictNeigh defines the neighbors dictNeigh['a'] = ['b','c','d'] # neighbors of 'a' dictNeigh['b'] = ['a']# neighbors of 'b' dictNeigh['c'] = ['a','d'] dictNeigh['d'] = ['a','c','e'] dictNeigh['e'] = ['d','f'] dictN...

My first step to PHP-MySQL

This is a very basic php-mysql tutorial and I will be trying to make it as simple as possible, since I it to be helpful for the first timers. This is the part of program when I was starting to learn Php-mysql. I was just trying to create a html form, get some data filled and then save the data in the database. And also displaying those data back. It was a messy code but I felt glad enough since it was a tangible piece of my learning process. Since then, if anyone asked me some help regarding the startup, i used to provide this code for them to play with. And I thought it will be a good idea if I can share it. a simple html form <form name="form1" method="post" action="target.php"> <p class="style1" align="left"> <label>Enter your details:</label> </p> <table width="421" bgcolor="#cccccc"> <tbody><tr> <td width="195">Name: <input nam...