Stack of codes.
Please comment below your opinion. We will try to improve and bring more accurate contents for you.

Thursday, 30 November 2017

Image Optimization Tips:

Image Optimization Tips:

Name Your Images Descriptively and in Plain English

It's really easy to blast through hundreds of product shots and keep the default file name your camera gives them. But before you keep that habit, let's discuss why that's not a good idea.

When it comes to SEO, it's important to use acceptable keywords to help your webpage rank on search engines. Creating descriptive, keyword-rich file names is absolutely crucial for image optimization. Search engines not only crawl the text on your webpage, but they also search for keywords within your image file names.

Let's use this image as an example:



You could use the generic name that your camera gave to the image such as DCMIMAGE10.jpg. However, it would be much better to name the file: 2012-Ford-Mustang-LX-Red.jpg

Also think about how your customers search for products on your website. What naming patterns do they use when they search? In the example above, car shoppers may search using the terms:



2012 Red Ford Mustang LX
Ford Mustang LX Red 2012
Red Ford Mustang LX 2012
A good habit to get into is to look at your website analytics, and see what phrasing patterns your customers use to perform searches. Determine the most common naming patterns they use, and apply that formula to your image naming process.

How to auto adjust the div size for all mobile / tablet display formats?


This is called Responsive Web Development(RWD). To make page responsive to all device we need to use some basic fundamental such as:-

1. Set the viewport meta tag in head:

<meta name="viewport" content="width=device-width,height=device-height,initial-scale=1.0"/>

2.Use media queries.

Example:-

/* Smartphones (portrait and landscape) ----------- */
@media only screen
and (min-device-width : 320px)
and (max-device-width : 480px) {
/* Styles */
}

/* Smartphones (landscape) ----------- */
@media only screen
and (min-width : 321px) {
/* Styles */
}

/* Smartphones (portrait) ----------- */
@media only screen
and (max-width : 320px) {
/* Styles */
}

/* iPads (portrait and landscape) ----------- */
@media only screen
and (min-device-width : 768px)
and (max-device-width : 1024px) {
/* Styles */
}

/* iPads (landscape) ----------- */
@media only screen
and (min-device-width : 768px)
and (max-device-width : 1024px)
and (orientation : landscape) {
/* Styles */
}

/* iPads (portrait) ----------- */
@media only screen
and (min-device-width : 768px)
and (max-device-width : 1024px)
and (orientation : portrait) {
/* Styles */
}

/* Desktops and laptops ----------- */
@media only screen
and (min-width : 1224px) {
/* Styles */
}

/* Large screens ----------- */
@media only screen
and (min-width : 1824px) {
/* Styles */
}

/* iPhone 4 ----------- */
@media
only screen and (-webkit-min-device-pixel-ratio : 1.5),
only screen and (min-device-pixel-ratio : 1.5) {
/* Styles */
}

3. Larger Device, Medium Devices & Small Devices media queries. (Work in my Scenarios.)

Below media queries for generic Device type: - Larger Device, Medium Devices & Small Devices. This is just basic media types which work for all of scenario & easy to handle code instead of using various media queries just need to care of three media type.

/*###Desktops, big landscape tablets and laptops(Large, Extra large)####*/
@media screen and (min-width: 1024px){
/*Style*/
}

/*###Tablet(medium)###*/
@media screen and (min-width : 768px) and (max-width : 1023px){
/*Style*/
}

/*### Smartphones (portrait and landscape)(small)### */
@media screen and (min-width : 0px) and (max-width : 767px){
/*Style*/
}

PageSpeed: Leverage browser caching

PageSpeed: Leverage browser caching

Find your .htaccess file in the root of your domain. This file is a hidden file but should show up in FTP clients like FileZilla or CORE. You can edit the .htaccess file with notepad or any form of basic text editor.

In this file we will set our caching parameters to tell the browser what types of files to cache.

## EXPIRES CACHING ##
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpg "access plus 1 year"
ExpiresByType image/jpeg "access plus 1 year"
ExpiresByType image/gif "access plus 1 year"
ExpiresByType image/png "access plus 1 year"
ExpiresByType text/css "access plus 1 month"
ExpiresByType application/pdf "access plus 1 month"
ExpiresByType text/x-javascript "access plus 1 month"
ExpiresByType application/x-shockwave-flash "access plus 1 month"
ExpiresByType image/x-icon "access plus 1 year"
ExpiresDefault "access plus 2 days"
</IfModule>
## EXPIRES CACHING ##

Meta tags for share social images or link

Facebook Meta Tags

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" >
<title></title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="keywords" content="" >
<meta name="description" content="">
<!--FACEBOOK-->
<meta property="og:title" content="" >
<meta property="og:site_name" content="">
<meta property="og:url" content="" >
<meta property="og:description" content="" >
<meta property="og:image" content="" >
<meta property="fb:app_id" content="" >
<meta property="og:type" content="website" >
<meta property="og:locale" content="" >

-------------------------------------------------------------

## Twitter Social meta tags
<!--TWITTER-->
<meta property="twitter:card" content="summary" >
<meta property="twitter:title" content="" >
<meta property="twitter:description" content="" >
<meta property="twitter:creator" content="" >
<meta property="twitter:url" content="" >
<meta property="twitter:image" content="" >
<meta property="twitter:image:alt" content="" >

-----------------------------------------------------------
## Google+ meta tags 
<!--GOOGLE+-->
<link rel="author" href="">
<link rel="publisher" href="">

Facebook share more than one images

Facebook share link with more than one image




Wednesday, 29 November 2017

Star rating in php


<?php 
for ($rcnt=0; $rcnt<$product_rating; $rcnt++) { ?> 
<i class="fa fa-star has-star" aria-hidden="true"></i>
<?php 

for($star_blank=0; $star_blank < (5-$product_rating); $star_blank++){ ?> 
<i class="fa fa-star-o" aria-hidden="true"></i>
<?php } ?>

Show dotted text using css

How can I show dots (“…”) in a span with hidden overflow?

._shr_name{
    display:inline-block;
    width:180px;
    white-space: nowrap;
    overflow:hidden !important;
    text-overflow: ellipsis;
}

Tuesday, 28 November 2017

Facebook Share Code

For more Information visit Facebook Developer site: https://developers.facebook.com/docs/plugins/share-button/ 
Step 1: Include the JavaScript SDK on your page once, ideally right after the opening body tag.
<div id="fb-root"></div>
<script>(function(d, s, id) {
  var js, fjs = d.getElementsByTagName(s)[0];
  if (d.getElementById(id)) return;
  js = d.createElement(s); js.id = id;
  js.src = 'https://connect.facebook.net/en_US/sdk.js#xfbml=1&version=v2.11';
  fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
Step 2: Place this code wherever you want the plugin to appear on your page.
<div class="fb-share-button" data-href="https://developers.facebook.com/docs/plugins/" data-layout="button" data-size="small" data-mobile-iframe="true"><a class="fb-xfbml-parse-ignore" target="_blank" href="https://www.facebook.com/sharer/sharer.php?u=https%3A%2F%2Fdevelopers.facebook.com%2Fdocs%2Fplugins%2F&amp;src=sdkpreparse">Share</a></div>

Facebook Share Button

<html>
<head>
  <title>Your Website Title</title>
    <!-- You can use Open Graph tags to customize link previews.
    Learn more: https://developers.facebook.com/docs/sharing/webmasters -->
  <meta property="og:url"           content="https://www.your-domain.com/your-page.html" />
  <meta property="og:type"          content="website" />
  <meta property="og:title"         content="Your Website Title" />
  <meta property="og:description"   content="Your description" />
  <meta property="og:image"         content="https://www.your-domain.com/path/image.jpg" />
</head>
<body>

  <!-- Load Facebook SDK for JavaScript -->
  <div id="fb-root"></div>
  <script>(function(d, s, id) {
    var js, fjs = d.getElementsByTagName(s)[0];
    if (d.getElementById(id)) return;
    js = d.createElement(s); js.id = id;
    js.src = "https://connect.facebook.net/en_US/sdk.js#xfbml=1";
    fjs.parentNode.insertBefore(js, fjs);
  }(document, 'script', 'facebook-jssdk'));</script>

  <!-- Your share button code -->
  <div class="fb-share-button" 
    data-href="https://www.your-domain.com/your-page.html" 
    data-layout="button_count">
  </div>

</body>
</html>

5 best JavaScript frameworks of 2017



JavaScript is one of the most commonly used and popular programming language around the world. JavaScript frameworks are one of the main reasons behind its huge popularity and developers love JavaScript because of the efficiency, safety, and cost. Currently, there have so many JavaScript frameworks in the market but choosing a particular framework will depend on the kind of app you are trying to develop. In this geek story we'll discuss about the best 5 JavaScript framework of 2017.


Angular

Angular is one of the most popular JavaScript framework in the world, which is supported by Google. It has two variants AngularJS and Angular4. AngularJS is follow MVW model where Angular4 follow MVC model. It has been particularly useful to create dynamic web pages and single page web applications. Angular also highly preferred for hybrid mobile application development. Featured with components like overlays, sidebars, switches and absolute positioned navigation bars, this framework incorporates dynamic functionality to the application.

ReactJS

ReactJS is more of a library than a JS framework. It was introduced in 2013 as an open source JavaScript Framework Library, which is maintained by Facebook, Instagram and a huge community of individual corporations and developers. In MVC pattern React.js acts as "V" and can be smoothly integrated with any architecture and the usage of virtual DOM it provides a great performance boost, comparing to Angular 1.x. ReactJS is perfect for the projects that require powerful View Layers.

Vue.js

Took the best from Ember, React and Angular and putting all that into a handy package, which is called Vue.js. It is proved to be faster and leaner, comparing to React and Angular 2.0. It is an easy-to-learn and lightweight JavaScript library for web interface developments. Similar to Virtual DOM, it comes with two-way data binding and unlike React and Angular, it will only call for elements that are super essential to develop a web app.

Ember.js

Ember.JS is antoher open source JavaScript framework, which is based upon MVVM (Model View View Model) pattern. It work as an alternative to React and Angular in many cases. The framework is widely accepted for creating feature-rich web applications. Particularly, it helped developers to get across processes without breaking the web and putting the entire app under a single URL.

Meteor.js

Meteor is a smart and powerful tool that allows you build web and mobile applications at a breakneck speed. MeteorJS covers all the phases of software development cycle and takes care of such glooming processes as linking, files concatenation and others. Meteor requires less code, so even though you are newbies to programming, you are able to build your own amazing app. Currently, it used to build a real-time application for businesses.
by-geekboots

Monday, 27 November 2017

Convert stdClass object to array in PHP

Convert stdClass object to array in PHP


The easiest way is to JSON-encode your object and then decode it back to an array:

$array = json_decode(json_encode($object), True);
Or if you prefer, you can traverse the object manually, too:

foreach ($object as $value) 
    $array[] = $value->post_id;

codeigniter $this->db->like is case sensitive

codeigniter $this->db->like is case sensitive

There is no case insensitive version of the like function. What you can do is transform both sides of the comparison to lower case, so that you take that out of the equation.

$this->db->like('LOWER(' .$field. ')', strtolower($value));

OR
$this->db->like('LOWER(field_name)', strtolower($value));

Preg_replace deprecated


preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead

i'm not sure but it seems the entity_decode method in core/security is a very legacy fix for a pre php 5 bug in html_entity_decode. is this still needed?

A quick fix i used is replacing the latter two with replace_callback as mention in this stackoverflow article (1).

// Numeric Entities

// $str = preg_replace('~&#x(0*[0-9a-f]{2,5});{0,1}~ei', 'chr(hexdec("\\1"))', $str);
// $str = preg_replace('~&#([0-9]{2,4});{0,1}~e', 'chr(\\1)', $str);

$str = preg_replace_callback('~&#x(0*[0-9a-f]{2,5});{0,1}~i',
  create_function ('$matches', 'return chr(hexdec($matches[1]));'), $str);

$str = preg_replace_callback('~&#([0-9]{2,4});{0,1}~',
  create_function ('$matches', 'return chr($matches[1]);'), $str);
  

Thursday, 23 November 2017

Insert in Database

How to Insert in Database.?

This is the query to insert in the database.

INSERT INTO table_name(column1, column2,column3, ...)
VALUES (value1, value2,value3, ...);

Popular Posts

Stack Of Codes, stackofcodes, Stack your codes here, Open your coding for all, Php coding, Codeigniter, blogger, Stack of codes Developers, Php Framework, stackofcodes.in, best coding site, Stack the codes, place the code in stack, Stack of codes is the largest, most trusted online community for developers to learn and share their programming knowledge and build their carrers.

Labels

PHP CodeIgniter SQL Facebook HTML Connect mysqli Constructor Destructor Stack Of Codes Update SQL codeignitre delete files from folder Aadhaar Agent Align center image Alternative Control Structure Back Slash Browser Browser version CSS Calculate Date Difference in php Cannot modify header information Check image exists CodeIgniter get_where CodeIgniter-HMVC-3.1.6 Codeigniter 3.1.7 Connect and select database Constants Constructor and Destructor Convert stdClass object to array in PHP Copy Image from URL Date Calculator]php Date Difference Disable Window Update Documents exists Enable Window Update File exists Gas Linking with Aadhaar Get TinyMCE to use full image url instead of relative one Get all files from folder How to delete a file in php Image Corrupted Image Exists in php Ip address Jquery Checkbox check all Make slug in Javascript or Jquery Multiple Submit Buttons in a form Mysqli connect Only variable references should be returned by reference Open and Close html ul tag and close the ul on evry third block Phar Php Version For Codeigniter 3.0 Platform Read All files in Directory Reduce the image file size using PHP Rename Table Robots.txt Generator Robots.txt Generator - SEO Tools - SEObook Scraping Data Scraping Data From Website Scrollbar Design Select Checkbox Server Requirements For Codeigniter 3.1.6 Simple Carousel demo Slug Sub string in Php Substring TinyMCE URL Conversion Example TinyMCE settings to get image path correct UAC Warning in windows pro Unique Check Unique Check in Codeigniter Virtual hosts WSDL cache Win 8.1 with UAC Warning XAMPP to send mail from localhost Xampp apache - XAMPP installation best frameworks best javascript frameworks check if contains http:// in php clean url clear cache codeigniter $this->db->like is case sensitive data containing apostrophes deselect Checkbox all duplicate field entry escape_str every third block ul tag will close facebook Share facebook server foreach etc front Slash get_where in codeigniter hash_hmac headers already sent how to make robot.txt file for my website? htaccess http:// or https:// iS mobile if-else iv size for all mobile / tablet display javascript json_decode in array php looking for a job make url with hyphen media queries. mysql_real_escape_string mysqli real escapr string server down slug in Javascript some function of xamp is possible disabled sql - How to split a single column values to multiple column values tinymce image path showing as ../../ unlink File url contains http:// or https:// while window update