Will Fris's WordPress Weblog











{20101109}   XDebug configuration

In this entry i will try to publicly memorize my XDebug-configuration changes.

For now, showing more depth is the main one, in my config i have typed:

xdebug.var_display_max_depth=12

The default value is 3, which just doesn’t cover most of my multidimensional combined-key arrays.



As it turns out i configured xdebug to show all exceptions, even caught ones… silly me smiley

I found the answer to solve this issue on stackoverflow, after i had been told that it’s _really not_ standard php behaviour by some_people@#freenode:php .

The answer is to set

xdebug.show_exception_trace = Off

Thanks Artefacto for your answer to hide caught exceptions shown by xdebug.



{20101017}   if it is IT i fi

if it is IT i fi

et vice versa

if iT Is it i fi

the jewels you find whilst programming :p

( this was from a comment: “convert $k to a multidimensional array if it is.” )



{20101017}   protocal relative uri

i just came across protocol-relative uri , an example:

instead of `directly` linking to a file in google’s cdn( content distribution network)

http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js

it is possible to link to it in a protocol relative way like so:

//ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js

thanks to Ken Redler, answering a question on stackoverflow.



JaY, i can be even lazier with typing

Okay, it took a few minutes to figure out
but i now have a way to recursively open all `webby`-files
while typing only two letters
in my terminal/command-line/commandprompt/sli/shell/bash/sh/whatever…

To be able to do so i use two aliases
in my ~/.bash_aliases file( which gets sourced in my ~/.bashrc file ).
I use bash on ubuntu and do not yet know if this will work on other boxes…

`webby`-files can mean anything ofcourse, but at this moment it means the following for me:

files ending in : .phtml , .php , .css , .js or .htaccess

The two aliases in ~/.bash_aliases

alias web_files='find . -regex '\''.*\.\(php\|phtml\|css\|js\|htaccess\)'\'' '

alias vw='vim $( web_files )'

c’est tout .



re: What constitutes a good website?

Stephen Hay:

“[…] a lot of government organizations and businesses don’t see the need to even try and conform to accessibility guidelines.[…]”

Another reply to Stephen Hay‘s request for more reasons to create accessible sites( if I interpreted and read his article correctly that is).
How can we get `the others` to see that it’s important to create accessible sites?

On a sidenote, in a broader sense this is an exploration into the world of `seducing your client` to ‘buy your story’.
A story which of course to you seems to be the best option.

client’s view on compliance

Reading through the comments on Stephen’s article quickly gives me more then enough arguments in favour of creating accessible sites.
When all these arguments can be produced on such a short notice and ‘shaken from the sleeve’, I guess those arguments are quite ‘out-there’/quite well known.
If so, how come businesses and the people in it are not picking up on it?

Frank Schaap:

“[…]So, why don’t people already care? Most people don’t care much for technology at all, or mayb[…]”

At this moment I imagine myself that it is a matter of time. The companies have not yet had enough time to feel and thereby take-note-of the fact that, if done properly, creating accessible and rich web-content really is a profession, something that can not just be done by someone who knows how to type on a computer.

In a more negative view I tend to think that this is an illusion
and most of them will never learn this lesson from mother father time.
Which brings me to another question; why should they ?

supplier’s view on compliance

Dutch government organizations will, if I understand correctly, soon be `forced` to create compliant content.

businesses only care about what is good for their business, not about technical things.
Therefore their choice will be based upon business-needs.
When this choice results in a non-compliant result they have made a `wrong` choice according to us.
But this choice might just serve their needs quite well.
If however it does not( or (in time )turn out not to) serve them well they will hopefully learn a lesson.
That’s where `we` should draw their attention and provide them with our insight(s).

Thinking about this, I noticed that they probably just cannot see these things as a problem.
This is because they have not( yet) experienced a problem with it.
So, ask yourself: Have you ever consciously solved a problem you did not know about ?
Herein might lay a solution.

Making it something to brag about, a viable solution ?

Frank Schaap:

“[…]Maybe we should have something like a webstandards F1 or WRC… make people want to have that CCS3 badge slapped on their shiny alloy footers. Make it bragable[😛…]”

It’s always good to provide stimuli, I have however become wary about badges like the w3c-badges
which people, without complying, just put on their sites.
What can be done to prevent such a monstrous atrocity ?

This seems to me as a reflection of men’s ignorance( which is said to be bliss).

Let them have it, an unfinished solution?

I’m sorry to say that I don’t know how,
but I do think that there is an answer in providing them with real problems.
It should however be a problem that will draw their attention, let their ignorance be ignored.

Another way probably is to make the product more economically interesting, another type of ‘letting them have it’.

Making the product economically more beneficial, a solution?

Well, essentially this will be most of the things Frank Schaap writes. 😛



While working in PHP today, I wanted to have a way to turn a string like:
name=value,name=,name=value
(maybe even: name=value,name,name=value,=value,name=value )
I tried:
explode('=' , explode(',' , $array));
But unfortunately that did not work, since explode() does not except an array as argument. (And the small fact that I got the parameters mixed up first time around did not help either. 🙂 )

I could not immediately come up with a way to do this, so I searched for something like: `php recursive explode`.
Among others, I found `PHP split or explode`.
One of the questions that poster asks is: “Is it recommended to avoid to use the split() function and other PHP functions ?”
To answer this, I went to the php split-function page in the manual, which I can do by typing: `p split` in the location bar since I use firefox and made `p` the keyword for this search engine.
(I actually type: `:o p split`, since I am using the vimperator add-on for firefox, maybe more about that some other time though.)

Nonetheless, that page did not answer my question either.
I however digressed as I do very often, going off to write this blog-entry and to answer my new question:
What is the difference between str_split and explode ?
Well , in short to this is:

str_split
splits a string by a certain amount of chars and returns an array

while

explode
splits a string by a certain other string and returns an array

.
This however did not solve the problem , so I searched a bit more: `explode to associative array` .
Which gave me some useful hits that were good for hints, but did not provide a way to do key-value_pairs.

I thought it took too long to find a solution, so I wrote my own, in the neglect of it being an `unelegant` solution.
So for now, this is my solution to the problem:


<?php
#I have absolutely no idea why explode() should have it's delimiter as first parameter(as it says in the manual).
function splita ($string , $delimiters = ' ')
	{
		$array                                      =  array();
		is_array($delimiters) ? NULL : $delimiters  =  array_slice(func_get_args() , 1);//Check if array is empty?
		if (count($delimiters) !== 2){throw new Exception('Sorry, not yet supported.');}
		reset($delimiters);
		$arr                                        =  explode(current($delimiters) , $string);
		next($delimiters);
		foreach ($arr as $index => $name_value_pair)
			{
				$tmp  =  explode(current($delimiters) , $name_value_pair);
				if ($tmp === FALSE)
					{//echo 'geen value:' . implode(':',$tmp);
						$array[$tmp[0]]  =  '';
					}
				elseif (isset($tmp[1]))
					{//echo 'name-value:' . implode(':',$tmp);
						$array[$tmp[0]]  =  $tmp[1];
					}
				else
					{//echo 'just-value:' . implode(':',$tmp);
						$array[]         =  $tmp[0];
					}
			}
		return $array;
	}
?>

I will probably change it again sometime, there’s also stuff I did not take into account yet.
Anyway, for now, it will do.

Update (Sun 2009-08-23, 15:55.47 CEST):
I knew it…
The parse_str() function… doh!



{20090806}   MySQL – Grant

So I forgot about the `backtics` again … :S


http://dev.mysql.com/doc/refman/5.1/en/grant.html

To specify quoted values, quote database, table, column, and routine names as identifiers, using backticks (“`”). Quote user names and host names as identifiers or as strings, using either backticks (“`”), single quotes (“’”), or double quotes (“””). Quote passwords as strings, using single quotes.

The “_” and “%” wildcards are allowed when specifying database names in GRANT statements that grant privileges at the global or database levels. This means, for example, that if you want to use a “_” character as part of a database name, you should specify it as “\_” in the GRANT statement, to prevent the user from being able to access additional databases matching the wildcard pattern; for example, GRANT … ON `foo\_bar`.* TO ….



After following this guide about fixing the super-key in ubuntu I can now really start using the `Super`-key . Isn’t it strange that this key has the windows logo on it ? How did this happen ? Where and when did all laptop-producing companies decide to do this ?

The occasion for this renewed interest in my keyboard was triggered by a survey about business-class laptops I did today (results will probably taken into account by Lenovo) .

This survey also gave birth to a renewed interest into the current laptop-monitor’s aspect-ratio’s . Why have they all gone to 19:10 (a.k.a. 8:5) ?

Before I bought my current laptop , with a 19 to 10 ratio , I have really considered buying one without the same performance but with a 4 to 3 ratio . In the end I decided it wasn’t worth the loss in performance but I am beginning to doubt that decision .

Well , anyway , Thinkpads FTW ! : )



{20090628}  

World March for Peace and Nonviolence

Please join the world march for peace and nonviolence.



et cetera