Pages

Tuesday, November 16, 2010

Add source code syntax highlighter to blogger

SyntaxHighlighter (by Alex Gorbatchev) it's a pretty good and customizable option.

It supports a lot of different languages and you can easily create new "brushes" for your language if it is not supported by default.

Now, adding 'Syntax Highlighter' to my blog:

Step1: Save old template

From Design->Edit HTML->Download Full Template

Step2:

In Design->Edit HTML, add the following before ending of the head element, just above </head>:
<!--SYNTAX HIGHLIGHTER BEGINS-->
<link href='http://alexgorbatchev.com/pub/sh/current/styles/shCore.css' rel='stylesheet' type='text/css'/>
<link href='http://alexgorbatchev.com/pub/sh/current/styles/shThemeDefault.css' rel='stylesheet' type='text/css'/>
<script src='http://alexgorbatchev.com/pub/sh/current/scripts/shCore.js' type='text/javascript'></script>
<script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushCpp.js' type='text/javascript'></script>
<script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushCSharp.js' type='text/javascript'></script>
<script language='javascript'>
SyntaxHighlighter.config.bloggerMode = true;
SyntaxHighlighter.config.clipboardSwf = 'http://alexgorbatchev.com/pub/sh/current/scripts/clipboard.swf';
SyntaxHighlighter.all();
</script>
<!--SYNTAX HIGHLIGHTER ENDS-->
Other possible variants for "brushes" are:

shBrushCss.js, shBrushJava.js, shBrushJScript.js, shBrushPhp.js, shBrushPython.js, shBrushSql.js, shBrushRuby.js, shBrushVb.js, shBrushXml.js, shBrushPerl.js.

The brush "shBrushXml.js" applies also to html syntax highlighting.

Step3:
You can preview anytime the template.
And while creating a new post, use <pre> tag in the post.
The code of your post needs to go in between the
<pre class="brush: html">
and
</pre>
tags, in order to highlight properly.

Step4
Other possible themes (instead of "shThemeDefault.css":

shThemeDjango.css, shThemeEclipse.css, shThemeEmacs.css, shThemeFadeToGrey.css, shThemeMidnight.css, shThemeRDark.css.

Monday, November 15, 2010

Anti-Advice

Never give advice. Wise men don't need advice. Fools won't take it

Gravity

"Falling in love is one of the most irrational behaviors or brain states imaginable for both men and women"


Saturday, February 27, 2010

Personalize view in VS debug, watch windows

Base article:

Writing custom visualizers for Visual Studio 2005

Example for a structure:

In source code:

struct test_struct{
int val; /* 0xf - FALSE; 0xa - TRUE other - INCOHERENT*/
}

In autoexp.dat, [Visualizer] section:

[Visualizer]

; My Visualizer for my test struct
test_struct {
preview (
#(
#if ($c.val == 0xA) (
#("TRUE")
) #else (
#if ($c.val == 0xF) (
#("FALSE")
) #else (
#("INCOHERENT")
)
)
)
)
}

Thursday, January 28, 2010

Ourselves

When you try to show others you're [.good.kind.smart.evil.cool.], in fact you're demonstrating to yourself because you don't beleve it.

Sunday, January 10, 2010

Make things happen

Getting things done is not the same as making things happen. You can:
  • …reply to emails
  • …pay the bills 
  • …cross off to-do’s
  • …fulfill your obligation 
  • …repeat what you heard 
  • …go with the flow 
  • …anticipate roadblocks 
  • …aim for “good enough”
 Or you can:
  •  …organize a community 
  • …take a risk 
  • …set ambitious goals 
  • …give more than you take
  •  …change perceptions 
  • …forge a new path 
  • …create possibility
  •  …demand excellence 
 "Don’t worry too much about getting things done.Make things happen! "