Archive for Tools

Syntax Highlighter, WordPress & CSS

// April 26th, 2009 // Comments Off on Syntax Highlighter, WordPress & CSS // Tools, wordpress

I recently changed my Syntax Highlighter (which was cool, but old and abandon-ware) for the SyntaxHighlighter Evolved. Which I must say I love. Old versions were really bad. They were not that flexible. But version 2.0 is VERY flexible, and looks great. So I did the change in Neonlabs and Structum.

I stumbled with several problems. The first, and the one that bothered me more, was that in the Structum page, the code seemed to be broken into weird lines.

Broken Code

This was obviously a CSS problem since I didn’t have that problem in Neonlabs. So I used several tools to see which was the offending style. I mostly looked for the ‘pre’ tag on CSS but was not successful. After looking through the whole CSS style for my theme, I found the offending line of code:

#primary code {

Yep, it was a simple display attribute. I just commented that line and everything just worked.

Fixed Code

After that I tried editing the code to make it look better for the Structum page and I noticed that when it loaded it had a nasty Warning:

Warning: htmlspecialchars_decode() expects parameter 1 to be string, NULL given in /…/wp-includes/compat.php on line 105

And when I looked at the code blocks in my posts, there was nothing. They were empty.

I did a little research to see what was the problem, and it seems it is a WordPress bug. Simple variable naming bug in compat.php:

	function htmlspecialchars_decode( $str, $quote_style = ENT_COMPAT )
		if ( !is_scalar( $string ) ) {
			trigger_error( 'htmlspecialchars_decode() expects parameter 1 to be string, ' . gettype( $string ) . ' given', E_USER_WARNING );

Can you see the problem ? The problem resides in the $string variable. It doesn’t exist, so its value is null. Changing the variable parameter for is_scalar and gettype from $string to $str fixed the problem.

This is how it should look:

	function htmlspecialchars_decode( $str, $quote_style = ENT_COMPAT )
		if ( !is_scalar( $str ) ) {
			trigger_error( 'htmlspecialchars_decode() expects parameter 1 to be string, ' . gettype( $str ) . ' given', E_USER_WARNING );

After that, everything is working seamlessly again :D. hope this helps :D.

Fowler on Oslo

// November 10th, 2008 // Comments Off on Fowler on Oslo // Architecture, microsoft, software development, Tools

I just found this document written by Martin Fowler on his thoughts on Oslo.

Some comments made by Folwer:

  • Talking about Oslo in general:

“A couple of weeks ago I got an early peek behind the curtain as I, and my language-geek colleague Rebecca Parsons, went through a preview of the PDC coming-out talks with Don Box, Gio Della-Libera and Vijaye Raji. It was a very interesting presentation, enough to convince me that Oslo is a technology to watch.”

  • Talking about M:

“I think I like this. When I first came across it, I rather liked the MPS notion of: “it looks like text, but really it’s a structured editor”. But recently I’ve begun to think that we lose a lot that way, so the Oslo way of working is appealing.”

  • Talking about comparison of Oslo with other tools:

“One particularly interesting point in this comparison is comparing Oslo with Microsoft’s DSL tools. They are different tools with a lot of overlap, which makes you wonder if there’s a place for both them. I’ve heard vague “they fit together” phrases, but am yet to be convinced. It could be one of those situations (common in big companies) where multiple semi-competing projects are developed. Eventually this could lead to one being shelved. But it’s hard to speculate about this as much depends on corporate politics and it’s thus almost impossible to get a straight answer out of anyone (and even if you do, it’s even harder to tell if it is a straight answer).”

“It was only a couple of hours, so I can’t make any far-reaching judgements about Oslo. I can, however, say it looks like some very interesting technology. What I like about it is that it seems to provide a good pathway to using language workbenches. Having Microsoft behind it would be a big deal although we do need to remember that all sorts of things were promised about Longhorn that never came to pass. But all in all I think this is an interesting addition to the Language Workbench scene and a tool that could make DSLs much more prevalent.”

The article is very good. I liked a lot, I think everyone should read it in full.

Is NStatic dead?

// October 16th, 2008 // 2 Comments » // .net, Tools

It has been almost three years since the initial announcement of NStatic by Wesner Moise and still no release, not even a beta release. I wonder if the project is still alive or just in the backlog.  Wesner has not commented at all about NStatic release in his blog, nor he writes in his blog as regularly as he used to.

This is very sad, due to the excitement that I had when I learned about NStatic, and it lasted a whole year, learning about how the tool works. That excitement has just gone out of the door. NStatic is vaporware for me now, since I haven’t really seen anything, and I understand that software takes a long time to build, specially this complex, but still after almost three years, we have seen nothing.

In my personal opinion, I think talking about the tool so much is just going to affect negatively, especially if it is going to be a commercial tool.

Well this is just my opinion, I really feel disappointed because I was expecting it very eagerly. Now I don’t really expect it at all. There are other tools in the market that fill the gap right now.  They might not have the features that NStatic presumes it has, but it exists right now.

In my case, I have already adopted a tool for static analysis, and personally, even if NStatic was coming out tomorrow, it would take a long time for me to actually decide on adopting it. I don’t think the features that it has over the one we are using is actually going to be enough for us to change our process and re adapt. NStatic would have to be extremely innovative in its features and extremely correct in its findings in order for me to consider it as a cost effective solution for my projects.

I have to say this rant is not against Wesner at all or the NStatic project. The truth is I have never met him. But what I feel is very dissapointed, because too much time has passed and I don’t think I will see the product that Wesner proposes in a long time.