Symfony2 just introduced its WebProfiler, the utility will soon be the favorite of all programmers. Most veterans will recall that five years ago was the first Symfony framework to include a web debug toolbar. This bar displays useful information for debugging applications and provides access to all logs with a single click:

Symfony2 presents its WebProfiler as the great evolution of the web debug toolbar. Whenever you view a page, Symfony2 generates a unique token debug (pictured above, the token is 4c7e59811509c). By clicking on that token, it shows the WebProfiler with all the debug information:

In the menu on the left side you can see the five main sections to the Profiler which now has:
- Request: displays information about the request and response (parameters, cookies, headers).
- Exception: if the request has caused an exception, it shows the type of exception, the message from the server and the whole execution trace.
- Events: Shows the events raised during execution of the application (along with their event listeners) and the events that have been identified but have not come to run.
- Logs: Displays the same information to log the original debug toolbar.
- Doctrine / Propel: shows the queries to the database and the time taken for each.
Another great features of the Profiler is that it keeps all your information in a database called SQLiteprofiler.db and stored in the directory cache/ in your application. With this database, you’ll be able to consult the entire execution history of your application, which will facilitate the clearance of projects:

If you want to try the Profiler, you need version of the sandbox Symfony2 PR3, which has not yet been published as a downloadable file. Therefore, when you can only download via git:
mkdir sandbox
git clone http://github.com/symfony/symfony-sandbox.git sandbox
cd sandbox /
git checkout PR3
Now you can try accessing http://localhost/sandbox/index_dev.php
Popularity: 2% [?]
This post is about developing a symfony project that provides multiple applications that are reachable on multiple top level domains. That is application will share the same backend (models, data, etc.) but each site is a standalone application and has a dedicated top level domain.
Create two applications
The first step is to create two applications. Run
symfony generate:app site1
symfony generate:app site2
in your console and change the default actions, routing, etc. Same thing as usual.
Edit .htaccess
The next step is quite simple: Open your .htaccess file in /sf_project_dir/web and insert your second application to the .htaccess file (BEFORE the default RewriteRule)
RewriteCond %{HTTP_HOST} secondhost.com$ [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ site2.php [QSA,L]
That’s all!
That’s all to get it working. Each request to your second domain will be redirected to the according application. A drawback is, that your “frontend” application is still reachable on your second domain if you type in the script name directly. Since I’m not an htaccess expert, I just added some php code to my index.php:
if($_SERVER['SERVER_NAME'] != 'www.flatratesvergleich.de') {
header('Location: http://www.flatratesvergleich.de' . $_SERVER['REQUEST_URI']);
die;
}
Popularity: 1% [?]
J.K. Rowling, author of the best-selling Harry Potter book series, delivers her Commencement Address, “The Fringe Benefits of Failure, and the Importance of Imagination,” at the Annual Meeting of the Harvard Alumni Association. (via harvardmagazine.com)
J.K. Rowling Speaks at Harvard Commencement from Harvard Magazine on Vimeo.
I always liked this video as it has been a vigra for my moral. I am posting it here for my own reference
Popularity: 1% [?]
Most-frequently asked question in the channel for symfony:
- how to get rid of the slash on the end of the URL DoctrineRouteCollection
- why not take the last slash
- etc. in the same vein
So you just a snippet of advice:
# To avoid trailing slash problem RewriteRule
^(.+)/$ http://% (HTTP_HOST) / $ 1 [R = 301, L]
Scientific value of the snippet does not represent, but the question really often ask) so that “search and ye shall find”))
Have fun!
Popularity: 4% [?]
This is a super short snippet that I ALWAYS forget how to do! Often I want to build more complex where clauses with Propel Criteria which use SQL functions such as UCASE, LCASE, LEN and the date functions DAY, MONTH and YEAR. This is possible using Propel & Criteria, but how to do it is not immediately obvious.
The snippet below shows how to select objects from the database which were created in a specific month and year. Using Criteria::CUSTOM, it’s possible to specify a column and a comparison to do with that column. This is quite useful for doing things like building archive lists. Continue reading →
Popularity: 2% [?]
Propel 1.5 does not cease to please the pace of development and introduction of new features, just a few weeks ago, Francois Zaninotto(project leader Propel) has published a new opportunity to edit the nested forms using mergeRelation and embedRelation and the other day to use Namespaces in the generation of models.
Propel 1.5 allows the use of Namespaces in files describing your model if you are using in the php version 5.3 Continue reading →
Popularity: 2% [?]
I have been going through HTML5 and CSS3 details since last few weeks. I found this cheat sheet while surfing web. I am attaching it here,for my own reference.
html5 Cheat Sheet
Popularity: 3% [?]
Posted in General, HTML
|
Tagged HTML, html5
|
Hi All, I was updating my ubuntu 10.04 with some security patches. Everything worked fine but in between I messed up with my ubuntu top panel, and some of the icons went missing. I tried adding them using “add to panel” option, but I did not find it usable. As I don’t remember the default sequence of icons. Even after adding all of them it was looking weird.
So I started looking out for options which can reset my both panels (top & bottom). This what I found, hopefully some of you may find it useful.
NOTE: It worked for me on ubuntu10.04, I personally have not tested it on any other distro. Though It should work as expected. I am posting it here for my own reference.
Following commands would do the trick.
gconftool-2 --shutdown
(Note: There should be no spaces between the two dashes before shutdown.)
A friend of mine has suggested a better method instead of shutting down gconfd. Instead use the following command (thanks !)
gconftool --recursive-unset /apps/panel
(Remember: There should be no spaces between the two dashes before shutdown.)
Then enter the next command:
rm -rf ~/.gconf/apps/panel
And enter one more command:
pkill gnome-panel
That’s it! All the best.
Popularity: 11% [?]
Hi All, I was trying to remove Ruby Gems on my lucid distro (ubuntu 10.04). I thought of posting it here for my own reference. Some of you might find useful.
First thing we need to find out is the exact location that the Ruby installs it’s libraries. In the terminal program, You can type the following command to find out the exact location.
ruby -e 'puts $:'
You’ll get list of paths. This is the output that I got in my machine.
/usr/local/lib/site_ruby/1.8
/usr/local/lib/site_ruby/1.8/i486-linux
/usr/local/lib/site_ruby/1.8/i386-linux
/usr/local/lib/site_ruby
/usr/lib/ruby/vendor_ruby/1.8
/usr/lib/ruby/vendor_ruby/1.8/i486-linux
/usr/lib/ruby/vendor_ruby
/usr/lib/ruby/1.8
/usr/lib/ruby/1.8/i486-linux
/usr/lib/ruby/1.8/i386-linux
.
Next we need to change our directory in to /usr/local/lib/site_ruby/1.8 and type following command to list the files.
ls -la
drwxr-xr-x 5 root root 4096 2009-07-15 12:15 .
drwxr-xr-x 3 root root 4096 2009-07-15 12:14 ..
-rw-r--r-- 1 root root 1415 2009-07-15 12:15 gauntlet_rubygems.rb
drwxrwsr-x 2 root staff 4096 2009-07-15 12:14 i486-linux
drwxr-xr-x 2 root root 4096 2009-07-15 12:15 rbconfig
drwxr-xr-x 6 root root 4096 2009-07-15 12:15 rubygems
-rw-r--r-- 1 root root 29116 2009-07-15 12:15 rubygems.rb
-rw-r--r-- 1 root root 268 2009-07-15 12:15 ubygems.rb
Now we are ready to remove the gems. Type
rm -r rubygems.rb ubygems.rb rubygems
If you wish to remove all gems installed in your computer, first find out the location by executing following commands
which gem gem1.8
Next you can remove them by using following commands. That’s it!
rm -r /usr/local/bin/gem
rm -r /usr/bin/gem1.8
All the best.
Popularity: 17% [?]