Saturday, July 21, 2012

Smartvideo extension for managing youtube videos in your browser

for chrome and firefox.
For e.g.,
1. to save bandwidth set default video quality to 240 for all videos.
2. have different settings for embedded and youtube videos.

Youtube allows face blurring in videos

Saturday, July 14, 2012

New features in PHP I didn't know about

Type hinting
Short array syntax
Function array dereferencing
Instance method call
objects as functions
Session Handler Interface
JSON Serializable interface

PHP Dev/Debug Tools


Benchmark your webserver with : siege
System calls made by apache(httpd) with : strace
Check inclued hierarchy
callgrind xdebug xhprof
hiphop  for static analysis

Others : 
replace time() with $_SERVER['REQUEST_TIME']
prefer require/include over require_once/include_once

Monday, July 9, 2012

accessing properties file in jsp/jstl using spring

<spring:eval var="itemsPerPage" expression="@browsePageProperties.getProperty('itemsPerPage')" scope="request"/> 

where browsePageProperties is defined in (Application Conext Xml) root-context.xml like this : 

    <util:properties id="browsePageProperties" location=""/>  

Thursday, July 5, 2012

vim for eclipse

hibernate many to many query

Thanks Dude !

1. JPA Sucks.

2. HQL works : 
Session session = (Session) entityManager.getDelegate();
Criteria criteria = session.createCriteria(Design.class);
Query query = session.createQuery("select d from Design d join d.tags t where in (:tags) group by d having count(t) =:tag_count");
   List<Design> list = query.list();

3. Hibernate without HQL doesn't work : 
/* int i=0;
   for ( String tagName : tags ) {
       String aliasName = "alias_" + i;
       criteria.createAlias("tags", aliasName, Criteria.INNER_JOIN);
       criteria.add( Restrictions.eq(aliasName+".name",tagName) );
  // List<Design> list = criteria.list();

4. PHP and MySql Rock.

Blog Archive