Wednesday, March 20, 2019

splitting strings with mysql



SELECT
SUBSTRING_INDEX(email, '@', 1) ,
SUBSTRING_INDEX(email, '@', -1) 
FROM listings

Wednesday, March 13, 2019

mysql date difference

SELECT * FROM myTable 
WHERE dateCol >= DATE_SUB(NOW(),INTERVAL 1 YEAR) LIMIT 0,1


SELECT FROM myTable 
WHERE dateCol >= DATE_SUB(NOW(),INTERVAL YEARLIMIT 0,1



SELECT FROM myTable 
WHERE dateCol >= DATE_SUB(NOW(),INTERVAL MONTHLIMIT 0,1

SELECT FROM myTable 
WHERE dateCol >= DATE_SUB(NOW(),INTERVAL 40 DAYLIMIT 0,1



SELECT FROM myTable 
WHERE dateCol >= DATE_SUB(NOW(),INTERVAL HOURLIMIT 0,1



SELECT FROM myTable 
WHERE dateCol >= DATE_SUB(NOW(),INTERVAL 15 MINUTELIMIT 0,1



SELECT FROM myTable 
WHERE dateCol >= DATE_SUB(NOW(),INTERVAL 600 SECONDLIMIT 0,1

Wednesday, January 9, 2019

cpanel cronjob to delete files older than 7 days

find /home/jerome/public_html/uploads/* -mtime +6 -type f -delete

Wednesday, December 27, 2017

Sunday, November 12, 2017

Quote of the day

The future belongs to those who prepare for it today. Malcolm X ~ American Activist 1925-May 19th - 1965-Feb-21st

Monday, February 1, 2016

yii getBaseUrl and getHomeUrl

Yii::app()->getBaseUrl(true);   // => http://localhost/yii_projectsYii::app()->getHomeUrl();       // => /yii_projects/index.php
Yii::app()->getBaseUrl(false);  // => /yii_projects

Image Thumbnails Using PHP

function make_thumb($src, $dest, $desired_width) {

 /* read the source image */
 $source_image = imagecreatefromjpeg($src);
 $width = imagesx($source_image);
 $height = imagesy($source_image);
 
 /* find the "desired height" of this thumbnail, relative to the desired width  */
 $desired_height = floor($height * ($desired_width / $width));
 
 /* create a new, "virtual" image */
 $virtual_image = imagecreatetruecolor($desired_width, $desired_height);
 
 /* copy source image at a resized size */
 imagecopyresampled($virtual_image, $source_image, 0, 0, 0, 0, $desired_width, $desired_height, $width, $height);
 
 /* create the physical thumbnail image to its destination */
 imagejpeg($virtual_image, $dest);
}

Monday, January 11, 2016

Yuor Barin Can Raed Tihs

S1M1L4RLY, Y0UR M1ND 15 R34D1NG 7H15 4U70M471C4LLY W17H0U7 3V3N 7H1NK1NG 4B0U7 17



Friday, December 4, 2015

YouTube video generated images -- for thumbnails

http://img.youtube.com/vi//default.jpg
http://img.youtube.com/vi//hqdefault.jpg    
http://img.youtube.com/vi//mqdefault.jpg    
http://img.youtube.com/vi//sddefault.jpg    
http://img.youtube.com/vi//maxresdefault.jpg   

source: http://stackoverflow.com/questions/2068344/how-do-i-get-a-youtube-video-thumbnail-from-the-youtube-api

Sunday, November 22, 2015

magento block types

For understanding more about magento block types following are some built-in block types which are widely used in layout.
  1. core/template: This block renders a template defined by its template attribute. The majority of blocks defined in the layout are of type or subtype of core/template.
  2. page/html: This is a subtype of core/template and defines the root block. All other blocks are child blocks of this block.
  3. page/html_head: Defines the HTML head section of the page which contains elements for including JavaScript, CSS etc.
  4. page/html_header: Defines the header part of the page which contains the site logo, top links, etc.
  5. page/template_links: This block is used to create a list of links. Links visible in the footer and header area use this block type.
  6. core/text_list: Some blocks like contentleftright etc. are of type core/text_list. When these blocks are rendered, all their child blocks are rendered automatically without the need to call thegetChildHtml() method.
  7. page/html_wrapper: This block is used to create a wrapper block which renders its child blocks inside an HTML tag set by the action setHtmlTagName. The default tag is 
     if no element is set.
  8. page/html_breadcrumbs: This block defines breadcrumbs on the page.
  9. page/html_footer: Defines footer area of page which contains footer links, copyright message etc.
  10. core/messages: This block renders error/success/notice messages.
  11. page/switch: This block can be used for the language or store switcher.
This is a list of only commonly used block types. There are many other block types which are used in advanced theme implementations.

About

Blogger templates