Jun 16

jQuery event object

This post is copy of a part of previous post. I’ve just started to adding new updates to the previous one and finally decided to make it a different one ;) What is it about? It’s about something most of you know if you work a lot with jQuery or if you read its documentation more carefully than I did. It’s about an interesting property in jQuery event object and some interesting results of using jQuery on() method.

If you want to bind a function to click event of an element it is quite easy if the element exist in DOM after page is loaded. For example:

<form>
  <button type="button">Click Me!</button>
</form>
(function(){
  $('button[type=button]').click(function() {
    //an action here...
  });
})();

or

(function(){
  $('button[type=button]').bind('click', function() {
    //an action here...
  });
})();

But if the button is added later after an AJAX call for example we should use $.on() function (before it was $.live() and/or $.delegate()):

(function(){
  $('form').on('click', 'button[type=button]', function() {
    //an action here...
  });
})();

It works “the same” but problem occurs if you want to do something with the event target. For example hide or disable the clicked button. If element is in the DOM, it is easy and it works:

(function(){
  $('button[type=button]').bind('click', function(e) {
    var target = e.target;
    $(target).hide();
  });
})();

But if the element is not in the DOM and you use $.proxy() it happens to be harder and tricky unless you read jQuery manual ;)

(function(){
  $('form').on('click', 'button[type=button]', $.proxy(function(e) {
    var target = e.currentTarget;
    $(target).hide();
  }, this));
})();

Maybe I will play with it more and write more about it later because right now I did not even check if the code I had written above is correct ;)

Update (2012-06-07):
I put the code above to a test file and it works. However, I hadn’t expected it to work the way it worked :P I expected e.target and e.currentTarget to be different when I used jQuery on() method. At the begining I thought it worked correctly because the code didn’t change DOM anyhow. So, I created another test file with DOM modifications. Again — the results weren’t as I had expected them to be ;) It was like that during our work I mentioned above. Maybe the HTML there was more complicated that one from my examples and that was the case. I’ll investigate it more and if find out what is going on, I’ll update it here ;)

Update (2012-06-16):
The same day I wrote previous update I talked about the issue with my colleague. He had showed me the issue during our project work. He agreed with me our code was a lot more complicated than my examples. It was a wrapper with an image inside and unsorted list with anchors inside. Clicking on one of the anchor was supposed to trigger an event which changed the image. It took me few time to create another example. I’ve just added a wrapper then and bind an event to it. Clicking buttons and observing what’s going on in the console. It illustrate our issue a little bit.

Permanent link to this article: https://blog.lukaszewski.it/2012/06/16/jquery-event-object/

May 29

Short post #2

I did not have time to work on a particular case. And that is why this month’s post is the second one from “Short posts” series ;) I would like to mention here few things which were/are occupying my time recently. Maybe in June I’ll write more focused on one topic and longer post (however it will be UEFA Euro 2012 so we will see… :p).

WordPress

Who does not know WordPress? A big blogging system which I used for my blog. But also which many used for their blogs and… People and small businesses even build web-pages based on WordPress as a content management system. Finally, I did try it too and I got impressed how easy it is to build a theme and plugins for WordPress. There were only two things I did not like much: lots of WordPress plugins are written in the way we call spaghetti code + the internationalization process is quite odd for me and too much time consuming. But still, I would like to build more plugins themes, maybe contribute in a WP project. We will see. I will let you know if anything of that will come true ;) For know, I encourage you to read a little bit more WordPress documentation.

Wikia&AKAI

At the beginning of this month we gave again few talks to Poznań’s students of Poznań University of Technology. This time we told a little bit more about PhantomJS project, mobile development and I talked about handling errors in PHP. This time the meeting was special because after talks we went to KontenerART to talk more with some beers in our hands. Thanks to that, I got interesting feedback that my presentation could have been more technical. However, later we agreed that it is hard to be talking for 30 minutes about PHP errors only from the technical point of view ;) You can find my presentation here and the other presentation (also from previous meetings) here.

jQuery event handling

Last but not least thing I would like to mention is an interesting thing about jQuery and its Event object. We found it out recently during our work on wikia.com page. I’ve learnt that the jQuery event object except target property has also other interesting properties. One of them is currentTarget. I did few tests and put my thoughts here but then, the post stopped to be a short one ;) So, more about it with some simple code examples can be found in the next post.

Permanent link to this article: https://blog.lukaszewski.it/2012/05/29/short-post-2/

Apr 22

Talks by AKAI & Wikia

Last weekend we started all Engineering All Hands 2012. It made my days even shorten than before. Finally, I’m relaxing this weekend: sleeping, playing games, taking long walks, reading… and (I made it!) writing. This time it will be just a short post about cooperation between AKAI, which is web-application fans’ club gathering students from Poznań’s universities, and Wikia.

Our work on talks for students started in November 2011. We organized three meetings so far and at the last meeting I gave it a try and also talked a little bit about PHP basics. I must say I was really nervous but I got impression that my presentation wasn’t as bored as I thought it had been ;) I even had few questions to answer and about one of them I’d like to write more.

The question was about “class variables” which exist in Python — do they exist it PHP as well? I wasn’t sure what was the answer because I didn’t know Python at all. But after my honest answer about lack of Python skills the questioner told me that those are variables which values doesn’t change and is the same between different instances of a class. Of course, the answer was pretty simple and the rest of the audience answered the question. You can use in PHP something which is static field of a class:

class A {
        public $b = 0;
        public static $c = 0;

        public function incrB() {
                $this->b++;
        }

        public function incrC() {
                self::$c++;
        }

        public function display() {
                print_r(array(
                        $this->b,
                        self::$c
                ));
        }
}

$a1 = new A;
$a2 = new A;
$a3 = new A;

$a1->display();
$a2->display();
$a3->display();

$a2->incrB();
$a2->incrC();

$a1->display();
$a2->display();
$a3->display();

$a2->incrB();
$a2->incrC();
$a3->incrB();
$a3->incrC();

$a1->display();
$a2->display();
$a3->display();

After running this simple script you can notice how the static field $c “remembers” its previous value. This value is also shared between different instances of the class. So, at the beginning the value equals 0. We increase it by firing incrC() method of object $a2. Later we display values and for each instance ($a1, $a2, $a3) the value of $c equals 1. Then we increase it twice by firing incrC() method of object $a2 and the same named method of object $a3. The value of $c static field for each instances equals 3 at the end of the script.

I went through the English and Polish documentation chapters reading about classes and I didn’t find anything highlighted about this behavior of “class variables” in Python. There was also nothing about static fields. Therefore I assumed in Python all variables of a class behaves like that. And that’s why author of the question called it “class variables”. But maybe I’m wrong. If so, I’ll change this part of the post soon ;)

I would also invite you to next event by AKAI and Wikia which will take place at Poznań University of Technology on May 8th. More information (unfortunately only in Polish) here. Here you can find slides from my previous talk + all slides from “Front-end i… w praktyce” events are available here.

Permanent link to this article: https://blog.lukaszewski.it/2012/04/22/talks-by-akai-and-wikia/

Mar 25

php constant() function

Even though I’ve been creating PHP applications and small pages for few years there are still lots of surprising and sometimes magic abilities of this language. Some of them we heard from other programmers. Some we discover during our daily work. Today I’d like to share with you about a built-in function which the way I learnt it was exactly what I’ve written before: a magic function that helped me to solve a little issue in our Wikia codebase.

The case looked like that:

class A {
  const TYPE_A = 1;
  const TYPE_B = 2;
  const TYPE_C = 3;
  const TYPE_D = 4;
  const TYPE_E = 5;

  public static function isValid($text, $type) {
    //...
  }
}

class B {
  protected $user = null;

  public function __construct($user) {
    //...
  }

  public function isUsersNameBlocked() {
    return $this->isOkWithA($this->user->getName(), A::TYPE_B);
  }

  public function isUsersNickBlocked() {
    return $this->isOkWithA($this->user->getNick(), A::TYPE_C);
  }

  public function isUsersOccupationBlocked() {
    return $this->isOkWithA($this->user->getOccupation());
  }

  protected function isOkWithA($text, $type = null) {
    $type = is_null($type) ? A::TYPE_A : $type;
    if( class_exists('A') ) {
      return A::isValid($text, $type);
    }

    return true;
  }
}

It turned out one of our wikis doesn’t have the extension “X” which includes the class “A” above and therefore extension “Y” and its class “B” had a logic error within. There had been a thought that it could happen and that’s why the author added the “if” block in isOkWithA() method. But it wasn’t enough. First call to “A” class was before the “if” block and even earlier in other “B” methods (isUsersNameBlocked(), isUsersNickBlocked())!

The hacky way would be replace the class constants with integers before our “secure if” statement. But it wasn’t good idea since later the constants values may change and no one who changes them will think about B class.

We could also re-design everything and maybe put those methods in the A class or introduce some hooks functions. Well, it needed consultation and discussions about how solid and proper is the idea and what the best way to implement and release it is. We could have planed it for later and still needed a quick fix to stop the only one wiki polluting our log with the fatal errors.

I came with a simple solution. I wanted to pass a string parameter in the methods of the B class instead of the constants of the A class. But something like that didn’t work:

//...
public function isUsersNameBlocked() {
  return $this->isOkWithA($this->user->getName(), 'TYPE_B');
}

public function isUsersNickBlocked() {
  return $this->isOkWithA($this->user->getNick(), 'TYPE_C');
}

protected function isOkWithA($text, $type = null) {
  if( class_exists('A') ) {
    $type = is_null($type) ? A::TYPE_A : A::$type;
    return A::isValid($text, $type);
  }

  return true;
}
//...

But then we tried to get to static property of A class not its constant. I tried a little more tricks which are possible thanks to rich syntax of PHP but it ended with nothing. Finally, after short googling the Internet the built-in function constant() was discovered! :) And I changed these parts of code:

class B {
  public function isUsersNameBlocked() {
    return $this->isOkWithA($this->user->getName(), 'TYPE_B');
  }

  public function isUsersNickBlocked() {
    return $this->isOkWithA($this->user->getNick(), 'TYPE_C');
  }
  
  protected function isOkWithA($text, $type = null) {
    if( class_exists('A') ) {
      $type = is_null($type) ? A::TYPE_A : constant("A::$type");
      return A::isValid($text, $type);
    }

    return true;
  }
}

This solution still looks a bit hacky but it’s better than passing directly integers, I think. However it’s still error-prone and in the long term actions we will probably change a little bit the architecture of the extension.

It does seem PHP has really interesting built-in functions. Maybe they are a little bit hacky but they are making PHP flexible, aren’t they?

Permanent link to this article: https://blog.lukaszewski.it/2012/03/25/php-constant-function/

Feb 24

Installing screen saver in Ubuntu 11.10

As you probably know new Ubuntu 11.10 doesn’t have screen saver. When you press combination of Ctrl + Alt + L to lock your screen there is only a black screen. If you want some fancy screen savers you have to install it. It’s easy to do and you’ll probably find lots of quick tutorials how to do it.

The most of those tutorials in few steps tell you how to install XScreenSaver which is, I guess, most popular one. Those tutorials looks usually like this one:

  1. Remove gnome screen saver which is the blank screen fired after pressing lock shortcut:
    sudo apt-get remove gnome-screensaver
  2. Install XScreenSaver with plugins:
    sudo apt-get install xscreensaver xscreensaver-gl-extra xscreensaver-data-extra
  3. And add to startup applications new screensaver’s command:
    xscreensaver -nosplash

I followed this one if you need confirmation of instructions above ;)

After that you can open your dash and run XScreenSaver to be able preview lots of new screen savers. It took me a while till I found my favorited ones. Finally I chose one and got back to work ;) But after a while I needed a coffee. I headed to the kitchen but before leaving my desk I automatically pressed Ctrl + Alt + L to lock my screen. An error occurred with information that it couldn’t find gnome-screensaver app. Of course it couldn’t — I had had removed it :) But it took me a while to fine on the Internet the solution which is quite simple and I hope will help some of you as it helped me.

Go to your terminal and create new symlink:

sudo ln -s /usr/bin/xscreensaver-command /usr/bin/gnome-screensaver-command

That’s all! After creating it the Ctrl + Alt + L works perfectly and I can go for my coffee ;)

Cheers.

Permanent link to this article: https://blog.lukaszewski.it/2012/02/24/installing-screen-saver-in-ubuntu-11-10/

Feb 11

Summary of “High Performance Web Sites” by Steve Souders

Finally I did read the book I mentioned in my previous post. Here are the 14 steps/rules presented by Steve Souders and my short description of them.

Make fewer HTTP requests

The main rule which is connected to some of the next rules. It’s also the most effective for first-time visitors to your web site and pretty good for subsequent views. The chapter in the book has sub-chapters which are more detailed rules focused on particular components of a web. If you strict to all of them you’ll make fewer HTTP request and your page will be faster. Those more detailed rules are: image maps (56% better performance of sample page), CSS sprites (57% better performance), inline images (50% better performance) and combined scripts and stylesheets.

Use a content delivery network

CDN is a collection of web servers distributed across multiple geographic locations. They have the same data and deliver them to a user more efficiently than one web server with that data. The example page done by the author loaded 18% faster with CDN than without. I’m surprised Steve Souders put this rule at the beginning. In my opinion the saving here are smaller than in next rule and sometimes it doesn’t make any sense to buy such a service as CDN. Something from category nice-to-have when your page finally got bigger audience. Interesting is the fact that in Poland I found only one company in Google who has such a service in their offer as CDN (but I only had 5 minutes to do the search — maybe the market is bigger). I had the feeling polish companies usually build their own CDN architecture.

Add an expires header

As I mentioned before implementing this rule had better results than the previous one. But, what’s important, the performance isn’t as much better as you visit the page by the first time. The way how to achieve the results was presented by me in my previous post — a easy reconfiguration of your web server. Example provided by the author had 57% reduction of time for the page to load.

And it’s all based on the caching system. The only problem with this you can meet is when you change already cached by user’s browser file. It’s quite likely the user won’t get updated file because the browser wouldn’t even ask for the file because its cached version didn’t expired. The solution is really simple: include a version number in your files’ names. Every time you want to be sure users will get the newest version of a file you’ve just changed, change the number everywhere the file was included and the browser will download it.

Gzip components

Once again you can get 53% faster loading page when you compress its components. However, we need to be careful here. We have to remember that gziping things costs us a higher usage of our server’s CPU and also it costs a higher usage our users computer’s CPUs. But there are also possibilities to gzip only some, choosen files i.e. bigger one. Author presents Apache servers’ directive mod_gzip_minimum_file_size we can set it to 1 or 2K and server will compress only those files.
Another issue are proxy servers between our web server and users. A user visits our page using proxy server. His browser does support gzip so the response from our server is a compressed content. Another user visits our page using the same proxy server. But her browser doesn’t support gzip and still gets compressed content. To solve this problem we need to use Accept-Encoding in the server’s Vary response header.

Put stylesheets at the top

By going through this chapter you’ll finish with more detailed rule:
[important]Put your stylesheets in the document HEAD using the LINK tag.[/important]
This rule is more about a user experience. Steve Souders explains us two phenomenons: blank white screen and Flash of Unstyled Content (FOUC). By putting our stylesheets at the top we risk less unwanted user experience and it won’t block progressive rendering of a page.

Put scripts at the bottom

This chapter is very similar to the previous one. Again it’s more about good user experience. Scripts block parallel downloading. They also block progressive rendering for all content below the script. It’s slightly different than CSS because progressive rendering is blocked as long as the stylesheets aren’t downloaded.

Avoid CSS expressions

Another rule of better user experience. But this time this is one of the few rules that addresses performance of a page after it has been loaded. I never used CSS expressions because I didn’t find an issue which could be solved only with a CSS expression. For a different page background we use SASS servers, for a different width of a page or an element on a page we use JavaScript.

Make javascript and CSS external

This one is quite tricky. The test at the beginning of the chapter shows inline scripts and CSS rules make better performance of a page. But this is true as long as you don’t have many pageviews. If you make your scripts and CSS external it’s more likely they’ll be cached by a user’s browser. And it can result with more than 50% faster page loading as described in previous chapters.

However, author finds the only exception where inlining is preferable. The exception is a homepage. There are three metrics presented by Steve Souders in this chapter: page views, empty cache vs. primed cache and component reuse. Analyzing these metrics creates an inclination toward inlining over using external files.

Reduce DNS Lookups

The chapter starts with an introduction to the Internet, IP addresses and Domain Name Systems. Then we can read about DNS maps in our (or users’) operating systems, browsers and finally we get know each new DNS lookup could take up to 20-120 milliseconds. It’s better to avoid many of those lookups.

Minify javascript

We learn here about minification and obfuscation. There are also two tests for small files and bigger files. In the first case it’s 17-19% faster than a normal case. And in bigger files test there is 30-31% faster page loading than normal.

Avoid redirects

Redirects are worse than CSS at the bottom of a page and JavaScript at the top of it. We can find few alternatives to avoid redirects in this chapter. We should remember about trailing slash which is the most wasteful redirect.

Remove duplicate scripts

Duplicate scripts happen even on big portals or mostly on big portals. Factors are various but the bigger is developing team, the bigger is codebase, the bigger are chances a script will be duplicated. They hurt performance in two ways: unnecessary HTTP requests and wasted JavaScript execution.
As a way of avoiding duplicate scripts the author propose implementing a script management module in our templating system.

Configure ETags

ETags are mechanism that web servers and browsers use to validate cached components. The problem with them is that they are typically constructed using attributes that make them unique to a specific server hosting a site. ETags won’t match when a browser gets the original component from one server and later makes a conditional GET request that goes to a different server. If Expires attribute in header is enough for you and you don’t need ETags just remove them from your server configuration. If you have components that have to be validated based on something other than the last-modified date, ETags are a powerful way of doing that and you can change the way how they are constructed.

Make AJAX cacheable

We can learn some basics about AJAX at the beginning of this chapter. Author informs us that the best way to optimize AJAX request is to follow some of introduced before rules. The most important rule is to make the response cacheable. But we can also gzip the response, make sure there are no additional DNS lookups, minify the response if it’s a javascript, avoid redirects and configure or remove ETags.

Summary

Below I placed the list of all rules. As you noticed few times I mentioned something about Steve Souders’ tests. All of the examples can be found here.

  1. Make fewer HTTP requests.
  2. Use a content delivery network.
  3. Add a far future Expires header to your components.
  4. Gzip your scripts and stylesheets.
  5. Put your stylesheets in the document HEAD using the LINK tag.
  6. Move scripts to the bottom of the page.
  7. Avoid CSS expressions.
  8. Put your JavaScript and CSS in external files.
  9. Reduce DNS lookups by using Keep-Alive and fewer domains.
  10. Minify your JavaScript source code.
  11. Find ways to avoid redirects.
  12. Make sure scripts are included only once.
  13. Reconfigure or remove ETags.
  14. Make sure your AJAX requests follow the performance guidelines, especially having a far future Expires header.

I still keep my opinion that not all of the rules could be respected and done only with a front-end engineer’s work. Mentioned by me in the previous post rules: adding expires headers and gziping our page’s components can be done properly (and easy) only with changes in our server configuration. The same comes with next rules such as: reducing DNS lookups or configuring ETags. But I still keep my opinion that it doesn’t harm any front-end engineer if she gets know about these ways to make her page performance better. She could take care of it and set the right configuration or pass it to someone who knows better how to configure the web server.

I’m looking forward to read the second part and I’ll probably write about it too.

Stay tuned! :)

Permanent link to this article: https://blog.lukaszewski.it/2012/02/11/summary-of-high-performance-web-sites-by-steve-souders/

Feb 01

Was Steve Souders wrong?

Hi!

Wow, it’s been a while again. Sorry about that but the end of December and entire January were really busy for me. The fact I had 6 updates waiting in my WordPress dashboard just proves more how long I didn’t visit this page. Nothing changes about me having no time for anything…

The same is with this post. I decided to write it because I can’t wait till I finish the book, I’m reading. I’m sure most of you know it. It’s a quite old book if we’re talking about computer books. High Performance Web Sites by Steve Souders. The book isn’t a big one as Thinking in Java, Thinking in C++ or any other thinking-in-a-computer-language books. But I started reading it on Monday, I read about half of it and didn’t find time to finish it yesterday… and probably today. So, I decided to write about at least the half I’ve managed to read this month. I’d like to write a summary after I finish the book — it’ll be probably mostly for me because I’m almost the only reader of this blog ;) And I’m sure while writing I’ll remember more from what I’ve read.

So, the summary will show up here but today I’d like to write about two chapters I’ve already read. The book is mostly dedicated to frontend engineers and it explains how important is to think about performance of your website when you’re a frontend developer. But among the chapters at the beginning the author forgets about it and, in my opinion, at least two of those chapters are addressed to web application server’s (Apache) administrators.

Rule 3: Add an Expires header

Thanks to such a simple solution our page could be 50% faster (if a user let her browser cache pages — by default most of the browsers do that). But, how do HTTP headers sent to the server link to a frontend engineer work? As examples Steve Souders gives us three lines of Apache server configuration (with mod_expires module enabled):

<filesmatch "\.(gif|jpg|js|css)$">
ExpiresDefault "access plus 10 years"
</filesmatch>

How simple is that?! Piece of cake! But what I’d like to add is that many of common frameworks gives you ability to add the headers. It can be helpful when you don’t have access to your server configuration because you use one of different hosting services. But it won’t add the header to your gif/jpg/js/css files — only the php output will have the header.

[important]So, remember: Add a far future Expires header to your components.[/important]

Rule 4: Gzip Components.

Again, from his tests Steve Souders has interesting results — with sites loading faster of around 50% and size reduction of 70%! And again, this time he presents us two Apache modules: mod_gzip and mod_deflate. The first one is available in version 1.3 and the second one starts with version 2.0. And the basic configuration for compressing scripts can’t be easier in the second case:

AddOutputFilterByType DEFLATE text/html text/css application-x-javascript

With mod_gzip in Apache 1.3 it takes few more lines:

mod_gzip_item_include     file     \.js$
mod_gzip_item_include     mime     ^application/x-javascript$
mod_gzip_item_include     file     \.css$
mod_gzip_item_include     mime     ^text/css$

Of course before that we have to put the directives which enables the module and it’s nice to put there also additional directives and have better control on the configuration. Since, as you probably know, compression is quite CPU consuming and we need to find the optimal way of using it.

Again, there are PHP frameworks which helps you with the compression of response.

[important]So, remember: Gzip your scripts and stylesheets.[/important]

Was Steve Souders wrong?

Was he wrong and instead of 14 steps for frontend engineers there should be 12 steps? Of course no! Recently someone sent me a link to an article about problem of finding out why your agile team isn’t agile at all. The main reason was that only one part of a project is being created by one agile team and after “their work” the other part of the project is being made by other agile team. When, there should be one team with at least one specialist of a domain. Sometimes, especially in small companies, this is hard to do. But there is also the idea we need to improve ourselves all the time ;) So, if a frontend developer has a little knowledge of configuration of an Apache server, that’s good! (at least better than no such a knowledge at all)

Permanent link to this article: https://blog.lukaszewski.it/2012/02/01/was-steve-souders-wrong/

Dec 04

CSS3 – 3D transformation – inspired by meet.js

meet.js, Poznań, 2011-11-25

Last Friday, 25th of November, I attended to meet.js event in Poznań. (Well it was two weeks ago but just after the meeting I started to write this post…) The meeting started quite early at 6pm. Usually I’m still at work at this time but this time I made it and left the office around 5.20 to get to meet.js.

What did I find there? A lot of positive people, mostly front-end developers who are up to talk about and share their ideas, experiences. This is how PHPCon should looks like next year! ;)

Talk of Bartek Szopka could be called “tani blichtr” (Google tells me it could be translated to “cheap tinsel” but I’ve already heard “cheap deal” too) by some of my colleagues but it inspired me to write this short post.
The slides itself were interesting form a technical and visual point of view. It was HTML5&CSS3 presentation about 3D transformations in CSS3. Not only presented the syntax of CSS3 (webkit) transformations but it was interactive and with small sliders Bartaz could change values of CSS properties and therefore change the view of elements on each slide.

Unfortunately, author told us he hadn’t had any opportunity to use 3D transformation in a big scale anywhere else than the presented slides. But, honestly, he wouldn’t like CSS3 3D transformations be used too much. It’s nice just to add some more subtle effects (not too much) to make your site more attractive. And I agree.

CSS 3D transformation example*

Those transformation works so far only with modern web browsers (Safari, Chrome, Firefox10, IE10). We’ll have to wait till the possibility to display it everywhere will be common. As I’ve mentioned in previous paragraph those transformations are really nice visually but they shouldn’t be used too much. Here is a simple example how we can use them. This is a simple form with few pages.

I didn’t spend much time on this but maybe I’ll describe it more later. Still I don’t like the effect which is fired when you click “Finish” button. The X axis should be more in the middle of cube. I’ll have to learn more about this ;) But I think this example shows the best what Bartaz meant.

More links:

* – If you don’t see any 3d effects on *nix operating systems (in example: Ubuntu) 1. Make sure your graphic card can handle 3d ;) (or make sure you installed all needed 3d drivers) and then go to chrome://flags, enable “Replace the list of rendering software” (in polish: “Zastąp listę renderowania programowego”) restart Chrome and… done! :)

Permanent link to this article: https://blog.lukaszewski.it/2011/12/04/css3-3d-transformation-inspired-by-meet-js/

Oct 31

PHPCon PL 2011, Day 2

This post is more about whole event than about the second day of it. But the second day was most important because it lasted whole day. And it had 10 talks instead of 3 (like it was on Friday and Sunday).

Second presentation was about profiling PHP applications by Derick Rethans. It was second presentation of Derick at this edition of PHPCon Poland. It was something like introduction to different tools. Some of them were simple benchmarkers: siege, vmstat, other tracing tools such as Xdebug and ValaXdebug. The last profiler which was presented is called XHProf. Hard to setup in your system but pretty useful and nice looking. I think this presentation wasn’t bad but I didn’t find it really interesting. I could learn this tools when I’ll be needing them ;)

Next speaker woke me up :P It was David Coallier who presented us a little bit of history of PHP and talked about its future. He mentioned new features in PHP 5.3: namespaces, closures & lambda’s functions, Phar, DateTime, SPL, FPM, Collator… lots of them. Most of them I shortly described in my previous post.
Talked a little bit about quite good PHP frameworks developed during last few years: Symfony2, ZendFramework, Lithium. David told us that “Symfony people are dicks!” ;) Of course it shouldn’t be taken as an insult. It was something positive. Meaning: those guys respect their users’ feedback and change their product according to it. I got interested here with Lithium framework (previous CakePHP) and the aspect oriented programming (I need to read more about it!).
He finished the talk by saying: “Evolution is bringing PHP developers to clouds”.

Stephan Hochdörfer was next and he talked about testing untestable code. He told us the presentation wouldn’t be about testing it would be about being creative. However, I got a little bit more sure that I don’t have a tester soul, and probably because of that I saw there only examples of mocking different types of things: database connections, web services, file systems, mail servers etc. Maybe it’d be more interesting if I’d have written more unit tests.

Next talk I attended that day was about graph databases. Two positive Italians told us about GraphDB. They started with basics from graph domain, such as: vertex, edge, path. Explained what GraphDB is and why we should sometimes use it (index-free adjacency) and finally they told us about OrientDB. They showed us a bunch of tools we could use to “play” with the OrientDB but all of those tools are for Java language. But Alessandro and David are PHP passionates and they wanted to encourage us to help them with congow/Orient library on which they work.

Last presentation I saw on the second day was about internationalization in general (and a little bit in our company). It was prepared by my colleague and in my humble opinion it was one of very few polish talks which could easily be compared to our foreigners’ talks. TOR showed few really funny examples of how hard it is to translate something if you don’t know the context and how easy it is when you have thousand of volunteers willing to translate something for you ;) After this talk we decided to get some rest and visit conference room on the other day.

On Sunday it was really hard to get up. Mostly because we went really late to our beds since we spent lots of hours in the bar chatting with other programmers/speakers. However, I made it and after quick breakfast, I went to see the first talk on Sunday. It was about upgrading ourselves. Lorna Mitchell, who we met in the bar, gave a really nice talk about how to invest in your team skills. It wasn’t something the audience didn’t know. But the end of her talk, the questions’ part, showed that polish IT businessmen need lots of more talks like this one. One of the questions was: “OK, but what if I invest in my team, I’ll send them to courses, they’ll got the skills and decide not to work for me anymore because with those skills they can get more money somewhere else?”. It shows how closed to the world our businessmen are. And it’s sad that they can’t see with a little bit more wider angle ;)

After this talk I decided to have a break and to get back for the last one which was about traits in PHP 5.4. I was disappointed — again ;/ It was nothing more that we can read in PHP Manual. After 15 minutes we decided to pack our backpacks and go home.

We all agreed it wasn’t something we expected. However after quick chatting with the organizer we hope next year it’ll be better because even if it didn’t fulfilled our expectations it was better than last year (as I heard) and we wish the trend will keep afloat.

See you on PHPCon Poland 2012! ;)

Permanent link to this article: https://blog.lukaszewski.it/2011/10/31/phpcon-pl-2011-day-2/

Oct 22

PHPCon PL 2011, Day 1

The begining of PHPCon 2011 in Mąchocice near Kielce wasn’t something special. To be more honest and maybe even ruthless: it was boring and completly waste of time. My friends who came with me and myself were really disappointed. And as I looked on faces of other attenders — the feelings were similar or the same.

First talk was about geolocation and maps by Derick Rethans. It wasn’t anything special however in my personal feeling it was nice as something to start with. I even got interested in Open Maps project and in free time I’d like to check it and play a little bit with it. Second presentation was the worst one. It was about Yii PHP framework. Author seemed not prepared at all. I’m not an expert in php frameworks domain but I know Symfony and after the presentation Yii doesn’t have anything else/better than Symfony. Therefore, why should we use it? Well, the speaker couldn’t answer this question. However, he was a passionate. He didn’t create and contribute in creating the framework but he wanted to share his positive feelings about the framework. Unfortunately, the audience seemed immune to “his magic” ;) The last presentation on first day of conference was about making PHP programers more productive. This presentation didn’t blow our minds either. Shortly: it was about quit using mouse and start using keyboard shortcuts.

Right now I’m after the first presentation of second day. It was about security of PHP applications. Young and very charismatic speaker, Przemysław Pawliczuk (mostly known as eRIZ did a great job with this one. He gave us an examples of basic attacks like: SQL incjection, Cross Site Request-Forgery or Cross Site Scripting. Also showed a source of “Rebbecca Troy” (if I remembered the name correctly) which is quite interesting because it tests victim’s machine for every possible way a PHP can be used to: sending an e-mail, querying a database, dumping database etc. At the end if all those tests fails (there is no whole which could be used to attack) it puts a compiled C code which will observe traffic on a victim’s machine. So, the second day of PHPCon started more interesting than the first.

Stay tuned for more info about PHPCon!

Permanent link to this article: https://blog.lukaszewski.it/2011/10/22/phpcon-pl-2011-day-1/

Older posts «

» Newer posts