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
Mysqlnd

PHP Dev/Debug Tools

Source

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="classpath:browsePage.properties"/>  

Thursday, July 5, 2012

vim for eclipse

http://vrapper.sourceforge.net/home/

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 t.name in (:tags) group by d having count(t) =:tag_count");
query.setParameterList("tags",tags);
query.setInteger("tag_count",tags.length);
   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) );
       i++;
   }*/
  // List<Design> list = criteria.list();

4. PHP and MySql Rock.

Blog Archive