Many of web developers are struggling for choosing good option for frontend. there is confusion in choosing AngularJS or ReactJS whether it is a smarter choice for front-end development. React and Angular are powerful front end development technologies. AngularJS is designed and managed by Google, while Facebook and its community maintain ReactJS. They are built on JavaScript that makes advancement and customisation to develop advanced front end of web applications. According to my experience, here I am mentioning some of the comparison points between AngularJS and ReactJS. I hope this…
Year: 2019
How To Remove Last Character From A String Using jQuery?
Common problem faced by developers, how to remove last character from a string using jQuery, Here I am going to explain the solution with an example. var str = ‘123-4’; alert(str.slice(0, -1));
Difference between TRUNCATE , DELETE and DROP in MySql Server
TRUNCATE TRUNCATE is a DDL(Data Manipulation Language) command TRUNCATE is executed using a table lock and whole table is locked for remove all records. We cannot use Where clause with TRUNCATE. TRUNCATE removes all rows from a table. Minimal logging in transaction log, so it is performance wise faster. TRUNCATE TABLE removes the data by deallocating the data pages used to store the table data and records only the page deallocations in the transaction log. Identify column is reset to its seed value if table contains any identity column. To…
How to connect with redshift in python
Connecting to AWS Redshift with Python The following Python code demonstrates how to establish a connection to an AWS Redshift database using the psycopg2 library. This function sets up a connection and creates a cursor for querying the database. import psycopg2 import psycopg2.extras def redshift_connect(): # Connection and session creation print(“redshift_connect start…”) conn = psycopg2.connect( dbname=”RS_DB_NAME”, host=”HOST_NAME”, port=”RS_PORT”, user=”USER_NAME”, password=”PWD” ) print(“redshift connection variable”, conn) cursor = conn.cursor(cursor_factory=psycopg2.extras.RealDictCursor) return conn, cursor This code defines a redshift_connect function that: Imports the psycopg2 library and its extras module for advanced cursor functionality.…
Set Library Path for python running configuration
******************** Set Library Path for python running configuration ***** -> home/user/.bashrc Add below code in your library path export PATH=”/home/user/anaconda3/bin:$PATH” export PYTHONPATH=”/home/user/anaconda3/bin/md”
How to Convert a Python Dictionary to List
>>> from functools import reduce >>> a = {‘foo’: ‘bar’, ‘baz’: ‘quux’, ‘hello’: ‘world’} >>> list(reduce(lambda x, y: x + y, a.items())) [‘foo’, ‘bar’, ‘baz’, ‘quux’, ‘hello’, ‘world’] explanation: -> a.items() returns a list of tuples. -> Adding two tuples together makes one tuple containing all elements. Thus the reduction creates one tuple containing all keys and values and then the list(…) makes a list from that.
How To Integrate DoubleClick Bid Manager API With Laravel 5.4
In this article I am explaining a simple process to setup Google Bid Manager (DBM) API by PHP Artisan Command with laravel 5.4. You can get campaigns or your line items data either setting up a cron using created command or running command on terminal. First, edit composer.json in the project’s root folder to include the Google Client: { “require”: { “google/apiclient”: “^2.0” } } Next run composer update at shell prompt to pull in the sdk to the vendor folder. php composer.phar install –no-dev Now we would like to…
Process To Test AWS Route53 ChangeResourceRecordSets API from Terminal
image credit: google images Here I am explaining the process to test AWS Route53 ChangeResourceRecordSets API from terminal. you can copy below code and paste that to your terminal then hit an ENTER from your keyboard. aws route53 change-resource-record-sets –hosted-zone-id ZGN2AVYTFOA –change-batch ‘{ “Comment”: “”, “Changes”: [ { “Action”: “CREATE”, “ResourceRecordSet”: { “Name”: “anilc.phpmypassion.com.”, “Type”: “A”, “AliasTarget”: { “HostedZoneId”: “Z26RNL4JYFTOTI”, “DNSName”: “phpmypassion-event-0ddd4472d016751e.elb.us-east-1.amazonaws.com”, “EvaluateTargetHealth”: false } } } ] }’ “HostedZoneId”: Z26RNL4JYFTOTI :- This hosted zone id belongs to Load Balancer Id –hosted-zone-id ZGN2AVYTFOA :- This hosted zone id belongs to…
How to get data from redshift table as dictionary in python
The dict cursors allow to access to the retrieved records using an interface similar to the Python dictionaries instead of the tuples. Add following code into your cursor function cursor_factory=psycopg2.extras.RealDictCursor After adding the above code your cursor should be look like this – cur = con.cursor(cursor_factory=psycopg2.extras.RealDictCursor) if you have an error of not found class .extra – AttributeError: module ‘psycopg2’ has no attribute ‘extras’ Resolved this error by importing class as below import psycopg2 import psycopg2.extras Now if you run this code, you will get data in dictionary from redshift …
Pandas- ImportError: Missing required dependencies [‘numpy’]
This is a common error that sometimes occur when importing pandas library. Here I am sharing the solution for that. So please follow as I described below and if you found any difficulty, intimate me by your comment. Problem:- >>> import pandas Traceback (most recent call last): File “<stdin>”, line 1, in <module> File “/home/anil/anaconda3/lib/python3.6/site-packages/pandas/__init__.py”, line 19, in <module> “Missing required dependencies {0}”.format(missing_dependencies)) ImportError: Missing required dependencies [‘numpy’] Solution:- check all folder list in your python lib folder -> ls -la Now if you see numpy…
