Friday, 27 July 2018

How to load external link data, in our existing page popup / as a content?


You can use tow things
1) embed
2) iframe

embed can cause some major functionality issues, better to to use iframe

embed syntex:
<embed src="https://www.google.com"/>

iframe syntax :
<iframe scrolling="yes" user-agent="Mozilla/5.0 (iPhone; CPU iPhone OS 5_0 like Mac OS X) AppleWebKit/534.46 (KHTML, like Gecko) Version/5.1 Mobile/9A334 Safari/7534.48.3" src="https://www.google.com"></iframe>

Don't forget to mention user-agent attribute otherwise it can cause issue such as
"Error: Cannot set user agent for iframe with location different to this page" - content.js

comment your issues, will help you to solve it

EXPLORE PROGRAMMING
Thanks

Wednesday, 20 June 2018

Solutions of facing problems while fatching IDs in Shopify - Liquid

Hello,
blog on shopify liquid code,

use of "{{forloop.index}}" ,

input : 
{% for product in collections.frontpage.products %}
    {{ forloop.index }}
{% else %}
    // no products in your frontpage collection
{% endfor %}
  
 output:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16

  • if you are facing problems while assigning IDs and names of  "<divs>" or anchor tags at the time of placing tabify or accordion , you should use id = {{forloop.index}} in your cart or product loops . 
  • Dont assign {{product.id}} or {{block.id}} as an IDs of  "<div> / <a>" , it is very hard to get those things when you started applying your Custom jQuery or start making / adding own functionalities. it would be easy when you have used {{forloop.index}}, As it is going to be easy to target and fetch in jquery

Wednesday, 18 April 2018

Access Localhost in Mobile or any another device

your laptop or PC and Mobile should be connected to same network

Write "ipconfig" in CMD
Find IPV4 Address in PC or laptop

Copy paste that IPV4 Address in mobile

If you are having access denied issue then do as follows:
Path >> C:\wamp64\bin\apache\apache2.4.27\conf\extra\httpd-vhosts (For wamp server)
File name: httpd-vhosts.conf


# Virtual Hosts
#
<VirtualHost *:80>
  ServerName localhost
  ServerAlias localhost
  DocumentRoot "${INSTALL_DIR}/www"
  <Directory "${INSTALL_DIR}/www/">
     Options FollowSymLinks  // Copy This Code
       AllowOverride All   // Copy This Code
       Require all granted  // Copy This Code
  </Directory>
</VirtualHost>


 then restart your Wamp

Access that Address in Mobile Again :)
Thank You

Thursday, 29 March 2018

Pattern Program using C


#include <stdio.h>
int main()
{
   int i,j,k,m,space, rows;
   scanf("%d\n",&rows);
   for(i=0; i<=rows; i++)
   {
       for(space=0; space<=rows-i; ++space)
       {
           printf("  ");
       }
       for(j=i;j>=0;j--)
       {
           printf("%d ",j);
           m=j;
           if(m==0)
           {
               for(k=1;k<=i;k++)
               {
                   printf("%d ",k);
               }
           }
       }
       printf("\n");
   }
   return 0;
}

Output:  

Wednesday, 28 March 2018

Calculate age using datepicker


$( function() {
    $( "#datepicker").datepicker({dateFormat: 'mm/dd/yyyy'});
  } );
$("#datepicker").datepicker({
        maxDate: '+0d',    
        yearRange: '1914:3025',
        buttonImageOnly: true,
        changeMonth: true,
        changeYear: true,
      
    }).on('change', function () {
        var age = getAge(this);
        $("#age").html("You are " + age + " old");
      
    });

    function getAge(dateVal) {
        var
            birthday = new Date(dateVal.value),
            today = new Date(),
            ageInMilliseconds = new Date(today - birthday),
            years = ageInMilliseconds / (24 * 60 * 60 * 1000 * 365.25 ),
            months = 12 * (years % 1),
            days = Math.floor(30 * (months % 1));
            return Math.floor(years) + ' years ' + Math.floor(months) + ' months ' + days + ' days';
    }

Friday, 23 March 2018

Few Questions - Answers

1.       What is the result of NaN = = NaN?
 Answer:-  false.
- NaN stands for Not a Number.
- suppose there is a NaN as x and another NaN is y. value of both can be different.
2.       $("#a1").on("click",{times: 3},function_call);
Answer: -  Answer would be  function_call  will be executed once regardless of the number of times a1 is clicked.

3.       Mention one advantage of using $.ajax over $.get or $.post?
Answer: -  $.ajax offers error callback option

4.       What will following code do?
code:  $(“div#first , div.first , ol#items > [name$=’first’] “)
Answer:  
div#first - will select div having id as first
div.first - will select div having class as first
ol#items > [name$=’first’] “) – will select immediate child of ordered list having id as items whose name ends with ‘first’

Infinite scroll on collection page in Shopify

 Hello, Collection page structure is as followed {% paginate collection.products by 48 %} <div class="collection-content"> ...