Skip to main content

Posts

Detect identical & black frame in video with ffmpeg?

Thumbnail creation is a very needed feature for any social networking site. Obviously, ffmpeg is the ideal solution for generating thumbnail. Problem-1: Detecting identical thumbnails Fortunately, we have a good solution-- libpuzzle . It would be ideal to have a filter in ffmpeg for that. Problem-2: Detecting black/dark frames I'm still keenly looking for a solution tied up with ffmpeg. When Google turned no help, Heleena (my wife) solved it by calculating average luminance value of the frame and ignoring the frames based on certain preset threshold value--which worked better at that time.

Converting PSD with PHP/ImageMagick

After seeing feature rich options in Imagick PECL extension at Mikko Koppanen 's (the author) website and also impressed with ImageMagick 's features, I have decided to use it for the PSD to XHTML conversion website that I'm architecting and managing. Since, the team wants programming help for converting PSD images, I have tried it (documentation is sparse on PSD handling) Converting PSD to PNG/JPEG/etc Note that, flattenImages() is needed for layered/multi-page PSD file. <?php $im = new Imagick('test.psd'); $im->flattenImages(); $im->setImageFormat('png'); $im->writeImage('test.png'); ?> Extracting PSD layers One by one <?php $im = new Imagick('test.psd'); $im->setImageFormat('png'); for ($i = 0, $num_layers = $im->getNumberImages(); $i $im->setImageIndex($i); $im->writeImage('layer' . $i . '.png'); } ?> Note that, there is a better version below In a single call with writeIm...

CakePHP security issue - even in thechaw.com (written by core dev)

CakePHP security issue Recently I have stumbled upon thechaw.com --written by CakePHP core dev and developed in CakePHP. I just wanted to check if they have fixed the old security issue in CakePHP and found that the issue is still open. Proof of concept CakePHP memory error In another time, found a famous memory error even in bakery.cakephp.org Bottom line CakePHP is open source and so you can fix these issues by yourself

Save American College, Madurai

This post was written in 2008 and outdated now. For update, please check Save American College, Madurai (Update 2011) Update (2011-01-16) : Save American College, Madurai (Update 2011) I'm highly privileged to have 3 degrees (B.Sc. (Spl. Physics), PGDCA and MCA) from The American College, Madurai, South India . Unlike other "commercial" colleges, American College has given room for poor students and uplifted them. And unlike other "elite" colleges who'd give seat only for "intellectuals", American College has produced geniuses. In the recent months, the saddening thing is that the college is under divide (Principal Vs. Bishop). Here is the email I sent to alumnae lately informing about the informations that I received about the developments: Update (2011-01-16) : Save American College, Madurai (Update 2011) All: I was thinking that the " Save American College " campaign was a FUD . But, when I tried to understand the problem through my...

Rasmus Lerdorf's humbled LinkedIn profile

I recently stumbled upon Rasmus Lerdorf 's (creator of PHP) profile in LinkedIn. His profile humbly reads "Developer at PHP". On the other side, I also stumbled upon John Resig 's (creator of jQuery) profile in LinkedIn. His profile reads "Creator, Lead Developer at jQuery JavaScript Library". I'm really surprised by Rasmus Lerdorf's humbleness which reminds me of Dr. Dennis Ritchie's (creator of C) humble email to me. Long live Rasmus Lerdorf and his humbleness.

Solved: Safari Flash full screen issue

Some common problems when trying to use Flash video embed code (e.g., YouTube like embed code) 1. When using lightbox on the page, it's getting hidden behind the Flash video player Solution: Add wmode="transparent" to the embed tag 2. On IE7, getting "click to activate" Solution: Inject the embed code through JavaScript. (Useful libraries: jQuery Flash Plugin , SWFObject ) 3. XHTML validation issue Solution: Use unobtrusive JavaScript embedding. (Useful libraries: jQuery Flash Plugin , SWFObject ) 4. On Safari the full screen doesn't work -- even if we add allowfullscreen="true" (this is the issue I faced lately and google wasn't helpful). In all other browsers, it works fine. Solution: Add type="application/x-shockwave-flash" to the embed tag

Problems with CakePHP - follow-up

Some people have responded including the Datepicker fame Marc Grabanski . So, this follow-up... First of all, I was not ranting nor complaining; I've just blogged/documented my experience. The common problem most of the people pointed out are that it scales for addons.mozilla.com. Those who have accessed their source code can understand that they've done lot of things and also the site is not database-intensive. You should really create a real database-intensive website to understand what I mean. The other point that been pointed out is about open source and community. Lot of people may not be knowing that it's 2 people pushing it and don't want others to be credited . The generic model or dynamic model idea was originally been from grigri and Marcel . It's hard to be called as open source as only few and sycophants are driving it's direction (I'm not talking about svn access) So, here are my humble checklist before you start shouting at me Did you read a...

Open source PHP frameworks and problems

I was using CakePHP for sometime and proposed CakePlus , another UIMS toolkit on the top of CakePHP but also altering some problematic core of it. The thread should explain the outcome of the post. And, then I noted Akelos framework has most of the things built in. Issues with frameworks esp. CakePHP Scalability not a priority - Developers aren't aware that we can't throw more and more hardware Excessive use of regular expressions Evangelist isn't aware that the framework throws many queries unnecessarily More memory consumption - 100M would never be enough for a simple project Poor coding standards and practices - Prolong use of extract() often leads to more memory consumption Can't use the native approaches or baked codes. The override approach always lead to hard to debug codes Poor architected codes and no clear defined approaches. People belong to the cult drives the direction and often throws unprofiled codes. No native provision to share codes between M-V-C and...

Working with Jeremy Zawodny, Alan Knowles, Cal Henderson

My life and career are full of surprise... I wanted to work in film direction Wanted to work in AT&T Bell Labs with Dr. Dennis M. Ritchie (creator of C) Wanted to work in Borland with the great developers of Delphi But, none of these dreams came true. And, after 6 years of my career into Web Application Development, I informed the company about my humble desire to work with the great minds I came to know through internet--to see if the company can offer employment for them: Jeremy Zawodny , Alan Knowles , Cal Henderson . Peter (who is actually from UK), who approached them updated me that Jeremy cannot join the company due to his marriage and Alan feels that the company may not offer the international salary. And, my dreams are just dreams! If anyone wants to work with me, ping me through LinkedIn

Track previous link of a site in PHP

I just spotted through Google that Raj Shekhar has quoted my post to comp.lang.php in his Blog Ideas page: mr_burns wrote: > Is it possible to get the previous url. For example, if I am on page > page01.php - and I then click to - page02.php - from page02.php, can > use script to determine that I have come from page01.php? It doesnt > have to be the entire url, even just the file name. Cheers Add this line in the beginning of every script or possibly using a global-common include file say config.php output_add_rewrite_var('referer', htmlspecialchars($_SERVER['PHP_SELF']));

www.php.net online manual user notes contributions

Sometime ago I had lot of interest in contributing to the www.php.net online manual's notes. Thought lot of them are deleted now and not even relevant now, I'd thought of archiving them for my own reference: http://www.php.net/ref.pdf#32797 Date: 7 Jun 2003 06:42:11 -0000 If you want to create PDF without using PDFlib library, you may try FPDF ( http://www.fpdf.org ). If you want to know, how to use FPDF in PHP scripts, you can look at the source code of phpMyAdmin as phyMyAdmin uses this FPDF. ( http://www.phpmyadmin.net ) http://www.php.net/ref.array#32969 Date: 12 Jun 2003 11:32:58 -0000 If you want to remove a particular element from the array without loosing the keys, you can use the following function: function RemoveArrayElement($arr, $element) { if (($key=array_search($element, $arr))!==false) unset($arr[$key]); return( $arr ); }/*---------RemoveArrayElement()----------*/ Example: $arr = array("a","b","c","f","x...

"A to Z of C" book turns 5

A to Z of C , the DOS/Turbo C programming book written by K. Joseph Wesley and myself turned 5 on August 1. Initially, we felt bad for spending our time in writing a book that were rejected and deceived by publishers. Now we get quite reasonable appreciations from people around the world--even though it's having technical and grammatical errors. Long live the internet publishing! Probably a time for "A to Z of PHP" ?

I'm Zend (PHP 5) Certified Engineer:-)

As of January 13, 2007, I'm ZCE/ Zend Certified Engineer (PHP 5)

Bookmarklet: Mozilla/Firefox unicode rendering bug

Bug #270012 is long time opening in Firefox and got bunch of duplicates. Tamil and other Indian texts are getting broken on "text-align: justify;" Fix #270012 The above bookmarklet can be used on such broken pages to fix rendering and I've been using it for a long time. Though there is a Greasemonkey script available, I still prefer my bookmarklet as it is tidy.

BehaviorS.js - An alternative to Behaviour.js, event:Selectors and Low Pro libs for unobtrusive JavaScript programming

BehaviorS.js yet another unobtrusive JavaScript library similar to Behaviour.js and event:Selectors but in implementation uses hash based lookup without extending elements; so presumably it should be faster than the rest. The original script and idea was by JLof ; I extended it for DOMContentLoaded support, optimized a bit to avoid scanning of more depths, and added new rules support. I wanted to document the plug a long time and just got time to do it. For the time being BehaviorS.js is available here Update (2006-09-11) : Coralized the link to BehaviorS.js so as to save the load on free brinkster.com webpage Update (2006-09-27) : If the coralized link to BehaviorS.js doesn't work, use http://www21.brinkster.com/guideme/BehaviorS/ Update (2025-06-07) : Now available in https://github.com/rrjanbiah/behaviorsjs

Why Google PR is quirky -- Google PR bug

Recently I have been informed that the PageRank provided by pagerankstatus , a Firefox extension is different from official Google Toolbar. Since, I have been slightly involved with the development of this extension, I have studied the reason behind it. Example Target site: http://benmccann.com/ Pagerankstatus's PR: 4 Official Google Toolbar's PR: 0 Reason: Google's bug Analysis Pagerankstatus What pagerankstatus requests: ...features=Rank:FVN... What Google returns: Rank_1:1: 4 Official Google Toolbar (IE) What Google Toolbar requests: ...features=Rank:... What Google returns: Rank_1:1: 0 Official Google Toolbar (FF) What Google Toolbar requests: ...features=Rank... What Google returns: Rank_1:1: 0 Google info XML file : ...info:... PR inside XML file: 4 ( This might be the right PR. Same as of pagerankstatus. ) Conclusion (Google bug) Official Google Toolbar has downgraded the category/directory option; that's why now not sending "FVN" as "FVN"...