Windows, Python and Eric4 IDE Tuesday, February 10, 2009

Python is really fun ! mixing OOP with procedural programming is powerful and not a flaw in Python as always Ruby guys wanted to convince you ;)

Almost all Linux flavors include python but for windows you may want stuck with ActiveState ActivePython package which will setup python for you (PATH variable and registry entries) as will as a rich set of windows APIs backing your Python scripting for windows.

The IDE

The are plenty of Python Editors and IDEs. WingIDE is the Python's IntelliJ , the best but costs, so i picked Eric4. regardless the 90's web design of the project website Eric4 has numerous features including Integrated Python Debugger, coding folding, Auto-completion,error highlighting and much much more.

assuming you have already install ActivePython, getting Eric4 to work is straight-forward :

  1. Download the latest package from SourceForge project page.
  2. for compiling Eric4 you will need Microsoft VC++ redistributable from here.
  3. finally you'll need PyQt (Python binding for Qt Framework). simply install Riverbank preconfigured PyQt package which includes Qt runtime from here.

After downloading Eric4 archive go forward and extract it in you preferred location , lets pick c:/program files as the windows De facto. Install Microsoft VC++ and PyQt mentioned in step 1 & 2 and finally browse to Eric4 directory and type the following on you Command Line:

C:\Program Files\eric4-x.x.x> python install.py

That's it ! a batch file eric4.bat will be generated. feel free to to add a shortcut into your desktop or whatever place.


on the upcoming post i will show you how to set up a productive Django Development Environment using Eric4 and their django plugin, Till then :)

Intellij , increase Java's Memory Friday, February 6, 2009






It's common to get Out Of Memory exception when you run application or Debug application on Inellij, However that's not a bug ! you only need to increase JAVA memory settings.

The steps are as follows :

  1. go to "Run" menu the select "Edit Configurations"
  2. increase the memory of Java VM passing -Xmx512M parameter, see the screen shot below.




Enlight your blogger with SyntaxHighlighter 2.0 ! Wednesday, February 4, 2009






Syntax highlighting is essential for your blog posts with code snippets. The Just released SyntaxHighlighter 2.0 is a breeze to use and work with.
I will follow you on this post to successfully integrated SyntaxHighlighter 2.0 into your blogger without having to setup an external hosting.

Step 1:
Login into your Blogger go to the Layout tab and then to Edit HTML

Step 2:


browse your template and locate the <head> Tag

add the following javascript includes:



<script src='http://alexgorbatchev.com/pub/sh/2.0.278/scripts/shCore.js' type='text/javascript'/>
<script src='http://alexgorbatchev.com/pub/sh/2.0.278/scripts/shBrushPlain.js' type='text/javascript' />
<script src='http://alexgorbatchev.com/pub/sh/2.0.278/scripts/shBrushXml.js' type='text/javascript' />
<script src='http://alexgorbatchev.com/pub/sh/2.0.278/scripts/shBrushCss.js' type='text/javascript' />
<script src='http://alexgorbatchev.com/pub/sh/2.0.278/scripts/shBrushJScript.js' type='text/javascript' />




Step 3:

Blogger does not accept <link> tags within the <head> , you need to manually copy&paste css to the <head> tag:
the css required are
http://alexgorbatchev.com/pub/sh/2.0.278/styles/shCore.css
and
http://alexgorbatchev.com/pub/sh/2.0.278/styles/shThemeDefault.css

Step 4:
add the following javascript into the head tag :

SyntaxHighlighter.config.clipboardSwf = 'http://alexgorbatchev.com/pub/sh/2.0.278/scripts/clipboard.swf';
SyntaxHighlighter.config.bloggerMode = true;
SyntaxHighlighter.config.gutter = false;
SyntaxHighlighter.all();



Step 5:

You now need to wrap the text inside your pre tags which will later include the code snippets. unwakeable provide an excellent css snippet which resolves such issue in almost all modern browsers.

ok, back to the <head> tag , add the following style:

pre {
overflow-x: auto; /* Use horizontal scroller if needed; for Firefox 2, not needed in Firefox 3 */
white-space: pre-wrap; /* css-3 */
white-space: -moz-pre-wrap !important; /* Mozilla, since 1999 */
white-space: -pre-wrap; /* Opera 4-6 */
white-space: -o-pre-wrap; /* Opera 7 */
/* width: 99%; */
word-wrap: break-word; /* Internet Explorer 5.5+ */
}


That's it ! save you template and Start blogging with code snippets inside <pre> tags.



if you like it please consider donating , it's DonationWare anyways :)