Apr 24, 2017

Difference between Angular 2 & Angular 4 (What's New) 2017


Angular 4 doesn't change that much as compare to Angular 2. They have deprecated some old features and added some new however Angular 4 shouldn't have any breaking changes. We can still use deprecated features as it is deprecated not removed but for safe side if possible use Angular 4 as in future it will be removed completely.

So many people was confused even I that why Angular 4 and why not Angular 3? It's not so complicated, the reason I found like because of their internal versioning conflicts they skipped Angular 3 and moved on Angular 4.

Change 1: They have changed *ngif conditional pattern and made it very clear If Else pattern.

See example below:

Angular 2:*ngIf (Depricated):

<div *ngIf="showText">If part to display text</div>
<div *ngIf="!showText">Else part to display text</div>

Angular 4:*ngIf (New):

<div *ngIf="showText; else elsePart">If part to display text</div>
<ng-template #elsePart>
<p>Else part to display text</p>
</ng-template>


Change 2: "Renderer" class changed to "Renderer2"

See example below:

Angular 2:Renderer (Depricated):

import {Component, Renderer} from '@angular/core'
export Class Add Component {
showText = true;
constructor (private renderer : Renderer ){}

onChangeBackground (element:HTMLElement){
this.renderer.setElementStyle(element,'background-color','red');
}
}

Angular 4:Renderer2 (New):

import {Component, Renderer2} from '@angular/core'
export Class Add Component {
showText = true;
constructor (private renderer : Renderer2 ){}

onChangeBackground (element:HTMLElement){
this.renderer.setElementStyle(element,'background-color','red');
}
}

New features By Angular 4:

Feature 1: Added new Email validation class so it replaced the regular expression pattern.

See example below:

Angular 2:Email pattren (Depricated):
<form #f="ngForm">
<input type="email" pattern="[a-z0-9!#$..........etc]" />
</form>

Angular 4:Email class (New):
<form #f="ngForm">
<input type="email" email />
</form>

Feature 2: Using updated Type Script version 2.2

Feature 3: Added seperate Animation package.

See example below:

Angular 2: Extends from core class:

import {
animate,state,style,transition,trigger 
} from '@angular/core';

Angular 4:Extends from seperate animation class:

import {
animate,state,style,transition,trigger 
} from '@angular/animations';


Please comments if you have any queries. Thanks!

Note: The above examples are just samples. You need to check syntax and find where exactly put this code.

Mar 8, 2017

Google App Script: How to resolve error Script function not found: doGet in Google App Script

As per my previous post related to 'How to create a simple Hello World standalone HTML/Javascript page with Example in Google App Script'. I have explained about Code.gs file in Step 4. When you created the new project first time the Code.gs file by default created in editor in which we need to create a method function doGet(e). 

See example below:

function doGet(e) {
  return HtmlService
    .createHtmlOutputFromFile('helloworld.html')//This is html file we want to render
    .setTitle("Hello World Example");//We can set title from here
}

We need to add doGet(e) function in Code.gs to publish project as WebApp. This function uses HTMLService to return HTML Output of helloworld.html file that we created earlier post 'How to create a simple Hello World standalone HTML/Javascript page with Example in Google App Script'.

If you missed to add this function doGet(e) in Code.gs file then it generally throws this error message "Script function not found: doGet".

For more detail please refer google developers doc: https://developers.google.com/apps-script/guides/web


I hope, it must be helpful & please share your feedback or queries in comments box.

Google App Script: How to create a simple Hello World standalone HTML/Javascript page with Example in Google App Script

Google Apps Script is a scripting language based on JavaScript that will allow you to create Google Apps like Docs, Sheets, and Forms. You don't need to install anything there, Google provides you a code editor and that editor can open in browser, and also you can run scripts Google's servers. Wow! that's fantastic feature no headache of server management :)

In this post, I will show you how we can simply create a simple Hello World standalone page/program and how to publish that web app privately or publicly over there.

Please refer following steps one by one and create your first standalone Google App Script project.

Step 1: First visit http://script.google.com if not logged in yet then please login by using gmail account.



Step 2: Create a new project Go to menu New->Project then click on 'Untitled Project' you can see on left corner and enter project name there like 'HelloWorld' (It can be anything)



Step 3: Go to menu File -> New -> Html file and create a HTML file name as 'helloworld.html'

Step 4: Copy the following code in 'helloworld.html' file.

<!DOCTYPE html>
<html>
  <head>
    <base target="_top">
    <script>
      function clickMe() {        
        google.script.run
              .withSuccessHandler(showAlert) // will execute showAlert(value) function on success
              .myFunction(); // will call myFunction() function present in Code.gs file
      }
      
      function showAlert(value) {
        document.getElementById('message').innerHTML = value;
      }
    </script>
  </head>
  <body>
    <h2>Hello World!!!</h2>
    <div id="message" style="color:green"></div>    
    <p><button onclick="clickMe(); return false;">Click Me</button></p> 
  </body>
</html>


Step 5: When you created the project first time there is a Code.gs file by default in the script editor. Click on that and copy paste following code in it.


function myFunction() {
  return 'Hey!!! Welcome To My First Google AppScript!';
}
function doGet(e) {
  return HtmlService
    .createHtmlOutputFromFile('helloworld.html')
    .setTitle("Hello World Example");//We can set title from here
}


Very Important Note:  We need to add doGet(e) function in Code.gs to publish project as Web App. This function uses HTMLService to return HTML Output of helloworld.html file that we created earlier.

#Deploying/Publishing a script as a web app

Now our script is ready to publish so do the following steps to publish it.

Step 1: Save a new version of the script by selecting File > Manage Versions, then Save New Version.
For Example : type 1 there if this is your first build.




Step 2: Then select Publish > Deploy as web app.




Step 3: You can see under Project Version, select the version you just saved above.


Step 4: Under the 'Execute the app as', select the authorization for the app, means this app should be accessible by you only or it should be publicly accessed.

Step 5: Under the 'Who has access to the app', you need to select who should be allowed to visit this web app. The options are differ depending on the type of account you have choose, but they can include "Only myself", any member of your domain, "Anyone" (with a Google account), or "Anyone, even anonymous".

Step 6: Click Deploy.

As you click on Deploy button, you can see a message indicating that your project has been successfully deployed as a web app.

For testing execute that Current web app URL then you will see web page with Click Me button.
When you click on that Click Me button you will get success message like below screen.


For more detail please refer google developers doc: https://developers.google.com/apps-script/guides/web


I hope, it must be helpful & please share your feedback or queries in comments box. Thanks!

Mar 7, 2017

Mahagenco Syllabus for Online Examination Of Dy. Executive Engg & Addt. Executive Engg.

This is the syllabus of Mahagenco Online Examination Of Dy. Executive Engg & Addt. Executive Engg as per the information provided by Mahagenco on their site.

Syllabus for Online Examination Of Dy. Executive Engg & Addt. Executive Engg. 

Post Name: Dy. Executive Engg and Addt. Executive Engg
Domain Required: Thermal/Hydro/Gas/ Power Plant
Topics:
Thermal Power Plant
Gas Turbine Plants
Hydro-Electric powerplants
Boiler Maintanance
Turbine Maintanance
Coal Handling Plant Design & Operation
& Maintenance
Water Treatment Plant (Operation &
Maintenance)
Ash Handling Plant (Operation &
Maintenance
Plant Control Room Operation
Testing & Instrument Controls
Electrical Maintanance
Field Quality Plan
Performance Optimization
Management Information System
Stores 
Project Management 
Design Aspects Boiler, Turbine & Generator 
Process Engineering

Reference Site:https://www.mahagenco.in/uploads/career/Syllabus_topics_DyEE_AddlEE.pdf

Please visit https://www.mahagenco.in for more & latest information.

Mahagenco SYLLABUS FOR ASST. ENGINEER

This is the syllabus of Mahagenco ASST. ENGINEER as per the information provided by Mahagenco on their site.

Post Name: ASST. ENGINEER

Domain Required: Aptitude -Technical & Non technical
Topics:
Verbal Ability
Quantitative Ability
Logical Reasoning
Objective English

Domain Required: Degree Electrical
Topics:
Power Electronics
A C machine
Analog Circuits
Control System
DC Machine
Digital Electronics
Electrical Basics
Network theory

Domain Required: Degree Electronics
Topics:
Control Systems
Digital Electronics and Logic Design
Electronics Devices and Circuits
Micro processor/Microcontrollers
Operational Amplifiers
Power Electronics
Principles of Communication engineering

Domain Required: Degree Electronics & Power
Topics:
AC power transmissions
Bulk power transmissions
Distribution of power
Generation of electrical power
Electronics & Communication/Basics


Domain Required: Degree Electronics & Telecomm
Topics:
Analog Circuits
Basics
Integrated Circuits and Digital Electronics
Micro Processor and Micro Controllers
Other Electronic Devices
PLT
Semiconductors and Transistor Devices


Domain Required: Degree Mechanica
Topics:
Applied Mechanics
Fluid Mechanics
Hydraulic Machines
Machine Design
Pipe and Fitting
Refrigeration and Air Conditioning
SOM
Theory of machines
Welding Technology
Workshop Technology
Thermodynamics

Domain Required: Degree Intrumentation
Topics:
Fundamentals
Transducers
Electronics
Control System
Digital Circuits
Micro processors &Microcontrollers
Measurments
Transistors & OPAMPS

Domain Required: Degree Power Engineering
Topics:
Switchgear & Protections
Thermal Power Plant Operation &Performance
Power Plant Maintenance Practices
Power Plant Operation Practices
Elective I-Non-Conventional Energy Sources
Power Plant Projects
Steam Turbines &Its Auxiliaries
Machine Design
Thermal Power Plant Commissioning
Energy Conversion
Turbo Generator & its Auxiliaries
Industrial Economics & Management
Thermal Power Plant Control & Instrumentation
Power Generation Techniques
Steam Generators & its Auxiliaries
Heat Transfer
Auto Control
Thermal Power Station Layout, Common Aux. & Safety
Environmental Management
Theory of Machines
Engineering Thermodynamics
Digital Circuits
Basic Electrical Machines
Fluid Power
Material Science & Metallurgy
Manufacturing Process
Network Analysis
Electronic Devices & Circuits

Domain Required: Degree Computer Engineering
Topics:
Digital Logic
Computer Organization & Architecture
Programming & Data Structure
Algorithems
Theory of Computation
Compiler Design
Operating System
Databases
Computer Networks

Reference Site:https://www.mahagenco.in/uploads/career/Syllabus%20ofAsst_Engineer_2016.pdf

Please visit https://www.mahagenco.in for more & latest information.

Mahagenco Download Sample paper of driver candidates (Driver Bharti/VahanChalak Sample paper) 2016

Mahagenco Driver Bharti 2016 Sample paper Download (Vahanchalak Lekhi Paper pattern).

There are three types of set like A, B and C provided here in which you can match your answer with the answers keys given in sample paper PDF.

Also you can read some instructions there which is very useful before start to your paper like paper timing is 1/5 hours and paper language is Marathi.

Candidates can download Mahagenco Driver Bharti from following link.

https://www.mahagenco.in/uploads/career/SET%20A%20PAPER%20with%20Answer%20Key.pdf
https://www.mahagenco.in/uploads/career/SET%20B%20PAPER%20with%20Answer%20Key.pdf
https://www.mahagenco.in/uploads/career/SET%20C%20PAPER%20with%20Answer%20Key.pdf

Please comment if you want anything else here.

Mahagenco SYLLABUS/Study Material/Guides FOR Juniour/JR. ENGINEER

This is the syllabus of Mahagenco Junior ENGINEER as per the information provided by Mahagenco on their site.

SYLLABUS FOR JR. ENGINEER 

Post Name:  Jr. Engineer

Domain Required: Aptitude - Technical & Non technical
Topics: 
Verbal Ability, 
Quantitative Ability, 
Logical Reasoning, 
Objective English

Domain Required: Diploma Electrical
Topics: 
Power Electronics
A C machine
Analog Circuits
Control System
DC Machine
Digital Electronics
Electrical Basics
Network theory

Domain Required: Diploma Electronics
Topics: 
Control Systems
Digital Electronics and Logic Design
Electronics Devices and Circuits
Micro processor/Microcontrollers
Operational Amplifiers
Power Electronics
Principles of Communication engineering

Domain Required: Diploma Electronics & Power
Topics: 
AC power transmissions
Bulk power transmissions
Distribution of power
Generation of electrical power
Electronics & Communication/Basics

Domain Required: Dimploma Electronics & Telecomm
Topics: 
Analog Circuits
Basics
Integrated Circuits and Digital Electronics
Micro Processor and Micro Controllers
Other Electronic Devices
PLT
Semiconductors and Transistor Devices

Domain Required: Diploma Mechanical
Topics:
Applied Mechanics
Fluid Mechanics
Hydraulic Machines
Machine Design
Pipe and Fitting
Refrigeration and Air Conditioning
SOM
Theory of machines
Welding Technology
Workshop Technology
Thermodynamics

Domain Required: Diploma Intrumentation
Topics: 
Fundamentals
Transducers
Electronics
Control System
Digital Circuits
Micro processors &Microcontrollers
Measurments
Transistors & OPAMPS

Domain Required: Diploma Power Engineering
Topics: 
Switchgear & Protections
Thermal Power Plant Operation &Performance
Power Plant Maintenance Practices
Power Plant Operation Practices
Elective I-Non-Conventional Energy Sources
Power Plant Projects
Steam Turbines &Its Auxiliaries
Machine Design
Thermal Power Plant Commissioning
Energy Conversion
Turbo Generator & its Auxiliaries
Industrial Economics & Management
Thermal Power Plant Control & Instrumentation
Power Generation Techniques
Steam Generators & its Auxiliaries
Heat Transfer
Auto Control
Thermal Power Station Layout, Common Aux. & Safety
Environmental Management
Theory of Machines
Engineering Thermodynamics
Digital Circuits
Basic Electrical Machines
Fluid Power
Material Science & Metallurgy
Manufacturing Process
Network Analysis
Electronic Devices & Circuits

Domain Required: Diploma Computer Engineering
Topics: 
Digital Logic
Computer Organization & Architecture
Programming & Data Structure
Algorithems
Theory of Computation
Compiler Design
Operating System
Databases
Computer Networks

Reference Site:https://www.mahagenco.in/uploads/career/Syllabus%20of%20Jr.Engineer%20Final.pdf

Please visit https://www.mahagenco.in for more & latest information.

Mar 1, 2017

You must know Magento 2.0.x system requirements before installation

If you are in process of installing the Magento 2.0.x then I strickly reccommned you to check following Magento 2.0.x system requirements before installation.

You need to confirm following items on your server system or local system:
#Operating systems (Linux x86-64)
#Web servers
#Database
#PHP
#Required PHP extensions
#PHP OPcache
#PHP settings
#SSL
#Mail server
#Optional but recommended php_xdebug2.2.0

Lets have a look at all the above items in detail:

#Operating systems (Linux x86-64)

Linux distributions such as RedHat Enterprise Linux (RHEL), CentOS, Ubuntu, Debian, and so on
Memory requirement

Upgrading the Magento applications and extensions you obtain from Magento Marketplaces and other sources can require up to 2GB of RAM. If you are using a system with less than 2GB of RAM, we recommend you create a swap file; otherwise, your upgrade might fail.
Composer (latest stable version)

Composer is required for developers who wish to contribute to the Magento 2 codebase or anyone who wishes to develop Magento extensions

#Web servers::
    - Apache 2.2 or 2.4
    - In addition, the apache mod_rewrite module must be enabled. mod_rewrite enables the server to perform URL rewriting. For more information, see our Apache documentation.
    - nginx 1.8 (or latest mainline version)

#Database::
- MySQL 5.6
- MariaDB and Percona are compatible with Magento because we support MySQL 5.6 APIs.

#PHP::
    - 5.6.x
    - 5.5.x, where x is 22 or greater
    - 7.0.2, 7.0.6–7.0.x
    There is a known PHP 7.0.5 issue that affects our code compiler; to avoid the issue, do not use PHP 7.0.5.

    Not supported:
        - PHP 7.1
        - PHP 5.4

#Required PHP extensions::
    - bc-math
    - curl
    - gd, ImageMagick 6.3.7 (or later) or both
    - intl
    - mbstring
    - mcrypt
    - mhash
    - openssl
    - PDO/MySQL
    - SimpleXML
    - soap
    - xml
    - xsl
    - zip
    PHP 7 only::
        - json
        - iconv

#PHP OPcache::
We strongly recommend you verify the PHP OPcache is enabled for performance reasons. The OPcache is enabled in many PHP distributions. To verify if it is installed, see our PHP documentation for CentOS or Ubuntu.

#PHP settings::
We recommend particular PHP configuration settings, such as memory_limit, that can avoid common problems when using Magento.

#SSL::
    - A valid security certificate is required for HTTPS.
    Self-signed SSL certificates are not supported.
    - Transport Layer Security (TLS) requirement
    - PayPal and repo.magento.com both require TLS 1.1 or later

#Mail server::
- Mail Transfer Agent (MTA) or an SMTP server
- Magento can utilize the following technologies:

    Redis version 3.0 for page caching and session storage (the latter supported by Magento version 2.0.6 and later only)
    Varnish version 3.5 or latest stable 4.x version for page caching

    memcached latest stable version for session storage with either memcache or memcached PHP extensions (latest stable version)

    Magento Enterprise Edition (EE) only::
        - Apache Solr 4.x
        - Solr search can be used as a search provider. Available for Magento Enterprise Edition (EE) only.
        - RabbitMQ 3.5
        - RabbitMQ can be used to publish messages to queue and to define the consumers that receive the messages asynchronously. Available for Magento EE only.

        Three master databases::
        - These master databases provide scalability advantages for different functional areas of the Magento application: checkout, orders, and product data. Available for Magento EE only.

#Optional but recommended php_xdebug2.2.0::
    - php_xdebug2.2.0 or later (development environments only; can have an adverse effect on performance)


The major differences between Magento 2.0.x and Magento 2.1.x: #PHP - Dropped support for PHP 5.5.x - 2.1.2 and later: Added support for PHP 7.0.4 #MySQL (2.1.2 and later): - Compatible with MySQL 5.7 #Added support for Elasticsearch 1.7 and 2.x (recommended by Magento) - If you get the Elasticsearch software from the Elasticsearch Linux repository, Magento support versions 2.x. - If you get the Elasticsearch software from their Elasticsearch-PHP repository, Magento support the 2.0 branch.

I would like to thanks to Magento community who provided a fantastic documetation.
Reference Magento Site: http://devdocs.magento.com/guides/v2.0/install-gde/system-requirements-tech.html

Feb 27, 2017

How to export an CSV excel file to pipe (|) delimited/separated in Laravel 4.2 with example

Hello Friends, sometime requirement is comes, out of default things provided by the frameworks or CMS, so in this case we needs customization in code or we needs to overrides the configuration settings if there.

Recently, I worked on generating csv file to create a pipe delimited file from an Excel Spreadsheet. Please go through the steps below to make it happened in Laravel 4.2

Note:You can keep any name for route, controller name and it's method name

Step 1: First of all we need to set Route.

For example: Route::any('/pipedelimited', array('uses' => 'PipedelimitedController@pipedelimited')); 

Step 2: Create controller at path app\controllers\PipedelimitedController.php and add pipedelimited() method in this controller. Also I am using here custom log and try catch blocks for logging and generating errors or exception while executing this script which is I recommended you for best practice standard.

For example::
<?php
use Monolog\Logger;//Use for log
use Monolog\Handler\StreamHandler;//Use for log

class PipedelimitedController extends BaseController
{
 
  public function pipedelimited() 
  {
  $error_log = new Logger('Test: CSV Pipe Delimited');
$error_log->pushHandler(new StreamHandler(storage_path().'/logs/pipedelimited.log', Logger::INFO));
$error_log->addInfo('CSV Pipe Delimited Start ');
try{

Config::set('excel::csv.delimiter', '|'); // Override default config

Excel::create('Newfile', function($excel) {

$excel->sheet('Newsheet', function($sheet) {

$sheet->loadView('pipedelimited');

});

})->store('csv', storage_path('exports'));

}catch (\Illuminate\Database\QueryException $ex) {           
            $error_log->addInfo($ex->getMessage());            
        } catch (\Exception $exx) {           
            $error_log->addInfo($exx->getMessage());            
        }
$error_log->addInfo('CSV Pipe Delimited END ');

  }
}

?>


As you can see in above public function pipedelimited() method, We are overriding the csv default delimiter Comma (,) configuration by using this code Config::set('excel::csv.delimiter', '|');

Step 3: Now we are creating the blade file that is the template file in which we will create a sample html table content with sample data. Create a pipedelimited.blade file at path app\views\pipedelimited.blade.php and add following content there.

For example::
<table>
<tr>
<th>Test1</th>
<th>Test1</th>
<th>Test1</th>
<th>Test1</th>
</tr>
<tr>
<td>Test2</td>
<td>Test2</td>
<td>Test2</td>
<td>Test2</td>
</tr>
</table>

Step 4: Now we ready to execute our script, we need to execute the URL http://yourhost.name/pipedelimited and the Newfile.csv file will be generate in folder app\storage\exports as we set this path while creating the csv.

This is it! We made it and please share your comments here if you are facing any issue or want to suggest anything related to this blog. Thanks!!!

Feb 7, 2017

Download old sample papers for Assistant Programmer MAHADISCOM Exam

Hi All,

Here is the some old sample paper questions of  Assistant Programmer MAHADISCOM which I collected from my friends and some of my own experience.

Click on link below to download it ...
https://drive.google.com/file/d/0BzzhuXDUMeOFalJWaEk2bE5jR2c/view?usp=sharing