A nice article about the startups here in Berlin listed by tube station!
Author: Daniel Kubitza
17th Century Shipbuilding and your failed software project
I think this talk speaks for itself!
Blackfire performance profiling
Now nearly a year ago I was put on new task:
Optimize the performance of an application I did not know before.
This was not a really a new tasks for me, but I was a little worried about the available tools outside. They work, but it is mostly hard to find the performance issue.
During this time Blackfire was already in beta and in the end of November a colleague and me got access. So I tried the same also with Blackfire. In the end I could not find anything for this project. But I really liked Blackfire.
Some month later I started to profile the performance of the homepage of a different project. Here I could very quickly find some issues and within one day I was able to double the performance of the homepage. To bad that I don’t have those profiles anymore.
On my current project we are mostly serving an API for mobile devices. So I took one day to profile every API endpoint. First I could not find any specific, but after I added 20.000 test items (and also over 6000 items are related to my test user) the performance of one Endpoint dropped to around 3.x seconds.
Here is to bad profile for the endpoint:
(note: screenshot say 18s but during this time the importer was still running)
Spot (what you can see in the screenshot) is the small ORM we use in our project. I quickly realized that there where 6426 entities created – which is definitely wrong :).
The issue was quickly found. All related items where fetched and counted (picardpalm) instead of using a real count query. So the fix for this issue was also very quick:
The result with the next profiling:
208ms instead of 3.x seconds.
Without Blackfire and the testdata we would not have found this problem until someone hits the amount of items which could took some month.
If you did not worked with Blackfire: Try it out. Its really worth the time you invest. And it offers much more I just described here.
Why your should not interrupt a programmer.
Old! But still the truth!
http://heeris.id.au/2013/this-is-why-you-shouldnt-interrupt-a-programmer/
Developer Humor
Here are some of my alltime favorite comics for developers.
- Code review
http://explosm.net/comics/2083/ - Technically Correct
http://www.infragistics.com/community/blogs/d-coding/archive/2013/08/21/developer-humor-technically-correct.aspx
So true! - Exploits of a Mom
http://xkcd.com/327/
XKCD classic - Geeks and repetitive tasks
http://imgur.com/Q8kV8
If only the project manager would know too. - Project flow tree
http://www.paragoninnovations.com/guide.shtml
The most known classic!
From MySQL-Workbench to Sonata-Admin
Goal:
Design your Database inside MySQL-Workbench and get a nearly completely auto generated Sonata Admin from your MySQL-Workbench schemata.
Preface:
Working as a web-developer I was mostly confronted to create a unique and custom data model for the customer. I started to use MySQL-Workbench to design my data structure and followed on that I looked for a way to get my created structure directly into PHP models and an auto generated database.
Years ago for the bmw motorcyle community (Zend Framework) I started with a simple macro to just create to create the database structure. After that I used Doctrine to generate my models. So I used it only as a project start.
With an auction platform for the “Österreichische Bundesforste AG” (Agavi) I found a nice schema exporter for the MySQL-Workbench. After some testing I could make some steps further. With the yaml export and the doctrine “generate-migrations-diff” I could also auto generate migrations after changing my data model inside MySQL-Workbench.
Now with Symfony I am still using the schema exporter from johmue. I created a fork to fit my needs for my Symfony projects and it fits perfectly to get an easy and quick way from the MySQL-Workbench to a Sonata-Admin. And I created a Bundle the integrate the exporter into Symfony.
- https://github.com/HydraxSkarrag/mwbs-exporter
- https://github.com/HydraxSkarrag/mwbs-exporter-symfony-bundle
This is actually a fork from Easens work.
Prerequisites:
Steps:
Install Symfony:
http://symfony.com/doc/current/book/installation.html
Install the MySQLWorkbench-Exporter and the Exporter-Bundle:
1 2 3 |
php composer.phar require hydrax-skarrag/mwbs-exporter:dev-master --no-update php composer.phar require hydrax-skarrag/mwbs-exporter-symfony-bundle:dev-master --no-update php composer.phar install |
Configure Exporter Bundle:
See https://github.com/HydraxSkarrag/mwbs-exporter-symfony-bundle#configuration
schema_name
here refers to name of the Workbench file without the extension (mwb). Workbench files are saved in the Resources/workbench/ directory as *.mwb inside your bundle.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
mwbs_exporter: schema: schema_name: bundle: YourBundle params: bundleNamespace: "YourBundle" repositoryNamespace: "YourBundle\\Entity" entityNamespace: "" useAnnotationPrefix: "ORM\\" generateBaseClasses: true useAutomaticRepository: true skipPluralNameChecking: false enhanceManyToManyDetection: true filename: "%%entity%%.%%extension%%" backupExistingFile: false indentation: 4 quoteIdentifier: false |
Create your schema with MySQL-Workbench:
I think the MySQL Workbench is pretty much self explaining. Create your tables and relations and than save your file to your Bundle /Ressources/workbench/schema_name.mwb
Export your schema and create your database tables:
Export the schema:
1 |
app/console mwbs:export-entities |
Check the changes to your database:
1 |
doctrine:schema:update --dump-sql |
Update your database:
1 |
doctrine:schema:update --force |
Install Sonata Admin:
See the offical dokumentation: http://sonata-project.org/bundles/admin/master/doc/reference/installation.html
I am using the SonataDoctrineORMAdminBundle.
Follow to Step 2.1 http://sonata-project.org/bundles/admin/master/doc/reference/getting_started.html and stop after this step (2.1). You can use the sonata generator for the following steps.
Create Admin classes with the generator:
I suggest to create an extra bundle for you admin generator.
e.g. YourProjectAdminBundle.
To create the admin classes you can use this command:
1 |
php app/console sonata:admin:generate |
Run your Sonata Admin and get lucky:
Browse to your site with /admin.
As you can see, the admin generator does not auto include your references. You have to add in on your own. And the ID for the edit mask should be removed.
How to change your Sonata Admin?
- Make your changes inside the MySQL-Workbench
- Export your entities
- Update your database
- Recreate your Sonata Admin or manually add your new fields (or remove.. or whatever)
- get lucky (again)
Questions? Errors?
Please use the comments!