QuicksearchShow tagged entriesCategories |
Monday, September 21. 2009
PHP Quiz part 3 Posted by Mark van der Velden
in PHP, PHPQuiz, PlanetPHP at
17:35
Comments (2) Trackbacks (0) Defined tags for this entry: form, php, php quiz, phpquiz, planetphp, precedence, references, string, unset cast
PHP Quiz part 3Welcome to another part of the PHP Quiz series, again some interesting questions to crack your brain about. If you have some nice additions or questions, be sure to leave a comment. Enjoy part three! As always, think of the answer before you execute the code or look it up. You can find round two here. Unset castWhat is the type of $a and what is the type of $b Form funWhat will the output be? <form method="post" action="" enctype="text/plain">
<input name="search" type="text"> <input type="submit"> </form> <?php error_reporting( E_ALL ); echo (string) filter_input(INPUT_POST, 'search'); ?> Fun with stringsStrings in PHP are versatile, but how versatile are they... What will the output be? $juggling = "Itffkhmf";
Continue reading "PHP Quiz part 3"$rox = "Spy"; $b = $c = ""; for ($i=0; $i<strlen($juggling); $i++) { $b .= $juggling[ $i ]; $b++; } for ($i=0; $i<strlen($rox); $i++) { $c .= $rox[ $i ]; $c--; } var_dump( $b, $c ); Sunday, August 30. 2009
New airfilters and map update Posted by Mark van der Velden
in Motorbike at
23:06
Comments (0) Trackbacks (0) New airfilters and map updateLast Saturday I went for new air filters and a new (injection) mapping. I was planning to get that done anyway, but then I decided to update my blade with two K&N filters also. Slightly more performance and little to no more maintenance needed in the future regarding that area. (And honestly, while the filters are much more accessible then at my previous bike. It's still not the most fun part to clean.) After approx. 2 hours they finished tuning and she took one more run on the Dynojet. A total of 165 bhp on the rear wheel and (the most valuable part) a much faster throttle response and better power outtake. It was costly for something that seems minor, but as soon as I drove off and noticed the difference it was all worth it! Wednesday, August 5. 2009
The way a developer community works Posted by Mark van der Velden
in Social at
13:00
Comments (2) Trackbacks (0) The way a developer community worksI was watching the talk "Standing out in the crowd" by speaker Kirrily Robert at OSCON 09. And tweeted about this (http://twitter.com/Dynom/statuses/3142970947/) and when I read it back it got me thinking. And I decided to blog about it. Much of what Skud (Kirrily) says is without a doubt true, but doesn't apply sole to women. It's generally the way it "works" in the open source world and between developers in general. There is a certain attitude that is simply there, not just between language fanbois but also between developers in general. Your sexual orientation, sex, hair color or religion has nothing to do with that. Partially I think the attitude is there to improve yourself, at least that's how it works for me. You try to be as good as the one you think is better then you are. In a lot of communities, you don't explicitly mention your gender. You simply join a community (subscribe to a form or e-mail list) and you start posting/reading etc. And unless your nick is 'Girlygirl99' it's not too obvious in name also, so I wonder how people treat anyone based on their online identity. Feel free to prove me wrong on that, it's not that I don't believe it, I simply have never seen discrimination towards sex or sexual orientation in any community I've been in. And maybe it differs a lot per community, I'm involved in the PHP community and from what I hear it has a small percentage PHP developers that are female, and they even have their own "support site" PHPWomen.org. And they seem to do pretty well. As Skud quotes in her talk, some projects have a "diversity statement". I think it's nonsense to mention it at any community/project. It should only be mentioned if it doesn't say "everyone". If you want to be part of a community, simply step in. Order a beer, listen and join the conversation. If you lack the assertive skills to do that, it's not something the community can do about. It's something you need to improve on. If a community helps beginners, well that is a (big) plus. Personally I don't care what you are, as long as you aren't (secretly) part of Skynet. Comments are more then welcome. Sunday, July 12. 2009
Taking her for a dyno run Posted by Mark van der Velden
in Motorbike at
14:29
Comments (2) Trackbacks (0) Taking her for a dyno runYesterday I took my new bike for a spin on a Dynojet. I did this for a number of reasons, since I didn't bought the bike from a dealer I didn't know for sure if the bike was in perfect shape, and also I wanted to know how much *real* BHP it has, since the bike is slightly tuned (Power commander and Termignoni exhaust), which is definitely not stock. The score was excellent, according to the readout my blade has 161BHP on the wheel (which is proximately 10% less then on the crankshaft, which is mostly used to indicate the power) and performs really nice, the graph shows a near linear output of power, no dips anywhere along the way which is simply near ideal. However there is some misconfiguration between 4k-6k rpm, the fuel maps are not rich enough, which is something that needs correcting! So I'll make an appointment for a followup meeting with the tune company to create a custom map for my bike. Saturday, July 4. 2009
A new love, black beauty Posted by Mark van der Velden
in Motorbike at
13:37
Comments (0) Trackbacks (0) A new love, black beautyEver since Honda announced the 2007 1000rr model, better known as the "Fireblade", I fell in love with it. The black color set, the black suspension, the seat pipe exhaust, the aggressive looks and the power makes it a perfect bike. I recently had the possibilities to buy one and after searching for the right bike for about a year, I finally found it. Or, rather: found her!
Thursday, June 25. 2009
Did you know... part two Posted by Mark van der Velden
in PHP, PlanetPHP at
19:14
Comments (0) Trackbacks (0) Did you know... part twoIn these blog series I'd like to talk a bit about some "Did you knows". These series contain information I came across along the way and I mention them here to give you insight or just to make you aware of it's existence. The information is by no means in chronological order and mostly not even covering "state of the art" or "brand new" items for that matter. Some are directly code related, others are just brief descriptions. Basically it's just a pile of PHP and web related information. You can find part one here. Continue reading "Did you know... part two"Thursday, June 25. 2009
Apache's fail with 'encoded slashes' Posted by Mark van der Velden
in Apache at
14:58
Comments (0) Trackbacks (0) Apache's fail with 'encoded slashes'Honestly it took me a while to debug a vague bug I had, at first I ignored it and used different path values, figuring it was a bad rewrite rule. I'm using a project and I'm developing on both Apache and IIS, with the one inconsistency that I always got a 404 when the path contained a encoded /, namely "%2F". So basically, a URL like this: http://domain.com/show/article/104671-Situation%20details%20n%2Fa (Title being: "Situation details n/a") is giving a 404. The error log was helpful, because it said:
Luckily, fixing this Arguably you could be saying that %2F's simply shouldn't be in the path, but rather in the POST body or as GET parameter. However in a world where everything has to be SEO and url's have to be pretty, isn't this silly default behavior ? Especially since the RFC's also clearly state that an encoded forward slash (%2F) should not be treated as a regular '/'. To quote RFC 2616 Characters other than those in the "reserved" and "unsafe" sets (see RFC 2396 [42]) are equivalent to their ""%" HEX HEX" encoding. and RFC 2396 2.2. Reserved Characters Wednesday, June 24. 2009
jQuery simple unordered list filter Posted by Mark van der Velden
in Javascript at
15:50
Comments (3) Trackbacks (0) jQuery simple unordered list filterI needed a simple filter system on a unordered list. The goal is to filter 'realtime' based on what a user is typing. I came up with the following, if you have any suggestions and/or performance tips feel free to drop a line! The HTML:The blog software is messing with the HTML, for a working example with ungarbled code. Look at the bottom of this post.
</p><div> <input name="filter" id="search_filter" type="text"> </div><div id="titles"> <ul> <li><a href="http://blog.dynom.nl/path/to/item/1">Item 1</a></li> <li><a href="http://blog.dynom.nl/path/to/item/2">Item 2</a></li> <li><a href="http://blog.dynom.nl/path/to/item/3">Item 3</a></li> </ul> </div>
The Javascriptvar My = {}
My.List = { Filter : function (inputSelector, listSelector) { // Sanity check var inp, rgx = new RegExp(), titles = $(listSelector), keys; if (titles.length === 0) { return false; } // The list with keys to skip (esc, arrows, return, etc) // 8 is backspace, you might want to remove that for better usability keys = [ 13, 27, 32, 37, 38, 39, 40, 8 ]; // binding keyup to the unordered list $(inputSelector).bind('keyup', function (e) { if (jQuery.inArray(e.keyCode, keys) >= 0) { return false; } // Building the regex from our user input, 'inp' should be escaped inp = $(this).attr('value'); rgx.compile(inp, 'im'); titles.each(function () { if (rgx.source !== '' && !rgx.test($(this).html())) { $(this).parent('li').hide(); } else { $(this).parent('li').show(); } }); }); } }; // When the DOM is ready $(document).ready(function () { // Attach the filter to our input and list My.List.Filter('input#search_filter', '#titles>ul>li>a'); }); Working exampleVisit http://dynom.nl/jquery/list.php for a working example. Tuesday, May 26. 2009
Javascript cookie helper class Posted by Mark van der Velden
in Javascript at
12:00
Comments (2) Trackbacks (0) Javascript cookie helper classLittle original perhaps, but I thought I'd share this cookie class. It makes my life a little easier, My.Cookie = {
/** * Set a cookie * @param {string} n name * @param {scalar} v value * @param {int} days */ set: function (n, v, days) { var e = '', d; if (days) { d = new Date(); d.setTime(d.getTime() + (days * 86400000)); e = "; expires=" + d.toGMTString(); } document.cookie = n + "=" + v + e + "; path=/"; }, /** * get a cookie * @param {string} n name */ get: function (n) { var match = n + "=", c = '', ca = document.cookie.split(';'), i; for (i = 0; i < ca.length, c=ca[i]; i++) { if (c.indexOf(match) === 0) { return c.substring(match.length, c.length); } } return null; }, /** * Delete a cookie * @param {string} n name */ del: function (n) { this.set(n, "", -1); } }; Thursday, May 14. 2009
PHP Quiz part 2 Posted by Mark van der Velden
in PHP, PHPQuiz, PlanetPHP at
10:41
Comments (10) Trackbacks (0) Defined tags for this entry: arrayaccess, nesting structures, operator precedence, php, php quiz, phpquiz, planetphp, references
PHP Quiz part 2A short quiz this time, but that doesn't make it less fun. Do you know the answer to all of them? Get a cup of coffee and kill 10 minutes with round two... As always, think of the answer before you execute the code or look it up. You can find round one here. Array pointerWhat will the output be ? ArrayAccess and isset funisset or not isset, thats the question. $a = new ArrayObject;
$a['fubar'] = NULL; $null = NULL; if (isset($null)) { echo 1; } else { echo 2; } if (isset($a['fubar'])) { echo 1; } else { echo 2; } if (array_key_exists('fubar', $a)) { echo 1; } else { echo 2; } Typo?The output might be confusing.. ReferencesHow many notices will be thrown? |
Calendar
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||
