Saturday, January 10, 2009

Code Snippet posting in Blogger using Syntax Highlighting

Finally able to get code posting in Blogger working.
This url helped me get there http://blog.gpowered.net/2007/07/howto-post-code.html


public class HelloWorld {
/**
* @Copyright Sarat Dontula :-)
*/
public static void main(String[] args)
{
System.out.println("Hello World");
}
}


What worked for me . In Blogger Layout -> Edit HTML -> After <head> tag place below code. Change the host name.


<link href='http://sdontula.googlepages.com/SyntaxHighlighter.css' rel='stylesheet' type='text/css'/>


Just before <body> place below code
 
<script language='javascript' src='http://sdontula.googlepages.com/shCore.js'/>
<script language='javascript' src='http://sdontula.blogspot.com/shBrushCSharp.js'/>
<script language='javascript' src='http://sdontula.blogspot.com/shBrushXml.js'/>
<script language='javascript' src='http://sdontula.blogspot.com/shBrushPython.js'/>
<script language='javascript' src='http://sdontula.blogspot.com/shBrushXml.js'/>
<script language='javascript' src='http://sdontula.blogspot.com/shBrushPhp.js'/>
<script language='javascript' src='http://sdontula.blogspot.com/shBrushJScript.js'/>
<script language='javascript' src='http://sdontula.googlepages.com/shBrushJava.js'/>




Again google should make it easy for developers to post code. This is just insane :-(

Blogger Code Styling & Display.

Found below url to style code on blogger.

http://rias-techno-wizard.blogspot.com/2008/08/display-css-codes-and-scripts-in-unique.html

I tried using syntaxhightlighting from http://code.google.com/p/syntaxhighlighter/ using this blog post http://www.fromjavatoruby.com/2008/10/ruby-syntax-highlighting-in-blogger.html without much luck.

I tried to host the .js and .css scripts on google page creator. May be google page creator doesn't serve resources if it sees some other domain is requesting it. (Remote Hot Linking). Will have to find out some other way.

It is crazy that blogger doesn't provide something out of the box to display code snippets. Driving me nuts !!!!

Friday, January 9, 2009

Apache Redirection

Uncomment below three lines in apache/conf/httpd.conf file:


LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_http_module modules/mod_proxy_http.so
LoadModule rewrite_module modules/mod_rewrite.so


Add below lines lines to httpd.conf:


RewriteEngine on
ProxyRequests Off

Order allow,deny
Allow from all

#Actual Redirection Code Starts
RewriteRule ^/customer-url$ customer-url/ [R]
ProxyPass /customer-url/ http://localhost:8080/customer-url/
ProxyPassReverse /customer-url/ http://localhost:8080/customer-url/


Above we are making apache accept requests on port 80 for a server which is serving web pages on 8080. It mean http://localhost/customer-url gets it's pages from http://localhost:8080/customer-url .

How to test if a machine has access to the smtp server

This url: http://support.microsoft.com/kb/304897
helps us in testing if server
is allowed to relay etc..

Basically you do:
1. telnet servername port
2. EHLO
3. RSET

(YOU SHOULD SEE MESSAGE AS A RESULT:
250 2.0.0 Resetting)

4. MAIL FROM:UserName@DomainName.com
(use an email belonging to the domain)

5. RCPT TO:RecipientName@DomainName.com
(use email belonging to the domain)

6. QUIT (TO EXIT)

Above should send out an email without errors.
This should tell us if we can configure email
properly.