Wednesday, January 11, 2017

AngularJS - Forget Angular 3; Google Is Set to Launch Angular 4

The Angular team has committed to time-based releases that occur in three cycles, setting Angular 4 to come out early next year.
  • Last month, Google surprised everyone when it detailed plans for Angular 3 to be released a short six months after Angular 2's arrival. Now, it turns out there will be "No Angular 3" release after all. Instead, Google will go right to version 4 of its popular JavaScript framework in March 2017.
  • Google's Igor Minar said at the recent NG-BE 2016 Angular conference in Belgium that Google will jump from version 2 to version 4 so that the number of the upgrades correlates with the Angular version 4 router planned for usage with the release.
  • Minar, in fact, laid out a roadmap that has eight beta releases of Angular 4 coming out between December and February, followed by two release candidates in February and the general release on March 1. However, Minar cautioned against getting too hung up on numbers and advised that the framework simply be called "Angular" anyway.
"Let's not call it AngularJS, let's not call it Angular 2," he said, "because as we are releasing more and more of these versions. It's going to be super confusing for everybody."

Google's goals for Angular 4 are to be as backward-compatible with Angular 2 as possible and to improve compiler error messages. In November, Google talked about the next version of Angular, then known as version 3, emphasizing improvements in tooling as well as reduced code generation.

Angular's upgrade plan also includes moving to TypeScript 2.1 as a baseline, away from TypeScript 1.8.

Angular 2 was rewritten in TypeScript, Microsoft's typed superset of JavaScript.

Earlier this month, Google released Angular 2.3, a minor upgrade featuring Angular Language Service, which is designed to integrate with IDEs and provide type completion and error-checking with Angular Templates.

Object inheritance for components is featured, as well. Angular 2.2 arrived in November, featuring ahead-of-time compilation compatibility.

Angular
https://angularjs.org/

Angular 2
https://angular.io/

Wordpress - Simple Functions and Loops based on Queries

<!--

TO Display product

BY Sunny Soni

-->

<ul class="products">
<?php
// $args = array( 'post_type' => 'product', 'posts_per_page' => 4,'order' => 'DESC' );
$args = array( 'post_type' => 'product','posts_per_page' => $a ,'meta_key' => '_featured', 'meta_value' => 'yes', 'orderby' => 'rand' );
$loop = new WP_Query( $args );
while ( $loop->have_posts() ) : $loop->the_post(); global $product; ?>
<li class="producthome">
<a href="<?php echo get_permalink( $loop->post->ID ) ?>">
<div class="thumbnail">
<?php if (has_post_thumbnail( $loop->post->ID )) echo get_the_post_thumbnail($loop->post->ID, 'shop_catalog'); else echo '<img src="'.woocommerce_placeholder_img_src().'" alt="Placeholder" width="65px" height="115px" />'; ?>
<div class="thumb-shadow"></div>
<strong class="below-thumb"><?php the_title(); ?></strong>
</div>
<span class="price"><?php echo $product->get_price_html(); ?></span>
</a>
<div class="buttons">
<?php woocommerce_template_loop_add_to_cart( $loop->post, $product ); ?>
</div>
</li>
<?php endwhile; ?>
<?php wp_reset_query(); ?>
</ul>
<!-------- --->


<!--

TO Display all the products

BY Sunny Soni

-->
<ul class="products">
<?php $args = array( 'post_type' => 'product', 'posts_per_page' => 4, 'order' => 'DESC' );
$loop = new WP_Query( $args );
while ( $loop->have_posts() ) : $loop->the_post(); global $product; ?>
<li class="producthome">
<a href="<?php the_permalink(); ?>">
<div class="thumbnail">
<?php if (has_post_thumbnail( $loop->post->ID )) echo get_the_post_thumbnail($loop->post->ID, 'shop_catalog'); else echo '<img src="'.woocommerce_placeholder_img_src().'" alt="Placeholder" width="65px" height="115px" />'; ?>
<div class="thumb-shadow"></div>
<strong class="below-thumb"><?php the_title(); ?></strong>
</div>
<span class="price"><?php echo $product->get_price_html(); ?></span>
</a>
<div class="buttons">
<?php woocommerce_template_loop_add_to_cart( $loop->post, $product ); ?>
<a href="<?php the_permalink(); ?>">Detail</a>
</div>
</li>
<?php endwhile; ?>
<?php wp_reset_query(); ?>
</ul>




<!--

To Display All Featured Product

BY Sunny Soni

-->

<ul class="products">
<?php $args = array( 'post_type' => 'product','posts_per_page' => 4 ,'meta_key' => '_featured','meta_value' => 'yes', 'orderby' => 'rand' );
$loop = new WP_Query( $args );
while ( $loop->have_posts() ) : $loop->the_post(); global $product; ?>
<div class="producthome">
<a href="<?php the_permalink(); ?>">
<div class="thumbnail">
<?php if (has_post_thumbnail( $loop->post->ID )) echo get_the_post_thumbnail($loop->post->ID, 'shop_catalog'); else echo '<img src="'.woocommerce_placeholder_img_src().'" alt="Placeholder" width="65px" height="115px" />'; ?>
<div class="thumb-shadow"></div>
<strong class="below-thumb"><?php the_title(); ?></strong>
</div>
<span class="price"><?php echo $product->get_price_html(); ?></span>
</a>
<div class="buttons">
<?php woocommerce_template_loop_add_to_cart( $loop->post, $product ); ?>
<a href="<?php the_permalink(); ?>">Detail</a>
</div>
</div>
<?php endwhile; ?>
<?php wp_reset_query(); ?>
</ul>



<!--

To Display SALE Product

BY Sunny Soni

-->

<ul class="products">
<?php $args = array( 'post_type' => 'product','posts_per_page' => 4 ,'product_cat' => 'sale', 'orderby' => 'rand' );
$loop = new WP_Query( $args );
while ( $loop->have_posts() ) : $loop->the_post(); global $product; ?>
<div class="producthome">
<a href="<?php the_permalink(); ?>">
<div class="thumbnail">
<?php if (has_post_thumbnail( $loop->post->ID )) echo get_the_post_thumbnail($loop->post->ID, 'shop_catalog'); else echo '<img src="'.woocommerce_placeholder_img_src().'" alt="Placeholder" width="65px" height="115px" />'; ?>
<div class="thumb-shadow"></div>
<strong class="below-thumb"><?php the_title(); ?></strong>
</div>
<span class="price"><?php echo $product->get_price_html(); ?></span>
</a>
<div class="buttons">
<?php woocommerce_template_loop_add_to_cart( $loop->post, $product ); ?>
<a href="<?php the_permalink(); ?>">Detail</a>
</div>
</div>
<?php endwhile; ?>
<?php wp_reset_query(); ?>
</ul>

Atm Machine logic in php

<form  method="post">
<div align="center" style="width:60%;">
<b>Atm Machine Test Page</b>
<br clear="all"><br clear="all">
<div align="left" style="float:left;margin-left:200px;width:20%">
Input::
</div>
<div align="left" style="float:left;margin-left:10px;width:30%">
<input type="text" name="txtAmount" value="<?=$_POST['txtAmount']?>"/>
</div>
<br><br>
<input type="submit" name="btnGenerate" value="Generate"/>
</div>
</form>
<?php

if($_POST['btnGenerate']=="Generate")
{

 $txtAmount = $_POST['txtAmount'];
 if($txtAmount != "")
 {
 //$txtAmount= intval($txtAmount);
 $rupees = array(1000,500,100,50,20,10);
 $count = array(0,0,0,0,0,0);

 if($txtAmount <=0)
 {
 $output="<b>Invalid Amount</b>";
 }else{

 if(!preg_match('/\d\d[0]$/',$txtAmount))
 {
 $output="<b>Invalid Amount</b>";
 }else{
 for($i=0;$i<count($rupees);$i++){
 if($rupees[$i]<$txtAmount || $rupees[$i]==$txtAmount){
 $count[$i]=intval($txtAmount/$rupees[$i]);
 $txtAmount=$txtAmount%$rupees[$i];
 }
 }
 for($i=0;$i<count($count);$i++){
 if($count[$i]!=0){
  $output .= "<br><b>".$rupees[$i]." X ".$count[$i]." = ".($rupees[$i]*$count[$i])."</b>";
 }
 }

 }
 }


 }else{
 $output="<b>Invalid Amount- Amount Input Not Blank</b>";
 }
?>
<div align="center" style="width:60%;">
<?php

echo "Output: $output";
?>
</div>
<?php
}
?>

<div style="float:right;margin-right:530px;margin-top:200px;">
<h5>Developed By Sunny J Soni</h5>
</div>

----------------------------------------------------------------------------------------------------------------------
Input - 5680
----------------------------------------------------------------------------------------------------------------------
Output: 
1000 X 5 = 5000
500 X 1 = 500
100 X 1 = 100
50 X 1 = 50
20 X 1 = 20
10 X 1 = 10