Posts Tagged ‘structum’

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 {
	display:block;
	...
}

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 );
			return;
		}
	...
  	}

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 );
			return;
		}
	...
  	}

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

New Structum Site!!

// July 24th, 2008 // 2 Comments » // .net, c++, software development, windows

I have finished the first phase of the Structum site, which is the place where all of my projects will end up. I have some projects which have collaborators, but the work is mostly going to be done by myself.

Structum used to be my company when I lived in Mexico, and I left it to get a position in another company. I sold all of my products of the time to the company I moved to.

Now, I have been working on a set of projects which I plan to release through the Structum site and using (again!) the Structum brand.

The first project displayed is the RegEx Compiler. This project was displayed in my blog first, but I have moved it to the Structum Site and released a beta of the new upcoming release. The new features include an improved UI and Regular Expressions testing modules. It is not finished yet, so I don’t recommend it for production environments.

There will be more to come. Stay tuned.

UPDATE: The new site is here: http://www.structum.net